Skip to content

Commit e4ee852

Browse files
committed
handle reset
1 parent 5c40697 commit e4ee852

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

hdl/sound/audio_out.v

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,18 @@ module audio_out
3737

3838
reg flt_ce;
3939
reg [31:0] cnt = 0;
40-
always @(posedge clk) begin
41-
42-
flt_ce <= 0;
43-
cnt <= cnt + {flt_rate[30:0],1'b0};
44-
if(cnt >= CLK_RATE) begin
45-
cnt <= cnt - CLK_RATE;
46-
flt_ce <= 1;
40+
always @(posedge clk, posedge reset) begin
41+
if(reset) begin
42+
cnt <= 0;
43+
flt_ce <= 0;
44+
end
45+
else begin
46+
flt_ce <= 0;
47+
cnt <= cnt + {flt_rate[30:0],1'b0};
48+
if(cnt >= CLK_RATE) begin
49+
cnt <= cnt - CLK_RATE;
50+
flt_ce <= 1;
51+
end
4752
end
4853
end
4954

0 commit comments

Comments
 (0)