Speed compiles by avoiding including the STL iostream header.

This commit is contained in:
Wilson Snyder 2010-01-14 21:03:06 -05:00
parent 16926edf18
commit e40b5819bd
12 changed files with 25 additions and 20 deletions

View File

@ -29,6 +29,9 @@ indicates the contributor was also the author of the fix; Thanks!
*** Add experimental clock domain crossing checks.
*** Speed compiles by avoiding including the STL iostream header.
Application programs may need to include it themselves to avoid errors.
**** Support optional cell parenthesis, bug179. [by Byron Bradley]
**** Support for loop i++, ++i, i--, --i, bug175. [by Byron Bradley]

View File

@ -35,7 +35,8 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
// <iostream> avoided to reduce compile time
// <string> avoided to reduce compile time
using namespace std;
//=========================================================================

View File

@ -33,6 +33,7 @@
#include <map>
#include <vector>
#include <string>
class VerilatedScope;

View File

@ -705,10 +705,10 @@ class EmitCImp : EmitCStmts {
puts(modClassName(m_modp)+"::"+nodep->name()
+"("+cFuncArgs(nodep)+") {\n");
puts("VL_DEBUG_IF(cout<<\" ");
puts("VL_DEBUG_IF(VL_PRINTF(\" ");
for (int i=0;i<m_modp->level();i++) { puts(" "); }
puts(modClassName(m_modp)+"::"+nodep->name()
+"\"<<endl; );\n");
+"\\n\"); );\n");
if (nodep->symProlog()) puts(EmitCBaseVisitor::symTopAssign()+"\n");
@ -771,8 +771,8 @@ class EmitCImp : EmitCStmts {
if (nodep->lhsp()->castVarRef()) {
varname = ": "+nodep->lhsp()->castVarRef()->varp()->prettyName();
}
puts(")) cout<<\"\tCHANGE: "+nodep->fileline()->ascii()
+varname+"\"<<endl; );\n");
puts(")) VL_PRINTF(\"\tCHANGE: "+nodep->fileline()->ascii()
+varname+"\\n\"); );\n");
}
}
}
@ -1435,12 +1435,12 @@ void EmitCImp::emitWrapEval(AstNodeModule* modp) {
puts("if (VL_UNLIKELY(__Vm_inhibitSim)) return;\n");
}
puts("// Evaluate till stable\n");
puts("VL_DEBUG_IF(cout<<\"\\n----TOP Evaluate "+modClassName(modp)+"::eval\"<<endl; );\n");
puts("VL_DEBUG_IF(VL_PRINTF(\"\\n----TOP Evaluate "+modClassName(modp)+"::eval\\n\"); );\n");
#ifndef NEW_ORDERING
puts("int __VclockLoop = 0;\n");
puts("IData __Vchange=1;\n");
puts("while (VL_LIKELY(__Vchange)) {\n");
puts( "VL_DEBUG_IF(cout<<\" Clock loop\"<<endl;);\n");
puts( "VL_DEBUG_IF(VL_PRINTF(\" Clock loop\\n\"););\n");
#endif
puts( "vlSymsp->__Vm_activity = true;\n");
puts( "_eval(vlSymsp);\n");

View File

@ -30,9 +30,9 @@ module t (/*AUTOARG*/
c_worked <= 0;
end
if (cyc == 8'd2) begin
`ifdef verilator
$c("cout<<\"Calling $c, calling $c...\"<<endl;");
$c("cout<<\"Cyc=\"<<dec<<(int)(",cyc,")<<endl;");
`ifdef VERILATOR
$c("VL_PRINTF(\"Calling $c, calling $c...\\n\");");
$c("VL_PRINTF(\"Cyc=%d\\n\",",cyc,");");
c_worked <= $c("my_function()");
c_wider <= $c9("0x10");
`else

View File

@ -37,10 +37,10 @@ module t (clk);
if ( cyc >= 4 ) begin
dindex = dindex + 2; //*** Error line
$display("%m: DIndex increment %d", cyc);
$c("cout<<\"Hello1?\"<<endl;");
$c("VL_PRINTF(\"Hello1?\\n\");");
end
$c("cout<<\"Hello2?\"<<endl;");
$c("cout<<\"Hello3?\"<<endl;");
$c("VL_PRINTF(\"Hello2?\\n\");");
$c("VL_PRINTF(\"Hello3?\\n\");");
end
end
endtask

View File

@ -32,8 +32,8 @@ module t_initial (/*AUTOARG*/
if (user_loaded_value!=1) $stop;
// Test $c
`ifdef verilator
$c ("cout<<\"Hi From C++\"<<endl;");
`ifdef VERILATOR
$c ("VL_PRINTF(\"Hi From C++\\n\");");
`endif
user_loaded_value <= 2;

View File

@ -53,7 +53,7 @@ int main() {
}
if(pass) {
cout << "*-* All Finished *-*" << endl;
VL_PRINTF("*-* All Finished *-*\n");
tb->final();
} else {
vl_fatal(__FILE__,__LINE__,"top", "Unexpected results from tristate test\n");

View File

@ -48,7 +48,7 @@ int main() {
}
if(pass) {
cout << "*-* All Finished *-*" << endl;
VL_PRINTF("*-* All Finished *-*\n");
tb->final();
} else {
vl_fatal(__FILE__,__LINE__,"top", "Unexpected results from inout test\n");

View File

@ -50,7 +50,7 @@ int main() {
}
if (pass) {
cout << "*-* All Finished *-*" << endl;
VL_PRINTF("*-* All Finished *-*\n");
tb->final();
} else {
vl_fatal(__FILE__,__LINE__,"top", "Unexpected results from pullup test\n");

View File

@ -50,7 +50,7 @@ int main() {
}
if(pass) {
cout << "*-* All Finished *-*" << endl;
VL_PRINTF("*-* All Finished *-*\n");
tb->final();
} else {
vl_fatal(__FILE__,__LINE__,"top", "Unexpected results from t_tri_select\n");

View File

@ -24,7 +24,7 @@ int main() {
Verilated::debug(0);
tb = new VM_PREFIX("tb");
cout << "*-* All Finished *-*" << endl;
VL_PRINTF("*-* All Finished *-*\n");
tb->final();
return 0;
}