]> Joshua Wise's Git repositories - fpgaboy.git/blobdiff - Soundcore.v
IP
[fpgaboy.git] / Soundcore.v
index 626001ddd31b6050dec257a75372bb171a8baa35..70c4db1f5dab5794196e02bf7bb3f97690d93ad7 100644 (file)
@@ -29,14 +29,19 @@ module Soundcore(
                (nr51[7] ? sndout4 : 4'b0);
        assign sndout3 = 0;
        assign sndout4 = 0;
-
-       assign data = rd ?
-                        addr == `ADDR_NR50 ? nr50 :
-                        addr == `ADDR_NR51 ? nr51 :
-                        addr == `ADDR_NR52 ? nr52 : 8'bzzzzzzzz
+       
+       reg rdlatch;
+       reg [15:0] addrlatch;
+       
+       assign data = rdlatch ?
+                        addrlatch == `ADDR_NR50 ? nr50 :
+                        addrlatch == `ADDR_NR51 ? nr51 :
+                        addrlatch == `ADDR_NR52 ? nr52 : 8'bzzzzzzzz
                      : 8'bzzzzzzzz;
 
        always @ (posedge core_clk) begin
+               rdlatch <= rd;
+               addrlatch <= addr;
                if(wr) begin
                        case(addr)
                        `ADDR_NR50: nr50 <= data;
This page took 0.026299 seconds and 4 git commands to generate.