Docsity

Digital Systems Design - Laboratory 2 | EECS 443, Lab Reports of Digital Systems Design

Toggle sidebar
bg1
EECS 443 – Digital Systems Design
Laboratory 2
Perry Alexander, [email protected]
Spring, 2009
In this project you will implement an instruction inter-
preter for the KURM09 (KU RISC Machine 2009) CPU that
will serve as your semester project. This device is a simple
16-instruction RISC-style CPU. As is traditional in a RISC ar-
chitecture, a small number of highly efficient instructions and
addressing modes will be defined. The ISA for the KURM09
is defined in a separate design document.
An instruction interpreter is a behavioral model of a CPU
that is frequently used early in the design cycle to prototype the
device. In many cases, the instruction interpreter will be used by
software developers to start coding activities even before hard-
ware prototypes or emulators are available. Your instruction in-
terpreter will be used to familiarize yourself with the KURM09
design and to develop a test entity for use throughout the design
process.
We will use a single VHDL entity activated by the clock
signal to process instructions. Your entity should support a clock
input and communication with a memory device. Parameters
function as named. The datain and dataout ports are used to
input and output data respectively. The address port is used to
specify a source or destination address, depending on the opera-
tion performed. The rd and wr ports are strobes that instruct the
memory to output (rd) or store (wr) data respectively. The ready
port is an input from memory that indicates when a memory op-
eration has completed. The VHDL skeleton in figure 1gives a
template for implementing the interpreter.
entity cpu is
port (datain: in word; dataout: out word;
address: out word; rd,wr: out bit;
ready: in bit; reset,clk: in bit);
end entity cpu;
Figure 1: Entity template for the instruction
interpreter. Items in italics are things you
must implement.
To write to memory:
1. Set dataout to the data value to be stored
2. Set address to the address where the data should be stored
3. Output a pulse on wr
4. Wait for ready
To read from memory:
1. Set address to the address where the data should be read
from
pf3

Partial preview of the text

Download Digital Systems Design - Laboratory 2 | EECS 443 and more Lab Reports Digital Systems Design in PDF only on Docsity!

EECS 443 – Digital Systems Design

Laboratory 2

Perry Alexander, [email protected]

Spring, 2009

In this project you will implement an instruction inter- preter for the KURM09 (KU RISC Machine 2009 ) CPU that will serve as your semester project. This device is a simple 16 -instruction RISC-style CPU. As is traditional in a RISC ar- chitecture, a small number of highly efficient instructions and addressing modes will be defined. The ISA for the KURM is defined in a separate design document.

An instruction interpreter is a behavioral model of a CPU that is frequently used early in the design cycle to prototype the device. In many cases, the instruction interpreter will be used by software developers to start coding activities even before hard- ware prototypes or emulators are available. Your instruction in- terpreter will be used to familiarize yourself with the KURM design and to develop a test entity for use throughout the design process.

We will use a single VHDL entity activated by the clock signal to process instructions. Your entity should support a clock input and communication with a memory device. Parameters function as named. The datain and dataout ports are used to input and output data respectively. The address port is used to specify a source or destination address, depending on the opera- tion performed. The rd and wr ports are strobes that instruct the memory to output (rd) or store (wr) data respectively. The ready port is an input from memory that indicates when a memory op- eration has completed. The VHDL skeleton in figure 1 gives a template for implementing the interpreter.

entity cpu is port (datain: in word ; dataout: out word ; address: out word ; rd,wr: out bit; ready: in bit; reset,clk: in bit); end entity cpu;

Figure 1 : Entity template for the instruction interpreter. Items in italics are things you must implement.

To write to memory:

  1. Set dataout to the data value to be stored
  2. Set address to the address where the data should be stored
  3. Output a pulse on wr
  4. Wait for ready

To read from memory:

  1. Set address to the address where the data should be read from

eecs 443 – digital systems design laboratory 2 2

  1. Output a pulse on rd
  2. Wait for ready
  3. Read the data from datain

The clk input implements a standard clock and causes the ma- chine to read and execute the next instruction. The reset input is used to set the program counter to 0 , implementing a reset action.

A behavioral memory model is available on the course website under the Resources Page. There are two files you must include, a behavioral model of memory and a collection of memory utili- ties. See the source file for an example of how to use the memory model. It is extremely important to read the documentation in the memory model before you use it. You will find memory initializa- tion and dumping capabilities to help you test your system.

Your architecture should use variables to represent reg- isters and define each instruction over those registers. It should repeatedly fetch instructions from memory and execute them us- ing a case statement that uses the instruction to determine what option to select. Figure 2 provides a template for how your archi- tecture should be structured. First, define variables for registers and program counters. Then within a process, fetch, decode, and execute an instruction after waiting for a rising clock edge. This should be repeated indefinitely.

architecture interpreter of cpu is begin update: process Variables for registers and program counter begin Wait on a rising clock edge Fetch instruction from memory Decode the instruction Execute the instructions in a case statement end process update; end architecture interpreter;

Figure 2 : Architecture template for the instruction interpreter. Items in italics are things you must implement.

Exercise 1 Develop an entity model for the interface of KURM09. This entity should define all inputs into the KURM09 and outputs generated. This must include the interface to memory, the system clock, and the CPU reset. A template for this entity is provided in the lab description.

Exercise 2 Develop behavioral instruction interpreter architecture for KURM09. The instruction interpreter should be structured and behave like the instruction interpreter defined in the lab description. It should execute 1 instruction per clock cycle.

Exercise 3 Integrate the behavioral model with a memory module in a test entity. Create a test entity that includes your CPU model, a clock model, and the memory model provided. Define the interconnections between these components.

Exercise 4 Exercise the model to demonstrate correctness. Load one or more program into memory, reset the CPU and start the clock. When your program has terminated, dump the memory to assure correct execu- tion of the program. Note that your test programs should exercise your CPU model thoroughly.