]> Joshua Wise's Git repositories - fpgaboy.git/blobdiff - core/insn_alu_a.v
DAA compile fixes, and PROGFLASH addr increment fix
[fpgaboy.git] / core / insn_alu_a.v
index a5e1c1c6778e443a4009513493caa39e586a50b8..3d7e917b0a29154cd217a973fc0f86d280293131 100644 (file)
                        `_A <= {`_F[4],`_A[7:1]};
                        `_F <= {`_F[7:5],`_A[0],`_F[3:0]};
                end
+               `INSN_alu_DAA: begin
+                       if (`_F[6]) begin                               
+                               if (`_F[4]) begin
+                                       if(`_A[3:0] >= 4'h6 && `_A[7:4] >= 4'h6 && `_F[5]) begin
+                                               `_A <= `_A + 8'h9A;
+                                               `_F <= {((`_A + 8'h9A) == 8'b0), `_F[6:0]};
+                                       end
+                                       else begin
+                                               `_A <= `_A + 8'hA0;
+                                               `_F <= {((`_A + 8'hA0) == 8'b0), `_F[6:0]};
+                                       end
+                               end
+                               else begin
+                                       if(`_A[3:0] <= 4'h9 && `_A[7:4] <= 4'h9 && !`_F[5]) begin
+                                               `_F <= {(`_A == 8'b0), `_F[6:0]};
+                                       end
+                                       else begin
+                                               `_A <= `_A + 8'hFA;
+                                               `_F <= {((`_A + 8'hFA) == 8'b0), `_F[6:0]};
+                                       end
+                               end
+                       end
+                       else begin
+                               if (`_F[4]) begin
+                                       if(`_F[5]) begin
+                                               `_A <= `_A + 8'h66;
+                                               `_F <= {((`_A + 8'h66) == 8'b0), `_F[6:0]};
+                                       end
+                                       else if (`_A[3:0] > 4'h9) begin
+                                               `_A <= `_A + 8'h66;
+                                               `_F <= {((`_A + 8'h66) == 8'b0), `_F[6:0]};
+                                       end
+                                       else begin
+                                               `_A <= `_A + 8'h60;
+                                               `_F <= {((`_A + 8'h60) == 8'b0), `_F[6:0]};
+                                       end
+                               end
+                               else begin
+                                       if(`_F[5]) begin
+                                               if(`_A[7:4] > 4'h9) begin
+                                                       `_A <= `_A + 8'h66;
+                                                       `_F <= {((`_A + 8'h66) == 8'b0), `_F[6:5], 1'b1, `_F[3:0]};
+                                               end
+                                               else begin
+                                                       `_A <= `_A + 8'h06;
+                                                       `_F <= {((`_A + 8'h06) == 8'b0), `_F[6:0]};
+                                               end
+                                       end
+                                       else begin
+                                               if(`_A[3:0] > 4'h9) begin
+                                                       if (`_A[7:4] > 4'h8) begin
+                                                               `_A <= `_A + 8'h66;
+                                                               `_F <= {((`_A + 8'h66) == 8'b0), `_F[6:5], 1'b1, `_F[3:0]};
+                                                       end
+                                                       else begin
+                                                               `_A <= `_A + 8'h06;
+                                                               `_F <= {((`_A + 8'h06) == 8'b0), `_F[6:0]};
+                                                       end
+                                               end
+                                               else begin
+                                                       if (`_A[7:4] > 4'h9) begin
+                                                               `_A <= `_A + 8'h66;
+                                                               `_F <= {((`_A + 8'h66) == 8'b0), `_F[6:5], 1'b1, `_F[3:0]};
+                                                       end
+                                                       else begin
+                                                               `_F <= {(`_A == 8'b0), `_F[6:0]};
+                                                       end
+                                               end
+                                       end
+                               end
+                       end
+               end
                `INSN_alu_CPL: begin
                        `_A <= ~`_A;
                        `_F <= {`_F[7],1'b1,1'b1,`_F[4:0]};
This page took 0.028725 seconds and 4 git commands to generate.