Professional Documents
Culture Documents
5494 N 17511
5494 N 17511
Verilog implementation
You can declare 32 32-bit registers (r0, r1, , r31) Use switch statement Remember that when register $0 is read, it always reads 0
Writing to a memory location will occur during positive clock Memory read is not controlled by clock Verilog implementation
Implement the 32 words in memory as 32 32-bit registers Note that an address of 0000100 refers to register r1.
module DataMemory(Address, WriteData, MemRead, MemWrite, Clk, ReadData); input [6:0] Address; // 7-bit address to memory. input [31:0] WriteData; // Data to be written into WriteRegister input MemRead; // Data in memory location Address is read if this control is set Input MemWrite; // WriteData is written in Address during positive clock edge if this control is set output [31:0] ReadData; // Value read from memory location Address
2
Single-cycle datapath
Multi-cycle datapath
Some of the control signal can be implied (register file read are values in A and B registers (actually A and B need not be registers at all) Explicit control vs indirect control (derived based on input like what instruction is being executed, or what function code field is) bits
6
Graphical specification
How many state bits do we require?
PLA Implementation
ROM implementation
ROM = "Read Only Memory"
Values of memory locations are fixed ahead of time
0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1
0 1 1 1 0 0 0 0
0 1 1 0 0 0 1 1
1 0 0 0 0 0 1 1
1 0 0 0 0 1 0 1
ROM implementation
How many inputs are there?
6 bits for opcode, 4 bits for state = 10 address lines (i.e., 210 = 1024 different addresses)
Rather wasteful, since for lots of the entries, the outputs are the same
i.e., opcode is often ignored
10
ROM vs PLA
Break up the table into two parts
4 state bits tell you the 16 outputs, 24 x 16 bits of ROM 10 bits tell you the 4 next state bits, 210 x 4 bits of ROM Total: 4.3K bits of ROM
PLA cells usually about the size of a ROM cell (slightly bigger)
11