VLSI Design Project

SystemVerilog HDL - Example Processor


Overview of a Simple Processor

A very simple single bus processor has been designed using SystemVerilog Hardware Description Language.

Architecture Diagram

The processor has a 16-bit data path and a 12-bit address space.

Each instruction is one word (16-bits) wide and consists of a 4-bit opcode and a 12-bit address operand:

Instruction Format

The following instructions are supported:

Note that this simple processor is too simple to meet the specification for the full custom design exercise because:

SystemVerilog code

The SystemVerilog files are the same for all microprocessors designed for the full custom design exercise:

The system described is shown below with 2048 words of RAM (addresses 0-2047) and I/O including a bank of 16 switches (mapped at address 2048) and a bank of 16 LEDs (mapped at address 2049):

System Diagram

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

The arrangement of the components can be clearly seen in the architecture diagram above.

Although the operation of the processor is simple and can easily be understood from a study of the architecture diagram and the SystemVerilog code, it is worth discussing the control unit in more detail:

A simplified ASM chart for the control unit is shown below:

ASM Chart

Notes

  1. Signals are only shown when active. TrisPC is shown active (i.e. =1) in IF_AddrSetup and IF_AddrHold it is inactive (=0) in all other states.

  2. To avoid confusion with active low signals, the chart shows ME/OE/WR/EN, these may be considered as the non-inverted versions of the active low signals nME/nOE/RnW/ENB. Thus where ME exists in the ASM chart, we may assume that the virtual non-inverted signal ME is high and the actual signal nME is low.

  3. Exactly one Tris signal is active in each state since the Tris signals determine which source drives the internal bus (SysBus).

  4. Although the state machine has only 8 states, 16 are shown in the ASM chart. This is a handy method to show the different behaviour of the controller for each of the three different sorts of instruction (Store, Jump, Other).

    If you are bothered by this shorthand you may want to draw the full ASM chart - very complex with conditional outputs, or you may find it useful to think of the opcode stored in the instruction register as a part of the state of the controller.

Most of the SystemVerilog modules above reference the opcodes.svh package file which defines the set of opcodes understood by the processor.

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:

Simple Program

When the simulation is invoked, the program is loaded from a hex file into the ram. By default the hex file loaded is:

The hex file can be generated in a number of ways; the simplest of these is to use a SystemVerilog file which assembles the program using pre-defined constants from the opcodes.svh file and then outputs the result in the appropriate format:

The following assembly language instructions are coded in the example program files:

This is approximately equivalent to the following `C' code:

Simulation