|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
本人这两天看Clifford E. Cummings写的异步fifo type2,是用象限法判断的,觉着差不多懂了,把源码拷贝进去,然后写测试程序,但发现波形中的读写指针都不走啊,求助各位!文章中的结构是这样的:
附上测试代码,各位看看代码是不是有问题啊:
module fifo2_test;
// Inputs
reg [7:0] wdata;
reg winc;
reg wclk;
reg wrst_n;
reg rinc;
reg rclk;
reg rrst_n;
// Outputs
wire [7:0] rdata;
wire wfull;
wire rempty;
// Instantiate the Unit Under Test (UUT)
fifo2 uut (
.rdata(rdata),
.wfull(wfull),
.rempty(rempty),
.wdata(wdata),
.winc(winc),
.wclk(wclk),
.wrst_n(wrst_n),
.rinc(rinc),
.rclk(rclk),
.rrst_n(rrst_n)
);
initial begin
// Initialize Inputs
wdata = 0;
//winc = 0;
//wclk = 0;
//wrst_n = 0;
rinc = 0;
rclk = 0;
rrst_n = 0;
end
// Wait 100 ns for global reset to finish
// Add stimulus here
initial begin
wclk=0;
forever //generate wclk singal
#10
wclk=!wclk;
end
initial begin
winc=0;
#100
winc=1 ;
end
//forever//generate rclk singal
//begin
//#10;
//rclk=~rclk;
//end
initial begin
wrst_n=1;
#50 wrst_n=0;
end
initial begin
rrst_n=1;
#80
rrst_n=0;
end
initial begin
rinc=0;
#150
rinc=1;
end
initial begin
rclk=0;
forever
#20
rclk=!rclk;
end
initial
begin
wdata=0;
#100
@(posedge wclk) wdata=01101100;
@(posedge wclk) #0 wdata=01111111;
@(posedge wclk) #0 wdata=10000000;
@(posedge wclk) #0 wdata=11111000;
@(posedge wclk) #0 wdata=10100001;
@(posedge wclk) #0 wdata=11100011;
@(posedge wclk) #0 wdata=10011011;
@(posedge wclk) #0 wdata=10110111;
@(posedge wclk) #0 wdata=01111000;
@(posedge wclk) #0 wdata=11100111;
@(posedge wclk) wdata=01101101;
@(posedge wclk) #0 wdata=11111111;
@(posedge wclk) #0 wdata=10110000;
@(posedge wclk) #0 wdata=11111100;
@(posedge wclk) #0 wdata=10100011;
@(posedge wclk) #0 wdata=1110111;
@(posedge wclk) #0 wdata=10011011;
@(posedge wclk) #0 wdata=10110111;
@(posedge wclk) #0 wdata=01111010;
@(posedge wclk) #0 wdata=11101111;
end
endmodule |
|