From f2b72883df7f67c53f7157193ec7271943a1654e Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Sun, 8 Jan 2017 23:30:25 -0600 Subject: Reimplement notneg in terms of subtract --- decoder.v | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'decoder.v') diff --git a/decoder.v b/decoder.v index 3e08df3..0457640 100644 --- a/decoder.v +++ b/decoder.v @@ -190,7 +190,7 @@ module decoder ( assign aluOp = instr_math ? {1'b0, math_op} : instr_shift ? {1'b1, shift_dir, shift_extend} : - instr_notneg ? ALU_ADD : + instr_notneg ? ALU_SUB : instr_mov ? ALU_JUSTX : instr_movimm ? ALU_JUSTX : ALU_ADD; @@ -206,7 +206,6 @@ module decoder ( 2'h0; assign aluOpSource2 = - instr_notneg ? 2'h1 : instr_branch ? 2'h2 : 2'h0; @@ -217,7 +216,9 @@ module decoder ( assign regDest = reg0; - assign aluCarrySource = 2'h0; + assign aluCarrySource = + instr_notneg ? {1'b0, !notneg_is_neg} : + 2'h0; assign regSetH = instr_mov ? (mov_word | mov_dest_byte_high) : @@ -242,7 +243,7 @@ module decoder ( 6'b1_10_0_10; assign imm = - instr_notneg ? {15'b0, notneg_is_neg} : + instr_notneg ? 16'b0 : instr_branch ? ext_imm_param : instr_addpc ? ext_imm_param : {movimm_imm, movimm_imm}; -- cgit v1.2.3