3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-22 15:15:51 +00:00

Represent memory size with size_t

This commit is contained in:
Akash Levy 2025-04-04 02:04:34 -07:00
parent 507308d34e
commit bb5f8415af
13 changed files with 60 additions and 35 deletions

View file

@ -252,7 +252,7 @@ struct JsonWriter
f << stringf("\n },\n");
f << stringf(" \"width\": %d,\n", it.second->width);
f << stringf(" \"start_offset\": %d,\n", it.second->start_offset);
f << stringf(" \"size\": %d\n", it.second->size);
f << stringf(" \"size\": %zu\n", it.second->size);
f << stringf(" }");
first = false;
}

View file

@ -158,7 +158,7 @@ void RTLIL_BACKEND::dump_memory(std::ostream &f, std::string indent, const RTLIL
if (memory->width != 1)
f << stringf("width %d ", memory->width);
if (memory->size != 0)
f << stringf("size %d ", memory->size);
f << stringf("size %zu ", memory->size);
if (memory->start_offset != 0)
f << stringf("offset %d ", memory->start_offset);
f << stringf("%s\n", memory->name.c_str());

View file

@ -460,7 +460,7 @@ void dump_memory(std::ostream &f, std::string indent, Mem &mem)
std::string mem_id = id(mem.memid);
dump_attributes(f, indent, mem.attributes);
f << stringf("%s" "reg [%d:0] %s [%d:%d];\n", indent.c_str(), mem.width-1, mem_id.c_str(), mem.size+mem.start_offset-1, mem.start_offset);
f << stringf("%s" "reg [%d:0] %s [%zu:%d];\n", indent.c_str(), mem.width-1, mem_id.c_str(), mem.size+mem.start_offset-1, mem.start_offset);
// for memory block make something like:
// reg [7:0] memid [3:0];
@ -497,7 +497,7 @@ void dump_memory(std::ostream &f, std::string indent, Mem &mem)
else
{
Const data = mem.get_init_data();
for (int i=0; i<mem.size; i++)
for (size_t i=0; i<mem.size; i++)
{
RTLIL::Const element = data.extract(i*mem.width, mem.width);
for (int j=0; j<element.size(); j++)