]> Joshua Wise's Git repositories - fpgaboy.git/commitdiff
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 0d85f953f5713ec704c696b927a4018094d96a55..bfd6880a1ea3d53889af9c1bc9500109711817dd 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 1283a9cfbc5c00645c79c1bf65fa78dd3271216e..26fc77eca45614d1c26c0920570413a83f959b93 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 14ccd76aae620ee90b99b6d54a463859e24d12af..a5e1c1c6778e443a4009513493caa39e586a50b8 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.024554 seconds and 4 git commands to generate.