58cleanName(std::string
name)
60 for (
int i = 0;
i <
name.length();
i++) {
63 else if (
name[i] ==
']')
79 const char first = orig[0];
81 if (first !=
'z' && first !=
'x' && first !=
'0')
84 const char *res = orig;
85 while (*++res == first) {}
87 if (first !=
'0' || *res !=
'1')
122 os << rep <<
vcdName() << std::endl;;
137 virtual std::string
vcdType() {
return "wire"; }
139 virtual void output(std::ostream &os) = 0;
145 size_t pos =
name.find_first_of(
'.');
146 if (pos == std::string::npos) {
149 std::string sname =
name.substr(0, pos);
150 auto it =
scopes.find(sname);
153 it->second->addValue(
name.substr(pos + 1), value);
160 os <<
"$scope module " <<
name <<
" $end" << std::endl;
163 const std::string &
name = p.first;
166 int w = value->
width();
175 std::string clean_name = cleanName(
name);
186 p.second->output(p.first, os);
188 os <<
"$upscope $end" << std::endl;
217 }
while (carry && pos >= 0);
228 stream() <<
"$date" << std::endl;
231 struct tm *p_tm = localtime(&long_time);
232 stream() << std::put_time(p_tm,
" %b %d, %Y %H:%M:%S\n");
233 stream() <<
"$end" << std::endl << std::endl;
236 stream() <<
"$version" << std::endl;
238 stream() <<
"$end" << std::endl << std::endl;
241 stream() <<
"$timescale" << std::endl;
244 stream() <<
"$end" << std::endl << std::endl;
251 stream() <<
"$enddefinitions $end" << std::endl << std::endl;
255 std::string timedump_comment =
257 "%g sec = %g timescale units.",
264 stream() <<
"$dumpvars" << std::endl;
267 stream() <<
"$end" << std::endl << std::endl;
310 bool time_printed =
false;
350 std::string
vcdType()
override {
return "real"; }
409 const int w = this->
width();
412 for (
int i = w - 1; i >= 0; i--)
413 str += this->
value()[i].to_bool() ?
'1' :
'0';
421 const std::string &
name)
427 const std::string &
name)
439 const std::string &
name)
481 std::string
vcdType()
override {
return "real"; }
498 const std::string &
name)
513 const int w = this->
width();
516 for (
int i = w - 1; i >= 0; i--)
517 str += this->
value()[i] ?
'1' :
'0';
530 const std::string &
name)
540 std::string
vcdType()
override {
return "event"; }
566 std::string
vcdType()
override {
return "time"; }
603 const int w = this->
width();
611 for (
int i = 0; i < w; i++)
614 for (
int i = 0; i < w; i++)
615 str[i] =
gem5::bits(val, w - i - 1) ?
'1' :
'0';
682 const char **literals)
689 while (count >> bits)
698 stream() <<
"$comment" << std::endl;
699 stream() << comment << std::endl;
700 stream() <<
"$end" << std::endl << std::endl;
static sc_time from_value(sc_dt::uint64)
sc_dt::uint64 value() const
void writeComment(const std::string &comment) override
void addTraceVal(const bool *v, const std::string &name) override
char _nextName[NextNameChars+1]
static const int NextNameChars
std::vector< VcdTraceValBase * > traceVals
void addNewTraceVal(const typename TV::TracedType *v, const std::string &name, int width=1)
gem5::Tick lastPrintedTime
std::string nextSignalName()
void trace(bool delta) override
void addValue(const std::string &name, VcdTraceValBase *value)
std::map< std::string, VcdTraceScope * > scopes
std::vector< std::pair< std::string, VcdTraceValBase * > > values
void output(const std::string &name, std::ostream &os)
const char * stripLeadingBits(const char *orig)
char scLogicToVcdState(char in)
VcdTraceValBase(int width)
virtual std::string vcdType()
void printVal(std::ostream &os, const std::string &rep)
void vcdName(const std::string &vcd_name)
const std::string & vcdName()
virtual void output(std::ostream &os)=0
void output(std::ostream &os) override
void output(std::ostream &os) override
std::string vcdType() override
void output(std::ostream &os) override
void output(std::ostream &os) override
std::string vcdType() override
void output(std::ostream &os) override
void output(std::ostream &os) override
std::string vcdType() override
void output(std::ostream &os) override
void output(std::ostream &os) override
void output(std::ostream &os) override
std::string vcdType() override
void output(std::ostream &os) override
static const int TimeWidth
VcdTraceVal(const T *t, const std::string &vcd_name, int width)
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
double s
These variables equal the number of ticks in the unit of time they're named after in a double.
uint64_t Tick
Tick count type.
std::string csprintf(const char *format, const Args &...args)
void ccprintf(cp::Print &print)
const char * sc_version()
#define SC_REPORT_ERROR(msg_type, msg)
const std::string & name()