Skip to content

Commit b572d5d

Browse files
committed
Share JAL and JALR microcode.
1 parent aeaa110 commit b572d5d

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/sentinel/microcode.asm

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ bgeu: a_src => imm, b_src => pc, latch_a => 1, latch_b => 1, CMP_GEU, \
404404

405405
origin 0x98;
406406
jalr: b_src => imm, latch_b => 1;
407+
jalr_shared:
407408
// Bring in PC and prepare to construct PC + 4. Calculate jmp target.
408409
latch_a => 1, latch_b => 1, a_src => four, b_src => pc, alu_op => add, \
409410
alu_o_mod => clear_lsb_o;
@@ -442,18 +443,8 @@ sw_wait: mem_req => 1, invert_test => 1, cond_test => mem_valid, \
442443
STOP_MEMREQ_THEN_JUMP_TO_ZERO;
443444

444445
origin 0xB0;
445-
jal: a_src => imm, b_src => pc, latch_a => 1, latch_b => 1;
446-
// Prepare to construct PC + 4. Calculate jmp target.
447-
latch_a => 1, a_src => four, alu_op => add, alu_o_mod => clear_lsb_o;
448-
// PC + 4 available on next cycle, just in time to be stored in RD.
449-
// Preemptively load target PC. If there's an exception, make sure the old
450-
// PC is still available on ALU output so we can reload.
451-
a_src => zero, latch_a => 1, pc_action => load_alu_o, alu_op => add, \
452-
except_ctl => latch_jal, jmp_type => direct, cond_test => exception, \
453-
invert_test => 1, target => fast_epilog;
454-
// Exception detected. Pass the old PC through, and then reload.
455-
alu_op => add, jmp_type => direct, cond_test => true, \
456-
target => branch_exception_detected;
446+
jal: a_src => imm, b_src => pc, latch_a => 1, latch_b => 1, \
447+
jmp_type => direct, target => jalr_shared;
457448

458449
fast_epilog: INSN_FETCH_EAGER_READ_RS1, WRITE_RD, SKIP_WAIT_IF_ACK;
459450
fast_epilog_csr: INSN_FETCH_EAGER_READ_RS1, WRITE_RD_CSR, SKIP_WAIT_IF_ACK;

0 commit comments

Comments
 (0)