55 return (udef & 1) ?
"x" : ((val & 1) ?
"1" :
"0");
59 char *ret =
new char[width + 3];
63 for (
unsigned i = 1; i < width + 1; i++)
65 ret[width + 1 - i] = (udef & 1) ?
'x' : ((val & 1) ?
'1' :
'0');
83 out +=
static_cast<char>(index % 94) + 33;
92 VCD::VCD(
const std::string &file,
const std::string &comment) : dumpstarted_(
false), lasttime_ps(0), file(file)
95 valid_ = out_.is_open();
113 "$timescale 1ps $end\n";
116 dumpvar =
"$enddefinitions $end\n$dumpvars\n";
133 bool VCD::declare(
void *variable,
const std::string &name,
unsigned width,
uint64_t initialvalue,
uint64_t undefined)
137 if (name.size() == 0)
147 if (sigs_.size() >= (94 + 94 * 94 + 94 * 94 * 94 + 94 * 94 * 94 * 94))
149 etiss::log(
etiss::ERROR,
"etiss::interfaces::VCD::declare called for more than supported variables.", *
this);
152 int checked_sig_size =
static_cast<int>(sigs_.size());
153 sigs_.emplace_back();
154 Signal &sig = sigs_.back();
158 sig.
value = initialvalue;
166 std::list<std::string> vec_bd =
etiss::split(name, [](
const std::string &
str,
size_t from,
size_t &seplen) {
167 size_t f1 =
str.find(
".", from);
168 size_t f2 =
str.find(
"::", from);
169 seplen = f1 < f2 ? 1 : 2;
170 return f1 < f2 ? f1 : f2;
172 std::vector<std::string> vec;
173 vec.insert(vec.end(), vec_bd.begin(), vec_bd.end());
176 for (
size_t i = 1; i < vec.size(); i++)
178 out_ <<
"$scope module " << vec[i - 1] <<
" $end\n";
180 out_ <<
"$var wire " << width <<
" " << sig.
ident <<
" " << vec[vec.size() - 1] <<
" $end\n";
181 for (
size_t i = 1; i < vec.size(); i++)
183 out_ <<
"$upscope $end\n";
187 dumpvar = dumpvar +
val2str(initialvalue, width, undefined) + sig.
ident +
"\n";
189 ptr2index_.insert(std::make_pair(variable, (checked_sig_size - 1)));
199 if (time_ps < lasttime_ps)
204 auto findex = ptr2index_.find(variable);
205 if (findex != ptr2index_.end())
207 if (time_ps > lasttime_ps)
210 lasttime_ps = time_ps;
212 int index = findex->second;
213 Signal &sig = sigs_[index];
228 if (lasttime_ps == 0)
234 for (
size_t i = 0; i < sigs_.size(); i++)
244 out_ <<
"#" << lasttime_ps <<
"\n";
245 for (
size_t i = 0; i < sigs_.size(); i++)
250 out_ <<
val2str(
s.value,
s.width,
s.undefined) <<
s.ident <<
"\n";
__device__ __2f16 float bool s
static __inline__ uint64_t
#define ETISS_VERSION_FULL
static std::string index2str(int index)
generated an identifier for the given index
static std::string val2str(uint64_t val, unsigned width, uint64_t udef)
TODO efficient implementation.
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
std::list< std::string > split(const std::string &str, std::function< size_t(const std::string &, size_t, size_t &)> findsplit)
void log(Verbosity level, std::string msg)
write log message at the given level.