Forum Discussion
Altera_Forum
Honored Contributor
11 years ago --- Quote Start --- Given your results, Im pretty sure your code is not error free. Why not post the code? Is this a standard Megawizard fifo? or some custom fifo? --- Quote End --- OK, here you go, I am using the standard MegaFunction... I bet that if I used a custom one I wouldn't have all these troubles! This is my wrapper module: ff is SCFIFO Megafunction.
module FIFO (aclr, clk, data, rdreq, wrreq, q);
input aclr;
input clk;
input data;
input rdreq;
input wrreq;
output q;
wire empty, full;
wire used;
fifo_mf ff (aclr, clk, data, rdreq, wrreq, empty, full, q, used);
endmodule
And here is my Testbench:
`timescale 1ns / 1ns
module tb();
reg aclr = 0;
reg clk = 0;
reg data = 0;
reg rdreq = 0;
reg wrreq = 0;
wire q;
FIFO DUT (aclr, clk, data, rdreq, wrreq, q);
always# 10 clk = ~clk;
always# 20 data = data + 1;
initial begin
# 40 aclr = 1;
# 10 wrreq = 1;
# 40 rdreq = 1;
end
endmodule
And just to disclaim any responsibility, here is my DO script:
vlib work
vlog +acc "tb.v"
vlog +acc "../FIFO.v"
vlog +acc "../fifo_mf.v"
vlog +acc "../fifo_mf_bb.v"
vsim -t 1ps -L altera_mf -lib work tb
view objects
view wave
log -r *
run 1 us
Now show me the error in my code.