Directly used in the teaching experiment the CoreABC instruction code programming, for initial contact digital circuits students there is a certain degree of difficulty, resulting in difficult to achieve the purpose of the experiment and to understand CoreABC micro control system. If instead of using the standard C language program CoreABC instruction program, you can reduce the difficulty of programming, thereby enhancing the efficiency of the teaching and development.C language code generator of CoreABC in the the embedded C AnyviewC language compiler based on combined the CoreABC instruction system design and implementation, the goal is the standard C language code program into CoreABC instruction sequence code, enables users to write and easy to understandprogram directly obtained target instruction sequence.Design and Implementation of the code generator consists of two parts:front-end and back-end of the generator. The front-end processing lexical analysis, parsing and syntax-directed translation, final result set of front-end processing; each element to the back-end through processing front-end result set, the final target instruction code sequence. The issue is a key part of that generation front-end design and implementation of correctness, that part is mainly reflected in the C language compiler the AnyviewC embedded expansions and modifications, including an extension of the C language library functions, the expansion of lexical analysis, parsing and Guidancetranslation extension design also involves the design of the the CoreABC register and memory addresses. The CoreABC associated with the operation of the hardware. C language can not directly implement, requires the use of expansion for the library functions to achieve the same function for some special instruction: Parsing and guided translation process is a critical part of the design of this project, the control fiow structure, function calls, and so on must be re-designed to achieve, so that the intermediate code conversion the distal end result can be obtained sequence of CoreABC instruction set for each a in C language operators. The rear end portion of the code generator of CoreABC is carried out on the basis of the preceding result set based on the design of the machine code machine corresponding operand processed in the previous result set obtained the final CoreABC target instruction sequence.This article describes the design and implementation of the CoreABC code generator to test the feasibility of the design, the focus is reflected in the design part of two parts of the analysis and research of the standard C language and instruction system of CoreABC, design code generator front-end and back-end, and the related experimental verification analysis. Finally with some examples to test the feasibility of the design, and on correlation analysis to prove this method can be extended. |