Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. LEARNING OBJECTIVES
rs
12
11
rt
9
rd
6
Function
3
2. I-Type Format:
Opcode
15
rs
12
11
rt
9
immediate
6
3. J-Type Format:
Opcode
15
immediate
12
11
Instruction Name
Type
Opcode/Functio
n
and
R-type
(0001)2 / (000)2
or
R-type
(0001)2 / (001)2
xor
R-type
(0001)2 / (010)2
not
R-type
(0001)2 / (011)2
R[rd] = ~ R[rs]
srl
R-type
(0001)2 / (100)2
add
R-type
(0001)2 / (110)2
sub
R-type
(0001)2 / (111)2
addi
I-type
(0010)2
I-type
(0011)2
I-type
(0100)2
I-type
(0101)2
if ( R[rs] == R[rt] )
PC = PC + 1 + SignExtImm
jmp
(jump)
J-type
(0110)2
PC = JumpAddress
jal (jump
and link)
J-type
(0111)2
ret
(return)
J-type
(1000)2
(add immediate)
lw
(load word)
sw
(store word)
beq
(branch equal)
Operation
R[7] = PC + 1; PC = JumpAddress
PC = R[7]
2.
3.
4.
data is the 16-bit data to be written to the register specified by c when write is
1 (at negative edge of the clock).
5.
6.
7.
For every clock cycle, there will be outputs from the register file regardless of the
instruction that is being executed. The registers in the register file must be negative
edge flip-flops. The reason of that will be explained in lab 5.
Control Signal
Functionality
RegDst
Branch
Values
0: use rt
1: use rd
1: beq comparator drives the PC
input
0: the beq comparator does not do
anything
0: do not read from memory
MemRead
MemToReg
01: Memory
10: PC + 1
11: nothing
ALUop
MemWrite
ALUSrc
RegWrite
Jump
Specifies
the
operation
performed in ALU (addition or
operation specified in function
field)
Enables writing data to memory
Ret
Jal
Section:
1. PROBLEM STATEMENT
1.1. The MIPS register file
Design and implement the MIPS register file specified in subsection 2.2.1. The register file
is a sequential circuit that contains 8 registers. It outputs two of its registers contents continuously
using ai and bi indices. The C is used to specify the register to be written with the port d
content. You have to implement it using verilog design language.
2. DESIGN PROCEDURE
1. Open the project created in the previous lab.
2. Create a new verilog file and call it RegisterFile.
3. Specify the ai, bi, C, d, clk, and write as inputs and A and B as outputs.
4. There are two logical parts in the register file. The first part derives the output ports, A
and B, by the ai" and bi indices. The second part writes the data d to R[C] if the
write signal is asserted. This part is triggered by the negative edge of clk. You have
to implement these two parts separately.
5. After you finish writing the code, compile and simulate the design using vector
waveform file. The vector waveform must be similar to what is shown in Figure 1.
3. WHAT TO SUBMIT
1. Th Exercise Sheet.
2. The verilog files, commented with your names.
3.