Decode instruction types
This commit is contained in:
parent
d5bb6da13c
commit
6c05fd21ef
|
@ -44,14 +44,24 @@
|
|||
$reset = *reset;
|
||||
|
||||
|
||||
// YOUR CODE HERE
|
||||
// ...
|
||||
// Program counter
|
||||
$next_pc[31:0] = $reset ? 0 : ($pc + 4);
|
||||
|
||||
$pc[31:0] = >>1$next_pc;
|
||||
|
||||
// Instruction memory
|
||||
`READONLY_MEM($pc, $$instr[31:0]);
|
||||
|
||||
// Decode instruction types
|
||||
$is_u_instr = $instr[6:2] ==? 5'b0x101;
|
||||
$is_i_instr = $instr[6:2] ==? 5'b0000x
|
||||
|| $instr[6:2] ==? 5'b001x0
|
||||
|| $instr[6:2] == 5'b11001;
|
||||
$is_r_instr = $instr[6:2] ==? 5'b011x0
|
||||
|| $instr[6:2] == 5'b01011
|
||||
|| $instr[6:2] == 5'10100;
|
||||
$is_s_instr = $instr[6:2] ==? 5'b0100x;
|
||||
$is_b_instr = $instr[6:2] == 5'b11000;
|
||||
$is_j_instr = $instr[6:2] == 5'b11011;
|
||||
|
||||
// Assert these to end simulation (before Makerchip cycle limit).
|
||||
*passed = 1'b0;
|
||||
|
|
Loading…
Reference in New Issue