Altera_Forum
Honored Contributor
14 years agoerror using Altera FIFO megafunction
Hello.
i've configured FIFO megafunc in such way as on img1 then i've tried to test its operating in such way
module incomingCMD ();
tri0 FULL, EMPTY, CLR, Q;
tri0 CMD;
tri0 USEDW;
reg CLK, RDREQ, WRREQ;
reg command;
assign CMD = command;
assign CLR = 0'b0;
initial
begin
CLK <= 0'b1;
RDREQ <= 0'b0;
WRREQ <= 0'b1;
end
always
begin
# 10 CLK <= ~ CLK;
end
initial
begin
# 20 command <= 0'b1;
# 30 command <= 0'b0;
# 50 command <= 0'b1;
# 70 command <= 0'b0;
# 90 command <= 0'b1;
# 20 command <= 0'b0;
# 70 command <= 0'b1;
# 10 command <= 0'b0;
# 50 command <= 0'b1;
# 80 command <= 0'b0;
# 20 command <= 0'b1;
# 40 WRREQ <= 0'b0;
# 20 RDREQ <= 0'b1;
end
fifoCMD cmdSroradgeDevice (
.clock(CLK),
.data(CMD),
.rdreq(RDREQ),
.sclr(CLR),
.wrreq(WRREQ),
.empty(EMPTY),
.full(FULL),
.q(Q),
.usedw(USEDW));
endmodule
but i'got unexpected result my FIFO looks like dead. Sim on img2 Tell, me please my mistake... And also one more question.. I'm going to write a controller SD Card R/W. SD uses CMD line both to get seriall commands and to response it. Thus i would like to know what is the best way to provide this relation. Am i right that trying to get responses in FIFO and than compare with command meanings ? Or there is some more comfortable way to do it?