YosysHQ / yosys

Yosys Open SYnthesis Suite
https://yosyshq.net/yosys/
ISC License
3.32k stars 859 forks source link

cxxrtl: fix debug information for zero-width items #4207

Closed whitequark closed 5 months ago

whitequark commented 5 months ago

Because all objects in C++ must have non-zero size, a value<0> has a size of 4 despite consisting of a uint32_t chunks[0]. The debug item assertions were not written expecting that and prevent any debug items for such values from compiling.

The C API does not define exactly what happens for a zero-width debug item, but it seems OK to say that they should refer to some unique pointer that cannot be, in actuality, read or written. This allows some techniques or optimizations that use curr pointers as keys and assume they correspond 1-to-1 to simulation objects.