Compare commits

..
7 Commits
14 changed files with 226 additions and 53 deletions
+11 -1
View File
@@ -3,7 +3,17 @@ Revision history for Verilator
The contributors that suggested a given feature are shown in []. [by ...]
indicates the contributor was also the author of the fix; Thanks!
* Verilator 3.822 2011/10/20
* Verilator 3.824 2011/10/25
*** Fix "always @ (* )", bug403, bug404. [Walter Lavino]
*** Add ASSIGNIN as suppressable error. [Jeremy Bennett]
**** Fix 3.823 constructor core dump on Debian, bug401. [Ahmed El-Mahmoudy]
* Verilator 3.823 2011/10/20
*** Support $ceil, $floor, etc. [Alex Solomatnikov]
+11
View File
@@ -2377,6 +2377,17 @@ List of all warnings:
=over 4
=item ASSIGNIN
Error that an assignment is being made to an input signal. This is almost
certainly a mistake, though technically legal.
input a;
assign a = 1'b1;
Ignoring this warning will only suppress the lint check, it will simulate
correctly.
=item ASSIGNDLY
Warns that you have an assignment statement with a delayed time in front of
+1 -1
View File
@@ -4,7 +4,7 @@
# redistribute it and/or modify it under the terms of either the GNU Lesser
# General Public License Version 3 or the Perl Artistic License Version 2.0.
AC_INIT([Verilator],[3.823 2011/10/20])
AC_INIT([Verilator],[3.824 2011/10/25])
AC_CONFIG_HEADER(src/config_build.h)
AC_CONFIG_FILES(Makefile src/Makefile src/Makefile_obj include/verilated.mk)
+17 -20
View File
@@ -34,11 +34,6 @@
//======================================================================
// Statics
map<string,int> FileLine::s_namemap;
deque<string> FileLine::s_names;
// s_defaultFileLine must be after s_name* initializer and in same .cpp file
FileLine FileLine::s_defaultFileLine = FileLine(EmptySecret());
int V3Error::s_errCount = 0;
int V3Error::s_warnCount = 0;
int V3Error::s_debugDefault = 0;
@@ -69,13 +64,28 @@ V3ErrorCode::V3ErrorCode(const char* msgp) {
m_e = V3ErrorCode::EC_ERROR;
}
//######################################################################
// FileLineSingleton class functions
int FileLineSingleton::nameToNumber(const string& filename) {
// Convert filenames to a filenameno
// This lets us assign a nice small identifier for debug messages, but more
// importantly lets us use a 4 byte int instead of 8 byte pointer in every FileLine.
map<string,int>::const_iterator iter = m_namemap.find(filename);
if (VL_LIKELY(iter != m_namemap.end())) return iter->second;
int num = m_names.size();
m_names.push_back(filename);
m_namemap.insert(make_pair(filename,num));
return num;
}
//######################################################################
// FileLine class functions
FileLine::FileLine(FileLine::EmptySecret) {
// Sort of a singleton
m_lineno=0;
m_filenameno=nameToNumber("AstRoot");
m_filenameno=singleton().nameToNumber("AstRoot");
m_warnOn=0;
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
@@ -84,18 +94,6 @@ FileLine::FileLine(FileLine::EmptySecret) {
}
}
int FileLine::nameToNumber(const string& filename) {
// Convert filenames to a filenameno
// This lets us assign a nice small identifier for debug messages, but more
// importantly lets us use a 4 byte int instead of 8 byte pointer in every FileLine.
map<string,int>::const_iterator iter = s_namemap.find(filename);
if (VL_LIKELY(iter != s_namemap.end())) return iter->second;
int num = s_names.size();
s_names.push_back(filename);
s_namemap.insert(make_pair(filename,num));
return num;
}
const string FileLine::filenameLetters() const {
const int size = 1 + (64 / 4); // Each letter retires more than 4 bits of a > 64 bit number
char out[size];
@@ -291,8 +289,7 @@ void FileLine::deleteAllRemaining() {
// Eventually the list will be empty and terminate the loop.
}
fileLineLeakChecks.clear();
s_names.clear();
s_namemap.clear();
FileLineSingleton::clear();
#endif
}
+34 -21
View File
@@ -48,14 +48,15 @@ public:
I_LINT, // All lint messages
I_DEF_NETTYPE_WIRE, // `default_nettype is WIRE (false=NONE)
// Error codes:
E_BLKLOOPINIT, // Error: Delayed assignment to array inside for loops
E_MULTITOP, // Error: Multiple top level modules
E_TASKNSVAR, // Error: Task I/O not simple
E_BLKLOOPINIT, // Error: Delayed assignment to array inside for loops
//
// Warning codes:
EC_FIRST_WARN, // Just a code so the program knows where to start warnings
//
ASSIGNDLY, // Assignment delays
ASSIGNIN, // Assigning to input
BLKANDNBLK, // Blocked and non-blocking assignments to same variable
BLKSEQ, // Blocking assignments in sequential block
CASEINCOMPLETE, // Case statement has missing values
@@ -105,10 +106,10 @@ public:
// Boolean
" I_COVERAGE", " I_TRACING", " I_LINT", " I_DEF_NETTYPE_WIRE",
// Errors
"MULTITOP", "TASKNSVAR", "BLKLOOPINIT",
"BLKLOOPINIT", "MULTITOP", "TASKNSVAR",
// Warnings
" EC_FIRST_WARN",
"ASSIGNDLY",
"ASSIGNDLY", "ASSIGNIN",
"BLKANDNBLK", "BLKSEQ",
"CASEINCOMPLETE", "CASEOVERLAP", "CASEWITHX", "CASEX", "CDCRSTLOGIC", "CMPCONST",
"COMBDLY", "DEFPARAM", "DECLFILENAME",
@@ -130,7 +131,8 @@ public:
bool dangerous() const { return ( m_e==COMBDLY ); }
// Warnings we'll present to the user as errors
// Later -Werror- options may make more of these.
bool pretendError() const { return ( m_e==BLKANDNBLK || m_e==IMPURE || m_e==MODDUP || m_e==SYMRSVDWORD); }
bool pretendError() const { return ( m_e==ASSIGNIN || m_e==BLKANDNBLK
|| m_e==IMPURE || m_e==MODDUP || m_e==SYMRSVDWORD); }
// Warnings to mention manual
bool mentionManual() const { return ( m_e==EC_FATALSRC || pretendError() ); }
@@ -252,8 +254,17 @@ inline uint32_t cvtToHash(void* vp) {
class FileLine;
class FileLineSingleton {
map<string,int> m_namemap; // filenameno for each filename
deque<string> m_names; // filename text for each filenameno
// COSNTRUCTORS
FileLineSingleton() { }
~FileLineSingleton() { }
protected:
friend class FileLine;
// METHODS
int nameToNumber(const string& filename);
string numberToName(int filenameno) { return m_names[filenameno]; }
void clear() { m_namemap.clear(); m_names.clear(); }
};
class FileLine {
@@ -263,31 +274,33 @@ class FileLine {
bitset<V3ErrorCode::_ENUM_MAX> m_warnOn;
// Consider moving opt.language() into here, so can know language per-node
static map<string,int> s_namemap; // filenameno for each filename
static deque<string> s_names; // filename text for each filenameno
static FileLine s_defaultFileLine;
static int nameToNumber(const string& filename);
static string numberToName(int filenameno) { return s_names[filenameno]; }
private:
struct EmptySecret {};
inline static FileLineSingleton& singleton() {
static FileLineSingleton s;
return s;
}
inline static FileLine& defaultFileLine() {
static FileLine* defFilelinep = new FileLine(FileLine::EmptySecret());
return *defFilelinep;
}
protected:
// User routines should never need to change line numbers
// We are storing pointers, so we CAN'T change them after initial reading.
friend class FileLineSingleton;
friend class V3ParseImp;
friend class V3PreLex;
friend class V3PreProcImp;
void lineno(int num) { m_lineno = num; }
void filename(const string& name) { m_filenameno = nameToNumber(name); }
void filename(const string& name) { m_filenameno = singleton().nameToNumber(name); }
void lineDirective(const char* textp, int& enterExitRef);
void linenoInc() { m_lineno++; }
void linenoIncInPlace() { m_lineno++; }
FileLine* copyOrSameFileLine();
public:
FileLine (const string& filename, int lineno) {
m_lineno=lineno; m_filenameno = nameToNumber(filename);
m_warnOn=s_defaultFileLine.m_warnOn; }
m_lineno=lineno; m_filenameno = singleton().nameToNumber(filename);
m_warnOn=defaultFileLine().m_warnOn; }
FileLine (FileLine* fromp) {
m_lineno=fromp->m_lineno; m_filenameno = fromp->m_filenameno; m_warnOn=fromp->m_warnOn; }
FileLine (EmptySecret);
@@ -302,7 +315,7 @@ public:
int lineno () const { return m_lineno; }
string ascii() const;
const string filename () const { return numberToName(m_filenameno); }
const string filename () const { return singleton().numberToName(m_filenameno); }
const string filenameLetters() const;
const string filebasename () const;
const string filebasenameNoExt () const;
@@ -315,7 +328,7 @@ public:
void warnLintOff(bool flag);
void warnStyleOff(bool flag);
void warnStateFrom(const FileLine& from) { m_warnOn=from.m_warnOn; }
void warnResetDefault() { warnStateFrom(s_defaultFileLine); }
void warnResetDefault() { warnStateFrom(defaultFileLine()); }
// Specific flag ACCESSORS/METHODS
bool coverageOn() const { return m_warnOn.test(V3ErrorCode::I_COVERAGE); }
@@ -325,13 +338,13 @@ public:
// METHODS - Global
static void globalWarnLintOff(bool flag) {
s_defaultFileLine.warnLintOff(flag); }
defaultFileLine().warnLintOff(flag); }
static void globalWarnStyleOff(bool flag) {
s_defaultFileLine.warnStyleOff(flag); }
defaultFileLine().warnStyleOff(flag); }
static void globalWarnOff(V3ErrorCode code, bool flag) {
s_defaultFileLine.warnOff(code, flag); }
defaultFileLine().warnOff(code, flag); }
static bool globalWarnOff(const string& code, bool flag) {
return s_defaultFileLine.warnOff(code, flag); }
return defaultFileLine().warnOff(code, flag); }
// METHODS - Called from netlist
// Merge warning disables from another fileline
+1 -1
View File
@@ -65,7 +65,7 @@ private:
if (nodep->varp()) {
if (nodep->lvalue() && nodep->varp()->isInOnly()) {
if (!m_ftaskp) {
nodep->v3error("Assigning to input variable: "<<nodep->prettyName());
nodep->v3warn(ASSIGNIN,"Assigning to input variable: "<<nodep->prettyName());
}
}
if (nodep->lvalue() && nodep->varp()->isConst()
+2 -1
View File
@@ -859,8 +859,9 @@ word [a-zA-Z0-9_]+
/************************************************************************/
/* Attributes */
/* Note simulators vary in support for "(* /_*something*_/ foo*)" where _ doesn't exist */
<V95,V01,V05,S05,S09>{
"(*"/{ws}*[^)] { yymore(); yy_push_state(ATTRMODE); } // Doesn't match (*)
"(*"({ws}|{crnl})*({id}|{escid}) { yymore(); yy_push_state(ATTRMODE); } // Doesn't match (*), but (* attr_spec
}
/************************************************************************/
+2 -2
View File
@@ -1527,7 +1527,7 @@ assignOne<nodep>:
delayE:
/* empty */ { }
| delay_control { $1->v3warn(ASSIGNDLY,"Ignoring delay on this assignment/primitive."); } /* ignored */
| delay_control { $1->v3warn(ASSIGNDLY,"Unsupported: Ignoring delay on this assignment/primitive."); } /* ignored */
;
delay_control<fl>: //== IEEE: delay_control
@@ -1929,7 +1929,7 @@ statement_item<nodep>: // IEEE: statement_item
//
//UNSUP par_block { $$ = $1; }
// // IEEE: procedural_timing_control_statement + procedural_timing_control
| delay_control stmtBlock { $$ = $2; $1->v3warn(STMTDLY,"Ignoring delay on this delayed statement."); }
| delay_control stmtBlock { $$ = $2; $1->v3warn(STMTDLY,"Unsupported: Ignoring delay on this delayed statement."); }
//UNSUP event_control stmtBlock { UNSUP }
//UNSUP cycle_delay stmtBlock { UNSUP }
//
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.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
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
compile (
);
execute (
check_finished=>1,
);
ok(1);
1;
+41
View File
@@ -0,0 +1,41 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2011 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
always @(*) begin
if (clk) begin end
end
always @(* ) begin
if (clk) begin end
end
// Not legal in some simulators, legal in others
// always @(* /*cmt*/ ) begin
// if (clk) begin end
// end
// Not legal in some simulators, legal in others
// always @(* // cmt
// ) begin
// if (clk) begin end
// end
always @ (*
) begin
if (clk) begin end
end
initial begin
$write("*-* All Finished *-*\n");
$finish;
end
endmodule
+4 -4
View File
@@ -15,11 +15,11 @@ compile (
verilator_flags2 => ['-Wall -Wno-DECLFILENAME'],
fails=>1,
expect=>
'%Warning-ASSIGNDLY: t/t_delay.v:\d+: Ignoring delay on this assignment/primitive.
'%Warning-ASSIGNDLY: t/t_delay.v:\d+: Unsupported: Ignoring delay on this assignment/primitive.
%Warning-ASSIGNDLY: Use .*
%Warning-ASSIGNDLY: t/t_delay.v:\d+: Ignoring delay on this assignment/primitive.
%Warning-ASSIGNDLY: t/t_delay.v:\d+: Ignoring delay on this assignment/primitive.
%Warning-STMTDLY: t/t_delay.v:\d+: Ignoring delay on this delayed statement.
%Warning-ASSIGNDLY: t/t_delay.v:\d+: Unsupported: Ignoring delay on this assignment/primitive.
%Warning-ASSIGNDLY: t/t_delay.v:\d+: Unsupported: Ignoring delay on this assignment/primitive.
%Warning-STMTDLY: t/t_delay.v:\d+: Unsupported: Ignoring delay on this delayed statement.
.*%Error: Exiting due to.*',
);
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.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
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
compile (
);
execute (
check_finished=>1,
);
ok(1);
1;
+64
View File
@@ -0,0 +1,64 @@
// DESCRIPTION: Verilator: Verilog Test module
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2008 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
integer v;
reg i;
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
wire oa; // From a of a.v
wire oz; // From z of z.v
// End of automatics
a a (.*);
z z (.*);
always @ (posedge clk) begin
`ifdef TEST_VERBOSE
$write("[%0t] cyc==%0d i=%x oa=%x oz=%x\n",$time, cyc, i, oa, oz);
`endif
cyc <= cyc + 1;
i <= cyc[0];
if (cyc==0) begin
v = 3;
if (v !== 3) $stop;
if (assignin(v) !== 2) $stop;
if (v !== 3) $stop; // Make sure V didn't get changed
end
else if (cyc<10) begin
if (cyc==11 && oz!==1'b0) $stop;
if (cyc==12 && oz!==1'b1) $stop;
if (cyc==12 && oa!==1'b1) $stop;
end
else if (cyc<90) begin
end
else if (cyc==99) begin
$write("*-* All Finished *-*\n");
$finish;
end
end
function integer assignin(input integer i);
i = 2;
assignin = i;
endfunction
endmodule
module a (input i, output oa);
// verilator lint_off ASSIGNIN
assign i = 1'b1;
assign oa = i;
endmodule
module z (input i, output oz);
assign oz = i;
endmodule
+2 -2
View File
@@ -13,8 +13,8 @@ compile (
v_flags2 => ["--lint-only --Mdir obj_lint_only"],
fails=>1,
expect=>
'%Error: t/t_var_in_assign_bad.v:\d+: Assigning to input variable: value
%Error: t/t_var_in_assign_bad.v:\d+: Assigning to input variable: valueSub
'%Error-ASSIGNIN: t/t_var_in_assign_bad.v:\d+: Assigning to input variable: value
%Error-ASSIGNIN: t/t_var_in_assign_bad.v:\d+: Assigning to input variable: valueSub
%Error: Exiting due to.*',
);