Signs of life

This commit is contained in:
Todd Strader 2020-01-18 16:13:30 -05:00
parent 12716bd1e8
commit 285ed67d83

View File

@ -26,6 +26,7 @@
// TODO -- collapse into constructor?
int VerilatedReplay::init() {
createMod();
addSignals();
for (SignalNameMap::iterator it = m_inputNames.begin(); it != m_inputNames.end(); ++it) {
addInputName(it->first);
@ -48,8 +49,6 @@ int VerilatedReplay::init() {
m_inputNames[it->second.fullName].signal);
}
createMod();
return 0;
}
@ -159,6 +158,20 @@ void VerilatedReplay::fstCb(uint64_t time, fstHandle facidx,
// TODO -- remove
VL_PRINTF("%lu %u %s\n", time, facidx, valuep);
// TODO -- is len always right, or should we use strlen() or something?
// TODO -- handle values other than 0/1, what can show up here?
vluint8_t* signal = m_inputHandles[facidx].signal;
vluint8_t byte = 0;
for (size_t bit = 0; bit < len; ++bit) {
char value = valuep[len - 1 - bit];
if (value == '1') byte |= 1 << (bit % 8);
if ((bit + 1) % 8 == 0 || bit == len - 1) {
*signal = byte;
++signal;
byte = 0;
}
}
}
void VerilatedReplay::fstCallbackVarlen(void* userDatap, uint64_t time, fstHandle facidx,