Update preprocessor to match next Verilog-Perl version.
Fix preprocessor preservation of newlines across macro substitutions. Fix preprocessor stringification of nested macros. Fix preprocessor whitespace on define arguments
This commit is contained in:
parent
f3704f4c05
commit
1e938d0e90
4
Changes
4
Changes
|
|
@ -5,6 +5,10 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||||
|
|
||||||
* Verilator 3.8****
|
* Verilator 3.8****
|
||||||
|
|
||||||
|
*** Fix preprocessor preservation of newlines across macro substitutions.
|
||||||
|
|
||||||
|
**** Fix preprocessor stringification of nested macros.
|
||||||
|
|
||||||
**** Fix some constant parameter functions causing crash, bug253. [Nick Bowler]
|
**** Fix some constant parameter functions causing crash, bug253. [Nick Bowler]
|
||||||
|
|
||||||
**** Fix do {...} while() not requiring final semicolon.
|
**** Fix do {...} while() not requiring final semicolon.
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,11 @@ class V3PreProcImp;
|
||||||
#define VP_DEFARG 307
|
#define VP_DEFARG 307
|
||||||
#define VP_ERROR 308
|
#define VP_ERROR 308
|
||||||
#define VP_DEFFORM 309
|
#define VP_DEFFORM 309
|
||||||
|
#define VP_STRIFY 310
|
||||||
|
#define VP_BACKQUOTE 311
|
||||||
|
|
||||||
#define VP_PSL 350
|
#define VP_PSL 350
|
||||||
|
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// Externs created by flex
|
// Externs created by flex
|
||||||
// We add a prefix so that other lexers/flexers in the same program won't collide.
|
// We add a prefix so that other lexers/flexers in the same program won't collide.
|
||||||
|
|
@ -117,21 +118,39 @@ void yy_delete_buffer( YY_BUFFER_STATE b );
|
||||||
#define KEEPCMT_SUB 2
|
#define KEEPCMT_SUB 2
|
||||||
#define KEEPCMT_EXP 3
|
#define KEEPCMT_EXP 3
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
// Entry for each file processed; a stack of entries included
|
||||||
|
|
||||||
|
class VPreStream {
|
||||||
|
public:
|
||||||
|
FileLine* m_curFilelinep; // Current processing point (see also m_tokFilelinep)
|
||||||
|
deque<string> m_buffers; // Buffer of characters to process
|
||||||
|
int m_ignNewlines; // Ignore multiline newlines
|
||||||
|
bool m_eof; // "EOF" buffer
|
||||||
|
bool m_file; // Buffer is start of new file
|
||||||
|
int m_termState; // Termination fsm
|
||||||
|
VPreStream(FileLine* fl)
|
||||||
|
: m_curFilelinep(fl), m_ignNewlines(0),
|
||||||
|
m_eof(false), m_file(false), m_termState(0) {
|
||||||
|
}
|
||||||
|
~VPreStream() {}
|
||||||
|
};
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// Class entry for each per-lexer state
|
// Class entry for each per-lexer state
|
||||||
|
|
||||||
class V3PreLex {
|
class V3PreLex {
|
||||||
public: // Used only by V3PreLex.cpp and V3PreProc.cpp
|
public: // Used only by V3PreLex.cpp and V3PreProc.cpp
|
||||||
FileLine* m_curFilelinep; // Current processing point
|
V3PreProcImp* m_preimpp; // Preprocessor lexor belongs to
|
||||||
|
stack<VPreStream*> m_streampStack; // Stack of processing files
|
||||||
// Parse state
|
YY_BUFFER_STATE m_bufferState; // Flex state
|
||||||
stack<YY_BUFFER_STATE> m_bufferStack; // Stack of inserted text above current point
|
FileLine* m_tokFilelinep; // Starting position of current token
|
||||||
deque<string> m_buffers; // Buffer of characters to process
|
|
||||||
|
|
||||||
// State to lexer
|
// State to lexer
|
||||||
static V3PreLex* s_currentLexp; // Current lexing point
|
static V3PreLex* s_currentLexp; ///< Current lexing point
|
||||||
int m_keepComments; // Emit comments in output text
|
int m_keepComments; ///< Emit comments in output text
|
||||||
bool m_pedantic; // Obey standard; don't Substitute `error
|
int m_keepWhitespace; ///< Emit all whitespace in output text
|
||||||
|
bool m_pedantic; ///< Obey standard; don't Substitute `error
|
||||||
|
|
||||||
// State from lexer
|
// State from lexer
|
||||||
int m_formalLevel; // Parenthesis counting inside def formals
|
int m_formalLevel; // Parenthesis counting inside def formals
|
||||||
|
|
@ -143,42 +162,59 @@ class V3PreLex {
|
||||||
int m_enterExit; // For VL_LINE, the enter/exit level
|
int m_enterExit; // For VL_LINE, the enter/exit level
|
||||||
|
|
||||||
// CONSTRUCTORS
|
// CONSTRUCTORS
|
||||||
V3PreLex() {
|
V3PreLex(V3PreProcImp* preimpp, FileLine* filelinep) {
|
||||||
|
m_preimpp = preimpp;
|
||||||
m_keepComments = 0;
|
m_keepComments = 0;
|
||||||
|
m_keepWhitespace = 1;
|
||||||
m_pedantic = false;
|
m_pedantic = false;
|
||||||
m_formalLevel = 0;
|
m_formalLevel = 0;
|
||||||
m_parenLevel = 0;
|
m_parenLevel = 0;
|
||||||
m_defCmtSlash = false;
|
m_defCmtSlash = false;
|
||||||
|
m_tokFilelinep = filelinep;
|
||||||
m_enterExit = 0;
|
m_enterExit = 0;
|
||||||
m_pslParenLevel = 0;
|
m_pslParenLevel = 0;
|
||||||
m_pslMoreNeeded = false;
|
m_pslMoreNeeded = false;
|
||||||
initFirstBuffer();
|
initFirstBuffer(filelinep);
|
||||||
}
|
}
|
||||||
~V3PreLex() {
|
~V3PreLex() {
|
||||||
while (!m_bufferStack.empty()) { yy_delete_buffer(m_bufferStack.top()); m_bufferStack.pop(); }
|
while (!m_streampStack.empty()) { delete m_streampStack.top(); m_streampStack.pop(); }
|
||||||
|
yy_delete_buffer(m_bufferState); m_bufferState=NULL;
|
||||||
}
|
}
|
||||||
void initFirstBuffer();
|
|
||||||
|
|
||||||
// Called by V3PreLex.l from lexer
|
// Called by V3PreLex.l from lexer
|
||||||
FileLine* curFilelinep() { return m_curFilelinep; }
|
VPreStream* curStreamp() { return m_streampStack.top(); } // Can't be empty, "EOF" is on top
|
||||||
void curFilelinep(FileLine* fl) { m_curFilelinep = fl; }
|
FileLine* curFilelinep() { return curStreamp()->m_curFilelinep; }
|
||||||
void appendDefValue(const char* text, size_t len);
|
void curFilelinep(FileLine* fl) { curStreamp()->m_curFilelinep = fl; }
|
||||||
|
void appendDefValue(const char* textp, size_t len) { m_defValue.append(textp,len); }
|
||||||
void lineDirective(const char* textp);
|
void lineDirective(const char* textp);
|
||||||
void linenoInc() { curFilelinep()->linenoInc(); }
|
void linenoInc() { if (curStreamp()->m_ignNewlines) curStreamp()->m_ignNewlines--;
|
||||||
|
else curFilelinep()->linenoInc(); }
|
||||||
// Called by V3PreProc.cpp to inform lexer
|
// Called by V3PreProc.cpp to inform lexer
|
||||||
void pushStateDefArg(int level);
|
void pushStateDefArg(int level);
|
||||||
void pushStateDefForm();
|
void pushStateDefForm();
|
||||||
void pushStateDefValue();
|
void pushStateDefValue();
|
||||||
void pushStateIncFilename();
|
void pushStateIncFilename();
|
||||||
void scanBytes(const char* strp, size_t len);
|
void scanNewFile(FileLine* filelinep);
|
||||||
|
void scanBytes(const string& str);
|
||||||
void scanBytesBack(const string& str);
|
void scanBytesBack(const string& str);
|
||||||
size_t inputToLex(char* buf, size_t max_size);
|
size_t inputToLex(char* buf, size_t max_size);
|
||||||
/// Called by VPreproc.cpp to get data from lexer
|
/// Called by V3PreProc.cpp to get data from lexer
|
||||||
YY_BUFFER_STATE currentBuffer();
|
YY_BUFFER_STATE currentBuffer();
|
||||||
|
int lex();
|
||||||
int currentStartState();
|
int currentStartState();
|
||||||
string currentUnreadChars();
|
|
||||||
void dumpSummary();
|
void dumpSummary();
|
||||||
void dumpStack();
|
void dumpStack();
|
||||||
|
void unused();
|
||||||
|
/// Utility
|
||||||
|
static int debug();
|
||||||
|
static void debug(int level);
|
||||||
|
static string cleanDbgStrg(const string& in);
|
||||||
|
|
||||||
|
private:
|
||||||
|
string currentUnreadChars();
|
||||||
|
string endOfStream(bool& againr);
|
||||||
|
void initFirstBuffer(FileLine* filelinep);
|
||||||
|
void scanSwitchStream(VPreStream* streamp);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Guard
|
#endif // Guard
|
||||||
|
|
|
||||||
224
src/V3PreLex.l
224
src/V3PreLex.l
|
|
@ -78,8 +78,10 @@ ws [ \t\f\r]
|
||||||
wsn [ \t\f]
|
wsn [ \t\f]
|
||||||
crnl [\r]*[\n]
|
crnl [\r]*[\n]
|
||||||
quote [\"]
|
quote [\"]
|
||||||
|
tickquote [`][\"]
|
||||||
backslash [\\]
|
backslash [\\]
|
||||||
symb ([a-zA-Z_][a-zA-Z0-9_$]*|\\[^ \t\f\r\n]+)
|
symb ([a-zA-Z_][a-zA-Z0-9_$]*|\\[^ \t\f\r\n]+)
|
||||||
|
symbdef ([a-zA-Z_][a-zA-Z0-9_$]*|\\[^ \t\f\r\n`]+)
|
||||||
word [a-zA-Z0-9_]+
|
word [a-zA-Z0-9_]+
|
||||||
drop [\032]
|
drop [\032]
|
||||||
psl [p]sl
|
psl [p]sl
|
||||||
|
|
@ -124,6 +126,10 @@ psl [p]sl
|
||||||
if (LEXP->m_parenLevel || LEXP->m_formalLevel) { appendDefValue(yytext,yyleng); yyleng=0; }
|
if (LEXP->m_parenLevel || LEXP->m_formalLevel) { appendDefValue(yytext,yyleng); yyleng=0; }
|
||||||
else return (VP_STRING); }
|
else return (VP_STRING); }
|
||||||
|
|
||||||
|
/* Stringification */
|
||||||
|
<INITIAL>{tickquote} { return VP_STRIFY; }
|
||||||
|
<INITIAL>"`\\`\"" { return VP_BACKQUOTE; }
|
||||||
|
|
||||||
/* Protected blocks */
|
/* Protected blocks */
|
||||||
<INITIAL>"`protected" { yy_push_state(PRTMODE); yymore(); }
|
<INITIAL>"`protected" { yy_push_state(PRTMODE); yymore(); }
|
||||||
<PRTMODE><<EOF>> { linenoInc(); yyerrorf("EOF in `protected"); yyleng=0; yyterminate(); }
|
<PRTMODE><<EOF>> { linenoInc(); yyerrorf("EOF in `protected"); yyleng=0; yyterminate(); }
|
||||||
|
|
@ -153,8 +159,10 @@ psl [p]sl
|
||||||
<DEFFORM>{drop} { }
|
<DEFFORM>{drop} { }
|
||||||
<DEFFORM><<EOF>> { linenoInc(); yy_pop_state(); yyerrorf("Unterminated ( in define formal arguments."); yyleng=0; return VP_DEFFORM; }
|
<DEFFORM><<EOF>> { linenoInc(); yy_pop_state(); yyerrorf("Unterminated ( in define formal arguments."); yyleng=0; return VP_DEFFORM; }
|
||||||
<DEFFORM>{crnl} { linenoInc(); appendDefValue((char*)"\n",1); } /* Include return so can maintain output line count */
|
<DEFFORM>{crnl} { linenoInc(); appendDefValue((char*)"\n",1); } /* Include return so can maintain output line count */
|
||||||
<DEFFORM>[\\]{crnl} { linenoInc(); appendDefValue((char*)"\n",1); } /* Include return so can maintain output line count */
|
<DEFFORM>[\\]{crnl} { linenoInc(); appendDefValue((char*)"\\\n",2); } /* Include return so can maintain output line count */
|
||||||
<DEFFORM>{quote} { yy_push_state(STRMODE); yymore(); }
|
<DEFFORM>{quote} { yy_push_state(STRMODE); yymore(); } /* Legal only in default values */
|
||||||
|
<DEFFORM>"`\\`\"" { appendDefValue(yytext,yyleng); } /* Maybe illegal, otherwise in default value */
|
||||||
|
<DEFFORM>{tickquote} { appendDefValue(yytext,yyleng); } /* Maybe illegal, otherwise in default value */
|
||||||
<DEFFORM>[{\[] { LEXP->m_formalLevel++; appendDefValue(yytext,yyleng); }
|
<DEFFORM>[{\[] { LEXP->m_formalLevel++; appendDefValue(yytext,yyleng); }
|
||||||
<DEFFORM>[}\]] { LEXP->m_formalLevel--; appendDefValue(yytext,yyleng); }
|
<DEFFORM>[}\]] { LEXP->m_formalLevel--; appendDefValue(yytext,yyleng); }
|
||||||
<DEFFORM>[^\/\*\n\r\\(){}\[\]\"]+ |
|
<DEFFORM>[^\/\*\n\r\\(){}\[\]\"]+ |
|
||||||
|
|
@ -168,7 +176,7 @@ psl [p]sl
|
||||||
<DEFVAL>{drop} { }
|
<DEFVAL>{drop} { }
|
||||||
<DEFVAL><<EOF>> { linenoInc(); yy_pop_state(); yytext=(char*)"\n"; yyleng=1; return (VP_DEFVALUE); } /* Technically illegal, but people complained */
|
<DEFVAL><<EOF>> { linenoInc(); yy_pop_state(); yytext=(char*)"\n"; yyleng=1; return (VP_DEFVALUE); } /* Technically illegal, but people complained */
|
||||||
<DEFVAL>{crnl} { linenoInc(); yy_pop_state(); yytext=(char*)"\n"; yyleng=1; return (VP_DEFVALUE); }
|
<DEFVAL>{crnl} { linenoInc(); yy_pop_state(); yytext=(char*)"\n"; yyleng=1; return (VP_DEFVALUE); }
|
||||||
<DEFVAL>[\\]{crnl} { linenoInc(); appendDefValue((char*)"\n",1); } /* Return, but not \ is part of define value */
|
<DEFVAL>[\\]{crnl} { linenoInc(); appendDefValue((char*)"\\\n",2); } /* Return, AND \ is part of define value */
|
||||||
<DEFVAL>[^\/\*\n\r\\]+ |
|
<DEFVAL>[^\/\*\n\r\\]+ |
|
||||||
<DEFVAL>[\\][^\n\r] |
|
<DEFVAL>[\\][^\n\r] |
|
||||||
<DEFVAL>. { appendDefValue(yytext,yyleng); }
|
<DEFVAL>. { appendDefValue(yytext,yyleng); }
|
||||||
|
|
@ -185,13 +193,15 @@ psl [p]sl
|
||||||
<DEFCMT>. { yymore(); }
|
<DEFCMT>. { yymore(); }
|
||||||
<DEFCMT><<EOF>> { yyerrorf("EOF in '/* ... */' block comment\n"); yyleng=0; yyterminate(); }
|
<DEFCMT><<EOF>> { yyerrorf("EOF in '/* ... */' block comment\n"); yyleng=0; yyterminate(); }
|
||||||
|
|
||||||
/* Define arguments */
|
/* Define arguments (use of a define) */
|
||||||
<ARGMODE>"/*" { yy_push_state(CMTMODE); yymore(); }
|
<ARGMODE>"/*" { yy_push_state(CMTMODE); yymore(); }
|
||||||
<ARGMODE>"//"[^\n\r]* { return (VP_COMMENT);}
|
<ARGMODE>"//"[^\n\r]* { return (VP_COMMENT);}
|
||||||
<ARGMODE>{drop} { }
|
<ARGMODE>{drop} { }
|
||||||
<ARGMODE><<EOF>> { yyerrorf("EOF in define argument list\n"); yyleng = 0; yyterminate(); }
|
<ARGMODE><<EOF>> { yyerrorf("EOF in define argument list\n"); yyleng = 0; yyterminate(); }
|
||||||
<ARGMODE>{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return(VP_WHITE); }
|
<ARGMODE>{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return(VP_WHITE); }
|
||||||
<ARGMODE>{quote} { yy_push_state(STRMODE); yymore(); }
|
<ARGMODE>{quote} { yy_push_state(STRMODE); yymore(); }
|
||||||
|
<ARGMODE>"`\\`\"" { appendDefValue(yytext,yyleng); } /* Literal text */
|
||||||
|
<ARGMODE>{tickquote} { return(VP_STRIFY); }
|
||||||
<ARGMODE>[{\[] { LEXP->m_parenLevel++; appendDefValue(yytext,yyleng); }
|
<ARGMODE>[{\[] { LEXP->m_parenLevel++; appendDefValue(yytext,yyleng); }
|
||||||
<ARGMODE>[}\]] { LEXP->m_parenLevel--; appendDefValue(yytext,yyleng); }
|
<ARGMODE>[}\]] { LEXP->m_parenLevel--; appendDefValue(yytext,yyleng); }
|
||||||
<ARGMODE>[(] { LEXP->m_parenLevel++;
|
<ARGMODE>[(] { LEXP->m_parenLevel++;
|
||||||
|
|
@ -214,7 +224,7 @@ psl [p]sl
|
||||||
} else {
|
} else {
|
||||||
yy_pop_state(); return (VP_DEFARG);
|
yy_pop_state(); return (VP_DEFARG);
|
||||||
}}
|
}}
|
||||||
<ARGMODE>"`"{symb} { return (VP_DEFREF); } /* defref in defref */
|
<ARGMODE>"`"{symbdef} { appendDefValue(yytext,yyleng); } /* defref in defref - outer macro expands first */
|
||||||
<ARGMODE>[^\/\*\n\r\\(,){}\[\]\"`]+ |
|
<ARGMODE>[^\/\*\n\r\\(,){}\[\]\"`]+ |
|
||||||
<ARGMODE>. { appendDefValue(yytext,yyleng); }
|
<ARGMODE>. { appendDefValue(yytext,yyleng); }
|
||||||
|
|
||||||
|
|
@ -257,7 +267,8 @@ psl [p]sl
|
||||||
<PSLMULM>"//"[^\n\r]* { return (VP_COMMENT); } /* Comments inside block comments get literal inclusion (later removal) */
|
<PSLMULM>"//"[^\n\r]* { return (VP_COMMENT); } /* Comments inside block comments get literal inclusion (later removal) */
|
||||||
|
|
||||||
/* Define calls */
|
/* Define calls */
|
||||||
<INITIAL,PSLMULM,PSLONEM>"`"{symb} { return (VP_DEFREF); }
|
/* symbdef prevents normal lex rules from makeing `\`"foo a symbol {`"foo} instead of a BACKQUOTE */
|
||||||
|
<INITIAL,PSLMULM,PSLONEM>"`"{symbdef} { return (VP_DEFREF); }
|
||||||
|
|
||||||
/* Generics */
|
/* Generics */
|
||||||
<INITIAL,PSLMULM>{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return(VP_WHITE); }
|
<INITIAL,PSLMULM>{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return(VP_WHITE); }
|
||||||
|
|
@ -296,59 +307,177 @@ void V3PreLex::pushStateIncFilename() {
|
||||||
yymore();
|
yymore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3PreLex::initFirstBuffer() {
|
void V3PreLex::debug(int level) { yy_flex_debug=level; }
|
||||||
// Called from constructor to make first buffer
|
int V3PreLex::debug() { return yy_flex_debug; }
|
||||||
// yy_create_buffer also sets yy_fill_buffer=1 so reads from YY_INPUT
|
|
||||||
yy_switch_to_buffer(yy_create_buffer(NULL, YY_BUF_SIZE));
|
int V3PreLex::lex() {
|
||||||
m_bufferStack.push(currentBuffer());
|
V3PreLex::s_currentLexp = this; // Tell parser where to get/put data
|
||||||
yyrestart(NULL);
|
m_tokFilelinep = curFilelinep(); // Remember token start location, may be updated by the lexer later
|
||||||
|
return yylex();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t V3PreLex::inputToLex(char* buf, size_t max_size) {
|
size_t V3PreLex::inputToLex(char* buf, size_t max_size) {
|
||||||
// We need a custom YY_INPUT because we can't use flex buffers.
|
// We need a custom YY_INPUT because we can't use flex buffers.
|
||||||
// Flex buffers are limited to 2GB, and we can't chop into 2G pieces
|
// Flex buffers are limited to 2GB, and we can't chop into 2G pieces
|
||||||
// because buffers can't end in the middle of tokens.
|
// because buffers can't end in the middle of tokens.
|
||||||
// m_buffers only applies to the "base" buffer when there's no scanBytes outstanding
|
// Note if we switched streams here (which we don't) "buf" would be
|
||||||
// It won't be called on scan_buffers as they don't have yy_fill_buffer set.
|
// become a stale invalid pointer.
|
||||||
//
|
//
|
||||||
//if (debug()) { cout<<"- pp:inputToLex ITL s="<<max_size<<" bs="<<m_bufferStack.size()<<endl; dumpSummary(); }
|
VPreStream* streamp = curStreamp();
|
||||||
|
if (debug()>=10) { cout<<"- pp:inputToLex ITL s="<<max_size<<" bs="<<streamp->m_buffers.size()<<endl; dumpStack(); }
|
||||||
// For testing, use really small chunks
|
// For testing, use really small chunks
|
||||||
//if (max_size > 13) max_size=13;
|
//if (max_size > 13) max_size=13;
|
||||||
|
again:
|
||||||
size_t got = 0;
|
size_t got = 0;
|
||||||
|
// Get from this stream
|
||||||
while (got < max_size // Haven't got enough
|
while (got < max_size // Haven't got enough
|
||||||
&& !m_buffers.empty()) { // And something buffered
|
&& !streamp->m_buffers.empty()) { // And something buffered
|
||||||
string front = m_buffers.front(); m_buffers.pop_front();
|
string front = curStreamp()->m_buffers.front(); streamp->m_buffers.pop_front();
|
||||||
size_t len = front.length();
|
size_t len = front.length();
|
||||||
if (len > (max_size-got)) { // Front string too big
|
if (len > (max_size-got)) { // Front string too big
|
||||||
string remainder = front.substr(max_size-got);
|
|
||||||
front = front.substr(0, max_size-got);
|
|
||||||
m_buffers.push_front(remainder); // Put back remainder for next time
|
|
||||||
len = (max_size-got);
|
len = (max_size-got);
|
||||||
|
string remainder = front.substr(len);
|
||||||
|
front = front.substr(0, len);
|
||||||
|
streamp->m_buffers.push_front(remainder); // Put back remainder for next time
|
||||||
}
|
}
|
||||||
strncpy(buf+got, front.c_str(), len);
|
strncpy(buf+got, front.c_str(), len);
|
||||||
got += len;
|
got += len;
|
||||||
}
|
}
|
||||||
//if (debug()) { cout<<"- pp::inputToLex got="<<got<<" '"<<string(buf,got)<<"'"<<endl; }
|
if (!got) { // end of stream; try "above" file
|
||||||
|
bool again=false;
|
||||||
|
string forceOut = endOfStream(again/*ref*/);
|
||||||
|
streamp = curStreamp(); // May have been updated
|
||||||
|
if (forceOut != "") {
|
||||||
|
if (forceOut.length() > max_size) {
|
||||||
|
yyerrorf("Output buffer too small for a `line");
|
||||||
|
} else {
|
||||||
|
got = forceOut.length();
|
||||||
|
strncpy(buf, forceOut.c_str(), got);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (streamp->m_eof) {
|
||||||
|
if (yy_flex_debug) cout<<"- EOF\n";
|
||||||
|
}
|
||||||
|
got = 0; // 0=EOF/EOS - although got was already 0.
|
||||||
|
if (again) goto again;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (debug()>=10) { cout<<"- pp::inputToLex got="<<got<<" '"<<string(buf,got)<<"'"<<endl; }
|
||||||
return got;
|
return got;
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3PreLex::scanBytes(const char* strp, size_t len) {
|
string V3PreLex::endOfStream(bool& againr) {
|
||||||
|
// Switch to file or next unputString
|
||||||
|
againr = false;
|
||||||
|
if (yy_flex_debug) cout<<"-EOS state="<<curStreamp()->m_termState<<" at "<<curFilelinep()<<endl;
|
||||||
|
if (curStreamp()->m_eof) return ""; // Don't delete the final "EOF" stream
|
||||||
|
bool exited_file = curStreamp()->m_file;
|
||||||
|
if (!exited_file) {
|
||||||
|
// Midpoint of stream, just change buffers
|
||||||
|
delete curStreamp();
|
||||||
|
m_streampStack.pop(); // Must work as size>1; EOF is entry 0
|
||||||
|
againr = true;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
// Multiple steps because we need FLEX to see ending \n and EOS to end
|
||||||
|
// any illegal states, like an unterminated `protected region
|
||||||
|
else if (!curStreamp()->m_termState) {
|
||||||
|
// First shutdown phase for a file
|
||||||
|
// Terminate all files with a newline. This prevents problems if
|
||||||
|
// the user had a define without a terminating newline,
|
||||||
|
// otherwise the resumed file's next line would get tacked on.
|
||||||
|
// Also makes it likely the `line that changes files comes out
|
||||||
|
// immediately.
|
||||||
|
curStreamp()->m_termState = 1;
|
||||||
|
return "\n"; // Exit old file
|
||||||
|
}
|
||||||
|
else if (curStreamp()->m_termState == 1) {
|
||||||
|
// Now the EOF - can't be sent with other characters
|
||||||
|
curStreamp()->m_termState = 2;
|
||||||
|
return ""; // End of file
|
||||||
|
}
|
||||||
|
else if (curStreamp()->m_termState == 2) {
|
||||||
|
// Now ending `line
|
||||||
|
curStreamp()->m_termState = 3;
|
||||||
|
return curFilelinep()->lineDirectiveStrg(2); // Exit old file
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Final shutdown phase for a stream, we can finally change the
|
||||||
|
// current fileline to the new stream
|
||||||
|
curStreamp()->m_termState = 0;
|
||||||
|
FileLine* filelinep = curFilelinep();
|
||||||
|
delete curStreamp();
|
||||||
|
m_streampStack.pop(); // Must work as size>1; EOF is entry 0
|
||||||
|
if (curStreamp()->m_eof) {
|
||||||
|
// EOF doesn't have a "real" fileline, but a linenumber of 0 from init time
|
||||||
|
// Inherit whatever we last parsed so it's more obvious.
|
||||||
|
curFilelinep(filelinep);
|
||||||
|
}
|
||||||
|
// The caller parser remembered the start location for the text we are parsing,
|
||||||
|
// but we've discovered there was a file switch along the way, so update it.
|
||||||
|
m_tokFilelinep = curFilelinep();
|
||||||
|
//
|
||||||
|
if (curStreamp()->m_eof) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return curFilelinep()->lineDirectiveStrg(0); // Reenter resumed file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void V3PreLex::initFirstBuffer(FileLine* filelinep) {
|
||||||
|
// Called from constructor to make first buffer
|
||||||
|
// yy_create_buffer also sets yy_fill_buffer=1 so reads from YY_INPUT
|
||||||
|
VPreStream* streamp = new VPreStream(filelinep);
|
||||||
|
streamp->m_eof = true;
|
||||||
|
m_streampStack.push(streamp);
|
||||||
|
//
|
||||||
|
m_bufferState = yy_create_buffer(NULL, YY_BUF_SIZE);
|
||||||
|
yy_switch_to_buffer(m_bufferState);
|
||||||
|
yyrestart(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void V3PreLex::scanNewFile(FileLine* filelinep) {
|
||||||
|
// Called on new open file. scanBytesBack will be called next.
|
||||||
|
VPreStream* streamp = new VPreStream(filelinep);
|
||||||
|
m_tokFilelinep = curFilelinep();
|
||||||
|
streamp->m_file = true;
|
||||||
|
scanSwitchStream(streamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void V3PreLex::scanBytes(const string& str) {
|
||||||
// Note buffers also appended in ::scanBytesBack
|
// Note buffers also appended in ::scanBytesBack
|
||||||
// Not "m_buffers.push_front(string(strp,len))" as we need a `define
|
// Not "m_buffers.push_front(string(strp,len))" as we need a `define
|
||||||
// to take effect immediately, in the middle of the current buffer
|
// to take effect immediately, in the middle of the current buffer
|
||||||
yy_scan_bytes(strp, len);
|
// Also we don't use scan_bytes that would set yy_fill_buffer
|
||||||
m_bufferStack.push(currentBuffer()); // yy_scan_bytes makes new buffer
|
// which would force Flex to bypass our YY_INPUT routine.
|
||||||
|
VPreStream* streamp = new VPreStream(curFilelinep());
|
||||||
|
streamp->m_buffers.push_front(str);
|
||||||
|
scanSwitchStream(streamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void V3PreLex::scanSwitchStream(VPreStream* streamp) {
|
||||||
|
curStreamp()->m_buffers.push_front(currentUnreadChars());
|
||||||
|
m_streampStack.push(streamp);
|
||||||
|
yyrestart(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3PreLex::scanBytesBack(const string& str) {
|
void V3PreLex::scanBytesBack(const string& str) {
|
||||||
// Initial creation, that will pull from YY_INPUT==inputToLex
|
// Initial creation, that will pull from YY_INPUT==inputToLex
|
||||||
// Note buffers also appended in ::scanBytes
|
// Note buffers also appended in ::scanBytes
|
||||||
m_buffers.push_back(str);
|
if (curStreamp()->m_eof) yyerrorf("scanBytesBack without being under scanNewFile");
|
||||||
|
curStreamp()->m_buffers.push_back(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3PreLex::appendDefValue(const char* textp, size_t len) {
|
string V3PreLex::currentUnreadChars() {
|
||||||
// Append given text to current definition value being formed
|
// WARNING - Peeking at internals
|
||||||
m_defValue.append(textp,len);
|
ssize_t left = (yy_n_chars - (yy_c_buf_p -currentBuffer()->yy_ch_buf));
|
||||||
|
if (left > 0) { // left may be -1 at EOS
|
||||||
|
*(yy_c_buf_p) = (yy_hold_char);
|
||||||
|
return string(yy_c_buf_p, left);
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
YY_BUFFER_STATE V3PreLex::currentBuffer() {
|
YY_BUFFER_STATE V3PreLex::currentBuffer() {
|
||||||
|
|
@ -366,21 +495,46 @@ void V3PreLex::lineDirective(const char* textp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3PreLex::dumpSummary() {
|
void V3PreLex::dumpSummary() {
|
||||||
cout<<"- pp::dumpSummary curBuf="<<(void*)(currentBuffer())
|
cout<<"- pp::dumpSummary curBuf="<<(void*)(currentBuffer());
|
||||||
<<" nBuf="<<m_bufferStack.size()
|
#ifdef FLEX_DEBUG // Else peeking at internals may cause portability issues
|
||||||
<<" yyfill="<<currentBuffer()->yy_fill_buffer<<endl;
|
ssize_t left = (yy_n_chars
|
||||||
|
- (yy_c_buf_p
|
||||||
|
-currentBuffer()->yy_ch_buf));
|
||||||
|
cout<<" left="<<dec<<left;
|
||||||
|
#endif
|
||||||
|
cout<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3PreLex::dumpStack() {
|
void V3PreLex::dumpStack() {
|
||||||
// For debug use
|
// For debug use
|
||||||
dumpSummary();
|
dumpSummary();
|
||||||
stack<YY_BUFFER_STATE> tmpstack = m_bufferStack;
|
stack<VPreStream*> tmpstack = LEXP->m_streampStack;
|
||||||
printf(" bufferStack[%p]:",this);
|
|
||||||
while (!tmpstack.empty()) {
|
while (!tmpstack.empty()) {
|
||||||
printf(" %p",tmpstack.top());
|
VPreStream* streamp = tmpstack.top();
|
||||||
|
cout<<"- bufferStack["<<(void*)(streamp)<<"]: "
|
||||||
|
<<" at="<<streamp->m_curFilelinep
|
||||||
|
<<" nBuf="<<streamp->m_buffers.size()
|
||||||
|
<<" size0="<<(streamp->m_buffers.empty() ? 0 : streamp->m_buffers.front().length())
|
||||||
|
<<(streamp->m_eof?" [EOF]":"")
|
||||||
|
<<(streamp->m_file?" [FILE]":"");
|
||||||
|
cout<<endl;
|
||||||
tmpstack.pop();
|
tmpstack.pop();
|
||||||
}
|
}
|
||||||
printf("\n");
|
}
|
||||||
|
|
||||||
|
string V3PreLex::cleanDbgStrg(const string& in) {
|
||||||
|
string out = in;
|
||||||
|
string::size_type pos;
|
||||||
|
while ((pos=out.find("\n")) != string::npos) { out.replace(pos, 1, "\\n"); }
|
||||||
|
while ((pos=out.find("\r")) != string::npos) { out.replace(pos, 1, "\\r"); }
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
void V3PreLex::unused() {
|
||||||
|
if (0) {
|
||||||
|
// Prevent unused warnings
|
||||||
|
yy_top_state();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*###################################################################
|
/*###################################################################
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -32,6 +32,9 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
// Compatibility with Verilog-Perl's preprocessor
|
||||||
|
#define fatalSrc(msg) v3fatalSrc(msg)
|
||||||
|
|
||||||
class V3InFilter;
|
class V3InFilter;
|
||||||
|
|
||||||
class V3PreProc {
|
class V3PreProc {
|
||||||
|
|
@ -40,14 +43,14 @@ class V3PreProc {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// STATE
|
// STATE
|
||||||
FileLine* m_fileline; // Last token's starting point
|
|
||||||
int m_debug; // Debugging
|
int m_debug; // Debugging
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// CONSTANTS
|
// CONSTANTS
|
||||||
enum MiscConsts {
|
enum MiscConsts {
|
||||||
DEFINE_RECURSION_LEVEL_MAX = 50, // How many `def substitutions before an error
|
DEFINE_RECURSION_LEVEL_MAX = 50, // How many `def substitutions before an error
|
||||||
INCLUDE_DEPTH_MAX = 500 // How many `includes deep before an error
|
INCLUDE_DEPTH_MAX = 500, // How many `includes deep before an error
|
||||||
|
NEWLINES_VS_TICKLINE = 20 // Use `line in place of this many newlines
|
||||||
};
|
};
|
||||||
|
|
||||||
// ACCESSORS
|
// ACCESSORS
|
||||||
|
|
@ -60,11 +63,12 @@ public:
|
||||||
int debug() const { return m_debug; }
|
int debug() const { return m_debug; }
|
||||||
void debug(int level) { m_debug = level; }
|
void debug(int level) { m_debug = level; }
|
||||||
|
|
||||||
FileLine* fileline() { return m_fileline; } // File/Line number for last getline call
|
FileLine* fileline(); ///< File/Line number for last getline call
|
||||||
|
|
||||||
// CONTROL METHODS
|
// CONTROL METHODS
|
||||||
// These options control how the parsing proceeds
|
// These options control how the parsing proceeds
|
||||||
int keepComments() { return 2; } // Return comments, 0=no, 1=yes, 2=callback
|
int keepComments() { return 2; } // Return comments, 0=no, 1=yes, 2=callback
|
||||||
|
bool keepWhitespace() { return false; }
|
||||||
bool lineDirectives() { return true; } // Insert `line directives
|
bool lineDirectives() { return true; } // Insert `line directives
|
||||||
bool pedantic() { return false; } // Obey standard; Don't substitute `error
|
bool pedantic() { return false; } // Obey standard; Don't substitute `error
|
||||||
static bool optPsl();
|
static bool optPsl();
|
||||||
|
|
@ -83,12 +87,16 @@ public:
|
||||||
}
|
}
|
||||||
virtual string removeDefines(const string& text)=0; // Remove defines in a text string
|
virtual string removeDefines(const string& text)=0; // Remove defines in a text string
|
||||||
|
|
||||||
|
// UTILITIES
|
||||||
|
void error(string msg) { fileline()->v3error(msg); } ///< Report a error
|
||||||
|
void fatal(string msg) { fileline()->v3fatalSrc(msg); } ///< Report a fatal error
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// CONSTUCTORS
|
// CONSTUCTORS
|
||||||
V3PreProc(FileLine* fl) {
|
V3PreProc() {
|
||||||
m_fileline=fl;
|
|
||||||
m_debug=0;
|
m_debug=0;
|
||||||
};
|
};
|
||||||
|
void configure(FileLine* fl);
|
||||||
public:
|
public:
|
||||||
static V3PreProc* createPreProc(FileLine* fileline);
|
static V3PreProc* createPreProc(FileLine* fileline);
|
||||||
virtual ~V3PreProc() {}
|
virtual ~V3PreProc() {}
|
||||||
|
|
|
||||||
|
|
@ -8,45 +8,56 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 10 "t/t_pipe_filter.v" 0
|
||||||
example line 10;
|
example line 10;
|
||||||
example line 11;
|
example line 11;
|
||||||
|
|
||||||
|
`line 13 "t/t_pipe_filter.v" 0
|
||||||
|
|
||||||
`line 13 "t/t_pipe_filter.v" 0
|
`line 13 "t/t_pipe_filter.v" 0
|
||||||
`line 1 "t/t_pipe_filter_inc.vh" 1
|
`line 1 "t/t_pipe_filter_inc.vh" 1
|
||||||
int lint_off_line_7 = 1;
|
int lint_off_line_7 = 1;
|
||||||
|
`line 2 "t/t_pipe_filter.v" 0
|
||||||
int lint_off_line_8 = 1;
|
int lint_off_line_8 = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 8 "t/t_pipe_filter.v" 0
|
||||||
inc line 6;
|
inc line 6;
|
||||||
inc line 7;
|
inc line 7;
|
||||||
inc line 8;
|
inc line 8;
|
||||||
inc line 9;
|
inc line 9;
|
||||||
`line 12 "t/t_pipe_filter_inc.vh" 2
|
|
||||||
|
`line 13 "t/t_pipe_filter_inc.vh" 2
|
||||||
`line 13 "t/t_pipe_filter.v" 0
|
`line 13 "t/t_pipe_filter.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 15 "t/t_pipe_filter.v" 0
|
||||||
|
|
||||||
`line 15 "t/t_pipe_filter.v" 0
|
`line 15 "t/t_pipe_filter.v" 0
|
||||||
`line 1 "t/t_pipe_filter_inc.vh" 1
|
`line 1 "t/t_pipe_filter_inc.vh" 1
|
||||||
int lint_off_line_7 = 1;
|
int lint_off_line_7 = 1;
|
||||||
|
`line 2 "t/t_pipe_filter.v" 0
|
||||||
int lint_off_line_8 = 1;
|
int lint_off_line_8 = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 8 "t/t_pipe_filter.v" 0
|
||||||
inc line 6;
|
inc line 6;
|
||||||
inc line 7;
|
inc line 7;
|
||||||
inc line 8;
|
inc line 8;
|
||||||
inc line 9;
|
inc line 9;
|
||||||
`line 12 "t/t_pipe_filter_inc.vh" 2
|
|
||||||
|
`line 13 "t/t_pipe_filter_inc.vh" 2
|
||||||
`line 15 "t/t_pipe_filter.v" 0
|
`line 15 "t/t_pipe_filter.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 17 "t/t_pipe_filter.v" 0
|
||||||
example line 15;
|
example line 15;
|
||||||
example line 16;
|
example line 16;
|
||||||
`line 19 "t/t_pipe_filter.v" 2
|
|
||||||
|
`line 20 "t/t_pipe_filter.v" 2
|
||||||
|
|
|
||||||
|
|
@ -13,21 +13,23 @@ compile (
|
||||||
execute (
|
execute (
|
||||||
check_finished=>1,
|
check_finished=>1,
|
||||||
expect=>quotemeta(
|
expect=>quotemeta(
|
||||||
'pre thrupre thrumid thrupost post: "right side"
|
qq{pre thrupre thrumid thrupost post: "right side"
|
||||||
left side: "right side"
|
left side: "right side"
|
||||||
left side : "right side "
|
left side: "right side"
|
||||||
left_side : "right_side "
|
left_side: "right_side"
|
||||||
na : "right_side "
|
na: "right_side"
|
||||||
prep ( midp1 left_side midp2 ( outp ) ) : "right_side "
|
prep ( midp1 left_side midp2 ( outp ) ): "right_side"
|
||||||
na: "nana"
|
na: "nana"
|
||||||
`ls `rs : "`ls `rs "
|
left_side right_side: "left_side right_side"
|
||||||
|
left side: "right side"
|
||||||
: ""
|
: ""
|
||||||
left side: "right side"
|
left side: "right side"
|
||||||
left side : "right side "
|
left side: "right side"
|
||||||
|
standalone
|
||||||
twoline: "first second"
|
twoline: "first second"
|
||||||
Line 38 File "t/t_pp_display.v"
|
Line 49 File "t/t_pp_display.v"
|
||||||
*-* All Finished *-*
|
*-* All Finished *-*
|
||||||
'));
|
}));
|
||||||
|
|
||||||
ok(1);
|
ok(1);
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ module t;
|
||||||
`define thru(x) x
|
`define thru(x) x
|
||||||
`define thruthru `ls `rs // Doesn't expand
|
`define thruthru `ls `rs // Doesn't expand
|
||||||
`define msg(x,y) `"x: `\`"y`\`"`"
|
`define msg(x,y) `"x: `\`"y`\`"`"
|
||||||
|
`define left(m,left) m // The 'left' as the variable name shouldn't match the "left" in the `" string
|
||||||
initial begin
|
initial begin
|
||||||
//$display(`msg( \`, \`)); // Illegal
|
//$display(`msg( \`, \`)); // Illegal
|
||||||
$display(`msg(pre `thru(thrupre `thru(thrumid) thrupost) post,right side));
|
$display(`msg(pre `thru(thrupre `thru(thrumid) thrupost) post,right side));
|
||||||
|
|
@ -27,13 +28,23 @@ module t;
|
||||||
$display(`msg( prep ( midp1 `ls midp2 ( outp ) ) , `rs ));
|
$display(`msg( prep ( midp1 `ls midp2 ( outp ) ) , `rs ));
|
||||||
$display(`msg(`noarg,`noarg`noarg));
|
$display(`msg(`noarg,`noarg`noarg));
|
||||||
$display(`msg( `thruthru , `thruthru )); // Results vary between simulators
|
$display(`msg( `thruthru , `thruthru )); // Results vary between simulators
|
||||||
|
$display(`left(`msg( left side , right side ), left_replaced));
|
||||||
|
//$display(`msg( `"tickquoted_left`", `"tickquoted_right`" )); // Syntax error
|
||||||
|
`ifndef VCS // Sim bug - wrong number of arguments, but we're right
|
||||||
$display(`msg(`thru(),)); // Empty
|
$display(`msg(`thru(),)); // Empty
|
||||||
|
`endif
|
||||||
$display(`msg(`thru(left side),`thru(right side)));
|
$display(`msg(`thru(left side),`thru(right side)));
|
||||||
$display(`msg( `thru( left side ) , `thru( right side ) ));
|
$display(`msg( `thru( left side ) , `thru( right side ) ));
|
||||||
|
`ifndef NC
|
||||||
|
$display(`"standalone`");
|
||||||
|
`endif
|
||||||
|
|
||||||
|
`ifdef VERILATOR
|
||||||
|
// Illegal on some simulators, as the "..." crosses two lines
|
||||||
`define twoline first \
|
`define twoline first \
|
||||||
second
|
second
|
||||||
$display(`msg(twoline, `twoline));
|
$display(`msg(twoline, `twoline));
|
||||||
|
`endif
|
||||||
|
|
||||||
$display("Line %0d File \"%s\"",`__LINE__,`__FILE__);
|
$display("Line %0d File \"%s\"",`__LINE__,`__FILE__);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,15 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 7 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 7 "t/t_preproc.v" 0
|
||||||
|
|
||||||
`line 9 "t/t_preproc.v" 0
|
|
||||||
`line 1 "t/t_preproc_inc2.vh" 1
|
`line 1 "t/t_preproc_inc2.vh" 1
|
||||||
|
|
||||||
|
`line 3 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 4 "t/t_preproc.v" 0
|
||||||
At file "t/t_preproc_inc2.vh" line 4
|
At file "t/t_preproc_inc2.vh" line 4
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -23,198 +24,248 @@ At file "t/t_preproc_inc2.vh" line 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 6 "inc3_a_filename_from_line_directive" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
At file "inc3_a_filename_from_line_directive" line 10
|
At file "inc3_a_filename_from_line_directive" line 10
|
||||||
|
|
||||||
|
`line 12 "inc3_a_filename_from_line_directive" 0
|
||||||
|
|
||||||
|
|
||||||
`line 13 "inc3_a_filename_from_line_directive" 0
|
|
||||||
|
`line 15 "inc3_a_filename_from_line_directive" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 19 "inc3_a_filename_from_line_directive" 2
|
||||||
`line 17 "inc3_a_filename_from_line_directive" 0
|
|
||||||
|
|
||||||
`line 18 "inc3_a_filename_from_line_directive" 2
|
|
||||||
`line 6 "t/t_preproc_inc2.vh" 0
|
`line 6 "t/t_preproc_inc2.vh" 0
|
||||||
|
|
||||||
`line 7 "t/t_preproc_inc2.vh" 2
|
|
||||||
`line 9 "t/t_preproc.v" 0
|
`line 8 "t/t_preproc_inc2.vh" 2
|
||||||
|
`line 7 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 12 "t/t_preproc.v" 0
|
||||||
/*verilator pass_thru comment*/
|
/*verilator pass_thru comment*/
|
||||||
|
|
||||||
|
`line 14 "t/t_preproc.v" 0
|
||||||
/*verilator pass_thru_comment2*/
|
/*verilator pass_thru_comment2*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 19 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 22 "t/t_preproc.v" 0
|
||||||
wire [3:0] q = {
|
wire [3:0] q = {
|
||||||
1'b1
|
1'b1 ,
|
||||||
`line 25 "t/t_preproc.v" 0
|
|
||||||
,
|
|
||||||
|
|
||||||
`line 26 "t/t_preproc.v" 0
|
|
||||||
1'b0 ,
|
1'b0 ,
|
||||||
|
1'b1 ,
|
||||||
1'b1
|
1'b1
|
||||||
`line 27 "t/t_preproc.v" 0
|
|
||||||
,
|
|
||||||
1'b1
|
|
||||||
`line 28 "t/t_preproc.v" 0
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
`line 29 "t/t_preproc.v" 0
|
||||||
text.
|
text.
|
||||||
|
|
||||||
|
`line 31 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
foo bar
|
foo bar
|
||||||
foobar2
|
foobar2
|
||||||
|
|
||||||
|
`line 36 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 40 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 46 "t/t_preproc.v" 0
|
||||||
|
first part
|
||||||
|
`line 46 "t/t_preproc.v" 0
|
||||||
|
second part
|
||||||
|
`line 46 "t/t_preproc.v" 0
|
||||||
|
third part
|
||||||
|
{
|
||||||
|
`line 47 "t/t_preproc.v" 0
|
||||||
|
a,
|
||||||
|
`line 47 "t/t_preproc.v" 0
|
||||||
|
b,
|
||||||
|
`line 47 "t/t_preproc.v" 0
|
||||||
|
c}
|
||||||
|
Line_Preproc_Check 48
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 52 "t/t_preproc.v" 0
|
||||||
first part second part third part
|
|
||||||
Line_Preproc_Check 49
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 54 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
deep deep
|
deep deep
|
||||||
|
|
||||||
|
`line 58 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
"Inside: `nosubst"
|
"Inside: `nosubst"
|
||||||
"`nosubst"
|
"`nosubst"
|
||||||
|
|
||||||
|
`line 63 "t/t_preproc.v" 0
|
||||||
|
|
||||||
x y LLZZ x y
|
x y LLZZ x y
|
||||||
p q LLZZ p q r s LLZZ r s LLZZ p q LLZZ p q r s LLZZ r s
|
p q LLZZ p q r s LLZZ r s LLZZ p q LLZZ p q r s LLZZ r s
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 69 "t/t_preproc.v" 0
|
||||||
firstline comma","line LLZZ firstline comma","line
|
firstline comma","line LLZZ firstline comma","line
|
||||||
|
|
||||||
|
`line 71 "t/t_preproc.v" 0
|
||||||
|
|
||||||
x y LLZZ "a" y
|
x y LLZZ "a" y
|
||||||
|
|
||||||
|
`line 74 "t/t_preproc.v" 0
|
||||||
|
|
||||||
(a,b)(a,b)
|
(a,b)(a,b)
|
||||||
|
|
||||||
|
`line 77 "t/t_preproc.v" 0
|
||||||
|
|
||||||
$display("left side: \"right side\"")
|
$display("left side: \"right side\"")
|
||||||
|
|
||||||
|
`line 80 "t/t_preproc.v" 0
|
||||||
|
|
||||||
bar_suffix more
|
bar_suffix more
|
||||||
|
|
||||||
|
`line 83 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
$c("Zap(\"",bug1,"\");");;
|
|
||||||
$c("Zap(\"","bug2","\");");;
|
|
||||||
|
|
||||||
|
`line 85 "t/t_preproc.v" 0
|
||||||
|
$c("Zap(\"",bug1,"\");");;
|
||||||
|
|
||||||
|
`line 86 "t/t_preproc.v" 0
|
||||||
|
$c("Zap(\"","bug2","\");");;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wire tmp_d1 = d1; wire tmp_o1 = tmp_d1 + 1; assign o1 = tmp_o1 ;
|
|
||||||
wire tmp_d2 = d2 ; wire tmp_o2 = tmp_d2 + 1; assign o2 = tmp_o2 ;
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 94 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
|
||||||
|
$display("pre thrupre thrumid thrupost post: \"right side\"");
|
||||||
|
$display("left side: \"right side\"");
|
||||||
|
$display("left side: \"right side\"");
|
||||||
|
$display("left_side: \"right_side\"");
|
||||||
|
$display("na: \"right_side\"");
|
||||||
|
$display("prep ( midp1 left_side midp2 ( outp ) ): \"right_side\"");
|
||||||
|
$display("na: \"nana\"");
|
||||||
|
$display("left_side right_side: \"left_side right_side\"");
|
||||||
|
$display(": \"\"");
|
||||||
|
$display("left side: \"right side\"");
|
||||||
|
$display("left side: \"right side\"");
|
||||||
|
$display("standalone");
|
||||||
|
|
||||||
|
`line 115 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
generate for (i=0; i<(3); i=i+1) begin psl cover { m5k.f .ctl._ctl_mvldx_m1.d[i] & ~m5k.f .ctl._ctl_mvldx_m1.q[i] & !m5k.f .ctl._ctl_mvldx_m1.cond & ((m5k.f .ctl.alive & m5k.f .ctl.alive_m1))} report "fondNoRise: m5kc_fcl._ctl_mvldx_m1"; psl cover { ~m5k.f .ctl._ctl_mvldx_m1.d[i] & m5k.f .ctl._ctl_mvldx_m1.q[i] & !m5k.f .ctl._ctl_mvldx_m1.cond & ((m5k.f .ctl.alive & m5k.f .ctl.alive_m1))} report "fondNoFall: m5kc_fcl._ctl_mvldx_m1"; end endgenerate
|
|
||||||
|
|
||||||
|
$display("twoline: \"first second\"");
|
||||||
|
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 128 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
begin addr <= (({regs[6], regs[7]} + 1)); rd <= 1; end and begin addr <= (({regs[6], regs[7]})); wdata <= (rdata); wr <= 1; end
|
|
||||||
begin addr <= ({regs[6], regs[7]} + 1); rd <= 1; end
|
|
||||||
begin addr <= ({regs[6], regs[7]}); wdata <= (rdata); wr <= 1; end
|
|
||||||
|
|
||||||
|
`line 133 "t/t_preproc.v" 0
|
||||||
|
module add1 ( input wire d1, output wire o1);
|
||||||
|
|
||||||
|
`line 134 "t/t_preproc.v" 0
|
||||||
|
wire tmp_d1 = d1;
|
||||||
|
`line 134 "t/t_preproc.v" 0
|
||||||
|
wire tmp_o1 = tmp_d1 + 1;
|
||||||
|
`line 134 "t/t_preproc.v" 0
|
||||||
|
assign o1 = tmp_o1 ;
|
||||||
|
endmodule
|
||||||
|
module add2 ( input wire d2, output wire o2);
|
||||||
|
|
||||||
|
`line 137 "t/t_preproc.v" 0
|
||||||
|
wire tmp_d2 = d2;
|
||||||
|
`line 137 "t/t_preproc.v" 0
|
||||||
|
wire tmp_o2 = tmp_d2 + 1;
|
||||||
|
`line 137 "t/t_preproc.v" 0
|
||||||
|
assign o2 = tmp_o2 ;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
`line 140 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
`line 130 "t/t_preproc.v" 0
|
|
||||||
|
|
||||||
Line_Preproc_Check 131
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 147 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 151 "t/t_preproc.v" 0
|
||||||
|
|
||||||
(p,q)
|
`line 151 "t/t_preproc.v" 0
|
||||||
|
generate for (i=0; i<(3); i=i+1) begin
|
||||||
|
`line 151 "t/t_preproc.v" 0
|
||||||
|
psl cover { m5k.f .ctl._ctl_mvldx_m1.d[i] & ~m5k.f .ctl._ctl_mvldx_m1.q[i] & !m5k.f .ctl._ctl_mvldx_m1.cond & ((m5k.f .ctl.alive & m5k.f .ctl.alive_m1))} report "fondNoRise: m5kc_fcl._ctl_mvldx_m1";
|
||||||
|
`line 151 "t/t_preproc.v" 0
|
||||||
|
psl cover { ~m5k.f .ctl._ctl_mvldx_m1.d[i] & m5k.f .ctl._ctl_mvldx_m1.q[i] & !m5k.f .ctl._ctl_mvldx_m1.cond & ((m5k.f .ctl.alive & m5k.f .ctl.alive_m1))} report "fondNoFall: m5kc_fcl._ctl_mvldx_m1";
|
||||||
|
`line 151 "t/t_preproc.v" 0
|
||||||
|
end endgenerate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(x,y )
|
`line 155 "t/t_preproc.v" 0
|
||||||
Line_Preproc_Check 144
|
module prot();
|
||||||
|
`protected
|
||||||
|
I!#r#e6<_Q{{E2+]I3<[3s)1@D|'E''i!O?]jD>Jo_![Cl)
|
||||||
|
#nj1]p,3^1~,="E@QZB\T)eU\pC#C|7=\$J$##A[@-@{Qk]
|
||||||
|
`endprotected
|
||||||
|
`line 160 "t/t_preproc.v" 0
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
x,y)--bee submacro has comma paren
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$display("bits %d %d", $bits(foo), `10);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
`line 162 "t/t_preproc.v" 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
`line 164 "t/t_preproc.v" 0
|
|
||||||
|
|
||||||
|
|
||||||
`line 165 "t/t_preproc.v" 0
|
`line 165 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -224,21 +275,172 @@ $display("bits %d %d", $bits(foo), `10);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 173 "t/t_preproc.v" 0
|
||||||
|
begin addr <= (({regs[6], regs[7]} + 1)); rd <= 1; end and begin addr <= (({regs[6], regs[7]})); wdata <= (rdata); wr <= 1; end
|
||||||
|
begin addr <= ({regs[6], regs[7]} + 1); rd <= 1; end
|
||||||
|
begin addr <= ({regs[6], regs[7]}); wdata <= (rdata); wr <= 1; end more
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 179 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 180 "t/t_preproc.v" 0
|
||||||
|
`line 1 "t/t_preproc_inc4.vh" 1
|
||||||
|
|
||||||
|
`line 3 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 5 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 7 "t/t_preproc_inc4.vh" 2
|
||||||
|
`line 180 "t/t_preproc.v" 0
|
||||||
|
|
||||||
`line 181 "t/t_preproc.v" 0
|
`line 181 "t/t_preproc.v" 0
|
||||||
|
|
||||||
`line 181 "t/t_preproc.v" 0
|
|
||||||
|
|
||||||
|
`line 184 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 186 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 193 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
$blah("ab,cd","e,f");
|
||||||
|
$blah(this.logfile,vec);
|
||||||
|
$blah(this.logfile,vec[1,2,3]);
|
||||||
|
$blah(this.logfile,{blah.name(), " is not foo"});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 202 "t/t_preproc.v" 0
|
||||||
|
`pragma foo = 1
|
||||||
|
`default_nettype none
|
||||||
|
`default_nettype uwire
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 209 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 213 "t/t_preproc.v" 0
|
||||||
|
Line_Preproc_Check 213
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 218 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(p,q)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 225 "t/t_preproc.v" 0
|
||||||
|
(x,y)
|
||||||
|
Line_Preproc_Check 226
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 231 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
beginend
|
||||||
|
beginend
|
||||||
|
"beginend"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 241 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`\esc`def
|
||||||
|
|
||||||
|
`line 245 "t/t_preproc.v" 0
|
||||||
|
Not a \`define
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 249 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
x,y)--bee submacro has comma paren
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 257 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
$display("bits %d %d", $bits(foo), `10);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 262 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 265 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 270 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
assign a3 = ~b3 ;
|
assign a3 = ~b3 ;
|
||||||
|
`line 282 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 284 "t/t_preproc.v" 0
|
||||||
|
|
||||||
\
|
\
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -247,32 +449,56 @@ $display("bits %d %d", $bits(foo), `10);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def foo
|
`line 293 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 293 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 293 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 293 "t/t_preproc.v" 0
|
||||||
|
def i
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 297 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 301 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 307 "t/t_preproc.v" 0
|
||||||
1 /*verilator NOT IN DEFINE*/ (nodef)
|
1 /*verilator NOT IN DEFINE*/ (nodef)
|
||||||
2 /*verilator PART OF DEFINE*/ (hasdef)
|
2 /*verilator PART OF DEFINE*/ (hasdef)
|
||||||
3 /*verilator NOT PART OF DEFINE*/ (nodef)
|
3
|
||||||
4 /*verilator PART OF DEFINE*/ (nodef)
|
`line 309 "t/t_preproc.v" 0
|
||||||
5 also in also3 (nodef)
|
/*verilator NOT PART
|
||||||
|
OF DEFINE*/ (nodef)
|
||||||
|
`line 310 "t/t_preproc.v" 0
|
||||||
HAS a NEW LINE
|
4
|
||||||
|
`line 310 "t/t_preproc.v" 0
|
||||||
|
/*verilator PART
|
||||||
|
OF DEFINE*/ (nodef)
|
||||||
|
`line 311 "t/t_preproc.v" 0
|
||||||
|
5 also in
|
||||||
|
`line 311 "t/t_preproc.v" 0
|
||||||
|
also3 (nodef)
|
||||||
|
|
||||||
|
|
||||||
|
HAS a NEW
|
||||||
|
`line 314 "t/t_preproc.v" 0
|
||||||
|
LINE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 318 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -286,40 +512,146 @@ HAS a NEW LINE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 331 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 334 "t/t_preproc.v" 0
|
||||||
EXP: clxx_scen
|
EXP: clxx_scen
|
||||||
clxx_scen
|
clxx_scen
|
||||||
EXP: clxx_scen
|
EXP: clxx_scen
|
||||||
"clxx_scen"
|
"clxx_scen"
|
||||||
|
|
||||||
EXP: do if (start("verilog/inc1.v", 25)) begin message({"Blah-", "clx_scen", " end"}); end while(0);
|
EXP: do if (start("verilog/inc1.v", 25)) begin message({"Blah-", "clx_scen", " end"}); end while(0);
|
||||||
do
|
|
||||||
`line 239 "t/t_preproc.v" 0
|
`line 340 "t/t_preproc.v" 0
|
||||||
if (start("t/t_preproc.v", 239)) begin message({"Blah-", "clx_scen", " end"}); end while(0);
|
do
|
||||||
|
`line 340 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 340 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 340 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 340 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 340 "t/t_preproc.v" 0
|
||||||
|
if (start("t/t_preproc.v", 340)) begin
|
||||||
|
`line 340 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 340 "t/t_preproc.v" 0
|
||||||
|
message({"Blah-", "clx_scen", " end"});
|
||||||
|
`line 340 "t/t_preproc.v" 0
|
||||||
|
end
|
||||||
|
`line 340 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 340 "t/t_preproc.v" 0
|
||||||
|
while(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 344 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 348 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 348 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 349 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 351 "t/t_preproc.v" 0
|
||||||
`line 249 "t/t_preproc.v" 0
|
|
||||||
|
|
||||||
|
|
||||||
EXP: This is fooed
|
EXP: This is fooed
|
||||||
This is fooed
|
This is fooed
|
||||||
|
|
||||||
EXP: This is fooed_2
|
EXP: This is fooed_2
|
||||||
This is fooed_2
|
This is fooed_2
|
||||||
|
|
||||||
|
|
||||||
|
`line 357 "t/t_preproc.v" 0
|
||||||
|
|
||||||
np
|
np
|
||||||
np
|
np
|
||||||
|
|
||||||
`line 262 "t/t_preproc.v" 2
|
|
||||||
|
`line 362 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 367 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 372 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 378 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 382 "t/t_preproc.v" 0
|
||||||
|
hello3hello3hello3
|
||||||
|
hello4hello4hello4hello4
|
||||||
|
|
||||||
|
|
||||||
|
`line 386 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 388 "t/t_preproc.v" 0
|
||||||
|
`line 1 "t/t_preproc_inc4.vh" 1
|
||||||
|
|
||||||
|
`line 3 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 5 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 7 "t/t_preproc_inc4.vh" 2
|
||||||
|
`line 388 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
`line 389 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 393 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 397 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Line_Preproc_Check 401
|
||||||
|
|
||||||
|
|
||||||
|
`line 404 "t/t_preproc.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Line_Preproc_Check 407
|
||||||
|
"FOO \
|
||||||
|
BAR " "arg_line1 \
|
||||||
|
arg_line2" "FOO \
|
||||||
|
BAR "
|
||||||
|
`line 410 "t/t_preproc.v" 0
|
||||||
|
Line_Preproc_Check 410
|
||||||
|
|
||||||
|
|
||||||
|
`line 413 "t/t_preproc.v" 2
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
// DESCRIPTION: Verilator: Verilog Test module
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
//
|
|
||||||
//
|
|
||||||
// This file ONLY is placed into the Public Domain, for any use,
|
// This file ONLY is placed into the Public Domain, for any use,
|
||||||
// without warranty, 2004-2007 by Wilson Snyder.
|
// without warranty, 2000-2010 by Wilson Snyder.
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Includes
|
// Includes
|
||||||
|
|
@ -46,6 +44,7 @@ text.
|
||||||
|
|
||||||
/*******COMMENT*****/
|
/*******COMMENT*****/
|
||||||
`MULTILINE
|
`MULTILINE
|
||||||
|
`MOREMULTILINE
|
||||||
Line_Preproc_Check `__LINE__
|
Line_Preproc_Check `__LINE__
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
@ -86,14 +85,57 @@ $display(`msg(left side, right side))
|
||||||
`zap(bug1);
|
`zap(bug1);
|
||||||
`zap("bug2");
|
`zap("bug2");
|
||||||
|
|
||||||
|
/* Define inside comment: `DEEPER and `WITHTICK */
|
||||||
|
// More commentary: `zap(bug1); `zap("bug2");
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
// display passthru
|
||||||
|
|
||||||
|
`define ls left_side
|
||||||
|
`define rs right_side
|
||||||
|
`define noarg na
|
||||||
|
`define thru(x) x
|
||||||
|
`define thruthru `ls `rs // Doesn't expand
|
||||||
|
`define msg(x,y) `"x: `\`"y`\`"`"
|
||||||
|
initial begin
|
||||||
|
//$display(`msg( \`, \`)); // Illegal
|
||||||
|
$display(`msg(pre `thru(thrupre `thru(thrumid) thrupost) post,right side));
|
||||||
|
$display(`msg(left side,right side));
|
||||||
|
$display(`msg( left side , right side ));
|
||||||
|
$display(`msg( `ls , `rs ));
|
||||||
|
$display(`msg( `noarg , `rs ));
|
||||||
|
$display(`msg( prep ( midp1 `ls midp2 ( outp ) ) , `rs ));
|
||||||
|
$display(`msg(`noarg,`noarg`noarg));
|
||||||
|
$display(`msg( `thruthru , `thruthru )); // Results vary between simulators
|
||||||
|
$display(`msg(`thru(),)); // Empty
|
||||||
|
$display(`msg(`thru(left side),`thru(right side)));
|
||||||
|
$display(`msg( `thru( left side ) , `thru( right side ) ));
|
||||||
|
$display(`"standalone`");
|
||||||
|
|
||||||
|
// Unspecified when the stringification has multiple lines
|
||||||
|
`define twoline first \
|
||||||
|
second
|
||||||
|
$display(`msg(twoline, `twoline));
|
||||||
|
//$display(`msg(left side, \ right side \ )); // Not sure \{space} is legal.
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
// rt.cpan.org bug34429
|
// rt.cpan.org bug34429
|
||||||
|
|
||||||
`define ADD_UP(a,c) \
|
`define ADD_UP(a,c) \
|
||||||
wire tmp_``a = a; \
|
wire tmp_``a = a; \
|
||||||
wire tmp_``c = tmp_``a + 1; \
|
wire tmp_``c = tmp_``a + 1; \
|
||||||
assign c = tmp_``c ;
|
assign c = tmp_``c ;
|
||||||
|
|
||||||
`ADD_UP(d1,o1) // expansion is OK
|
module add1 ( input wire d1, output wire o1);
|
||||||
`ADD_UP( d2 , o2 ) // expansion is bad
|
`ADD_UP(d1,o1) // expansion is OK
|
||||||
|
endmodule
|
||||||
|
module add2 ( input wire d2, output wire o2);
|
||||||
|
`ADD_UP( d2 , o2 ) // expansion is bad
|
||||||
|
endmodule
|
||||||
|
|
||||||
`define check(mod, width, flopname, gate, path) \
|
`define check(mod, width, flopname, gate, path) \
|
||||||
generate for (i=0; i<(width); i=i+1) begin \
|
generate for (i=0; i<(width); i=i+1) begin \
|
||||||
|
|
@ -108,6 +150,17 @@ assign c = tmp_``c ;
|
||||||
|
|
||||||
`check(m5kc_fcl, 3, _ctl_mvldx_m1, `CK_fr, `MF._ctl_mvldx_m1) // ignorecmt
|
`check(m5kc_fcl, 3, _ctl_mvldx_m1, `CK_fr, `MF._ctl_mvldx_m1) // ignorecmt
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
// Quotes are legal in protected blocks. Grr.
|
||||||
|
module prot();
|
||||||
|
`protected
|
||||||
|
I!#r#e6<_Q{{E2+]I3<[3s)1@D|'E''i!O?]jD>Jo_![Cl)
|
||||||
|
#nj1]p,3^1~,="E@QZB\T)eU\pC#C|7=\$J$##A[@-@{Qk]
|
||||||
|
`endprotected
|
||||||
|
endmodule
|
||||||
|
//"
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
// macro call with define that has comma
|
// macro call with define that has comma
|
||||||
`define REG_H 6
|
`define REG_H 6
|
||||||
`define REG_L 7
|
`define REG_L 7
|
||||||
|
|
@ -119,9 +172,38 @@ assign c = tmp_``c ;
|
||||||
|
|
||||||
`EX_READ((`_HL + 1)) and `EX_WRITE((`_HL), rdata)
|
`EX_READ((`_HL + 1)) and `EX_WRITE((`_HL), rdata)
|
||||||
`EX_READ(`_HL + 1)
|
`EX_READ(`_HL + 1)
|
||||||
`EX_WRITE(`_HL, rdata)
|
`EX_WRITE(`_HL, rdata) more
|
||||||
|
|
||||||
//===========================================================================
|
//======================================================================
|
||||||
|
// include of parameterized file
|
||||||
|
`define INCNAME "t_preproc_inc4.vh"
|
||||||
|
`include `INCNAME
|
||||||
|
`ifndef T_PREPROC_INC4
|
||||||
|
`error "No Inc4"
|
||||||
|
`endif
|
||||||
|
`undef T_PREPROC_INC4
|
||||||
|
|
||||||
|
`ifdef NOT_DEFINED_INC
|
||||||
|
`include NOT_DEFINED_INC
|
||||||
|
`endif
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
// macro call with , in {}
|
||||||
|
|
||||||
|
`define xxerror(logfile, msg) $blah(logfile,msg)
|
||||||
|
`xxerror("ab,cd","e,f");
|
||||||
|
`xxerror(this.logfile, vec);
|
||||||
|
`xxerror(this.logfile, vec[1,2,3]);
|
||||||
|
`xxerror(this.logfile, {blah.name(), " is not foo"});
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
// pragma/default net type
|
||||||
|
|
||||||
|
`pragma foo = 1
|
||||||
|
`default_nettype none
|
||||||
|
`default_nettype uwire
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
// Ifdef
|
// Ifdef
|
||||||
|
|
||||||
`define EMPTY_TRUE
|
`define EMPTY_TRUE
|
||||||
|
|
@ -143,6 +225,25 @@ Line_Preproc_Check `__LINE__
|
||||||
)
|
)
|
||||||
Line_Preproc_Check `__LINE__
|
Line_Preproc_Check `__LINE__
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
// defines split arguments
|
||||||
|
|
||||||
|
`define BEGIN begin
|
||||||
|
`define END end
|
||||||
|
`define BEGINEND `BEGIN`END
|
||||||
|
`define quoteit(x) `"x`"
|
||||||
|
`BEGIN`END // 2001 spec doesn't require two tokens, so "beginend" ok
|
||||||
|
`BEGINEND // 2001 spec doesn't require two tokens, so "beginend" ok
|
||||||
|
`quoteit(`BEGIN`END) // No space "beginend"
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
// bug106
|
||||||
|
`define \esc`def got_escaped
|
||||||
|
`ifdef \esc`def
|
||||||
|
`\esc`def
|
||||||
|
`endif
|
||||||
|
Not a \`define
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// misparsed comma in submacro
|
// misparsed comma in submacro
|
||||||
`define sb bee
|
`define sb bee
|
||||||
|
|
@ -257,3 +358,54 @@ EXP: This is fooed_2
|
||||||
`NOPARAM()
|
`NOPARAM()
|
||||||
`NOPARAM( )
|
`NOPARAM( )
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
// It's unclear if the spec allows this; is text_macro_idenitfier before or after substitution?
|
||||||
|
`define NODS_DEFINED
|
||||||
|
`define NODS_INDIRECT(x) x
|
||||||
|
`ifndef `NODS_INDIRECT(NODS_DEFINED)
|
||||||
|
`error "Indirect failed"
|
||||||
|
`endif
|
||||||
|
`ifdef `NODS_INDIRECT(NODS_UNDEFINED)
|
||||||
|
`error "Indirect2 failed"
|
||||||
|
`endif
|
||||||
|
//======================================================================
|
||||||
|
// Metaprogramming
|
||||||
|
`define REPEAT_0(d)
|
||||||
|
`define REPEAT_1(d) d
|
||||||
|
`define REPEAT_2(d) `REPEAT_1(d)d
|
||||||
|
`define REPEAT_3(d) `REPEAT_2(d)d
|
||||||
|
`define REPEAT_4(d) `REPEAT_3(d)d
|
||||||
|
|
||||||
|
`define CONCAT(a, b) a``b
|
||||||
|
`define REPEATC(n, d) `CONCAT(`REPEAT_, n)(d)
|
||||||
|
`define REPEATT(n, d) `REPEAT_``n(d)
|
||||||
|
|
||||||
|
`REPEATC(3, hello3 )
|
||||||
|
`REPEATT(4, hello4 )
|
||||||
|
//======================================================================
|
||||||
|
// Include from stringification
|
||||||
|
`undef T_PREPROC_INC4
|
||||||
|
`define NODS_CONC_VH(m) `"m.vh`"
|
||||||
|
`include `NODS_CONC_VH(t_preproc_inc4)
|
||||||
|
`ifndef T_PREPROC_INC4 `error_here `endif
|
||||||
|
//======================================================================
|
||||||
|
// Defines doing defines
|
||||||
|
// Note the newline on the end - required to form the end of a define
|
||||||
|
`define DEFINEIT(d) d \
|
||||||
|
|
||||||
|
`define _DEFIF_Z_0 1
|
||||||
|
`define DEFIF_NZ(d,n) `undef d `ifndef _DEFIF_Z_``n `DEFINEIT(`define d 1) `endif
|
||||||
|
`DEFIF_NZ(TEMP,1)
|
||||||
|
`ifndef TEMP `error "bad" `endif
|
||||||
|
`DEFIF_NZ(TEMP,0)
|
||||||
|
`ifdef TEMP `error "bad0" `endif
|
||||||
|
Line_Preproc_Check `__LINE__
|
||||||
|
//======================================================================
|
||||||
|
// Quoted multiline - track line numbers, and insure \\n gets propagated
|
||||||
|
`define MULQUOTE "FOO \
|
||||||
|
BAR "
|
||||||
|
`define MULQUOTE2(mq) `MULQUOTE mq `MULQUOTE
|
||||||
|
Line_Preproc_Check `__LINE__
|
||||||
|
`MULQUOTE2("arg_line1 \
|
||||||
|
arg_line2")
|
||||||
|
Line_Preproc_Check `__LINE__
|
||||||
|
//======================================================================
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 10 "t/t_preproc_def09.v" 0
|
||||||
|
|
||||||
'initial $display("start", "msg1" , "msg2" , "end");'
|
'initial $display("start", "msg1" , "msg2", "end");'
|
||||||
'initial $display("start", "msg1" , "msg2" , "end");'
|
'initial $display("start", "msg1" , "msg2" , "end");'
|
||||||
'initial $display("start", " msg1" , , "end");'
|
'initial $display("start", " msg1" , , "end");'
|
||||||
'initial $display("start", " msg1" , , "end");'
|
'initial $display("start", " msg1" , , "end");'
|
||||||
|
|
@ -24,15 +25,17 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 26 "t/t_preproc_def09.v" 0
|
||||||
|
|
||||||
'$display(5,,2,,3 );'
|
|
||||||
'$display(5,,2,,3);'
|
'$display(5,,2,,3);'
|
||||||
'$display(1 ,,"B",,3 );'
|
'$display(5,,2,,3);'
|
||||||
|
'$display(1,,"B",,3);'
|
||||||
'$display(1 ,,"B",,3 );'
|
'$display(1 ,,"B",,3 );'
|
||||||
'$display(5,,2,,);'
|
'$display(5,,2,,);'
|
||||||
'$display(5,,2,,);'
|
'$display(5,,2,,);'
|
||||||
|
|
||||||
|
|
||||||
|
`line 35 "t/t_preproc_def09.v" 0
|
||||||
|
|
||||||
'$display(1,,,,3);'
|
'$display(1,,,,3);'
|
||||||
'$display(5,,,,"C");'
|
'$display(5,,,,"C");'
|
||||||
|
|
@ -41,23 +44,27 @@
|
||||||
'$display(5,,2,,"C");'
|
'$display(5,,2,,"C");'
|
||||||
'$display(5,,2,,"C");'
|
'$display(5,,2,,"C");'
|
||||||
|
|
||||||
|
`line 43 "t/t_preproc_def09.v" 0
|
||||||
|
|
||||||
'$display(1 ,,0,,"C");'
|
'$display(1,,0,,"C");'
|
||||||
'$display(1 ,,0,,"C");'
|
'$display(1 ,,0,,"C");'
|
||||||
'$display(5,,0,,"C");'
|
'$display(5,,0,,"C");'
|
||||||
'$display(5,,0,,"C");'
|
'$display(5,,0,,"C");'
|
||||||
|
|
||||||
|
|
||||||
|
`line 50 "t/t_preproc_def09.v" 0
|
||||||
|
|
||||||
'b + 1 + 42 + a '
|
'b + 1 + 42 + a'
|
||||||
'b + 1 + 42 + a'
|
'b + 1 + 42 + a'
|
||||||
|
|
||||||
|
|
||||||
|
`line 55 "t/t_preproc_def09.v" 0
|
||||||
|
|
||||||
'"==)" "((((" () ';
|
'"==)" "((((" () ';
|
||||||
'"==)" "((((" () ';
|
'"==)" "((((" () ';
|
||||||
|
|
||||||
|
|
||||||
|
`line 60 "t/t_preproc_def09.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -68,8 +75,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 70 "t/t_preproc_def09.v" 0
|
||||||
'(6) (eq=al) ZOT'
|
'(6) (eq=al) ZOT'
|
||||||
HERE-71 - Line71
|
HERE-71 - Line71
|
||||||
|
|
||||||
|
|
||||||
`line 74 "t/t_preproc_def09.v" 2
|
|
||||||
|
`line 75 "t/t_preproc_def09.v" 2
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
// DESCRIPTION: Verilog::Preproc: Example source code
|
||||||
|
// This file ONLY is placed into the Public Domain, for any use,
|
||||||
|
// without warranty, 2000-2010 by Wilson Snyder.
|
||||||
|
|
||||||
|
`define T_PREPROC_INC4
|
||||||
|
|
@ -5,16 +5,20 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 7 "t/t_preproc_psl.v" 0
|
||||||
/*verilator metacomment preserved*/
|
/*verilator metacomment preserved*/
|
||||||
|
|
||||||
|
`line 9 "t/t_preproc_psl.v" 0
|
||||||
/*verilator metacomment also_preserved*/
|
/*verilator metacomment also_preserved*/
|
||||||
|
|
||||||
|
`line 11 "t/t_preproc_psl.v" 0
|
||||||
Hello in t_preproc_psl.v
|
Hello in t_preproc_psl.v
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 17 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -22,25 +26,47 @@ Hello in t_preproc_psl.v
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 28 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
`line 28 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
`line 28 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
`line 28 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 29 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
29
|
29
|
||||||
|
|
||||||
|
`line 31 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 40 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
`line 40 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
`line 40 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
`line 40 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
`line 40 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 41 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
41
|
41
|
||||||
|
|
||||||
|
`line 43 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
`line 45 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 50 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -48,23 +74,17 @@ Hello in t_preproc_psl.v
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 57 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 62 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 65 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
`line 59 "t/t_preproc_psl.v" 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
`psl
|
`psl
|
||||||
psl assert always sig!=90;
|
psl assert always sig!=90;
|
||||||
|
|
@ -72,5 +92,7 @@ psl assert always sig!=90;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 72 "t/t_preproc_psl.v" 0
|
||||||
72
|
72
|
||||||
`line 73 "t/t_preproc_psl.v" 2
|
|
||||||
|
`line 74 "t/t_preproc_psl.v" 2
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,20 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 7 "t/t_preproc_psl.v" 0
|
||||||
/*verilator metacomment preserved*/
|
/*verilator metacomment preserved*/
|
||||||
|
|
||||||
|
`line 9 "t/t_preproc_psl.v" 0
|
||||||
/*verilator metacomment also_preserved*/
|
/*verilator metacomment also_preserved*/
|
||||||
|
|
||||||
|
`line 11 "t/t_preproc_psl.v" 0
|
||||||
Hello in t_preproc_psl.v
|
Hello in t_preproc_psl.v
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 17 "t/t_preproc_psl.v" 0
|
||||||
psl default clock = (posedge clk);
|
psl default clock = (posedge clk);
|
||||||
psl fails1: cover {cyc==10};
|
psl fails1: cover {cyc==10};
|
||||||
psl assert always cyc!=10;
|
psl assert always cyc!=10;
|
||||||
|
|
@ -29,10 +33,12 @@ Hello in t_preproc_psl.v
|
||||||
|
|
||||||
29
|
29
|
||||||
|
|
||||||
|
`line 31 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
psl
|
psl
|
||||||
|
`line 35 "t/t_preproc_psl.v" 0
|
||||||
fails_ml:
|
fails_ml:
|
||||||
assert always
|
assert always
|
||||||
cyc==3 -> mask==8'h21;
|
cyc==3 -> mask==8'h21;
|
||||||
|
|
@ -41,13 +47,16 @@ Hello in t_preproc_psl.v
|
||||||
|
|
||||||
41
|
41
|
||||||
|
|
||||||
|
`line 43 "t/t_preproc_psl.v" 0
|
||||||
psl assert never (cyc==1 && reset_l);
|
psl assert never (cyc==1 && reset_l);
|
||||||
|
|
||||||
|
`line 45 "t/t_preproc_psl.v" 0
|
||||||
psl fails3: assert always
|
psl fails3: assert always
|
||||||
psl cyc==3 -> mask==8'h21;
|
psl cyc==3 -> mask==8'h21;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 50 "t/t_preproc_psl.v" 0
|
||||||
psl assert always
|
psl assert always
|
||||||
psl {[*]; cyc==3;
|
psl {[*]; cyc==3;
|
||||||
psl cyc==4; cyc==6};
|
psl cyc==4; cyc==6};
|
||||||
|
|
@ -55,16 +64,17 @@ Hello in t_preproc_psl.v
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 57 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
`line 59 "t/t_preproc_psl.v" 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 62 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
psl assert always cyc!=10;
|
psl assert always cyc!=10;
|
||||||
|
|
||||||
|
`line 65 "t/t_preproc_psl.v" 0
|
||||||
|
|
||||||
`psl
|
`psl
|
||||||
psl assert always sig!=90;
|
psl assert always sig!=90;
|
||||||
|
|
@ -72,5 +82,7 @@ psl assert always sig!=90;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
`line 72 "t/t_preproc_psl.v" 0
|
||||||
72
|
72
|
||||||
`line 73 "t/t_preproc_psl.v" 2
|
|
||||||
|
`line 74 "t/t_preproc_psl.v" 2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue