Merge pull request #2002 from YosysHQ/dave/cxxrtl-width

cxxrtl: Round up constant width
This commit is contained in:
whitequark 2020-04-25 18:30:53 +00:00 committed by GitHub
commit 868b6b1b0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -732,7 +732,7 @@ struct CxxrtlWorker {
int chunk_width = min(width, CHUNK_SIZE); int chunk_width = min(width, CHUNK_SIZE);
uint32_t chunk = data.extract(offset, chunk_width).as_int(); uint32_t chunk = data.extract(offset, chunk_width).as_int();
if (fixed_width) if (fixed_width)
f << stringf("0x%.*xu", chunk_width / 4, chunk); f << stringf("0x%.*xu", (3 + chunk_width) / 4, chunk);
else else
f << stringf("%#xu", chunk); f << stringf("%#xu", chunk);
if (width > CHUNK_SIZE) if (width > CHUNK_SIZE)