Patching SystemC is no longer required to trace sc_bvs.

This commit is contained in:
Wilson Snyder 2009-07-07 17:51:00 -04:00
parent 6129452681
commit 8174c1ad02
7 changed files with 66 additions and 15 deletions

View File

@ -3,7 +3,9 @@ Revision history for Verilator
The contributors that suggested a given feature are shown in []. [by ...]
indicates the contributor was also the author of the fix; Thanks!
* Verilator 3.711 2009/**
* Verilator 3.712 2009/**
** Patching SystemC is no longer required to trace sc_bvs.
*** Support zero-width constants in concatenations. [Jeff Winston]

View File

@ -109,8 +109,7 @@ DISTFILES_INC = $(INFOS) .gitignore Artistic COPYING *.in *.ac \
MANIFEST.SKIP \
bin/* \
install-sh configure mkinstalldirs *.texi \
include/verilated.[chv]* \
include/verilatedos.[chv]* \
include/verilated*.[chv]* \
include/*.in \
include/.*ignore \
.*attributes */.*attributes */*/.*attributes \

View File

@ -2337,12 +2337,6 @@ Call Verilated::assertOn(false) before you first call the model, then turn
it back on after reset. It defaults to true. When false, all assertions
controlled by --assert are disabled.
=item Why do I get "undefined reference to `get_datap()'"?
You need to apply the SystemC patches that are provided with the SystemPerl
kit. These enable fast tracing of SystemC sc_bv<> signals. Recompiling
SystemC is not needed, it's just a header change.
=item Why do I get "undefined reference to `sc_time_stamp()'"?
In C++ (non SystemC) code you need to define this function so that the

51
include/verilatedsc.h Normal file
View File

@ -0,0 +1,51 @@
// -*- C++ -*-
//*************************************************************************
//
// Copyright 2009-2009 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License.
// Version 2.0.
//
// Verilator is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//*************************************************************************
///
/// \file
/// \brief Verilator: Common include for all Verilated SystemC files
///
/// This file is included automatically by Verilator at the top of
/// all SystemC files it generates.
///
/// Code available from: http://www.veripool.org/verilator
///
//*************************************************************************
#ifndef _VERILATEDSC_H_
#define _VERILATEDSC_H_ 1 ///< Header Guard
#include "verilatedos.h"
#include "systemc.h"
//=============================================================================
// VL_SC_BV_DATAP
// We want to get a pointer to m_data in the sc_bv_base class,
// but it is protected. So make an exposing class, then use
// cast magic to get at it. Saves patching get_datap in SystemC.
#define VL_SC_BV_DATAP(bv) (VlScBvExposer::sp_datap(bv))
class VlScBvExposer : public sc_bv_base {
public:
static uint32_t* sp_datap(const sc_bv_base& base) {
return static_cast<const VlScBvExposer*>(&base)->sp_datatp(); }
uint32_t* sp_datatp() const { return (uint32_t*)(m_data); }
// Above reads this protected element in sc_bv_base:
// sc_digit* m_data; // data array
};
//=========================================================================
#endif // guard

View File

@ -121,8 +121,7 @@ If you will be using SystemC, download and install System-Perl,
@url{http://search.cpan.org/search?module=SystemC::Netlist}. Note
you'll need to set a @samp{SYSTEMPERL} environment variable to point
to the downloaded kit. Optionally also set @samp{SYSTEMPERL_INCLUDE}
to point to the installed headers. Also, make sure to do a @code{make
sc_patch}.
to point to the installed headers.
@item
@code{cd} to the Verilator directory containing this README.

View File

@ -1885,8 +1885,8 @@ class EmitCTrace : EmitCStmts {
if (nodep->valuep()->castVarRef()) {
AstVarRef* varrefp = nodep->valuep()->castVarRef();
AstVar* varp = varrefp->varp();
if (emitTraceIsScBv(nodep)) puts("(uint32_t*)");
puts("(");
if (emitTraceIsScBv(nodep)) puts("VL_SC_BV_DATAP(");
varrefp->iterate(*this); // Put var name out
if (varp->arraysp()) {
if (arrayindex==-2) puts("[i]");
@ -1894,7 +1894,7 @@ class EmitCTrace : EmitCStmts {
else puts("["+cvtToStr(arrayindex)+"]");
}
if (varp->isSc()) puts(".read()");
if (emitTraceIsScBv(nodep)) puts(".get_datap()");
if (emitTraceIsScBv(nodep)) puts(")");
puts(")");
} else {
puts("(");

View File

@ -68,7 +68,10 @@ public:
V3OutScFile(const string& filename) : V3OutCFile(filename) {}
virtual ~V3OutScFile() {};
virtual void putsHeader() { puts("// Verilated -*- SystemC -*-\n"); }
virtual void putsIntTopInclude() { puts("#include \"systemc.h\"\n"); }
virtual void putsIntTopInclude() {
puts("#include \"systemc.h\"\n");
puts("#include \"verilatedsc.h\"\n");
}
};
class V3OutSpFile : public V3OutCFile {
@ -76,7 +79,10 @@ public:
V3OutSpFile(const string& filename) : V3OutCFile(filename) {}
virtual ~V3OutSpFile() {};
virtual void putsHeader() { puts("// Verilated -*- SystemC -*-\n"); }
virtual void putsIntTopInclude() { puts("#include \"systemperl.h\"\n"); }
virtual void putsIntTopInclude() {
puts("#include \"systemperl.h\"\n");
puts("#include \"verilatedsc.h\"\n");
}
};
class V3OutVFile : public V3OutFile {