#include "vcppd/vcd.h" #include "vcppd/builder.h" #include #include #include using namespace vcppd; Vcd::Vcd(const Builder& builder) : stream(builder.stream), variables(builder.variables), current_time(0) { } Vcd::~Vcd() { stream << std::format("#{}", current_time) << std::endl; } void Vcd::tick() { stream << std::format("#{}", current_time) << std::endl; for (const auto& [name, entry] : variables) { stream << "b"; for (int i = 0; i < entry.size; i++) { uint8_t byte; memcpy(&byte, static_cast(entry.ref) + i, 1); stream << std::format("{0:b}", byte); } stream << " " << name << std::endl; } current_time += 1; }