From 224fa02c13ee4d1e152ae9095401d5f4b32073f9 Mon Sep 17 00:00:00 2001 From: Torrey0 <147440137+Torrey0@users.noreply.github.com> Date: Tue, 17 Mar 2026 21:53:49 -0700 Subject: [PATCH] Fixed ALU nzp computation having the n and p bits swapped, and performing unsigned subtration overflow. --- src/alu.sv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/alu.sv b/src/alu.sv index 4d23614..9e826dd 100644 --- a/src/alu.sv +++ b/src/alu.sv @@ -36,7 +36,8 @@ module alu ( if (core_state == 3'b101) begin if (decoded_alu_output_mux == 1) begin // Set values to compare with NZP register in alu_out[2:0] - alu_out_reg <= {5'b0, (rs - rt > 0), (rs - rt == 0), (rs - rt < 0)}; + // n z p + alu_out_reg <= {5'b0, (rs < rt), (rs == rt), (rs > rt)}; end else begin // Execute the specified arithmetic instruction case (decoded_alu_arithmetic_mux)