VLSI Design Project

Simulation Environment


Overview

The simulation environment for the VLSI Design Project consists of a number of SystemVerilog files which model a basic computer system built around the microprocessor under test:

System Diagram

The system employs a bus structure with the microprocessor as bus master and memory and I/O devices as bus slaves.

From the point of view of the microprocessor bus master, the address is multiplexed, with address and data sharing the 16-bit Data bus:

The address latch within the bus interconnect serves to de-multiplex the bus such that the slaves see separate address and data signals:

note that the ME (not memory enable) line from the microprocessor bus master is gated in the Address Decoder to provide separate CE (not chip enable) lines to each slave device.

Design Hierarchy

SystemVerilog supports an interface construct which allows us to group all the wires for the interconnect together with some of the associated logic.

Interconnect based around a Simple Interface

The diagram below is a block diagram for one possible implementation of the system based around a SystemVerilog interface rather than a set of individual wires:

System Diagram with Simplified Interface

In this example the connections to the interface are made through the interface modports:

Each modport defines the sub-set of the bus connections that will connect to the module along with the direction (input, output or inout) from the point of view of the connected module. Thus the definition for the Master modport is:

    modport Master (
      inout Data,
      output ALE, nME, nOE, RnW,
      input nIRQ, nWait
    );

There is no Address Latch in the above diagram because the functionality of the address latch is included within the interface.

The complete SystemVerilog code for this simple example interface can be found in:

    simple_interface.sv

Actual Interconnect

The interface used in the simulation environment is slightly more complex:

System Diagram with Interface
There are a number of differences which deserve a mention:

The SystemVerilog code for the interface can be found in:

    demux_bus.sv

The hierarchy of the design is defined within the top-level module and testbench file which instances the demux_bus interface along with sub-modules for the bus master, bus slaves and the address decoder:

    system.sv

Memory Map and Address Decoder

Memory Map

The address decoder provides the device select signals for all of the slaves.

    decoder.sv

The external memory and I/O supports a number of different configurations. The default (reduced address map) configuration includes:

An alternative (full address map) configuration uses different addresses for the switches and LEDs and supports a timer interface device:

Bus Slaves

Bus Master

Top level module for the microprocessor

    cpu.sv

The cpu.sv file mentioned above is merely a shell which simulates the pad ring and which instances the real processor definition.

Simulation

Simulation Options

A number of options may be set to control the simulation:

In addition there is an options.sv file which is included by a number of the sytem modules and which defines marcos to control simulation options:

The simulate script may also be called with options:

	./simulate +define+switch_value=8
	./simulate +define+special_stimulus
	./simulate +define+special_monitor
	./simulate +define+ram_access_time=2us
Note that the +define+special_monitor option has no effect since it is set as the default in the options.sv file.

HDL Design

For your own HDL design, copy the example files to a new directory:

	cp -r example mydesign
Then edit the files in the new directory to reflect your design. You can simulate your design using:
	./simulate mydesign
Since you are likely to have more than one test program, you can specify the program file on the command line:
	./simulate mydesign programs/myprog1.sv
Note that if you need to include options they should occur after the design directory and program file specification:
	./simulate mydesign programs/myprog1.sv +define+switch_value=5


Iain McNally

23-3-2012