(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;