Go to the documentation of this file.
58 cleanName(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')
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;
175 std::string clean_name = cleanName(
name);
186 p.second->output(
p.first,
os);
188 os <<
"$upscope $end" << std::endl;
191 template <
typename T>
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;
341 addNewTraceVal<VcdTraceValBool>(
v,
name);
344 template <
typename T>
350 std::string
vcdType()
override {
return "real"; }
362 addNewTraceVal<VcdTraceValFloat<float>>(
v,
name);
367 addNewTraceVal<VcdTraceValFloat<double>>(
v,
name);
389 addNewTraceVal<VcdTraceValScLogic>(
v,
name);
392 template <
typename T>
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)
423 addNewTraceVal<VcdTraceValFinite<sc_dt::sc_int_base>>(
v,
name);
427 const std::string &
name)
429 addNewTraceVal<VcdTraceValFinite<sc_dt::sc_uint_base>>(
v,
name);
435 addNewTraceVal<VcdTraceValFinite<sc_dt::sc_signed>>(
v,
name);
439 const std::string &
name)
441 addNewTraceVal<VcdTraceValFinite<sc_dt::sc_unsigned>>(
v,
name);
444 template <
typename T>
467 addNewTraceVal<VcdTraceValLogic<::sc_dt::sc_bv_base>>(
v,
name);
472 addNewTraceVal<VcdTraceValLogic<::sc_dt::sc_lv_base>>(
v,
name);
475 template <
typename T>
481 std::string
vcdType()
override {
return "real"; }
494 addNewTraceVal<VcdTraceValFxval<sc_dt::sc_fxval>>(
v,
name);
498 const std::string &
name)
500 addNewTraceVal<VcdTraceValFxval<sc_dt::sc_fxval_fast>>(
v,
name);
503 template <
typename T>
513 const int w = this->
width();
516 for (
int i =
w - 1;
i >= 0;
i--)
517 str += this->
value()[
i] ?
'1' :
'0';
526 addNewTraceVal<VcdTraceValFxnum<::sc_dt::sc_fxnum>>(
v,
name);
530 const std::string &
name)
532 addNewTraceVal<VcdTraceValFxnum<::sc_dt::sc_fxnum_fast>>(
v,
name);
540 std::string
vcdType()
override {
return "event"; }
555 addNewTraceVal<VcdTraceValEvent>(
v,
name);
566 std::string
vcdType()
override {
return "time"; }
591 addNewTraceVal<VcdTraceValTime>(
v,
name);
594 template <
typename T>
603 const int w = this->
width();
611 for (
int i = 0;
i <
w;
i++)
614 for (
int i = 0;
i <
w;
i++)
626 addNewTraceVal<VcdTraceValInt<unsigned char>>(
v,
name,
width);
631 addNewTraceVal<VcdTraceValInt<char>>(
v,
name,
width);
637 addNewTraceVal<VcdTraceValInt<unsigned short>>(
v,
name,
width);
642 addNewTraceVal<VcdTraceValInt<short>>(
v,
name,
width);
648 addNewTraceVal<VcdTraceValInt<unsigned int>>(
v,
name,
width);
653 addNewTraceVal<VcdTraceValInt<int>>(
v,
name,
width);
659 addNewTraceVal<VcdTraceValInt<unsigned long>>(
v,
name,
width);
664 addNewTraceVal<VcdTraceValInt<long>>(
v,
name,
width);
671 addNewTraceVal<VcdTraceValInt<sc_dt::int64>>(
v,
name,
width);
677 addNewTraceVal<VcdTraceValInt<sc_dt::uint64>>(
v,
name,
width);
682 const char **literals)
692 addNewTraceVal<VcdTraceValInt<unsigned int>>(
v,
name,
bits);
698 stream() <<
"$comment" << std::endl;
699 stream() << comment << std::endl;
700 stream() <<
"$end" << std::endl << std::endl;
void printVal(std::ostream &os, const std::string &rep)
static sc_time from_value(sc_dt::uint64)
std::map< std::string, VcdTraceScope * > scopes
void output(std::ostream &os) override
const std::string & vcdName()
std::string vcdType() override
char scLogicToVcdState(char in)
virtual void output(std::ostream &os)=0
static const int TimeWidth
std::string nextSignalName()
const char * stripLeadingBits(const char *orig)
const std::string to_string(sc_enc enc)
void output(std::ostream &os) override
void trace(bool delta) override
void output(std::ostream &os) override
std::string csprintf(const char *format, const Args &...args)
void ccprintf(cp::Print &print)
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
char _nextName[NextNameChars+1]
VcdTraceVal(const T *t, const std::string &vcd_name, int width)
void output(std::ostream &os) override
#define SC_REPORT_ERROR(msg_type, msg)
void output(const std::string &name, std::ostream &os)
void output(std::ostream &os) override
void vcdName(const std::string &vcd_name)
static const int NextNameChars
uint64_t Tick
Tick count type.
VcdTraceValBase(int width)
void output(std::ostream &os) override
sc_dt::uint64 value() const
const char * sc_version()
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
void addTraceVal(const bool *v, const std::string &name) override
void writeComment(const std::string &comment) override
virtual std::string vcdType()
const std::string & name()
void output(std::ostream &os) override
void output(std::ostream &os) override
std::vector< std::pair< std::string, VcdTraceValBase * > > values
std::string vcdType() override
std::string vcdType() override
void output(std::ostream &os) override
void addValue(const std::string &name, VcdTraceValBase *value)
std::vector< VcdTraceValBase * > traceVals
gem5::Tick lastPrintedTime
void output(std::ostream &os) override
std::string vcdType() override
double s
These variables equal the number of ticks in the unit of time they're named after in a double.
Generated on Thu Jun 16 2022 10:42:09 for gem5 by doxygen 1.8.17