Name | Instruction_Memory |
---|---|
Memory Type | Single Port ROM |
32-Bit Addressing | Enabled |
Write Width | 32 bits |
Write Depth | 1024 |
Enable | Always Enabled |
COE File | instructions.coe |
Name | Data_Memory |
---|---|
Memory Type | Single Port RAM |
32-Bit Addressing | Disabled |
Write Width | 32 bits |
Write Depth | 1024 |
Enable | Use ENA pin |
COE File | data.coe |
Once the “instructions.coe” and “data.coe” are loaded into the instruction memory, you should simulate “test_CPU.v”. The simulation would not have completed within 1,000,000 ps. So in the console, please enter “run 1000 ns”.
You can tell the simulation is done when the instruction printed in the console is NOP (“00000000000000000000000000000000”). To check the result, hover over the Memory tab, on the left panel. Select Data_Memory. Change Value Radix to Decimal. It should be like the following.
The arguments to the program are stored in the first two memory slots in the Data Memory (loaded with data.coe). Once the program is executed, the third memory slot is filled with the GCD of the first two numbers.
We have coded a simple assembler in python.
Usage
python assembler.py <asm file>
"instructions.coe" file will be generated.
We have already assembled "gcd.asm" into "instructions.coe". So, just load into instruction memory.