initial
begin
full = 0;
empty = 1;
wr_Addr_Bin = 0;
rd_Addr_Bin = 0;
couter =0;
cur_Wr_Pt = 0;
cur_Rd_Pt = 0;
next_Wr_Pt = 1;
next_Rd_Pt = 1;
end
always @(addr)
begin
case (addr)
2'b01: fifoWR = 1;
2'b10: fifoRD = 1;
default:
begin
fifoWR = 0;
fifoRD = 0;
end
endcase
end
reg [couter_Size-1:0] couter;
always @(cur_Wr_Pt )
begin
if(cur_Wr_Pt>0)
empty_Flag = 0;
end
always @(posedge clk)
begin
if (full_Flag==1 ||couter_Rst==1)
couter <= 0 ;
if (full_Flag!=1 && ??)
couter <= couter+1;
end
always @(posedge clk1)
begin
if (rst == 1)
begin
Buff [deep_Size-1:0] <= 0;
cur_Wr_Pt = 0;
next_Wr_Pt = 1;
end
if ((full_Flag!=1)&&(fifoWR==1))
begin
Buff[cur_Wr_Pt] <= in_Data;
if (next_Wr_Pt< deep_Size-1)
begin
cur_Wr_Pt <= next_Wr_Pt;
next_Wr_Pt <=cur_Wr_Pt+1;
end
else
begin
full_Flag <=1;
cur_Wr_Pt = 0;
next_Wr_Pt = 1;
end
end
always @(posedge clk2)
begin
if (rst == 1)
begin
Buff [deep_Size-1:0] <= 0;
cur_Wr_Pt = 1;
next_Rd_Pt = 1;
end
if ((empty_Flag!=1)&&(fifoRD==1))
begin
out_data <= Buff[cur_Rd_Pt];
if (next_Wr_Pt< deep_Size-1)
begin
cur_Wr_Pt <= next_Wr_Pt;
next_Wr_Pt <=cur_Wr_Pt+1;
end
else
begin
empty_Flag <=1;
cur_Rd_Pt = 0;
next_Rd_Pt = 1;
end
end
endmodule