EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

questa file IO

Ask a question - edaboard.com

elektroda.net NewsGroups Forum Index - Verilog Language - questa file IO

Verictor
Guest

Thu Dec 02, 2010 5:08 am   



Hi,

I don't know what I am missing in the following simple file: I have
correct print out of the text file but there is no display in the
waveform window. More specific, data_in and dummy display correctly in
the shell window but all show 0's in the waveform window.

This is Questasim 6.5. The input data file is simple a text file.

module vtest();

reg clk;
reg rst;
reg data_in;

reg dummy;

integer fileID;

parameter CLK_PERIOD = 10.0;

initial begin
clk = 1'b0;
forever begin
#(CLK_PERIOD/2) clk = !clk;
end
end

initial begin
rst = 1'b1;
repeat(10) @(posedge clk);
rst = 1'b0;
end

initial begin
fileID = $fopen("u_input.txt", "r");
dummy = 1'b0;
end

always @(negedge clk) begin
while (!$feof(fileID)) begin
if ($fscanf(fileID, "%x", data_in)) begin
$display("data %d", data_in);
dummy = data_in;
$display("dummy %x", dummy);
end
end
end


endmodule

Muzaffer Kal
Guest

Thu Dec 02, 2010 5:19 am   



On Wed, 1 Dec 2010 19:08:35 -0800 (PST), Verictor <stehuang_at_gmail.com>
wrote:

Quote:
Hi,

I don't know what I am missing in the following simple file: I have
correct print out of the text file but there is no display in the
waveform window. More specific, data_in and dummy display correctly in
the shell window but all show 0's in the waveform window.

....
always @(negedge clk) begin
while (!$feof(fileID)) begin
if ($fscanf(fileID, "%x", data_in)) begin
$display("data %d", data_in);
dummy = data_in;
$display("dummy %x", dummy);
end
end
end

Your problem is that the always @(negedge clk) is outside the while
loop. If you want one read per clk, you need to reverse the order.
--
Muzaffer Kal

DSPIA INC.
ASIC/FPGA Design Services

http://www.dspia.com

elektroda.net NewsGroups Forum Index - Verilog Language - questa file IO

Ask a question - edaboard.com

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map Opony