1212
1313class MochaSim {
1414 public:
15- MochaSim (const char *ram_hier_path, int ram_size_words);
15+ MochaSim (const char *sram_hier_path, int sram_size_words,
16+ const char *dram_hier_path, int dram_size_words);
1617 virtual ~MochaSim () {}
1718 virtual int Main (int argc, char **argv);
1819
1920
2021 protected:
2122 top_chip_verilator _top;
2223 VerilatorMemUtil _memutil;
23- MemArea _ram ;
24+ MemArea _sram, _dram ;
2425
2526 virtual int Setup (int argc, char **argv, bool &exit_app);
2627 virtual void Run ();
2728 virtual bool Finish ();
2829};
2930
30- MochaSim::MochaSim (const char *ram_hier_path, int ram_size_words)
31- : _ram(ram_hier_path, ram_size_words, 8 ) {}
31+ MochaSim::MochaSim (const char *sram_hier_path, int sram_size_words,
32+ const char *dram_hier_path, int dram_size_words)
33+ : _sram(sram_hier_path, sram_size_words, 8 ),
34+ _dram(dram_hier_path, dram_size_words, 8 ) {}
3235
3336int MochaSim::Main (int argc, char **argv) {
3437 bool exit_app;
@@ -53,7 +56,8 @@ int MochaSim::Setup(int argc, char **argv, bool &exit_app) {
5356 simctrl.SetTop (&_top, &_top.clk_i , &_top.rst_ni ,
5457 VerilatorSimCtrlFlags::ResetPolarityNegative);
5558
56- _memutil.RegisterMemoryArea (" ram" , 0x10000000 , &_ram);
59+ _memutil.RegisterMemoryArea (" sram" , 0x10000000 , &_sram);
60+ _memutil.RegisterMemoryArea (" dram" , 0x80000000 , &_dram);
5761 simctrl.RegisterExtension (&_memutil);
5862
5963 exit_app = false ;
@@ -85,7 +89,9 @@ bool MochaSim::Finish() {
8589int main (int argc, char **argv) {
8690 MochaSim mocha_sim (
8791 " TOP.top_chip_verilator.u_top_chip_system.u_axi_sram.u_ram" ,
88- 16 * 1024 // 16k 64-bit words = 128 KiB
92+ 16 * 1024 , // 16k 64-bit words = 128 KiB
93+ " TOP.top_chip_verilator.u_dram_wrapper.u_ext_mem" ,
94+ 16 * 131072 // 131k 64-bit words = 2 GiB
8995 );
9096
9197 return mocha_sim.Main (argc, argv);
0 commit comments