Add WIDTH warning to etc file descriptors.
This commit is contained in:
parent
a555f87705
commit
d9e47a6293
2
Changes
2
Changes
|
|
@ -15,6 +15,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
|||
|
||||
**** Fix IMPURE errors due to X-assignment temporary variables. [Steve Tong]
|
||||
|
||||
**** Add WIDTH warning to $fopen etc file descriptors.
|
||||
|
||||
**** Internal changes to how $displays get compiled and executed.
|
||||
|
||||
* Verilator 3.665 2008/06/25
|
||||
|
|
|
|||
|
|
@ -563,7 +563,10 @@ private:
|
|||
nodep->iterateChildren(*this,WidthVP(ANYSIZE,0,BOTH).p());
|
||||
}
|
||||
virtual void visit(AstDisplay* nodep, AstNUser*) {
|
||||
if (nodep->filep()) nodep->filep()->iterateAndNext(*this,WidthVP(64,64,BOTH).p());
|
||||
if (nodep->filep()) {
|
||||
nodep->filep()->iterateAndNext(*this,WidthVP(64,64,BOTH).p());
|
||||
widthCheck(nodep,"file_descriptor (see docs)",nodep->filep(),64,64);
|
||||
}
|
||||
// Just let all arguments seek their natural sizes
|
||||
nodep->iterateChildren(*this,WidthVP(ANYSIZE,0,BOTH).p());
|
||||
}
|
||||
|
|
@ -571,22 +574,27 @@ private:
|
|||
nodep->filep()->iterateAndNext(*this,WidthVP(64,64,BOTH).p());
|
||||
nodep->filenamep()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p());
|
||||
nodep->modep()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p());
|
||||
widthCheck(nodep,"file_descriptor (see docs)",nodep->filep(),64,64);
|
||||
}
|
||||
virtual void visit(AstFClose* nodep, AstNUser*) {
|
||||
nodep->filep()->iterateAndNext(*this,WidthVP(64,64,BOTH).p());
|
||||
widthCheck(nodep,"file_descriptor (see docs)",nodep->filep(),64,64);
|
||||
}
|
||||
virtual void visit(AstFEof* nodep, AstNUser*) {
|
||||
nodep->filep()->iterateAndNext(*this,WidthVP(64,64,BOTH).p());
|
||||
nodep->width(1,1);
|
||||
widthCheck(nodep,"file_descriptor (see docs)",nodep->filep(),64,64);
|
||||
}
|
||||
virtual void visit(AstFFlush* nodep, AstNUser*) {
|
||||
nodep->filep()->iterateAndNext(*this,WidthVP(64,64,BOTH).p());
|
||||
widthCheck(nodep,"file_descriptor (see docs)",nodep->filep(),64,64);
|
||||
}
|
||||
virtual void visit(AstFGetC* nodep, AstNUser* vup) {
|
||||
nodep->filep()->iterateAndNext(*this,WidthVP(64,64,BOTH).p());
|
||||
if (vup->c()->prelim()) {
|
||||
nodep->width(32,8);
|
||||
}
|
||||
widthCheck(nodep,"file_descriptor (see docs)",nodep->filep(),64,64);
|
||||
}
|
||||
virtual void visit(AstFGetS* nodep, AstNUser* vup) {
|
||||
nodep->filep()->iterateAndNext(*this,WidthVP(64,64,BOTH).p());
|
||||
|
|
@ -594,6 +602,7 @@ private:
|
|||
if (vup->c()->prelim()) {
|
||||
nodep->width(32,32);
|
||||
}
|
||||
widthCheck(nodep,"file_descriptor (see docs)",nodep->filep(),64,64);
|
||||
}
|
||||
virtual void visit(AstFScanF* nodep, AstNUser* vup) {
|
||||
nodep->filep()->iterateAndNext(*this,WidthVP(64,64,BOTH).p());
|
||||
|
|
@ -601,6 +610,7 @@ private:
|
|||
if (vup->c()->prelim()) {
|
||||
nodep->width(32,32);
|
||||
}
|
||||
widthCheck(nodep,"file_descriptor (see docs)",nodep->filep(),64,64);
|
||||
}
|
||||
virtual void visit(AstSScanF* nodep, AstNUser* vup) {
|
||||
nodep->fromp()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p());
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ if (!$::Driver) { use FindBin; exec("./driver.pl", @ARGV, $0); die; }
|
|||
# redistribute it and/or modify it under the terms of either the GNU
|
||||
# General Public License or the Perl Artistic License.
|
||||
|
||||
unlink("obj_dir/t_sys_file_test.log");
|
||||
unlink("obj_dir/t_sys_file_basic_test.log");
|
||||
|
||||
compile (
|
||||
);
|
||||
|
|
@ -15,7 +15,7 @@ execute (
|
|||
check_finished=>1,
|
||||
);
|
||||
|
||||
file_grep ("obj_dir/t_sys_file_test.log",
|
||||
file_grep ("obj_dir/t_sys_file_basic_test.log",
|
||||
qr/\[0\] hello v=12345667
|
||||
\[0\] Hello2
|
||||
/);
|
||||
|
|
@ -28,7 +28,7 @@ module t;
|
|||
if (!$feof(file)) $stop;
|
||||
`endif
|
||||
|
||||
file = $fopen("obj_dir/t_sys_file_test.log","w"); // The "w" is required so we get a FD not a MFD
|
||||
file = $fopen("obj_dir/t_sys_file_basic_test.log","w"); // The "w" is required so we get a FD not a MFD
|
||||
if ($feof(file)) $stop;
|
||||
|
||||
$fdisplay(file, "[%0t] hello v=%x", $time, 32'h12345667);
|
||||
|
|
@ -55,7 +55,7 @@ module t;
|
|||
|
||||
begin
|
||||
// Check read functions
|
||||
file = $fopen("t/t_sys_file_input.dat","r");
|
||||
file = $fopen("t/t_sys_file_basic_input.dat","r");
|
||||
if ($feof(file)) $stop;
|
||||
|
||||
// $fgetc
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("./driver.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003 by Wilson Snyder. This program is free software; you can
|
||||
# redistribute it and/or modify it under the terms of either the GNU
|
||||
# General Public License or the Perl Artistic License.
|
||||
|
||||
unlink("obj_dir/t_sys_file_scan_test.log");
|
||||
|
||||
compile (
|
||||
);
|
||||
|
||||
execute (
|
||||
check_finished=>1,
|
||||
);
|
||||
|
||||
file_grep ("obj_dir/t_sys_file_scan_test.log",
|
||||
"# a
|
||||
1
|
||||
");
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2008 by Wilson Snyder.
|
||||
|
||||
`include "verilated.v"
|
||||
|
||||
module t;
|
||||
`verilator_file_descriptor infile, outfile;
|
||||
integer count, a;
|
||||
|
||||
initial begin
|
||||
infile = $fopen("t/t_sys_file_scan_input.dat", "r");
|
||||
outfile = $fopen("obj_dir/t_sys_file_scan_test.log", "w");
|
||||
|
||||
count = 1234;
|
||||
$display("count == %d, infile %d, outfile %d", count, infile, outfile);
|
||||
count = $fscanf(infile, "%d\n", a);
|
||||
$display("count == %d, infile %d, outfile %d", count, infile, outfile);
|
||||
$fwrite(outfile, "# a\n");
|
||||
$fwrite(outfile, "%d\n", a);
|
||||
$fclose(infile);
|
||||
$fclose(outfile);
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish(0); // Test arguments to finish
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
1
|
||||
2
|
||||
3
|
||||
Loading…
Reference in New Issue