From 4496e8d4e2bbd9eb9af4ecd5687a2a9676957073 Mon Sep 17 00:00:00 2001 From: Howard Mao Date: Tue, 15 Sep 2015 10:29:45 -0700 Subject: [PATCH] make sure htif_emulator properly sets memory size --- csrc/emulator.cc | 3 ++- csrc/htif_emulator.h | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/csrc/emulator.cc b/csrc/emulator.cc index dd01bfc8..bbd74b23 100644 --- a/csrc/emulator.cc +++ b/csrc/emulator.cc @@ -82,7 +82,8 @@ int main(int argc, char** argv) load_mem(mm->get_data(), loadmem); // Instantiate HTIF - htif = new htif_emulator_t(std::vector(argv + 1, argv + argc)); + htif = new htif_emulator_t(memsz_mb, + std::vector(argv + 1, argv + argc)); int htif_bits = tile.Top__io_host_in_bits.width(); assert(htif_bits % 8 == 0 && htif_bits <= val_n_bits()); diff --git a/csrc/htif_emulator.h b/csrc/htif_emulator.h index 9dbc0ba4..9cd216c7 100644 --- a/csrc/htif_emulator.h +++ b/csrc/htif_emulator.h @@ -8,9 +8,10 @@ class htif_emulator_t : public htif_pthread_t { public: - htif_emulator_t(const std::vector& args) + htif_emulator_t(uint32_t memsz_mb, const std::vector& args) : htif_pthread_t(args) { + this->_memsz_mb = memsz_mb; } void set_clock_divisor(int divisor, int hold_cycles) @@ -23,6 +24,11 @@ class htif_emulator_t : public htif_pthread_t set_clock_divisor(5, 2); htif_pthread_t::start(); } + + uint32_t mem_mb() { return _memsz_mb; } + + private: + uint32_t _memsz_mb; }; #endif