Guest
I am writing a verilog testbench and using the new file IO statements
defined in Verilog 2001. The testbench with the new file IO statement
works great with modelsim 6.0a but it did not work with NC-Verilog
5.10. The following is part of the design that NC-Verilog is having
problems:
initial
begin
in_file = $fopen("sst_test.txt", "r");
if (in_file == `NULL)
begin
$display("Test file does not exist.\n");
$stop;
end
c = $fgetc(in_file);
while (c !== `ENDOFFILE)
begin : file_block
if (c === "/")
begin
r = $ungetc(c, in_file);
r = $fgets(tst_cmd, in_file);
$display("The comment: %0s \n", tst_cmd);
end
else
begin
r = $ungetc(c, in_file);
r = $fscanf(in_file, " %s \n", tst_cmd);
case (tst_cmd)
"//":
$display("%s\n", tst_cmd);
"por":
power_on_reset;
"sn":
speed_negotiation;
"ping" | "Ping":
ping_cmd;
NC-Verilog was able to handle the fgetc and fgets but everytime it
executes the $fscanf it gives the following warning:
"The following message was reported while $fscanf was accessing design
data
Warn: SYSTF FMTMISM
Input stream does not match the format specifier"
Also, the $fscanf does not read the data as expected. My understanding
and modelsim's of $fscanf is to read the text until white space or new
line. What do I need to do to get this to work with NC-Verilog?
defined in Verilog 2001. The testbench with the new file IO statement
works great with modelsim 6.0a but it did not work with NC-Verilog
5.10. The following is part of the design that NC-Verilog is having
problems:
initial
begin
in_file = $fopen("sst_test.txt", "r");
if (in_file == `NULL)
begin
$display("Test file does not exist.\n");
$stop;
end
c = $fgetc(in_file);
while (c !== `ENDOFFILE)
begin : file_block
if (c === "/")
begin
r = $ungetc(c, in_file);
r = $fgets(tst_cmd, in_file);
$display("The comment: %0s \n", tst_cmd);
end
else
begin
r = $ungetc(c, in_file);
r = $fscanf(in_file, " %s \n", tst_cmd);
case (tst_cmd)
"//":
$display("%s\n", tst_cmd);
"por":
power_on_reset;
"sn":
speed_negotiation;
"ping" | "Ping":
ping_cmd;
NC-Verilog was able to handle the fgetc and fgets but everytime it
executes the $fscanf it gives the following warning:
"The following message was reported while $fscanf was accessing design
data
Warn: SYSTF FMTMISM
Input stream does not match the format specifier"
Also, the $fscanf does not read the data as expected. My understanding
and modelsim's of $fscanf is to read the text until white space or new
line. What do I need to do to get this to work with NC-Verilog?