1
0

make sure htif_emulator properly sets memory size

This commit is contained in:
Howard Mao 2015-09-15 10:29:45 -07:00
parent 56ecdff52d
commit 4496e8d4e2
2 changed files with 9 additions and 2 deletions

View File

@ -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<std::string>(argv + 1, argv + argc));
htif = new htif_emulator_t(memsz_mb,
std::vector<std::string>(argv + 1, argv + argc));
int htif_bits = tile.Top__io_host_in_bits.width();
assert(htif_bits % 8 == 0 && htif_bits <= val_n_bits());

View File

@ -8,9 +8,10 @@
class htif_emulator_t : public htif_pthread_t
{
public:
htif_emulator_t(const std::vector<std::string>& args)
htif_emulator_t(uint32_t memsz_mb, const std::vector<std::string>& 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