diff options
| author | uvok | 2026-01-26 20:31:24 +0100 |
|---|---|---|
| committer | uvok | 2026-01-26 20:31:24 +0100 |
| commit | 4cc62801974319a0ea2a1ed59fcf61aa9afed5bd (patch) | |
| tree | 746e670e3bc1fcae922cf0d6673aa95864789708 /eater_cpu/eater_decoder.sv | |
| parent | 3af78e1ad3d70a267f291124be7d7bc55db3f3b6 (diff) | |
eater: Add cond jump
Diffstat (limited to 'eater_cpu/eater_decoder.sv')
| -rw-r--r-- | eater_cpu/eater_decoder.sv | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/eater_cpu/eater_decoder.sv b/eater_cpu/eater_decoder.sv index 53ebf78..9239e92 100644 --- a/eater_cpu/eater_decoder.sv +++ b/eater_cpu/eater_decoder.sv @@ -5,7 +5,7 @@ module eater_decoder ( input clk_i, input wire [7:0] instruction_i, - input wire AluFlags flags_in, + input wire AluFlags alu_flags_in, output CpuControlFlags flags_o ); @@ -34,6 +34,9 @@ function CpuState insdep_state; STA: insdep_state = STA_INS_to_MAR; LDI: insdep_state = LDI_INS_to_A; JMP: insdep_state = JMP_INS_to_PC; + JC_op: insdep_state = JC_st_check; + JZ_op: insdep_state = JZ_st_check; + OUT_op: insdep_state = OUT_A_to_OUT; HALT_op: insdep_state = HALT_st; @@ -75,6 +78,8 @@ always @(posedge clk_i) begin JMP_INS_to_PC: next_state = PC_to_MAR; JMP_NOP: next_state = PC_to_MAR; + JC_st_check, JZ_st_check: next_state = PC_to_MAR; + OUT_A_to_OUT: next_state = PC_to_MAR; HALT_st: next_state = HALT_st; @@ -179,6 +184,15 @@ always_comb begin internal_flags.PC_in = 1; end + JC_st_check: begin + internal_flags.INS_out = alu_flags_in.Carry; + internal_flags.PC_in = alu_flags_in.Carry; + end + JZ_st_check: begin + internal_flags.INS_out = alu_flags_in.Zero; + internal_flags.PC_in = alu_flags_in.Zero; + end + JMP_NOP: begin end |
