summaryrefslogtreecommitdiff
path: root/nandgame/instruction_decode.sv
diff options
context:
space:
mode:
Diffstat (limited to 'nandgame/instruction_decode.sv')
-rw-r--r--nandgame/instruction_decode.sv7
1 files changed, 6 insertions, 1 deletions
diff --git a/nandgame/instruction_decode.sv b/nandgame/instruction_decode.sv
index f81f251..b78bee8 100644
--- a/nandgame/instruction_decode.sv
+++ b/nandgame/instruction_decode.sv
@@ -34,7 +34,9 @@ module instruction_decode #(
// whether result should be stored to D
output dst_D_out,
// whether result should be stored in memory at address in A register
- output dst_pA_out
+ output dst_pA_out,
+ // Invalid instruction
+ output invalid_ins
);
wire is_immediate_int;
@@ -42,6 +44,9 @@ wire is_immediate_int;
// bit 15 unset = immediate
assign is_immediate_int = !instruction_in[15];
+// bit 14 must be 1
+assign invalid_ins = instruction_in[15] == 1 && instruction_in[14] == 0;
+
assign dst_A_out = is_immediate_int || instruction_in[5];
assign dst_D_out = !is_immediate_int && instruction_in[4];
assign dst_pA_out = !is_immediate_int && instruction_in[3];