3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-25 00:22:34 +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

@ -807,7 +807,7 @@ grow_read_ports:;
if (cell_init) {
Const initparam = mem.get_init_data();
initdata.reserve(mem.size);
for (int i = 0; i < mem.size; i++) {
for (size_t i = 0; i < mem.size; i++) {
std::vector<State> val;
for (auto idx : shuffle_map) {
if (idx == -1)

View file

@ -2098,11 +2098,11 @@ void MemMapping::emit(const MemConfig &cfg) {
if (!bit.valid) {
initval.push_back(State::Sx);
} else {
int addr = bit.addr;
size_t addr = bit.addr;
for (int i = GetSize(cfg.def->dbits) - 1; i < cfg.def->abits; i++)
if (hwa & 1 << i)
addr += 1 << hw_addr_swizzle[i];
if (addr >= mem.start_offset && addr < mem.start_offset + mem.size)
if (addr >= (size_t) mem.start_offset && addr < mem.start_offset + mem.size)
initval.push_back(init_data[(addr - mem.start_offset) * mem.width + bit.bit]);
else
initval.push_back(State::Sx);

View file

@ -201,7 +201,7 @@ struct MemoryMapWorker
int count_static = 0;
for (int i = 0; i < mem.size; i++)
for (size_t i = 0; i < mem.size; i++)
{
int addr = i + mem.start_offset;
int idx = addr & ((1 << abits) - 1);
@ -268,7 +268,7 @@ struct MemoryMapWorker
}
}
log(" created %d %s cells and %d static cells of width %d.\n",
log(" created %zu %s cells and %d static cells of width %d.\n",
mem.size-count_static, formal && (static_only || async_wr) ? "$ff" : "$dff", count_static, mem.width);
int count_dff = 0, count_mux = 0, count_wrmux = 0;
@ -315,7 +315,7 @@ struct MemoryMapWorker
if (!static_only)
{
for (int i = 0; i < mem.size; i++)
for (size_t i = 0; i < mem.size; i++)
{
int addr = i + mem.start_offset;
int idx = addr & ((1 << abits) - 1);