mirror of https://github.com/YosysHQ/yosys.git
cxxrtl: improve printing of narrow memories.
This commit is contained in:
parent
3738391bdd
commit
f88378ae61
|
@ -726,12 +726,13 @@ struct CxxrtlWorker {
|
||||||
|
|
||||||
void dump_const_init(const RTLIL::Const &data, int width, int offset = 0, bool fixed_width = false)
|
void dump_const_init(const RTLIL::Const &data, int width, int offset = 0, bool fixed_width = false)
|
||||||
{
|
{
|
||||||
|
const int CHUNK_SIZE = 32;
|
||||||
f << "{";
|
f << "{";
|
||||||
while (width > 0) {
|
while (width > 0) {
|
||||||
const int CHUNK_SIZE = 32;
|
int chunk_width = min(width, CHUNK_SIZE);
|
||||||
uint32_t chunk = data.extract(offset, width > CHUNK_SIZE ? CHUNK_SIZE : width).as_int();
|
uint32_t chunk = data.extract(offset, chunk_width).as_int();
|
||||||
if (fixed_width)
|
if (fixed_width)
|
||||||
f << stringf("0x%08xu", chunk);
|
f << stringf("0x%.*xu", chunk_width / 4, chunk);
|
||||||
else
|
else
|
||||||
f << stringf("%#xu", chunk);
|
f << stringf("%#xu", chunk);
|
||||||
if (width > CHUNK_SIZE)
|
if (width > CHUNK_SIZE)
|
||||||
|
|
Loading…
Reference in New Issue