From: Pavel Pisa Date: Mon, 15 Dec 2014 09:28:08 +0000 (+0100) Subject: Correct unfinished/broken CMPU and CMP instructions and IT(TE) conditions. X-Git-Url: http://rtime.felk.cvut.cz/gitweb/fpga/lx-cpu1/tumbl.git/commitdiff_plain/7bf0b3bd95bc0a235f90ff063e39bb0cb3261268 Correct unfinished/broken CMPU and CMP instructions and IT(TE) conditions. The result bit 31 has not been updated when signs of inputs did not match and signBit_r_v used in IT(TE) has not been assigned from result when signs matched. The CMP(U) should compare inputs => it is equivalent to RSUB but specification of ALU_IN_NOT_REGA and CIN_ONE has been omitted. Signed-off-by: Pavel Pisa --- diff --git a/hw/decode.vhd b/hw/decode.vhd index b0e66ca..bb9810d 100644 --- a/hw/decode.vhd +++ b/hw/decode.vhd @@ -181,6 +181,8 @@ p_decode: ELSE alu_Action_v := A_CMP; END IF; + alu_Op1_v := ALU_IN_NOT_REGA; + alu_Cin_v := CIN_ONE; END IF; WHEN "100" | "101" => -- IT(U) / ITT(U) / ITE(U) @@ -200,6 +202,8 @@ p_decode: condition_raw_v := rD_v(2 downto 0); -- IT instruction isn't writing to anything wrb_Action_v := NO_WRB; + alu_Op1_v := ALU_IN_NOT_REGA; + alu_Cin_v := CIN_ONE; END IF; WHEN OTHERS => diff --git a/hw/exeq.vhd b/hw/exeq.vhd index ec5a6b1..512a97b 100644 --- a/hw/exeq.vhd +++ b/hw/exeq.vhd @@ -216,8 +216,9 @@ p_exeq: WHEN A_CMPU => IF (signBit_in1_v = signBit_in2_v) THEN - signBit_r_v := NOT signBit_in1_v; + result_v(31) := NOT signBit_in1_v; END IF; + signBit_r_v := result_v(31); IF (COMPATIBILITY_MODE_g = FALSE) AND (ID2EX_i.it_Action /= NO_IT) THEN -- have to update zero flag with current result IF (result_v = C_32_ZEROS) THEN @@ -229,8 +230,9 @@ p_exeq: WHEN A_CMP => IF (signBit_in1_v = signBit_in2_v) THEN - signBit_r_v := signBit_in1_v; + result_v(31) := signBit_in1_v; END IF; + signBit_r_v := result_v(31); IF (COMPATIBILITY_MODE_g = FALSE) AND (ID2EX_i.it_Action /= NO_IT) THEN -- have to update zero flag with current result IF (result_v = C_32_ZEROS) THEN