# Research on Key Technologies of Data Processing Mechanisms in Ternary Optical Computer
## 4 Efficacy Experiment of Data Processing in TOC
### Experimental Procedure  
1. Generating computation-data file. To input operation rules and operands in the interface depicted in Figure 4 to generate a computation-data file, follow these steps: 1. Press the'simple SD' button in the interface. The computation-data file generation software will then fill in the \"(8) Data Type\" field in Figure 2 with the identifier code \"01\" for simple structured data types. 2. Enter the operation rules and data bit size for each component of the simple structured quantity one by one, i.e., for \((\textit{fun}_{1})\), \((\textit{fun}_{2})\), \((\textit{fun}_{3})\), and \((\textit{fun}_{4})\), press the 'Enter Comp' button after each component, and after all components are entered, press the 'Enter SSD' button. When 'Enter Comp' is clicked for the first time, the software will fill in the \"(21) Item 1 Operation Rule and (22) Item 1 Data Bit Size\" fields in Figure 2 with the information just entered by the user. When 'Enter Comp' is clicked for the \((i)\)-th time, the software will fill in the \"Item \((i)\) Operation Rule\" and \"Item \((i)\) Data Bit Size\" fields with the information just entered by the user. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Item** & \(\textit{fun}_{1}\) & \(\textit{fun}_{2}\) & \(\textit{fun}_{3}\) & \(\textit{fun}_{4}\) \\ \hline \multirow{2}{*}{1} & \(a(2112111122021122)_{M}\) & \(c(122210112021)_{M}\) & \(e(10010110101110010)_{M}\) & \(h(11111100101010101)_{M}\) \\  & \(b(22122111110202012)_{M}\) & \(d(120121201012)_{M}\) & \(g(10101010010101010)_{M}\) & \(i(100111100101010010)_{M}\) \\ \hline \multirow{2}{*}{2} & \(a(20022111110202121)_{M}\) & \(c(120010112021)_{M}\) & \(e(10010110111001111)_{M}\) & \(h(11101101101010101)_{M}\) \\  & \(b(2100111122021122)_{M}\) & \(d(120120001012)_{M}\) & \(g(10101010010101011)_{M}\) & \(i(1001011001010101)_{M3. Continuously enter the structured quantity data, separating each component with a comma and each structured quantity with a semicolon. Each piece of data entered is displayed on the right side of the interface and can be corrected. 4. After pressing the 'Enter' key, the computation-data file generation software will fill the original data entered into the data area in Figure 2, thus creating a TOC computation-data file in the format \(X:\text{ae}*szg\), where X is the storage disk specified by the user, \(j\) is the folder on disk X, * is the name of the file, and.szg is the dedicated suffix for TOC computation data files. 2. Transferring computation-data files to ternary optical processors. After generating the *.szg file with the operation rules and raw data, it is only necessary to send the computation-data file to the TOC at the appropriate time in the program. This experiment extends the C programming language with a set of instructions for sending the computation-data file to the TOC and waiting for the operation result file. This set of extended instructions has the following functions: establish a communication connection with the TOC; send the *.szg file to the task management module of the TOC monitoring system; query whether the operation result file (*-r.szg) has been returned or suspend the program, wake up when waiting for the operation result file to return; continue executing the program after the *-r.szg file returns; mid-range communication with TOC. The extended statements for the C program in this experiment are as follows: 1. void SZG_Init(). The purpose of this instruction is to establish an expanded instruction environment for TOC. It must be placed in the first SZG class expansion instruction in the program and is run only once in the program. 2. int SZG(char \"path). Sends the computation-data file pointed to by the address pointer path to the ternary optical processor. 3. int SZG_SearchResult(char \"path). The function of this instruction is to query the operation status of the computation-data file pointed to by the address pointer on the TOP.