2018-10-02 22:42:53 +00:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
|
|
|
//=============================================================================
|
|
|
|
//
|
2021-03-20 21:46:00 +00:00
|
|
|
// Code available from: https://verilator.org
|
2018-10-02 22:42:53 +00:00
|
|
|
//
|
2022-01-01 13:26:40 +00:00
|
|
|
// Copyright 2001-2022 by Wilson Snyder. This program is free software; you
|
2020-03-21 15:24:24 +00:00
|
|
|
// 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.
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2018-10-02 22:42:53 +00:00
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
///
|
|
|
|
/// \file
|
2021-03-20 21:46:00 +00:00
|
|
|
/// \brief Verilated C++ tracing in FST format implementation code
|
|
|
|
///
|
|
|
|
/// This file must be compiled and linked against all Verilated objects
|
|
|
|
/// that use --trace-fst.
|
|
|
|
///
|
|
|
|
/// Use "verilator --trace-fst" to add this to the Makefile for the linker.
|
2018-10-02 22:42:53 +00:00
|
|
|
///
|
|
|
|
//=============================================================================
|
|
|
|
|
2020-04-13 23:13:10 +00:00
|
|
|
// clang-format off
|
|
|
|
|
2020-02-08 12:09:41 +00:00
|
|
|
#define __STDC_LIMIT_MACROS // UINT64_MAX
|
2018-10-02 22:42:53 +00:00
|
|
|
#include "verilated.h"
|
|
|
|
#include "verilated_fst_c.h"
|
2018-10-14 17:43:24 +00:00
|
|
|
|
2019-05-03 00:33:05 +00:00
|
|
|
// GTKWave configuration
|
2020-04-21 22:49:07 +00:00
|
|
|
#ifdef VL_TRACE_FST_WRITER_THREAD
|
2019-05-03 00:33:05 +00:00
|
|
|
# define HAVE_LIBPTHREAD
|
|
|
|
# define FST_WRITER_PARALLEL
|
|
|
|
#endif
|
|
|
|
|
2018-10-02 22:42:53 +00:00
|
|
|
// Include the GTKWave implementation directly
|
2019-11-16 08:54:05 +00:00
|
|
|
#define FST_CONFIG_INCLUDE "fst_config.h"
|
2018-10-02 22:42:53 +00:00
|
|
|
#include "gtkwave/fastlz.c"
|
2018-10-14 17:43:24 +00:00
|
|
|
#include "gtkwave/fstapi.c"
|
2018-10-02 22:42:53 +00:00
|
|
|
#include "gtkwave/lz4.c"
|
|
|
|
|
2018-10-14 11:04:18 +00:00
|
|
|
#include <algorithm>
|
2018-10-02 22:42:53 +00:00
|
|
|
#include <iterator>
|
2018-10-14 11:04:18 +00:00
|
|
|
#include <sstream>
|
2018-10-02 22:42:53 +00:00
|
|
|
|
|
|
|
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
|
|
|
|
# include <io.h>
|
|
|
|
#else
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2020-04-13 23:13:10 +00:00
|
|
|
// clang-format on
|
|
|
|
|
2021-04-07 13:55:11 +00:00
|
|
|
//=============================================================================
|
|
|
|
// Check that vltscope_t matches fstScopeType
|
2021-07-25 17:38:27 +00:00
|
|
|
|
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_MODULE) == static_cast<int>(VLT_TRACE_SCOPE_MODULE),
|
2021-04-07 13:56:12 +00:00
|
|
|
"VLT_TRACE_SCOPE_MODULE mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_TASK) == static_cast<int>(VLT_TRACE_SCOPE_TASK),
|
2021-04-07 13:56:12 +00:00
|
|
|
"VLT_TRACE_SCOPE_TASK mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_FUNCTION) == static_cast<int>(VLT_TRACE_SCOPE_FUNCTION),
|
2021-04-07 13:55:11 +00:00
|
|
|
"VLT_TRACE_SCOPE_FUNCTION mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_BEGIN) == static_cast<int>(VLT_TRACE_SCOPE_BEGIN),
|
2021-04-07 13:56:12 +00:00
|
|
|
"VLT_TRACE_SCOPE_BEGIN mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_FORK) == static_cast<int>(VLT_TRACE_SCOPE_FORK),
|
2021-04-07 13:56:12 +00:00
|
|
|
"VLT_TRACE_SCOPE_FORK mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_GENERATE) == static_cast<int>(VLT_TRACE_SCOPE_GENERATE),
|
2021-04-07 13:55:11 +00:00
|
|
|
"VLT_TRACE_SCOPE_GENERATE mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_STRUCT) == static_cast<int>(VLT_TRACE_SCOPE_STRUCT),
|
2021-04-07 13:56:12 +00:00
|
|
|
"VLT_TRACE_SCOPE_STRUCT mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_UNION) == static_cast<int>(VLT_TRACE_SCOPE_UNION),
|
2021-04-07 13:56:12 +00:00
|
|
|
"VLT_TRACE_SCOPE_UNION mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_CLASS) == static_cast<int>(VLT_TRACE_SCOPE_CLASS),
|
2021-04-07 13:56:12 +00:00
|
|
|
"VLT_TRACE_SCOPE_CLASS mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_INTERFACE)
|
|
|
|
== static_cast<int>(VLT_TRACE_SCOPE_INTERFACE),
|
2021-04-07 13:55:11 +00:00
|
|
|
"VLT_TRACE_SCOPE_INTERFACE mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_PACKAGE) == static_cast<int>(VLT_TRACE_SCOPE_PACKAGE),
|
2021-04-07 13:56:12 +00:00
|
|
|
"VLT_TRACE_SCOPE_PACKAGE mismatches");
|
2021-07-25 17:38:27 +00:00
|
|
|
static_assert(static_cast<int>(FST_ST_VCD_PROGRAM) == static_cast<int>(VLT_TRACE_SCOPE_PROGRAM),
|
2021-04-07 13:56:12 +00:00
|
|
|
"VLT_TRACE_SCOPE_PROGRAM mismatches");
|
2021-04-07 13:55:11 +00:00
|
|
|
|
2018-10-02 22:42:53 +00:00
|
|
|
//=============================================================================
|
2020-04-19 22:57:36 +00:00
|
|
|
// Specialization of the generics for this trace format
|
2018-10-02 22:42:53 +00:00
|
|
|
|
2020-04-19 22:57:36 +00:00
|
|
|
#define VL_DERIVED_T VerilatedFst
|
|
|
|
#include "verilated_trace_imp.cpp"
|
|
|
|
#undef VL_DERIVED_T
|
2018-10-02 22:42:53 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// VerilatedFst
|
|
|
|
|
|
|
|
VerilatedFst::VerilatedFst(void* fst)
|
2020-08-16 13:55:36 +00:00
|
|
|
: m_fst{fst} {}
|
2018-10-02 22:42:53 +00:00
|
|
|
|
2020-04-08 21:54:35 +00:00
|
|
|
VerilatedFst::~VerilatedFst() {
|
|
|
|
if (m_fst) fstWriterClose(m_fst);
|
2020-08-15 14:12:55 +00:00
|
|
|
if (m_symbolp) VL_DO_CLEAR(delete[] m_symbolp, m_symbolp = nullptr);
|
|
|
|
if (m_strbuf) VL_DO_CLEAR(delete[] m_strbuf, m_strbuf = nullptr);
|
2020-04-08 21:54:35 +00:00
|
|
|
}
|
|
|
|
|
2021-03-07 16:01:54 +00:00
|
|
|
void VerilatedFst::open(const char* filename) VL_MT_SAFE_EXCLUDES(m_mutex) {
|
2021-07-24 12:36:11 +00:00
|
|
|
const VerilatedLockGuard lock{m_mutex};
|
2018-10-08 00:39:51 +00:00
|
|
|
m_fst = fstWriterCreate(filename, 1);
|
2019-05-02 23:55:16 +00:00
|
|
|
fstWriterSetPackType(m_fst, FST_WR_PT_LZ4);
|
2020-04-19 22:57:36 +00:00
|
|
|
fstWriterSetTimescaleFromString(m_fst, timeResStr().c_str()); // lintok-begin-on-ref
|
2020-04-21 22:49:07 +00:00
|
|
|
#ifdef VL_TRACE_FST_WRITER_THREAD
|
2019-05-03 00:33:05 +00:00
|
|
|
fstWriterSetParallelMode(m_fst, 1);
|
|
|
|
#endif
|
2021-04-14 20:52:14 +00:00
|
|
|
fullDump(true); // First dump must be full for fst
|
2020-04-21 22:49:07 +00:00
|
|
|
|
2018-10-02 22:42:53 +00:00
|
|
|
m_curScope.clear();
|
|
|
|
|
2020-04-19 22:57:36 +00:00
|
|
|
VerilatedTrace<VerilatedFst>::traceInit();
|
2018-10-02 22:42:53 +00:00
|
|
|
|
|
|
|
// Clear the scope stack
|
2020-08-16 15:43:49 +00:00
|
|
|
auto it = m_curScope.begin();
|
2018-10-02 22:42:53 +00:00
|
|
|
while (it != m_curScope.end()) {
|
|
|
|
fstWriterSetUpscope(m_fst);
|
|
|
|
it = m_curScope.erase(it);
|
|
|
|
}
|
2020-04-08 21:54:35 +00:00
|
|
|
|
|
|
|
// convert m_code2symbol into an array for fast lookup
|
|
|
|
if (!m_symbolp) {
|
2020-04-19 22:57:36 +00:00
|
|
|
m_symbolp = new fstHandle[nextCode()];
|
2020-08-16 15:43:49 +00:00
|
|
|
for (const auto& i : m_code2symbol) m_symbolp[i.first] = i.second;
|
2020-04-08 21:54:35 +00:00
|
|
|
}
|
|
|
|
m_code2symbol.clear();
|
2020-04-29 23:09:09 +00:00
|
|
|
|
|
|
|
// Allocate string buffer for arrays
|
2021-02-22 02:25:21 +00:00
|
|
|
if (!m_strbuf) m_strbuf = new char[maxBits() + 32];
|
2018-10-02 22:42:53 +00:00
|
|
|
}
|
|
|
|
|
2021-03-07 16:01:54 +00:00
|
|
|
void VerilatedFst::close() VL_MT_SAFE_EXCLUDES(m_mutex) {
|
2021-07-24 12:36:11 +00:00
|
|
|
const VerilatedLockGuard lock{m_mutex};
|
2021-03-07 16:01:54 +00:00
|
|
|
VerilatedTrace<VerilatedFst>::closeBase();
|
2020-04-21 22:49:07 +00:00
|
|
|
fstWriterClose(m_fst);
|
2020-08-15 14:12:55 +00:00
|
|
|
m_fst = nullptr;
|
2020-04-21 22:49:07 +00:00
|
|
|
}
|
|
|
|
|
2021-03-07 16:01:54 +00:00
|
|
|
void VerilatedFst::flush() VL_MT_SAFE_EXCLUDES(m_mutex) {
|
2021-07-24 12:36:11 +00:00
|
|
|
const VerilatedLockGuard lock{m_mutex};
|
2021-03-07 16:01:54 +00:00
|
|
|
VerilatedTrace<VerilatedFst>::flushBase();
|
2020-04-21 22:49:07 +00:00
|
|
|
fstWriterFlushContext(m_fst);
|
|
|
|
}
|
|
|
|
|
2020-04-19 22:57:36 +00:00
|
|
|
void VerilatedFst::emitTimeChange(vluint64_t timeui) { fstWriterEmitTimeChange(m_fst, timeui); }
|
2018-10-02 22:42:53 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
// Decl
|
|
|
|
|
2018-10-08 11:21:22 +00:00
|
|
|
void VerilatedFst::declDTypeEnum(int dtypenum, const char* name, vluint32_t elements,
|
2020-04-04 17:45:24 +00:00
|
|
|
unsigned int minValbits, const char** itemNamesp,
|
|
|
|
const char** itemValuesp) {
|
2021-06-19 02:19:35 +00:00
|
|
|
const fstEnumHandle enumNum
|
2020-04-04 17:45:24 +00:00
|
|
|
= fstWriterCreateEnumTable(m_fst, name, elements, minValbits, itemNamesp, itemValuesp);
|
2018-10-08 11:21:22 +00:00
|
|
|
m_local2fstdtype[dtypenum] = enumNum;
|
|
|
|
}
|
|
|
|
|
2020-05-03 20:55:22 +00:00
|
|
|
void VerilatedFst::declare(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir,
|
2022-02-26 17:52:24 +00:00
|
|
|
fstVarType vartype, bool array, int arraynum, bool bussed, int msb,
|
|
|
|
int lsb) {
|
2020-05-03 20:55:22 +00:00
|
|
|
const int bits = ((msb > lsb) ? (msb - lsb) : (lsb - msb)) + 1;
|
|
|
|
|
2020-04-19 22:57:36 +00:00
|
|
|
VerilatedTrace<VerilatedFst>::declCode(code, bits, false);
|
2020-03-07 23:39:58 +00:00
|
|
|
|
2021-12-19 15:15:07 +00:00
|
|
|
std::string nameasstr = namePrefix() + name;
|
|
|
|
std::istringstream nameiss{nameasstr};
|
2020-06-02 03:16:02 +00:00
|
|
|
std::istream_iterator<std::string> beg(nameiss);
|
|
|
|
std::istream_iterator<std::string> end;
|
2018-10-02 22:42:53 +00:00
|
|
|
std::list<std::string> tokens(beg, end); // Split name
|
2021-07-24 12:36:11 +00:00
|
|
|
std::string symbol_name{tokens.back()};
|
2018-10-02 22:42:53 +00:00
|
|
|
tokens.pop_back(); // Remove symbol name from hierarchy
|
2021-04-07 13:55:11 +00:00
|
|
|
std::string tmpModName;
|
2018-10-02 22:42:53 +00:00
|
|
|
|
|
|
|
// Find point where current and new scope diverge
|
2020-08-16 15:43:49 +00:00
|
|
|
auto cur_it = m_curScope.begin();
|
|
|
|
auto new_it = tokens.begin();
|
2018-10-02 22:42:53 +00:00
|
|
|
while (cur_it != m_curScope.end() && new_it != tokens.end()) {
|
2020-04-04 17:45:24 +00:00
|
|
|
if (*cur_it != *new_it) break;
|
2018-10-02 22:42:53 +00:00
|
|
|
++cur_it;
|
|
|
|
++new_it;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Go back to the common point
|
|
|
|
while (cur_it != m_curScope.end()) {
|
|
|
|
fstWriterSetUpscope(m_fst);
|
|
|
|
cur_it = m_curScope.erase(cur_it);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Follow the hierarchy of the new variable from the common scope point
|
|
|
|
while (new_it != tokens.end()) {
|
2021-04-07 13:55:11 +00:00
|
|
|
if ((new_it->back() & 0x80)) {
|
|
|
|
tmpModName = *new_it;
|
|
|
|
tmpModName.pop_back();
|
|
|
|
// If the scope ends with a non-ascii character, it will be 0x80 + fstScopeType
|
2021-07-25 17:38:27 +00:00
|
|
|
fstWriterSetScope(m_fst, static_cast<fstScopeType>(new_it->back() & 0x7f),
|
|
|
|
tmpModName.c_str(), nullptr);
|
2022-01-09 21:49:38 +00:00
|
|
|
} else {
|
2021-04-07 13:55:11 +00:00
|
|
|
fstWriterSetScope(m_fst, FST_ST_VCD_SCOPE, new_it->c_str(), nullptr);
|
2022-01-09 21:49:38 +00:00
|
|
|
}
|
2018-10-02 22:42:53 +00:00
|
|
|
m_curScope.push_back(*new_it);
|
|
|
|
new_it = tokens.erase(new_it);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::stringstream name_ss;
|
|
|
|
name_ss << symbol_name;
|
2021-08-12 17:40:44 +00:00
|
|
|
if (array) name_ss << "[" << arraynum << "]";
|
2022-02-26 17:52:24 +00:00
|
|
|
if (bussed) name_ss << " [" << msb << ":" << lsb << "]";
|
2018-10-02 22:42:53 +00:00
|
|
|
std::string name_str = name_ss.str();
|
|
|
|
|
2018-10-08 11:21:22 +00:00
|
|
|
if (dtypenum > 0) {
|
2021-06-19 02:19:35 +00:00
|
|
|
const fstEnumHandle enumNum = m_local2fstdtype[dtypenum];
|
2018-10-08 11:21:22 +00:00
|
|
|
fstWriterEmitEnumTableRef(m_fst, enumNum);
|
|
|
|
}
|
2020-06-04 20:08:32 +00:00
|
|
|
|
2020-08-16 15:43:49 +00:00
|
|
|
const auto it = vlstd::as_const(m_code2symbol).find(code);
|
2020-06-04 20:08:32 +00:00
|
|
|
if (it == m_code2symbol.end()) { // New
|
|
|
|
m_code2symbol[code]
|
|
|
|
= fstWriterCreateVar(m_fst, vartype, vardir, bits, name_str.c_str(), 0);
|
2018-10-02 22:42:53 +00:00
|
|
|
} else { // Alias
|
2020-06-04 20:08:32 +00:00
|
|
|
fstWriterCreateVar(m_fst, vartype, vardir, bits, name_str.c_str(), it->second);
|
2018-10-02 22:42:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-19 22:57:36 +00:00
|
|
|
void VerilatedFst::declBit(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir,
|
|
|
|
fstVarType vartype, bool array, int arraynum) {
|
2022-02-26 17:52:24 +00:00
|
|
|
declare(code, name, dtypenum, vardir, vartype, array, arraynum, false, 0, 0);
|
2018-10-02 22:42:53 +00:00
|
|
|
}
|
2020-04-19 22:57:36 +00:00
|
|
|
void VerilatedFst::declBus(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir,
|
|
|
|
fstVarType vartype, bool array, int arraynum, int msb, int lsb) {
|
2022-02-26 17:52:24 +00:00
|
|
|
declare(code, name, dtypenum, vardir, vartype, array, arraynum, true, msb, lsb);
|
2020-04-19 22:57:36 +00:00
|
|
|
}
|
|
|
|
void VerilatedFst::declQuad(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir,
|
|
|
|
fstVarType vartype, bool array, int arraynum, int msb, int lsb) {
|
2022-02-26 17:52:24 +00:00
|
|
|
declare(code, name, dtypenum, vardir, vartype, array, arraynum, true, msb, lsb);
|
2020-04-19 22:57:36 +00:00
|
|
|
}
|
|
|
|
void VerilatedFst::declArray(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir,
|
|
|
|
fstVarType vartype, bool array, int arraynum, int msb, int lsb) {
|
2022-02-26 17:52:24 +00:00
|
|
|
declare(code, name, dtypenum, vardir, vartype, array, arraynum, true, msb, lsb);
|
2020-04-19 22:57:36 +00:00
|
|
|
}
|
|
|
|
void VerilatedFst::declDouble(vluint32_t code, const char* name, int dtypenum, fstVarDir vardir,
|
|
|
|
fstVarType vartype, bool array, int arraynum) {
|
2022-02-26 17:52:24 +00:00
|
|
|
declare(code, name, dtypenum, vardir, vartype, array, arraynum, false, 63, 0);
|
2018-10-02 22:42:53 +00:00
|
|
|
}
|
|
|
|
|
2020-04-25 18:37:59 +00:00
|
|
|
// Note: emit* are only ever called from one place (full* in
|
|
|
|
// verilated_trace_imp.cpp, which is included in this file at the top),
|
|
|
|
// so always inline them.
|
|
|
|
|
|
|
|
VL_ATTR_ALWINLINE
|
2020-04-29 23:09:09 +00:00
|
|
|
void VerilatedFst::emitBit(vluint32_t code, CData newval) {
|
2020-04-19 22:57:36 +00:00
|
|
|
fstWriterEmitValueChange(m_fst, m_symbolp[code], newval ? "1" : "0");
|
|
|
|
}
|
2020-04-29 23:09:09 +00:00
|
|
|
|
2020-04-25 18:37:59 +00:00
|
|
|
VL_ATTR_ALWINLINE
|
2020-04-29 23:09:09 +00:00
|
|
|
void VerilatedFst::emitCData(vluint32_t code, CData newval, int bits) {
|
|
|
|
char buf[VL_BYTESIZE];
|
|
|
|
cvtCDataToStr(buf, newval << (VL_BYTESIZE - bits));
|
|
|
|
fstWriterEmitValueChange(m_fst, m_symbolp[code], buf);
|
2020-04-19 22:57:36 +00:00
|
|
|
}
|
2020-04-29 23:09:09 +00:00
|
|
|
|
2020-04-25 18:37:59 +00:00
|
|
|
VL_ATTR_ALWINLINE
|
2020-04-29 23:09:09 +00:00
|
|
|
void VerilatedFst::emitSData(vluint32_t code, SData newval, int bits) {
|
|
|
|
char buf[VL_SHORTSIZE];
|
|
|
|
cvtSDataToStr(buf, newval << (VL_SHORTSIZE - bits));
|
|
|
|
fstWriterEmitValueChange(m_fst, m_symbolp[code], buf);
|
2020-04-19 22:57:36 +00:00
|
|
|
}
|
2020-04-29 23:09:09 +00:00
|
|
|
|
2020-04-25 18:37:59 +00:00
|
|
|
VL_ATTR_ALWINLINE
|
2020-04-29 23:09:09 +00:00
|
|
|
void VerilatedFst::emitIData(vluint32_t code, IData newval, int bits) {
|
|
|
|
char buf[VL_IDATASIZE];
|
|
|
|
cvtIDataToStr(buf, newval << (VL_IDATASIZE - bits));
|
|
|
|
fstWriterEmitValueChange(m_fst, m_symbolp[code], buf);
|
2020-04-19 22:57:36 +00:00
|
|
|
}
|
2020-04-29 23:09:09 +00:00
|
|
|
|
|
|
|
VL_ATTR_ALWINLINE
|
|
|
|
void VerilatedFst::emitQData(vluint32_t code, QData newval, int bits) {
|
|
|
|
char buf[VL_QUADSIZE];
|
|
|
|
cvtQDataToStr(buf, newval << (VL_QUADSIZE - bits));
|
|
|
|
fstWriterEmitValueChange(m_fst, m_symbolp[code], buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
VL_ATTR_ALWINLINE
|
|
|
|
void VerilatedFst::emitWData(vluint32_t code, const WData* newvalp, int bits) {
|
|
|
|
int words = VL_WORDS_I(bits);
|
|
|
|
char* wp = m_strbuf;
|
|
|
|
// Convert the most significant word
|
|
|
|
const int bitsInMSW = VL_BITBIT_E(bits) ? VL_BITBIT_E(bits) : VL_EDATASIZE;
|
|
|
|
cvtEDataToStr(wp, newvalp[--words] << (VL_EDATASIZE - bitsInMSW));
|
|
|
|
wp += bitsInMSW;
|
|
|
|
// Convert the remaining words
|
|
|
|
while (words > 0) {
|
|
|
|
cvtEDataToStr(wp, newvalp[--words]);
|
|
|
|
wp += VL_EDATASIZE;
|
|
|
|
}
|
|
|
|
fstWriterEmitValueChange(m_fst, m_symbolp[code], m_strbuf);
|
|
|
|
}
|
|
|
|
|
2020-04-25 18:37:59 +00:00
|
|
|
VL_ATTR_ALWINLINE
|
2020-04-19 22:57:36 +00:00
|
|
|
void VerilatedFst::emitDouble(vluint32_t code, double newval) {
|
|
|
|
fstWriterEmitValueChange(m_fst, m_symbolp[code], &newval);
|
|
|
|
}
|