Fix some bugs related to nested scopes
This commit is contained in:
parent
36e067cbf6
commit
2e89bebfe6
@ -11,6 +11,7 @@ namespace vcppd
|
||||
template <typename T> class Scope
|
||||
{
|
||||
friend T;
|
||||
friend Scope<Scope>;
|
||||
|
||||
public:
|
||||
Scope(const Scope&) = delete;
|
||||
@ -18,6 +19,7 @@ public:
|
||||
|
||||
Scope<Scope> scope(const std::string& name)
|
||||
{
|
||||
parent.scope(name);
|
||||
return Scope<Scope>(name, *this);
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ void Vcd::tick()
|
||||
for (int i = 0; i < entry.size; i++)
|
||||
{
|
||||
uint8_t byte;
|
||||
memcpy(&byte, static_cast<const uint8_t*>(entry.ref), 1);
|
||||
memcpy(&byte, static_cast<const uint8_t*>(entry.ref) + i, 1);
|
||||
stream << std::format("{0:b}", byte);
|
||||
}
|
||||
stream << " " << name << std::endl;
|
||||
|
||||
@ -4,11 +4,15 @@ int main(int argc, char** argv)
|
||||
{
|
||||
uint8_t eae = 0;
|
||||
uint8_t eae2 = 0;
|
||||
uint16_t eae3 = 1;
|
||||
|
||||
auto vcd = vcppd::Builder(std::cout)
|
||||
.scope("TOP")
|
||||
.trace("eae", eae)
|
||||
.trace("eae2", eae2)
|
||||
.scope("MIDDLE")
|
||||
.trace("eae3", eae3)
|
||||
.unscope()
|
||||
.unscope()
|
||||
.build();
|
||||
for (int i = 0; i < 10; i++)
|
||||
@ -16,6 +20,7 @@ int main(int argc, char** argv)
|
||||
vcd.tick();
|
||||
eae += 1;
|
||||
eae2 += 2;
|
||||
eae3 *= 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user