Skip to content

Commit

Permalink
ram: re-add the init_ram function for VCS support (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
poemonsense authored Sep 21, 2023
1 parent 630b4fe commit b42109f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/test/csrc/common/ram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ CoDRAMsim3 *dram = NULL;

SimMemory *simMemory = nullptr;

void init_ram(const char *image, uint64_t ram_size) {
simMemory = new MmapMemory(image, ram_size);
}

#ifdef TLB_UNITTEST
// Note: addpageSv39 only supports pmem base 0x80000000
void addpageSv39() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/csrc/common/ram.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ class LinearizedFootprintsMemory : public FootprintsMemory {
};

extern SimMemory *simMemory;
// This is to initialize the common mmap RAM
void init_ram(const char *image, uint64_t n_bytes);

#ifdef WITH_DRAMSIM3

Expand Down
2 changes: 1 addition & 1 deletion src/test/csrc/vcs/vcs_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extern "C" void set_max_cycles(long mc) {
extern "C" void simv_init() {
common_init("simv");

init_ram(bin_file);
init_ram(bin_file, DEFAULT_EMU_RAM_SIZE);
init_flash(flash_bin_file);

difftest_init();
Expand Down
2 changes: 1 addition & 1 deletion src/test/csrc/verilator/emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ Emulator::Emulator(int argc, const char *argv[]):
simMemory = new MmapMemoryWithFootprints(args.image, ram_size, args.footprints_name);
}
else {
simMemory = new MmapMemory(args.image, ram_size);
init_ram(args.image, ram_size);
}
}

Expand Down

0 comments on commit b42109f

Please sign in to comment.