上海大学学报(自然科学版) ›› 2013, Vol. 19 ›› Issue (3): 280-285.doi: 10.3969/j.issn.1007-2861.2013.03.012

• 计算机工程与科学 • 上一篇    下一篇

针对三值光学计算机的C 语言扩展

高桓1,2, 金翊1,2, 宋凯1,2,3   

  1. 1. 上海大学计算机工程与科学学院, 上海200072; 2. 上海大学高性能计算中心, 上海200072; 3. 华东交通大学信息工程学院, 南昌330013
  • 收稿日期:2012-11-13 出版日期:2013-06-30 发布日期:2013-06-30
  • 通讯作者: 金翊(1957—), 男, 教授, 博士生导师, 研究方向为三值光学计算机. E-mail:yijin@shu.edu.cn
  • 基金资助:

    国家自然科学基金资助项目(61073049); 国家自然科学基金青年基金资助项目(61103054); 上海市教委科研创新资助项目(13ZZ074, 13YZ005)

Extension of C Language in Ternary Optical Computer

GAO Huan1,2, JIN Yi1,2, SONG Kai1,2,3   

  1. 1. School of Computer Engineering and Science, Shanghai University, Shanghai 200072, China; 2. High Performance Computing Center, Shanghai University, Shanghai 200072, China; 3. School of Information Engineering, East China Jiaotong University, Nanchang 330013, China
  • Received:2012-11-13 Online:2013-06-30 Published:2013-06-30

摘要: 为了将三值光学计算机(ternary optical computer, TOC) 数据位众多和光学处理器硬件可重构性这两个特点应用于高级语言程序中, 提出并实现了针对三值光学计算机的C 语言扩充技术. 该技术中的用户可见部分包括一组C 语言扩充语句和一个用户运算请求文件自动生成软件模块, 其中扩充语句采用C语言函数的书写方式, 并采用专用字头SZG_ ; 运算请求文件自动生成软件模块将用户在给定界面中送入的运算方式和输入数据自动转换成预先制定的数据文件格式, 生成SZG 文件. 三值光学计算机返回的运算结果会自动保存在与运算请求文件相同的目录下, 且文件名由对应的运算请求文件名加后缀_R.SZG 组成. 用户不可见部分包括: 对扩充指令的编译进程、SZG文件生成机制、运算请求状况记录进程、运算结果接收进程和三值光学计算机端服务进程. 使用该技术, 用户不必改变编程习惯, 可直接在C 语言程序中使用三值光学计算机. 该技术已在由PC 机和嵌入式系统组成的三值光学计算机模拟环境中进行了实验, 实验结果表明, 该技术行之有效.

关键词: C 语言, 三值光学计算机, 用户运算请求编辑软件

Abstract: 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.

Key words: C language, ternary optical computer (TOC), user operation request editing software

中图分类号: