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

Large mem fix with long long

This commit is contained in:
Akash Levy 2026-06-24 17:21:10 -07:00
parent d0879b7657
commit 2c790e52cd

View file

@ -1822,8 +1822,8 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
module->memories[memory->name] = memory;
import_attributes(memory->attributes, net, nl);
int number_of_bits = net->Size();
int min_bits_in_word = number_of_bits;
long long number_of_bits = net->Size();
long long min_bits_in_word = number_of_bits;
int max_bits_in_addr = 0;
// get the size of each memory access
@ -1844,9 +1844,9 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
}
}
int number_of_words = number_of_bits / min_bits_in_word;
long long number_of_words = number_of_bits / min_bits_in_word;
memory->width = min_bits_in_word;
memory->width = (int)min_bits_in_word;
memory->size = 0;
memory->start_offset = INT_MAX;
@ -1872,14 +1872,14 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
// sanity check we haven't shrunk the memory
if (memory->size < number_of_words)
log_error("Expected memory of size %d words, but got %d for address range %d to %d (inclusive)\n", number_of_words, memory->size, min_idx, max_idx);
log_error("Expected memory of size %lld words, but got %d for address range %d to %d (inclusive)\n", (long long)number_of_words, memory->size, min_idx, max_idx);
// warn on oversize memories
// TODO consider using a minimum ratio?
if (memory->size > number_of_words) {
float ratio = memory->size / (float)number_of_words;
log_warning("RAM for identifier '%s' may be up to %.0f%% oversize due to addressing\n", net->Name(), (ratio-1)*100);
log_debug("Expected memory of size %d words, but got %d for address range %d to %d (inclusive)\n", number_of_words, memory->size, min_idx, max_idx);
log_debug("Expected memory of size %lld words, but got %d for address range %d to %d (inclusive)\n", (long long)number_of_words, memory->size, min_idx, max_idx);
}
continue;
}