SystemPerl mode (-sp-deprecated) has been removed.

This commit is contained in:
Wilson Snyder 2017-09-07 21:08:49 -04:00
parent 8dd612a0a0
commit 074689b5de
17 changed files with 69 additions and 387 deletions

View File

@ -4,6 +4,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
* Verilator 3.909 devel
*** SystemPerl mode (-sp-deprecated) has been removed.
**** Update keyword warnings to include C++11 and others.

View File

@ -911,7 +911,7 @@ developers.
=item --output-split I<bytes>
Enables splitting the output .cpp/.sp files into multiple outputs. When a
Enables splitting the output .cpp files into multiple outputs. When a
C++ file exceeds the specified number of operations, a new file will be
created at the next function boundary. In addition, any slow routines will
be placed into __Slow files. This accelerates compilation by as
@ -923,7 +923,7 @@ one-minute-compile chunks.
=item --output-split-cfuncs I<statements>
Enables splitting functions in the output .cpp/.sp files into multiple
Enables splitting functions in the output .cpp files into multiple
functions. When a generated function exceeds the specified number of
operations, a new function will be created. With --output-split, this will
enable GCC to compile faster, at a small loss in performance that gets
@ -933,7 +933,7 @@ function.
=item --output-split-ctrace I<statements>
Enables splitting trace functions in the output .cpp/.sp files into
Enables splitting trace functions in the output .cpp files into
multiple functions. Defaults to same setting as --output-split-cfuncs.
=item -P
@ -1430,8 +1430,8 @@ This is an example similar to the above, but using SystemC.
Verilated::commandArgs(argc, argv);
sc_clock clk ("clk",10, 0.5, 3, true);
Vour* top;
top = new Vour("top"); // SP_CELL (top, Vour);
top->clk(clk); // SP_PIN (top, clk, clk);
top = new Vour("top");
top->clk(clk);
while (!Verilated::gotFinish()) { sc_start(1, SC_NS); }
delete top;
exit(0);

View File

@ -46,7 +46,7 @@ using namespace std;
// Switches
#if VM_TRACE // Verilator tracing requested
# define WAVES 1 // Set backward compatibility flag as in systemperl.h
# define WAVES 1 // Set backward compatibility flag
#endif
//=========================================================================

View File

@ -22,7 +22,6 @@ CFG_CXXFLAGS_NO_UNUSED = @CFG_CXXFLAGS_NO_UNUSED@
######################################################################
# Programs
SP_PREPROC = sp_preproc
SP_INCLUDER = $(VERILATOR_INCLUDER)
VERILATOR_COVERAGE = $(PERL) $(VERILATOR_ROOT)/bin/verilator_coverage
VERILATOR_INCLUDER = $(PERL) $(VERILATOR_ROOT)/bin/verilator_includer
@ -93,9 +92,9 @@ VM_CLASSES += $(VM_CLASSES_FAST) $(VM_CLASSES_SLOW)
VM_SUPPORT += $(VM_SUPPORT_FAST) $(VM_SUPPORT_SLOW)
#######################################################################
##### SystemC or SystemPerl builds
##### SystemC builds
ifeq ($(VM_SP_OR_SC),1)
ifeq ($(VM_SC),1)
CPPFLAGS += $(SYSTEMC_CXX_FLAGS) -I$(SYSTEMC_INCLUDE)
LDFLAGS += $(SYSTEMC_CXX_FLAGS) -L$(SYSTEMC_LIBDIR)
SC_LIBS = -lsystemc
@ -106,23 +105,9 @@ ifeq ($(VM_SP_OR_SC),1)
endif
#######################################################################
##### SystemPerl builds
##### Stub
ifeq ($(VM_SP),1)
CPPFLAGS += -I$(SYSTEMPERL_INCLUDE) -DSYSTEMPERL
VPATH += $(SYSTEMPERL_INCLUDE)
LIBS += -lm -lstdc++
VK_CLASSES_SP = $(addsuffix .sp, $(VM_CLASSES))
# This rule is called manually by the upper level makefile
preproc:
@echo " SP Preprocess" $(basename $(VM_CLASSES)) ...
$(SP_PREPROC) -M sp_preproc.d --tree $(VM_PREFIX).sp_tree \
--preproc $(VK_CLASSES_SP)
else
preproc:
endif
preproc:
#######################################################################
##### C/H builds

View File

@ -412,7 +412,7 @@ void VerilatedVcd::dumpHeader () {
// We detect the spaces in module names to determine hierarchy. This
// allows signals to be declared without fixed ordering, which is
// required as Verilog signals might be separately declared from
// "SP_TRACE" signals.
// SC module signals.
// Print the signal names
const char* lastName = "";

View File

@ -105,12 +105,6 @@ endif
CPPFLAGSWALL = $(CPPFLAGS)
CPPFLAGSPARSER = $(CPPFLAGS) $(CFG_CXXFLAGS_PARSER)
ifneq ($(SYSTEMPERL),) # Intuit SYSTEMPERL_INCLUDE as it's new
SYSTEMPERL_INCLUDE ?= $(SYSTEMPERL)/src
#else if set, leave as-is.
#else if SYSTEMPERL="" don't set _INCLUDE so source will figure it out
endif
# Allow RPM builds to specify hardcoded data directories
# To do this:
ifeq ($(CFG_WITH_DEFENV),yes)
@ -118,8 +112,6 @@ ifeq ($(CFG_WITH_DEFENV),yes)
CPPFLAGS += -DDEFENV_SYSTEMC_ARCH=\"$(SYSTEMC_ARCH)\"
CPPFLAGS += -DDEFENV_SYSTEMC_INCLUDE=\"$(SYSTEMC_INCLUDE)\"
CPPFLAGS += -DDEFENV_SYSTEMC_LIBDIR=\"$(SYSTEMC_LIBDIR)\"
CPPFLAGS += -DDEFENV_SYSTEMPERL=\"$(SYSTEMPERL)\"
CPPFLAGS += -DDEFENV_SYSTEMPERL_INCLUDE=\"$(SYSTEMPERL_INCLUDE)\"
ifeq ($(VERILATOR_ROOT),) # Use what we're given, or intuit
CPPFLAGS += -DDEFENV_VERILATOR_ROOT=\"$(pkgdatadir)\"
else

View File

@ -782,12 +782,7 @@ class EmitCImp : EmitCStmts {
// We should move them to a different stage.
string filename = VL_DEV_NULL;
newCFile(filename, slow, source);
ofp = new V3OutSpFile (filename);
}
else if (optSystemPerl()) {
string filename = filenameNoExt+".sp";
newCFile(filename, slow, source);
ofp = new V3OutSpFile (filename);
ofp = new V3OutCFile (filename);
}
else if (optSystemC()) {
string filename = filenameNoExt+(source?".cpp":".h");
@ -1475,9 +1470,7 @@ void EmitCImp::emitCoverageDecl(AstNodeModule* modp) {
void EmitCImp::emitCtorImp(AstNodeModule* modp) {
puts("\n");
if (optSystemPerl() && modp->isTop()) {
puts("SP_CTOR_IMP("+modClassName(modp)+")");
} else if (optSystemC() && modp->isTop()) {
if (optSystemC() && modp->isTop()) {
puts("VL_SC_CTOR_IMP("+modClassName(modp)+")");
} else {
puts("VL_CTOR_IMP("+modClassName(modp)+")");
@ -1495,7 +1488,6 @@ void EmitCImp::emitCtorImp(AstNodeModule* modp) {
putsDecoration("// Reset structure values\n");
puts("_ctor_var_reset();\n");
emitTextSection(AstType::atScCtor);
if (optSystemPerl()) puts("SP_AUTO_CTOR;\n");
puts("}\n");
}
@ -1514,9 +1506,7 @@ void EmitCImp::emitCoverageImp(AstNodeModule* modp) {
if (v3Global.opt.coverage() ) {
puts("\n// Coverage\n");
// Rather than putting out VL_COVER_INSERT calls directly, we do it via this function
// This gets around gcc slowness constructing all of the template arguments
// SystemPerl 1.301 is much faster, but it's nice to remain back
// compatible, and have a common wrapper.
// This gets around gcc slowness constructing all of the template arguments.
puts("void "+modClassName(m_modp)+"::__vlCoverInsert(uint32_t* countp, bool enable, const char* filenamep, int lineno, int column,\n");
puts( "const char* hierp, const char* pagep, const char* commentp) {\n");
puts( "static uint32_t fake_zero_count = 0;\n"); // static doesn't need save-restore as constant
@ -1815,11 +1805,9 @@ void EmitCImp::emitIntFuncDecls(AstNodeModule* modp) {
void EmitCImp::emitInt(AstNodeModule* modp) {
// Always have this first; gcc has short circuiting if #ifdef is first in a file
if (!optSystemPerl()) { // else done for us automatically
puts("#ifndef _"+modClassName(modp)+"_H_\n");
puts("#define _"+modClassName(modp)+"_H_\n");
puts("\n");
}
puts("#ifndef _"+modClassName(modp)+"_H_\n");
puts("#define _"+modClassName(modp)+"_H_\n");
puts("\n");
ofp()->putsIntTopInclude();
if (v3Global.needHeavy()) {
@ -1863,21 +1851,16 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
} else {
puts("VL_MODULE("+modClassName(modp)+") {\n");
}
if (optSystemPerl()) puts("/*AUTOATTR(verilated)*/\n\n");
ofp()->resetPrivate();
ofp()->putsPrivate(false); // public:
// Instantiated modules
if (optSystemPerl()) {
puts("/*AUTOSUBCELLS*/\n\n");
} else {
putsDecoration("// CELLS\n");
if (modp->isTop()) puts("// Public to allow access to /*verilator_public*/ items;\n");
if (modp->isTop()) puts("// otherwise the application code can consider these internals.\n");
for (AstNode* nodep=modp->stmtsp(); nodep; nodep = nodep->nextp()) {
if (AstCell* cellp=nodep->castCell()) {
ofp()->putsCellDecl(modClassName(cellp->modp()), cellp->name());
}
putsDecoration("// CELLS\n");
if (modp->isTop()) puts("// Public to allow access to /*verilator_public*/ items;\n");
if (modp->isTop()) puts("// otherwise the application code can consider these internals.\n");
for (AstNode* nodep=modp->stmtsp(); nodep; nodep = nodep->nextp()) {
if (AstCell* cellp=nodep->castCell()) {
ofp()->putsCellDecl(modClassName(cellp->modp()), cellp->name());
}
}
@ -1958,7 +1941,7 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
if (modp->isTop()) puts("/// Destroy the model; called (often implicitly) by application code\n");
puts("~"+modClassName(modp)+"();\n");
}
if (v3Global.opt.trace() && !optSystemPerl()) {
if (v3Global.opt.trace()) {
if (modp->isTop()) puts("/// Trace signals in the model; called by application code\n");
puts("void trace (VerilatedVcdC* tfp, int levels, int options=0);\n");
if (modp->isTop() && optSystemC()) {
@ -1968,7 +1951,6 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
}
puts("\n// USER METHODS\n");
if (optSystemPerl()) puts("/*AUTOMETHODS*/\n");
emitTextSection(AstType::atScInt);
puts("\n// API METHODS\n");
@ -1995,7 +1977,7 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
emitIntFuncDecls(modp);
if (!optSystemPerl() && v3Global.opt.trace()) {
if (v3Global.opt.trace()) {
ofp()->putsPrivate(false); // public:
puts("static void traceInit ("+v3Global.opt.traceClassBase()+"* vcdp, void* userthis, uint32_t code);\n");
puts("static void traceFull ("+v3Global.opt.traceClassBase()+"* vcdp, void* userthis, uint32_t code);\n");
@ -2019,18 +2001,12 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
}
// finish up h-file
if (!optSystemPerl()) {
puts("#endif /*guard*/\n");
}
puts("#endif /*guard*/\n");
}
//----------------------------------------------------------------------
void EmitCImp::emitImp(AstNodeModule* modp) {
if (optSystemPerl()) {
puts("//############################################################\n");
puts("#sp implementation\n");
}
ofp()->printf("#include \"%-20s // For This\n",
(modClassName(modp)+".h\"").c_str());
@ -2042,11 +2018,6 @@ void EmitCImp::emitImp(AstNodeModule* modp) {
puts("#include \"verilated_dpi.h\"\n");
}
if (optSystemPerl() && (splitFilenum() || !m_fast)) {
puts("\n");
puts("SP_MODULE_CONTINUED("+modClassName(modp)+");\n");
}
emitTextSection(AstType::atScImpHdr);
if (m_slow && splitFilenum()==0) {
@ -2078,13 +2049,6 @@ void EmitCImp::emitImp(AstNodeModule* modp) {
}
}
if (m_fast && splitFilenum()==0) {
if (v3Global.opt.trace() && optSystemPerl() && m_modp->isTop()) {
puts("\n");
puts("\n/*AUTOTRACE(__MODULE__,recurse,activity,exists)*/\n\n");
}
}
// Blocks
puts("\n//--------------------\n");
puts("// Internal Methods\n");
@ -2102,15 +2066,7 @@ void EmitCImp::main(AstNodeModule* modp, bool slow, bool fast) {
UINFO(0," Emitting "<<modClassName(modp)<<endl);
}
if (optSystemPerl()) {
m_ofp = newOutCFile(modp, !m_fast, true);
if (m_fast) {
puts("#sp interface\n");
emitInt (modp);
}
}
else if (optSystemC()) {
if (optSystemC()) {
if (m_fast) {
m_ofp = newOutCFile (modp, !m_fast, false/*source*/);
emitInt (modp);
@ -2175,11 +2131,7 @@ class EmitCTrace : EmitCStmts {
void emitTraceHeader() {
// Includes
if (optSystemPerl()) {
puts("#include \"SpTraceVcd.h\"\n");
} else {
puts("#include \"verilated_vcd_c.h\"\n");
}
puts("#include \"verilated_vcd_c.h\"\n");
puts("#include \""+ symClassName() +".h\"\n");
puts("\n");
}
@ -2188,11 +2140,7 @@ class EmitCTrace : EmitCStmts {
puts("\n//======================\n\n");
puts("void "+topClassName()+"::trace (");
if (optSystemPerl()) {
puts("SpTraceFile* tfp, int, int) {\n");
} else {
puts("VerilatedVcdC* tfp, int, int) {\n");
}
puts("VerilatedVcdC* tfp, int, int) {\n");
puts( "tfp->spTrace()->addCallback ("
"&"+topClassName()+"::traceInit"
+", &"+topClassName()+"::traceFull"
@ -2209,7 +2157,7 @@ class EmitCTrace : EmitCStmts {
puts("vcdp->scopeEscape(' ');\n");
puts("t->traceInitThis (vlSymsp, vcdp, code);\n");
puts("vcdp->scopeEscape('.');\n"); // Restore so SystemPerl traced files won't break
puts("vcdp->scopeEscape('.');\n"); // Restore so later traced files won't break
puts("}\n");
splitSizeInc(10);

View File

@ -46,7 +46,6 @@ public:
void putsDecoration(const string& str) { if (v3Global.opt.decoration()) puts(str); }
void putsQuoted(const string& str) { ofp()->putsQuoted(str); }
bool optSystemC() { return v3Global.opt.systemC(); }
bool optSystemPerl() { return v3Global.opt.systemPerl(); }
static string symClassName() { return v3Global.opt.prefix()+"__Syms"; }
static string symClassVar() { return symClassName()+"* __restrict vlSymsp"; }
static string symTopAssign() { return v3Global.opt.prefix()+"* __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;"; }

View File

@ -90,15 +90,10 @@ public:
if (v3Global.opt.coverage()) {
putMakeClassEntry(of, "verilated_cov.cpp");
}
if (v3Global.opt.systemPerl()) {
putMakeClassEntry(of, "Sp.cpp"); // Note Sp.cpp includes SpTraceVcdC
}
else {
if (v3Global.opt.trace()) {
putMakeClassEntry(of, "verilated_vcd_c.cpp");
if (v3Global.opt.systemC()) {
putMakeClassEntry(of, "verilated_vcd_sc.cpp");
}
if (v3Global.opt.trace()) {
putMakeClassEntry(of, "verilated_vcd_c.cpp");
if (v3Global.opt.systemC()) {
putMakeClassEntry(of, "verilated_vcd_sc.cpp");
}
}
}
@ -139,22 +134,16 @@ public:
of.puts("PERL = "+V3Options::getenvPERL()+"\n");
of.puts("# Path to Verilator kit (from $VERILATOR_ROOT)\n");
of.puts("VERILATOR_ROOT = "+V3Options::getenvVERILATOR_ROOT()+"\n");
of.puts("# Path to SystemPerl kit top (from $SYSTEMPERL)\n");
of.puts("SYSTEMPERL = "+V3Options::getenvSYSTEMPERL()+"\n");
of.puts("# Path to SystemPerl kit includes (from $SYSTEMPERL_INCLUDE)\n");
of.puts("SYSTEMPERL_INCLUDE = "+V3Options::getenvSYSTEMPERL_INCLUDE()+"\n");
of.puts("# SystemC include directory with systemc.h (from $SYSTEMC_INCLUDE)\n");
of.puts(string("SYSTEMC_INCLUDE ?= ")+V3Options::getenvSYSTEMC_INCLUDE()+"\n");
of.puts("# SystemC library directory with libsystemc.a (from $SYSTEMC_LIBDIR)\n");
of.puts(string("SYSTEMC_LIBDIR ?= ")+V3Options::getenvSYSTEMC_LIBDIR()+"\n");
of.puts("\n### Switches...\n");
of.puts("# SystemPerl output mode? 0/1 (from --sp)\n");
of.puts(string("VM_SP = ")+(v3Global.opt.systemPerl()?"1":"0")+"\n");
of.puts("# SystemC output mode? 0/1 (from --sc)\n");
of.puts(string("VM_SC = ")+((v3Global.opt.systemC()&&!v3Global.opt.systemPerl())?"1":"0")+"\n");
of.puts("# SystemPerl or SystemC output mode? 0/1 (from --sp/--sc)\n");
of.puts(string("VM_SP_OR_SC = ")+(v3Global.opt.systemC()?"1":"0")+"\n");
of.puts(string("VM_SC = ")+((v3Global.opt.systemC())?"1":"0")+"\n");
of.puts("# Legacy or SystemC output mode? 0/1 (from --sc)\n");
of.puts(string("VM_SP_OR_SC = $(VM_SC)\n"));
of.puts("# Deprecated\n");
of.puts(string("VM_PCLI = ")+(v3Global.opt.systemC()?"0":"1")+"\n");
of.puts("# Deprecated: SystemC architecture to find link library path (from $SYSTEMC_ARCH)\n");

View File

@ -218,18 +218,6 @@ public:
}
};
class V3OutSpFile : public V3OutCFile {
public:
explicit V3OutSpFile(const string& filename) : V3OutCFile(filename) {}
virtual ~V3OutSpFile() {}
virtual void putsHeader() { puts("// Verilated -*- SystemC -*-\n"); }
virtual void putsIntTopInclude() {
putsForceIncs();
puts("#include \"systemperl.h\"\n");
puts("#include \"verilated_sc.h\"\n");
}
};
class V3OutVFile : public V3OutFile {
public:
explicit V3OutVFile(const string& filename) : V3OutFile(filename, V3OutFormatter::LA_VERILOG) {}

View File

@ -491,52 +491,6 @@ string V3Options::getenvSYSTEMC_LIBDIR() {
return var;
}
string V3Options::getenvSYSTEMPERL() {
// Must be careful to set SYSTEMPERL_INCLUDE first else we'd setenv
// SYSTEMPERL which would override a DEFENVed SYSTEMPERL_INCLUDE.
V3Options::getenvSYSTEMPERL_INCLUDE();
return V3Options::getenvSYSTEMPERLGuts();
}
string V3Options::getenvSYSTEMPERLGuts() {
// Get SYSTEMPERL when SYSTEMPERL_INCLUDE has already been tested
string var = V3Os::getenvStr("SYSTEMPERL","");
if (var == "" && string(DEFENV_SYSTEMPERL) != "") {
var = DEFENV_SYSTEMPERL;
V3Os::setenvStr("SYSTEMPERL", var, "Hardcoded at build time");
}
return var;
}
string V3Options::getenvSYSTEMPERL_INCLUDE() {
string var = V3Os::getenvStr("SYSTEMPERL_INCLUDE","");
if (var == "") {
string sp_src = V3Options::getenvSYSTEMPERLGuts()+"/src";
if (V3Options::fileStatNormal(sp_src+"/systemperl.h")) {
var = sp_src;
V3Os::setenvStr ("SYSTEMPERL_INCLUDE", var, "From $SYSTEMPERL/src");
} else if (string(DEFENV_SYSTEMPERL_INCLUDE) != "") {
// Note if SYSTEMPERL is DEFENVed, then SYSTEMPERL_INCLUDE is also DEFENVed
// So we don't need to sweat testing DEFENV_SYSTEMPERL also
var = DEFENV_SYSTEMPERL_INCLUDE;
V3Os::setenvStr("SYSTEMPERL_INCLUDE", var, "Hardcoded at build time");
}
}
// Only correct or check it if we really need the value
if (v3Global.opt.usingSystemPerlLibs()) {
// We warn about $SYSTEMPERL instead of _INCLUDE since that's more likely
// what users will want to set.
if (var == "") {
v3fatal("Need $SYSTEMPERL and $SYSTEMPERL_INCLUDE in environment for --sp or --coverage\n"
"Probably System-Perl isn't installed, see http://www.veripool.org/systemperl\n");
}
else if (var != "" && !V3Options::fileStatNormal(var+"/systemperl.h")) {
v3fatal("Neither $SYSTEMPERL nor $SYSTEMPERL_INCLUDE environment vars to point to System-Perl kit: "<<var<<endl);
}
}
return var;
}
string V3Options::getenvVERILATOR_ROOT() {
string var = V3Os::getenvStr("VERILATOR_ROOT","");
if (var == "" && string(DEFENV_VERILATOR_ROOT) != "") {
@ -683,7 +637,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
else if ( onoff (sw, "-autoflush", flag/*ref*/) ) { m_autoflush = flag; }
else if ( onoff (sw, "-bbox-sys", flag/*ref*/) ) { m_bboxSys = flag; }
else if ( onoff (sw, "-bbox-unsup", flag/*ref*/) ) { m_bboxUnsup = flag; }
else if ( !strcmp (sw, "-cc") ) { m_outFormatOk = true; m_systemC = false; m_systemPerl = false; }
else if ( !strcmp (sw, "-cc") ) { m_outFormatOk = true; m_systemC = false; }
else if ( onoff (sw, "-cdc", flag/*ref*/) ) { m_cdc = flag; }
else if ( onoff (sw, "-coverage", flag/*ref*/) ) { coverage(flag); }
else if ( onoff (sw, "-coverage-line", flag/*ref*/) ){ m_coverageLine = flag; }
@ -714,9 +668,8 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
else if ( onoff (sw, "-report-unoptflat", flag/*ref*/) ) { m_reportUnoptflat = flag; }
else if ( onoff (sw, "-relative-includes", flag/*ref*/) ) { m_relativeIncludes = flag; }
else if ( onoff (sw, "-savable", flag/*ref*/) ) { m_savable = flag; }
else if ( !strcmp (sw, "-sc") ) { m_outFormatOk = true; m_systemC = true; m_systemPerl = false; }
else if ( !strcmp (sw, "-sc") ) { m_outFormatOk = true; m_systemC = true; }
else if ( onoff (sw, "-skip-identical", flag/*ref*/) ) { m_skipIdentical = flag; }
else if ( !strcmp (sw, "-sp-deprecated") ) { m_outFormatOk = true; m_systemC = true; m_systemPerl = true; } // Undocumented, old
else if ( onoff (sw, "-stats", flag/*ref*/) ) { m_stats = flag; }
else if ( onoff (sw, "-stats-vars", flag/*ref*/) ) { m_statsVars = flag; m_stats |= flag; }
else if ( !strcmp (sw, "-sv") ) { m_defaultLanguage = V3LangCode::L1800_2005; }
@ -1179,8 +1132,6 @@ void V3Options::showVersion(bool verbose) {
cout << " SYSTEMC_ARCH = " << DEFENV_SYSTEMC_ARCH<<endl;
cout << " SYSTEMC_INCLUDE = " << DEFENV_SYSTEMC_INCLUDE<<endl;
cout << " SYSTEMC_LIBDIR = " << DEFENV_SYSTEMC_LIBDIR<<endl;
cout << " SYSTEMPERL = " << DEFENV_SYSTEMPERL<<endl;
cout << " SYSTEMPERL_INCLUDE = " << DEFENV_SYSTEMPERL_INCLUDE<<endl;
cout << " VERILATOR_ROOT = " << DEFENV_VERILATOR_ROOT<<endl;
cout <<endl;
@ -1190,8 +1141,6 @@ void V3Options::showVersion(bool verbose) {
cout << " SYSTEMC_ARCH = " << V3Os::getenvStr("SYSTEMC_ARCH","")<<endl;
cout << " SYSTEMC_INCLUDE = " << V3Os::getenvStr("SYSTEMC_INCLUDE","")<<endl;
cout << " SYSTEMC_LIBDIR = " << V3Os::getenvStr("SYSTEMC_LIBDIR","")<<endl;
cout << " SYSTEMPERL = " << V3Os::getenvStr("SYSTEMPERL","")<<endl;
cout << " SYSTEMPERL_INCLUDE = " << V3Os::getenvStr("SYSTEMPERL_INCLUDE","")<<endl;
cout << " VERILATOR_ROOT = " << V3Os::getenvStr("VERILATOR_ROOT","")<<endl;
cout << " VERILATOR_BIN = " << V3Os::getenvStr("VERILATOR_BIN","")<<endl; // wrapper uses this
}
@ -1235,7 +1184,6 @@ V3Options::V3Options() {
m_stats = false;
m_statsVars = false;
m_systemC = false;
m_systemPerl = false;
m_trace = false;
m_traceDups = false;
m_traceParams = true;

View File

@ -93,7 +93,6 @@ class V3Options {
bool m_savable; // main switch: --savable
bool m_systemC; // main switch: --sc: System C instead of simple C++
bool m_skipIdentical;// main switch: --skip-identical
bool m_systemPerl; // main switch: --sp: System Perl instead of SystemC (m_systemC also set)
bool m_stats; // main switch: --stats
bool m_statsVars; // main switch: --stats-vars
bool m_trace; // main switch: --trace
@ -179,8 +178,6 @@ class V3Options {
bool parseLangExt(const char* swp, const char* langswp, const V3LangCode& lc);
string filePathCheckOneDir(const string& modname, const string& dirname);
static string getenvSYSTEMPERLGuts();
V3Options(const V3Options&); ///< N/A, no copy constructor
public:
@ -212,9 +209,7 @@ class V3Options {
string bin() const { return m_bin; }
string flags() const { return m_flags; }
bool systemC() const { return m_systemC; }
bool systemPerl() const { return m_systemPerl; }
bool usingSystemCLibs() const { return !lintOnly() && (systemPerl() || systemC()); }
bool usingSystemPerlLibs() const { return !lintOnly() && systemPerl(); }
bool usingSystemCLibs() const { return !lintOnly() && systemC(); }
bool savable() const { return m_savable; }
bool skipIdentical() const { return m_skipIdentical; }
bool stats() const { return m_stats; }
@ -319,7 +314,7 @@ class V3Options {
bool oTable() const { return m_oTable; }
// METHODS (uses above)
string traceClassBase() const { return systemPerl() ? "SpTraceVcd" : "VerilatedVcd"; }
string traceClassBase() const { return "VerilatedVcd"; }
// METHODS (from main)
static string version();
@ -339,8 +334,6 @@ class V3Options {
static string getenvSYSTEMC_ARCH();
static string getenvSYSTEMC_INCLUDE();
static string getenvSYSTEMC_LIBDIR();
static string getenvSYSTEMPERL();
static string getenvSYSTEMPERL_INCLUDE();
static string getenvVERILATOR_ROOT();
// METHODS (file utilities using these options)

View File

@ -568,8 +568,6 @@ int main(int argc, char** argv, char** env) {
V3Options::getenvSYSTEMC_ARCH();
V3Options::getenvSYSTEMC_INCLUDE();
V3Options::getenvSYSTEMC_LIBDIR();
V3Options::getenvSYSTEMPERL();
V3Options::getenvSYSTEMPERL_INCLUDE();
V3Error::abortIfErrors();

View File

@ -53,12 +53,6 @@
#ifndef DEFENV_SYSTEMC_LIBDIR
# define DEFENV_SYSTEMC_LIBDIR ""
#endif
#ifndef DEFENV_SYSTEMPERL
# define DEFENV_SYSTEMPERL ""
#endif
#ifndef DEFENV_SYSTEMPERL_INCLUDE
# define DEFENV_SYSTEMPERL_INCLUDE ""
#endif
#ifndef DEFENV_VERILATOR_ROOT
# define DEFENV_VERILATOR_ROOT ""
#endif

View File

@ -15,7 +15,7 @@
default: $(VM_PREFIX)
ifneq ($(MAKE_MAIN),0)
# Add main to classes rather then SP_SRCS to save a compiler run
# Add main to classes rather then SC_SRCS to save a compiler run
VM_CLASSES += ${VM_PREFIX}__main $(VM_USER_CLASSES) $(VM_GLOBAL_FAST) $(VM_GLOBAL_SLOW)
endif
@ -38,7 +38,7 @@ CPPFLAGS += $(CPPFLAGS_ADD)
#######################################################################
# Linking final exe
ifeq ($(VM_SP_OR_SC),1)
ifeq ($(VM_SC),1)
LIBS += $(SC_LIBS)
endif

View File

@ -28,9 +28,6 @@ $Fork = Forker->new(use_sig_child=>1) if !$Fork;
$SIG{CHLD} = sub { $Fork->sig_child() if $Fork; };
$SIG{TERM} = sub { $Fork->kill_tree_all('TERM') if $Fork; die "Quitting...\n"; };
our $Have_System_Perl;
eval "use SystemC::Netlist; \$Have_System_Perl=1;";
#======================================================================
#======================================================================
@ -507,7 +504,6 @@ sub compile_vlt_flags {
@{$param{verilator_flags2}},
@{$param{verilator_flags3}});
$self->{sc} = 1 if ($checkflags =~ /-sc\b/);
$self->{sp} = 1 if ($checkflags =~ /-sp\b/);
$self->{trace} = 1 if ($opt_trace || $checkflags =~ /-trace\b/);
$self->{savable} = 1 if ($checkflags =~ /-savable\b/);
$self->{coverage} = 1 if ($checkflags =~ /-coverage\b/);
@ -663,7 +659,7 @@ sub compile {
elsif ($param{vlt}) {
my @cmdargs = $self->compile_vlt_flags(%param);
if ($self->sc_or_sp && !defined $ENV{SYSTEMC} && !defined $ENV{SYSTEMC_INCLUDE}) {
if ($self->sc && !defined $ENV{SYSTEMC} && !defined $ENV{SYSTEMC_INCLUDE}) {
$self->skip("Test requires SystemC; ignore error since not installed\n");
return 1;
}
@ -680,9 +676,6 @@ sub compile {
return 1 if $self->errors || $self->skips || $self->unsupporteds;
if (!$param{fails} && $param{verilator_make_gcc}) {
if ($self->sp) {
$self->_sp_preproc(%param);
}
$self->oprint("GCC\n");
$self->_run(logfile=>"$self->{obj_dir}/vlt_gcc.log",
cmd=>["cd $self->{obj_dir} && ",
@ -908,20 +901,11 @@ sub v_suffix {
return $self->{vhdl} ? "vhdl" : "v";
}
sub sp {
my $self = (ref $_[0]? shift : $Self);
return $self->{sp};
}
sub sc {
my $self = (ref $_[0]? shift : $Self);
return $self->{sc};
}
sub sc_or_sp {
return sc($_[0]) || sp($_[0]);
}
#----------------------------------------------------------------------
sub _run {
@ -1059,13 +1043,11 @@ sub _make_main {
print $fh "// General headers\n";
print $fh "#include \"verilated.h\"\n";
print $fh "#include \"systemc.h\"\n" if $self->sc;
print $fh "#include \"systemperl.h\"\n" if $self->sp;
print $fh "#include \"verilated_vcd_c.h\"\n" if $self->{trace} && !$self->sp;
print $fh "#include \"verilated_vcd_c.h\"\n" if $self->{trace};
print $fh "#include \"verilated_save.h\"\n" if $self->{savable};
print $fh "#include \"SpTraceVcd.h\"\n" if $self->{trace} && $self->sp;
print $fh "$VM_PREFIX * topp;\n";
if (!$self->sc_or_sp) {
if (!$self->sc) {
print $fh "vluint64_t main_time = false;\n";
print $fh "double sc_time_stamp () {\n";
print $fh " return main_time;\n";
@ -1094,7 +1076,7 @@ sub _make_main {
}
#### Main
if ($self->sc_or_sp) {
if ($self->sc) {
print $fh "extern int sc_main(int argc, char **argv);\n";
print $fh "int sc_main(int argc, char **argv) {\n";
print $fh " sc_signal<bool> fastclk;\n" if $self->{inputs}{fastclk};
@ -1109,11 +1091,7 @@ sub _make_main {
print $fh " Verilated::randReset(".$self->{verilated_randReset}.");\n" if defined $self->{verilated_randReset};
print $fh " topp = new $VM_PREFIX (\"top\");\n";
my $set;
if ($self->sp) {
print $fh " SP_PIN(topp,fastclk,fastclk);\n" if $self->{inputs}{fastclk};
print $fh " SP_PIN(topp,clk,clk);\n" if $self->{inputs}{clk};
$set = "";
} elsif ($self->sc) {
if ($self->sc) {
print $fh " topp->fastclk(fastclk);\n" if $self->{inputs}{fastclk};
print $fh " topp->clk(clk);\n" if $self->{inputs}{clk};
$set = "";
@ -1126,14 +1104,10 @@ sub _make_main {
$fh->print("\n");
$fh->print("#if VM_TRACE\n");
$fh->print(" Verilated::traceEverOn(true);\n");
if ($self->{sp}) {
$fh->print(" SpTraceFile* tfp = new SpTraceFile;\n");
} else {
$fh->print(" VerilatedVcdC* tfp = new VerilatedVcdC;\n");
}
$fh->print(" VerilatedVcdC* tfp = new VerilatedVcdC;\n");
$fh->print(" topp->trace (tfp, 99);\n");
$fh->print(" tfp->open (\"$self->{obj_dir}/simx.vcd\");\n");
if ($self->{trace} && !$self->sc_or_sp) {
if ($self->{trace} && !$self->sc) {
$fh->print(" if (tfp) tfp->dump (main_time);\n");
}
$fh->print("#endif\n");
@ -1209,11 +1183,10 @@ sub _print_advance_time {
my $action = shift;
my $set;
if ($self->sp) { $set = ""; }
elsif ($self->sc) { $set = ""; }
if ($self->sc) { $set = ""; }
else { $set = "topp->"; }
if ($self->sc_or_sp) {
if ($self->sc) {
print $fh "#if (SYSTEMC_VERSION>=20070314)\n";
print $fh " sc_start(${time},SC_NS);\n";
print $fh "#else\n";
@ -1222,7 +1195,7 @@ sub _print_advance_time {
} else {
if ($action) {
print $fh " ${set}eval();\n";
if ($self->{trace} && !$self->sc_or_sp) {
if ($self->{trace} && !$self->sc) {
$fh->print("#if VM_TRACE\n");
$fh->print(" if (tfp) tfp->dump (main_time);\n");
$fh->print("#endif //VM_TRACE\n");
@ -1350,22 +1323,6 @@ sub _make_top_vhdl {
#######################################################################
sub _sp_preproc {
my $self = shift;
my %param = (%{$self}, @_); # Default arguments are from $self
$self->oprint("Preproc\n");
$self->_run(logfile=>"simx.log",
fails=>0,
cmd=>["cd $self->{obj_dir} ; sp_preproc",
"--preproc",
"$self->{VM_PREFIX}.sp",
]);
}
#######################################################################
sub _read_inputs_v {
my $self = shift;
my $filename = $self->top_filename;

View File

@ -201,7 +201,6 @@ our $Opt_NumOps = 30;
our $Opt_Depth = 4;
our $Opt_Signed = 1;
our $Opt_Raise;
our $Opt_Sc;
our $Opt_BlockStmts = 2;
our $Signed_Pct = 60;
$Debug = 0;
@ -214,7 +213,6 @@ if (! GetOptions (
"raise=i" => \$Opt_Raise,
"seed=i" => \$opt_seed,
"signed!" => \$Opt_Signed,
"sc!" => \$Opt_Sc,
"<>" => \&parameter,
)) {
usage();
@ -230,8 +228,7 @@ srand($opt_seed);
init();
selftest();
gentest();
write_output_sc("vgen.cpp") if $Opt_Sc;
write_output_v("vgen.v") if !$Opt_Sc;
write_output_v("vgen.v");
#----------------------------------------------------------------------
@ -262,8 +259,6 @@ sub init {
gen_v($opref);
gen_pl($opref);
gen_rnd($opref);
$opref->{weight} = 0 if $Opt_Sc && !$opref->{sc};
$opref->{weight} = 2 if $Opt_Sc && $op eq 'VCONST';
}
raise();
}
@ -345,12 +340,6 @@ sub rnd_width {
|| (($v<50) && 95)
|| (($v<55) && 96)
|| (rnd(128)+1));
if ($Opt_Sc) {
$n = (0
#|| (($v<50) && 32)
|| (32));
#(!$max) or die "%Error: --sc max must 32/64/96,";
}
if ($max && $n>=$max) { $n = rnd($max-1)+1; }
return $n;
}
@ -549,87 +538,6 @@ sub write_output_v {
$fh->close();
}
sub write_output_sc {
my $filename = shift;
my $fh = IO::File->new($filename, "w") or die("%Error: $! $filename,\n");
print $fh "// -*- SystemC -*-\n";
print $fh "// Created by: $Rerun_Args\n";
# Classes
foreach my $block (@Blocks) {
print $fh "class $block->{name};\n";
}
print $fh "\n";
# Headers
print $fh "//".('='x60)."\n";
print $fh "SC_MODULE(Vgen) {\n";
print $fh "public:\n";
print $fh " sc_in_clk clk;\n";
print $fh " sc_in<bool> check;\n";
print $fh " static const int CYCLES /*verilator public*/ = ",$#Blocks+3,";\n";
print $fh "\n";
foreach my $var (sort (keys %Vars)) {
print $fh "",decl_text ($var,"sc_signal"),"\n";
}
print $fh "\n";
foreach my $block (@Blocks) {
print $fh " $block->{name}* ".lc($block->{name}).";\n";
}
print $fh " SC_CTOR(Vgen);\n";
print $fh "};\n\n";
# Sub Interface
print $fh "//".('='x60)."\n";
foreach my $block (@Blocks) {
print $fh "SC_MODULE($block->{name}) {\n";
print $fh "public:\n";
print $fh " sc_in_clk clk;\n";
print $fh " sc_in<bool> check;\n";
foreach my $var (@{$block->{inputs}}) {
print $fh "",decl_text ($var,"sc_in"),"\n";
}
foreach my $var (@{$block->{outputs}}) {
print $fh "",decl_text ($var,"sc_out"),"\n";
}
print $fh " SC_CTOR($block->{name});\n";
print $fh " void clkPosedge();\n";
print $fh "};\n\n";
}
# Implementation
print $fh "//".('='x60)."\n";
print $fh "SP_CTOR_IMP(Vgen) : clk(\"clk\"), check(\"check\") {\n";
foreach my $block (@Blocks) {
print $fh " //\n";
print $fh " SP_CELL (".lc($block->{name}).", $block->{name});\n";
print $fh " SP_PIN (".lc($block->{name}).", clk, clk);\n";
print $fh " SP_PIN (".lc($block->{name}).", check, check);\n";
foreach my $var (@{$block->{inputs}}, @{$block->{outputs}}, ) {
print $fh " SP_PIN (".lc($block->{name}).", $var, $var);\n";
}
}
print $fh "}\n\n";
# Sub Implementations
print $fh "//".('='x60)."\n";
foreach my $block (@Blocks) {
print $fh "SP_CTOR_IMP($block->{name}) {\n";
print $fh " SC_METHOD(clkPosedge);\n";
print $fh " sensitive << clk.pos();\n";
print $fh "}\n\n";
print $fh "void $block->{name}::clkPosedge() {\n";
print $fh @{$block->{preass}};
print $fh @{$block->{body}};
print $fh "}\n\n";
}
$fh->close();
}
######################################################################
sub callers {
@ -824,7 +732,7 @@ sub gen_rnd {
}
sub stop_text {
return $Opt_Sc?'USTOP()':'$stop';
return '$stop';
}
sub decl_text {
@ -832,23 +740,14 @@ sub decl_text {
my $decl_with = shift;
my $varref = $Vars{$var};
if ($Opt_Sc) {
(!$varref->{signed}) or die "%Error: No signed SystemC yet\n";
my $type = (( ($varref->{val}->Size == 32) && "sc_dt::uint32")
|| (($varref->{val}->Size == 64) && "sc_dt::uint64"));
$type or die "%Error: Unknown Size ".$varref->{val}->Size,",";
return sprintf " %s<%s> %s; //=%s"
, $decl_with, $type, $var, $varref->{val}->to_Hex;
} else {
return sprintf " reg %s [%3d:%3d] %s %s; //=%d'h%s"
, ($varref->{signed}?"signed":" ")
, ($varref->{val}->Size)-1+$VarAttrs{$var}{lsb},
, $VarAttrs{$var}{lsb}
, $var
, (rnd(100)<30 ? "/*verilator public*/":(" "x length("/*verilator public*/")))
, $varref->{val}->Size
, lc $varref->{val}->to_Hex;
}
return sprintf (" reg %s [%3d:%3d] %s %s; //=%d'h%s"
, ($varref->{signed}?"signed":" ")
, ($varref->{val}->Size)-1+$VarAttrs{$var}{lsb},
, $VarAttrs{$var}{lsb}
, $var
, (rnd(100)<30 ? "/*verilator public*/":(" "x length("/*verilator public*/")))
, $varref->{val}->Size
, lc $varref->{val}->to_Hex);
}
#######################################################################
@ -1057,15 +956,9 @@ sub val_to_text {
my $treeref = shift;
my $val = lc $treeref->{val}->to_Hex();
$val = "0" if $treeref->{val}->is_empty;
if ($Opt_Sc) {
return ("0x".$val
.(($treeref->{width}>32)?"ULL":"UL")
);
} else {
return ($treeref->{width}
.($treeref->{signed}?"'sh":"'h")
.$val);
}
return ($treeref->{width}
.($treeref->{signed}?"'sh":"'h")
.$val);
}
sub tree_dump {
@ -1119,10 +1012,6 @@ Number of operations to create.
Pick the specified number of random opcodes, and raise their frequency.
=item --sc
Output SystemC code (Experimental).
=item --seed
Seed for the random number generator. Defaults to 5, 0=randomize.
@ -1154,6 +1043,6 @@ Wilson Snyder <wsnyder@wsnyder.org>
######################################################################
### Local Variables:
### compile-command: "./vgen.pl -sc --depth=10 --blockstmts=10"
### compile-command: "./vgen.pl --depth=10 --blockstmts=10"
### compile-command: "make "
### End: