Skip to content

Commit

Permalink
Merge pull request #17 from efabless/fix_reset_type
Browse files Browse the repository at this point in the history
fix reset signal of all always blocks to be async
  • Loading branch information
NouranAbdelaziz authored Jul 7, 2024
2 parents cc51dc2 + fccb447 commit ffe3583
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions hdl/rtl/EF_I2S.pp.v
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ module i2s_rx (

reg ws_dly0, ws_dly;

reg last_ws; wire ws_npulse, ws_ppulse; always @(posedge clk) last_ws <= ws; assign ws_npulse = ~ws & last_ws; assign ws_ppulse = ws & ~last_ws;
reg last_sck; wire sck_pulse; always @(posedge clk) last_sck <= sck; assign sck_pulse = sck & ~last_sck;
reg last_ws, ws_npulse, ws_ppulse; always @(posedge clk, negedge rst_n) if(!rst_n)begin last_ws <= 1'b1; ws_npulse <= 1'b0; ws_ppulse <= 1'b0; end else begin last_ws <= ws; ws_npulse <= ~ws & last_ws; ws_ppulse <= ws & ~last_ws; end
reg last_sck; wire sck_pulse; always @(posedge clk, negedge rst_n) if(!rst_n) last_sck <= 1'b0; else last_sck <= sck; assign sck_pulse = sck & ~last_sck;

reg last_nsck; wire sck_npulse; always @(posedge clk) last_nsck <= sck; assign sck_npulse = ~sck & last_nsck;
reg last_ws_dly; wire ws_dly_npulse, ws_dly_ppulse; always @(posedge clk) last_ws_dly <= ws_dly; assign ws_dly_npulse = ~ws_dly & last_ws_dly; assign ws_dly_ppulse = ws_dly & ~last_ws_dly;
reg last_nsck; wire sck_npulse; always @(posedge clk, negedge rst_n) if(!rst_n) last_nsck <= 1'b0; else last_nsck <= sck; assign sck_npulse = ~sck & last_nsck;
reg last_ws_dly, ws_dly_npulse, ws_dly_ppulse; always @(posedge clk, negedge rst_n) if(!rst_n)begin last_ws_dly <= 1'b0; ws_dly_npulse <= 1'b0; ws_dly_ppulse <= 1'b0; end else begin last_ws_dly <= ws_dly; ws_dly_npulse <= ~ws_dly & last_ws_dly; ws_dly_ppulse <= ws_dly & ~last_ws_dly; end

always @(posedge clk or negedge rst_n)
if(!rst_n) begin
Expand Down
10 changes: 5 additions & 5 deletions hdl/rtl/EF_I2S.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

`default_nettype none

`define PED(clk, sig, pulse) reg last_``sig``; wire pulse; always @(posedge clk) last_``sig`` <= sig; assign pulse = sig & ~last_``sig``;
`define NED(clk, sig, pulse) reg last_n``sig``; wire pulse; always @(posedge clk) last_n``sig`` <= sig; assign pulse = ~sig & last_n``sig``;
`define PNED(clk, sig, ppulse, npulse) reg last_``sig``; wire npulse, ppulse; always @(posedge clk) last_``sig`` <= sig; assign npulse = ~sig & last_``sig``; assign ppulse = sig & ~last_``sig``;
`define PED(clk, sig, pulse) reg last_``sig``; wire pulse; always @(posedge clk, negedge rst_n) if(!rst_n) last_``sig`` <= 1'b0; else last_``sig`` <= sig; assign pulse = sig & ~last_``sig``;
`define NED(clk, sig, pulse) reg last_n``sig``; wire pulse; always @(posedge clk, negedge rst_n) if(!rst_n) last_n``sig`` <= 1'b0; else last_n``sig`` <= sig; assign pulse = ~sig & last_n``sig``;
`define PNED(clk, sig, ppulse, npulse, rst_val) reg last_``sig``, npulse, ppulse; always @(posedge clk, negedge rst_n) if(!rst_n)begin last_``sig`` <= rst_val; npulse <= 1'b0; ppulse <= 1'b0; end else begin last_``sig`` <= sig; npulse <= ~sig & last_``sig``; ppulse <= sig & ~last_``sig``; end


module i2s_rx (
Expand All @@ -37,11 +37,11 @@ module i2s_rx (

reg ws_dly0, ws_dly;

`PNED(clk, ws, ws_ppulse, ws_npulse)
`PNED(clk, ws, ws_ppulse, ws_npulse, 1'b1)
`PED(clk, sck, sck_pulse)

`NED(clk, sck, sck_npulse)
`PNED(clk, ws_dly, ws_dly_ppulse, ws_dly_npulse)
`PNED(clk, ws_dly, ws_dly_ppulse, ws_dly_npulse, 1'b0)

always @(posedge clk or negedge rst_n)
if(!rst_n) begin
Expand Down

0 comments on commit ffe3583

Please sign in to comment.