Fix some carry-related bugs and a typo in insn_alu_a.
authorJoshua Wise <joshua@rebirth.joshuawise.com>
Sun, 11 May 2008 11:04:03 +0000 (07:04 -0400)
committerJoshua Wise <joshua@rebirth.joshuawise.com>
Sun, 11 May 2008 11:04:03 +0000 (07:04 -0400)
core/insn_add_hl.v
core/insn_alu8.v
core/insn_alu_a.v

index 0d85f95..bfd6880 100644 (file)
@@ -25,7 +25,7 @@
                                `_F <=  { /* Z */ `_F[7],
                                          /* N */ 1'b0,
                                          /* H */ (({`_HL} + {tmp,tmp2}) & 16'h1000) ? 1'b1 : 1'b0,
-                                         /* C */ (({1'b0,`_HL} + {1'b0,tmp,tmp2}) >> 16 == 1) ? 1'b1 : 1'b0,
+                                         /* C */ (({1'b0,`_HL} + {1'b0,tmp,tmp2}) & 17'h10000) ? 1'b1 : 1'b0,
                                          `_F[3:0]
                                        };
                                `_HL <= {tmp, tmp2};
index 1283a9c..26fc77e 100644 (file)
                        end
                        `INSN_alu_AND: begin
                                `_A <= `_A & tmp;
-                               `_F <=  { /* Z */ ((`_A & tmp) == 0) ? 1'b1 : 1'b0,
+                               `_F <=  { /* Z */ ((`_A & tmp) == 8'b0) ? 1'b1 : 1'b0,
                                          3'b010,
                                          `_F[3:0]
                                        };
                        end
                        `INSN_alu_OR: begin
                                `_A <= `_A | tmp;
-                               `_F <=  { /* Z */ ((`_A | tmp) == 0) ? 1'b1 : 1'b0,
+                               `_F <=  { /* Z */ ((`_A | tmp) == 8'b0) ? 1'b1 : 1'b0,
                                          3'b000,
                                          `_F[3:0]
                                        };
                        end
                        `INSN_alu_XOR: begin
                                `_A <= `_A ^ tmp;
-                               `_F <=  { /* Z */ ((`_A ^ tmp) == 0) ? 1'b1 : 1'b0,
+                               `_F <=  { /* Z */ ((`_A ^ tmp) == 8'b0) ? 1'b1 : 1'b0,
                                          3'b000,
                                          `_F[3:0]
                                        };
index 14ccd76..a5e1c1c 100644 (file)
@@ -32,7 +32,7 @@
                        `_F <= {`_F[7:5],`_A[7],`_F[3:0]};
                end
                `INSN_alu_RRA: begin
-                       `_A <= {`_A[4],`_A[7:1]};
+                       `_A <= {`_F[4],`_A[7:1]};
                        `_F <= {`_F[7:5],`_A[0],`_F[3:0]};
                end
                `INSN_alu_CPL: begin
This page took 0.024204 seconds and 4 git commands to generate.