mirror of
https://github.com/aolofsson/oh.git
synced 2025-01-30 02:32:53 +08:00
Adding synchronous clear signal to fifo
-It's not uncommon to want to clear/invalidate all entries int he FIFO -Still need async reset for power-on in absence of clocks
This commit is contained in:
parent
2b2c719765
commit
04675f49a7
@ -12,7 +12,8 @@ module oh_fifo_sync #(parameter DW = 104, //FIFO width
|
|||||||
)
|
)
|
||||||
(
|
(
|
||||||
input clk, // clock
|
input clk, // clock
|
||||||
input nreset, // active high async reset
|
input nreset, //async reset
|
||||||
|
input clear, //clears reset (synchronous signal)
|
||||||
input [DW-1:0] din, // data to write
|
input [DW-1:0] din, // data to write
|
||||||
input wr_en, // write fifo
|
input wr_en, // write fifo
|
||||||
input rd_en, // read fifo
|
input rd_en, // read fifo
|
||||||
@ -35,7 +36,13 @@ module oh_fifo_sync #(parameter DW = 104, //FIFO width
|
|||||||
assign fifo_write = wr_en & ~full;
|
assign fifo_write = wr_en & ~full;
|
||||||
|
|
||||||
always @ (posedge clk or negedge nreset)
|
always @ (posedge clk or negedge nreset)
|
||||||
if(!nreset)
|
if(~nreset)
|
||||||
|
begin
|
||||||
|
wr_addr[AW-1:0] <= 'd0;
|
||||||
|
rd_addr[AW-1:0] <= 'b0;
|
||||||
|
rd_count[AW-1:0] <= 'b0;
|
||||||
|
end
|
||||||
|
else if(clear)
|
||||||
begin
|
begin
|
||||||
wr_addr[AW-1:0] <= 'd0;
|
wr_addr[AW-1:0] <= 'd0;
|
||||||
rd_addr[AW-1:0] <= 'b0;
|
rd_addr[AW-1:0] <= 'b0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user