]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/tumbl.git/commitdiff
Correct unfinished/broken CMPU and CMP instructions and IT(TE) conditions.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Mon, 15 Dec 2014 09:28:08 +0000 (10:28 +0100)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Mon, 15 Dec 2014 09:28:08 +0000 (10:28 +0100)
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 <pisa@cmp.felk.cvut.cz>
hw/decode.vhd
hw/exeq.vhd

index b0e66ca8b0eb165a6e5fe2001f56fd5164251b70..bb9810dc0e1812a3c9610fe41e9d0b57f8abd524 100644 (file)
@@ -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 =>
index ec5a6b12bbdb284f414a03b2f60eb0b798a79108..512a97b3625cc8aa2d18d0847f00c4ef359a88c0 100644 (file)
@@ -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