]> Joshua Wise's Git repositories - fpgaboy.git/blobdiff - Sound1.v
Set up the bus a little before the clock.
[fpgaboy.git] / Sound1.v
index 9444dbf19e775a2c62ebee95cd1e5a907af87b33..41abaa539e844f84f72d0cf890a45297b8450a4b 100644 (file)
--- a/Sound1.v
+++ b/Sound1.v
@@ -17,11 +17,11 @@ module Sound1(
        );
 
        /* can be optimized as register file */
-       reg [7:0] nr10, nr11, nr12, nr13, nr14;
+       reg [7:0] nr10 = 0, nr11 = 0, nr12 = 0, nr13 = 0, nr14 = 0;
        reg [10:0] counter = 0;
        reg [4:0] lencnt = 0;
        reg [3:0] delta = 4'b1111;
-       reg [2:0] dutycnt;
+       reg toggle = 0;
        reg [3:0] snd_out = 0;
 
        assign snd_data = en ? snd_out : 0;
@@ -58,15 +58,10 @@ module Sound1(
                        counter <= counter - 1;
                else begin
                        counter <= ~{nr14[2:0],nr13} + 1;  /* possible A */
-                       dutycnt <= dutycnt + 1;
+                       toggle <= ~toggle;
                end
-
-               case (nr11[7:6])
-               2'b00: snd_out <= dutycnt ? 0 : delta;   /* probable A */
-               2'b01: snd_out <= (dutycnt[2:1] == 2'b0) ? delta : 0;
-               2'b10: snd_out <= dutycnt[2] ? delta : 0;
-               2'b11: snd_out <= (dutycnt[2:1] == 2'b0) ? 0 : delta;
-               endcase
+               
+               snd_out <= toggle ? delta : 0;  /* Leave it to Dennis. */
        end
 
        always @ (posedge lenclk) begin
This page took 0.027317 seconds and 4 git commands to generate.