



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The solution to homework 2 of ee 4720, which involves translating two vax instructions to mips code and drawing a pipeline execution diagram for a pipelined mips implementation. The solution includes the corrected mips code, a pipeline execution diagram, and the cpi calculation.
Typology: Assignments
1 / 5
This page cannot be seen from the preview
Don't miss anything!




srl $2, $1, 10 andi $2, $2, 31
lui $10, 0x add $10, $10, $ lw $10, 0x4060($10) lw $10, 0($10) # The @ is for indirect, so load again! lw $11, 0($4) add $10, $10, $ sw $10, 0($4) addi $4, $4, 4 # Increment r4 by the size of the data item.
format immed
Addr 25: 20:
rsv rtv
IMM
NPC
Addr^ ALU
Data Data
Addr (^) D In
Addr
Data Out
Addr Data In
Data rtv Out
ALU
Decode dst dst dst dest. reg
NPC
LOOP:
addi $1, $2, 4 IF ID EX ME WB IF ID EX ME WB sub $3, $0, $3 IF ID EX ME WB IF ID EX ME WB and $1, $1, $6 IF ID -> EX ME WB IF ID -> EX or $4, $1, $5 IF -> ID ----> EX ME WB IF -> ID bne $4, $3, LO IF ----> ID ----> EX ME WB IF sw $4, 7($8) IF ----> ID EX ME WB add $10, $11, IF IDx
me_wb_md <= data_in_2; me_wb_exc <= ex_me_exc? ex_me_exc : next_me_wb_exc; me_wb_occ <= ~reset & ex_me_occ; tb_me_wb_din <= tb_ex_me_din; end
// E: The case statement and the assignment.
case( immed_fmt ) IMM_s: next_id_ex_imm = { immed[15]? 16’hffff : 16’h0, immed }; IMM_l: next_id_ex_imm = { immed, 16’h0 }; IMM_u: next_id_ex_imm = { 16’h0, immed }; IMM_j: next_id_ex_imm = { if_id_npc[31:28], ii, 2’b0 }; IMM_b: next_id_ex_imm = { immed[15]? 14’h3fff : 14’h0, immed, 2’b0 }; default: ‘UNEXPECTED(next_id_ex_imm,immed_fmt); endcase
// Further below
id_ex_imm <= next_id_ex_imm; // E
format immed
Addr 25: 20:
rsv rtv
IMM
NPC
Addr^ ALU
Data Data
Addr (^) D In
Addr
Data Out
Addr Data In
Data rtv Out
ALU
dest. reg^ Decode^ dst^ dst^ dst
NPC
4
6
5
6
LOOP:
addi $1, $2, 4 IF ID EX ME WB IF ID EX ME WB sub $3, $0, $3 IF ID EX ME WB IF ID EX ME and $1, $1, $6 IF ID EX ME WB IF ID EX or $4, $1, $5 IF ID EX ME WB IF ID bne $4, $3, LO IF ID EX ME WB IF sw $4, 7($8) IF ID EX ME WB add $10, $11, IF IDx