From b3494ea7cc4040adcbfd123f0931116b34d4e9e2 Mon Sep 17 00:00:00 2001 From: uvok Date: Fri, 9 Jan 2026 19:36:02 +0100 Subject: Implement halting --- nandgame/instruction_decode.sv | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'nandgame/instruction_decode.sv') 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]; -- cgit v1.2.3