Simulation

From Just a bit RISC
Jump to: navigation, search

The general command syntax for simulation is shown below:

{ ./simulate model programs/program.hex [programs/serial_data.hex] end_condition verilog_options}

model - Defines the simulation type to be used, behavioural, mixed or structural.

program - Defines the program to be simulated, example programs included in this guide are interrupt.hex, factorial.hex, multiply.hex and random.hex.

end_condition - Defines the condition for the simulation to end, either a maximum time or a maximum number of writes to the LEDs. The maximum time is specified as an amount of micro-seconds, e.g. ‘3000’ would simulate for 3000 <math>\mu</math>s. To specify a maximum number of writes the number is suffixed by the character ‘L’, e.g. ‘5L’.

verilog_options - Optional extra options to pass to the simulator, these follow the same format as options.sv. For example, +define+switch_value=5 gives the switches a value of five.

Figure {fig:reg} shows the register window for the NIMJAR processor simulation. The register window shows the contents of all internal registers, including the stack pointer, program counter, instruction register and immediate register. The current ALU function is shown, as well as the data on the system bus.

Also shown is the state of the controller as well as the registers it is selecting. The state of external circuitry is also shown, including the values of the switches and LEDs.

A memory window is also created so that the programmer can view the contents of the stack and the program memory space.

System.jpg