Parameterized module

B

bir

Guest
I have a parameterized fifo which accepts length and depth as its
parameter.

parameter FIFO_WIDTH = 3;
parameter FIFO_DEPTH = 8;

reg [FIFO_WIDTH-1:0] read_ptr;
reg [FIFO_WIDTH-1:0] write_ptr;
reg [FIFO_WIDTH:0] ptr_gap; // Gap between the pointers

always @(negedge pintrst_n or posedge pit_clk)
begin
if(pintrst_n== 1'b0)
begin
read_ptr <= ..??
write_ptr <= ..??
ptr_gap <= ..??

My question is how do I apply reset values to the pointers and ptr_gap
since they can be of varible length?


Thanks
Bir
 
The lint-friendly method might be {FIFO_WIDTH{1'b0}} or
{FIFO_WIDTH+1{1'b1}}.

If I'm content without a sign check, I'll just use "0" for all-zeros or "-1"
for all-ones.



"bir" <ritwikbiswas@gmail.com> wrote in message
news:1172269989.710284.211780@j27g2000cwj.googlegroups.com...
I have a parameterized fifo which accepts length and depth as its
parameter.

parameter FIFO_WIDTH = 3;
parameter FIFO_DEPTH = 8;

reg [FIFO_WIDTH-1:0] read_ptr;
reg [FIFO_WIDTH-1:0] write_ptr;
reg [FIFO_WIDTH:0] ptr_gap; // Gap between the pointers

always @(negedge pintrst_n or posedge pit_clk)
begin
if(pintrst_n== 1'b0)
begin
read_ptr <= ..??
write_ptr <= ..??
ptr_gap <= ..??

My question is how do I apply reset values to the pointers and ptr_gap
since they can be of varible length?


Thanks
Bir
 

Welcome to EDABoard.com

Sponsor

Back
Top