1 `define ADDR_NR50 16'hFF24
2 `define ADDR_NR51 16'hFF25
3 `define ADDR_NR52 16'hFF26
11 output reg snd_data_l,
15 reg [7:0] nr50,nr51,nr52;
19 wire [3:0] sndout1,sndout2,sndout3,sndout4;
20 wire [3:0] right_snd = nr51[0] ? sndout1 : 4'b0;
21 wire [3:0] left_snd = nr51[4] ? sndout1 : 4'b0;
27 addr == `ADDR_NR50 ? nr50 :
28 addr == `ADDR_NR51 ? nr51 :
29 addr == `ADDR_NR52 ? nr52 : 8'bzzzzzzzz
32 always @ (negedge core_clk) begin
35 `ADDR_NR50: nr50 <= data;
36 `ADDR_NR51: nr51 <= data;
37 `ADDR_NR52: nr52 <= {data[7],3'b1,data[3:0]};
43 snd_data_l <= (pwmcnt <= left_snd) ? 1 : 0;
44 snd_data_r <= (pwmcnt <= right_snd) ? 1 : 0;
55 .en(nr52[7] & nr52[0]),
67 .en(nr52[7] & nr52[0]),