Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this experiment, students have to modify the design of their pipelined processor implementation in experiment 9 to implement branch - if - greater -

In this experiment, students have to modify the design of their pipelined processor implementation in experiment 9 to implement branch-if-greater-than-or-equal (bge) and load-upper-immediate (lui) instructions. Afterwards, you need to test your updated design using the program given in Table 3.
For the implementation of the bge instruction, the instruction assembly is: bge rs1, rs2, immediate and the machine code is as follows:
312524201915141211760
imm[12], imm[10:5] rs2 rs1 Funct3=101 imm[4:1], imm[11] Opcode =1100011
The bge instruction is executed as follows:
if ((rs1)>=(rs2))
PC = target address = PC of bge + sign-extend(imm)*2
else
PC = PC +4
For the implementation of the lui instruction, the instruction assembly is: lui rd, immediate and the machine code is as follows:
311211760
imm[31:12] rd Opcode =0110111
The lui instruction is executed as follows:
(rd)={imm[31:12],12b0}
Take into consideration the following hints:
Similar to the beq instruction, the bge instruction should be resolved in the ID stage. Hence, if the bge instruction is taken then the instruction in the IF stage must be flushed.
Similar to the R-type and I-type instructions, the result of lui instruction can be forwarded from the MEM or the WB stage. The tables below show examples of these cases:
Clock Cycle 123456
LUI X5,100
F D E M
W
ADD X7, X5, X6
F D E M W
Clock Cycle 1234567
LUI X5,100
F D E M W
ADD X7, X3, X2 F D E M W
ADDI X9, X5,129
F D E M W
Unlike previous experiments, this is not a guided experiment, i.e., students are free to make decisions on how to modify all modules in their processor. However, you are not allowed to remove any of the old instructions or start a new implementation from scratch. Students are expected to extend their processor implementation in the lab. In addition, you are free to choose between structural or behavioral modeling for your modifications.
Step1: In Table 1, describe the changes you did for each file (if any). Note that there are some files where modifications are not needed.
Table 1: Verilog files
File Modified (yes/no)? Changes Description
Library439.v no
Exp 2 FA and MUX8_1.v
Exp 2 ALUs.v
Exp 3 REG32 and MUX32_1.v no
Exp 3 Decoders and RegFile.v no
Instruction_memory.v yes Loaded the program in Table 3
DataMem.v no
ControlUnit.v
Exp6 modules.v
Exp7 modules.v
Exp8 modules.v
Exp9 modules.v
Piplining_Procssor.v
Step2: In Table 2, complete the new rows added for the bge and lui instructions. In case new control signals are needed, use the extra three columns given to show your changes to the control unit. Highlight your changes in yellow, bold color. You can also add new columns if needed.
Table2: Truth Table for the Control Unit
instruction opcode func3 func7 aluop[2] aluop[1] aluop[0] alusrc pcsrc[1] pcsrc[0] memtoreg[1] memtoreg[0] regwrite memread memwrite branch
OR 01100111100000000000000001000
AND 01100111110000000001000001000
XOR 01100111000000000010000001000
ADD 01100110000000000011000001000
SLT 01100110100000000110000001000
SUB 01100110000100000111000001000
ORI 0010011110-000100001000
ANDI 0010011111-001100001000
XORI 0010011100-010100001000
ADDI 0010011000-011100001000
SLTI 0010011010-110100001000
LW 0000011010-011100011100
SW 0100011010-011100 x x 0010
BEQ 1100011000- x x x x 00 x x 0001
BGE 1100011101-
JAL 1101111-- x x x x 0110100 x
JALR 1100111000-01111010100 x
LUI 0110111--
Step3: Table 3 shows the Verilog program students are required to use for test. Fill-in the machine codes for this program and also load the instruction memory with this program.
Table 3: The content of the instruction memory
Address Instruction Machine Code
00 LW X1,12(X0)
01 LW X2,4(X0)
02 LW X3,100(X0)
03 LUI X5,5
04 ADD X6, X3, X5
05 LUI X5,-1
06 ADDI X9, X0,3
07 ADDI X7, X5,2048
08 BEQ X3, X6,4
09 BGE X6, X3,8
10 ADDI X7, X0,25
11 SW X6,23(X7)
12 JALR X1,60(X0)
13 XOR X0, X1, X2
14 BGE X1, X9,-8
15 LW X5,

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions