📄 readme.txt
字号:
About the Example
~~~~~~~~~~~~~~~~~
The example is a simple interpreter of a representative assemble language. The language supports the following instructions.
Instructions Eg. Syntax Meaning
MOV MOV A B; A = B
MOVI MOVI A 100; A = 100
ADD ADD A B; A = A + B
ADDI ADDI A 100; A = A + 100
SUB SUB A B; A = A - B
SUBI SUB A 100; A = A - 100
MULT MULT A B; A = A * B
MULTI MULTI A 100; A = A * 100
DIV DIV A B; A = A / B
DIVI DIV A 100; A = A / 100
READ READ A; Read A from stdin
WRITE WRITE A; Write A to stdout
Registers available are A, B, C,....,Y, Z
Comments begin with a semi-colon(;). A new instruction should start from a new line.
The interpreter opens an input file (main.c), identifies the instructions (decode.c) and executes them (instr.c).
The example takes as input a file named "testcase_list" in the project directory. This file contains a list of input data file paths. Each file in this list is fed to the interpreter.
It is required to cover all the source lines of the interpreter by writing testcases in the above language.
Below is a sample assembly code
MOVI A 100; A = 100
MOVI B 200; B = 200
ADD A B; A = 300
MULT A B; A = 60000
SUB A B; A = 59800
WRITE A;
WRITE B;
Setting up and running the demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o Setup CCS for C6416 Device Functional simulator
o Invoke CCS.
o Open the project interpreter.pjt
o Build the project.
o Load the program interpreter.out.
o Invoke menu Profile->Setup
o Click on Enable Profiling
o Select the activity "Collect Code Coverage Data"
o Open the file testcase_list in the directory above the COFF ( usually the project directory) to include the list of input data files. All the file paths should be relative to the COFF file path. This example has two input files: prog_1.nsm and prog_2.nsm
o Run the application to completion.
o Get the coverage view by clicking on menu Profile->Coverage Viewer.
o Look for uncovered code.
o Write test cases to cover the uncovered code and append the testcase file names to the testcase_list file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -