From 4cc62801974319a0ea2a1ed59fcf61aa9afed5bd Mon Sep 17 00:00:00 2001 From: uvok Date: Mon, 26 Jan 2026 20:31:24 +0100 Subject: eater: Add cond jump --- eater_cpu/eater_decoder.sv | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'eater_cpu/eater_decoder.sv') 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 -- cgit v1.2.3