为了将三值光学计算机(ternary optical computer,TOC)数据位众多和光学处理器硬件可重构性这两个特点应用于高级语言程序中,提出并实现了针对三值光学计算机的C语言扩充技术.该技术中的用户可见部分包括一组C语言扩充语句和一个用户运算请求文件自动生成软件模块,其中扩充语句采用C语言函数的书写方式,并采用专用字头SZG_;运算请求文件自动生成软件模块将用户在给定界面中送入的运算方式和输入数据自动转换成预先制定的数据文件格式,生成SZG文件.三值光学计算机返回的运算结果会自动保存在与运算请求文件相同的目录下,且文件名由对应的运算请求文件名加后缀R.SZG组成.用户不可见部分包括:对扩充指令的编译进程、SZG文件生成机制、运算请求状况记录进程、运算结果接收进程和三值光学计算机端服务进程.使用该技术,用户不必改变编程习惯,可直接在C语言程序中使用三值光学计算机.该技术已在由PC机和嵌入式系统组成的三值光学计算机模拟环境中进行了实验,实验结果表明,该技术行之有效.
To make use of the two characteristics of ternary optical computer(TOC) in C programs,hardware re-configurability and the excessive bit numbers,a new technique is developed,which can be divided into two parts.The user visible part includes some extension commands of C language and software of creating a user's operation request file.These extension commands have the same form with C function and a specialized prefix of SZG..The operation request file is automatically produced from the input data and corresponding operation that are entered by user through an especial interface.A suffix.SZG is added to the file,called a SZG file. The SZG file format corresponds to the TOC file protocol.The operation results returning from TOC are also saved in the same path of the user submitted SZG file and named "submitted file name_R.SZG".The user invisible part includes an extension commands compiling processor,a generation mechanism of SZG file,a state of operation request recording processor,and a result receiving processor and serving processor on the TOC. Using this technique,the user can use the TOC in C programs without changing their programming habits. Experiments have been done on a TOC simulation system consisting of a PC and an embedded system,and the feasibility of the technique is shown.