summaryrefslogtreecommitdiff
path: root/decoder.v
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2017-01-08 23:30:25 -0600
committerBobby Bingham <koorogi@koorogi.info>2017-01-08 23:30:25 -0600
commitf2b72883df7f67c53f7157193ec7271943a1654e (patch)
tree1b99cc488428db0f041dbd28b9e1f154453559f0 /decoder.v
parent17f5cbe781ae761d86d55fec7d46ba3172167894 (diff)
Reimplement notneg in terms of subtract
Diffstat (limited to 'decoder.v')
-rw-r--r--decoder.v9
1 files changed, 5 insertions, 4 deletions
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};