summaryrefslogtreecommitdiff
path: root/csim/load.c
diff options
context:
space:
mode:
Diffstat (limited to 'csim/load.c')
-rw-r--r--csim/load.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/csim/load.c b/csim/load.c
index 4e7583a..bb77a0e 100644
--- a/csim/load.c
+++ b/csim/load.c
@@ -20,13 +20,15 @@ void add_rom(const char *prefix, FILE *file) {
rom->prefix = prefix;
// Load ROM file
- fscanf(file, "%d %d\n", &(rom->addr_size), &(rom->word_size));
- rom->data = malloc(pow2(rom->addr_size) * sizeof(t_value));
+ fscanf(file, "%d %d\n", &(rom->words_defined), &(rom->word_size));
+ rom->data = malloc(rom->words_defined * sizeof(t_value));
- for (i = 0; i < pow2(rom->addr_size); i++) {
+ for (i = 0; i < rom->words_defined; i++) {
fscanf(file, " ");
if (fscanf(file, "/%lu", &(rom->data[i]))) {
// ok, value is read
+ } else if (fscanf(file, "x%x", &(rom->data[i]))) {
+ // ok, value is read
} else {
rom->data[i] = read_bool(file, NULL);
}
@@ -124,7 +126,7 @@ t_program *load_dumb_netlist (FILE *stream) {
// find corresponding ROM
for (r = roms; r != NULL; r = r->next) {
if (is_prefix(r->prefix, p->vars[p->eqs[i].dest_var].name)) {
- if (r->addr_size == as && r->word_size == ws) {
+ if (r->word_size == ws) {
p->eqs[i].Rom.rom = r;
break;
} else {