1
0

New address map

This commit is contained in:
Andrew Waterman
2016-04-30 20:59:36 -07:00
parent d0aa4c722d
commit 46bbbba5e6
11 changed files with 75 additions and 63 deletions

View File

@ -101,8 +101,7 @@ int main(int argc, char** argv)
}
// Instantiate HTIF
htif = new htif_emulator_t(memsz_mb,
std::vector<std::string>(argv + 1, argv + argc));
htif = new htif_emulator_t(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());
@ -181,13 +180,13 @@ int main(int argc, char** argv)
for (int i = 0; i < N_MEM_CHANNELS; i++) {
mm[i]->tick(
mem_ar_valid[i]->to_bool(),
mem_ar_bits_addr[i]->lo_word(),
mem_ar_bits_addr[i]->lo_word() - MEM_BASE,
mem_ar_bits_id[i]->lo_word(),
mem_ar_bits_size[i]->lo_word(),
mem_ar_bits_len[i]->lo_word(),
mem_aw_valid[i]->to_bool(),
mem_aw_bits_addr[i]->lo_word(),
mem_aw_bits_addr[i]->lo_word() - MEM_BASE,
mem_aw_bits_id[i]->lo_word(),
mem_aw_bits_size[i]->lo_word(),
mem_aw_bits_len[i]->lo_word(),

View File

@ -10,12 +10,10 @@ class htif_emulator_t : public htif_pthread_t
int memory_channel_mux_select;
public:
htif_emulator_t(uint32_t memsz_mb, const std::vector<std::string>& args)
htif_emulator_t(const std::vector<std::string>& args)
: htif_pthread_t(args),
memory_channel_mux_select(0)
{
this->_memsz_mb = memsz_mb;
for (const auto& arg: args) {
if (!strncmp(arg.c_str(), "+memory_channel_mux_select=", 27))
memory_channel_mux_select = atoi(arg.c_str()+27);
@ -36,14 +34,6 @@ class htif_emulator_t : public htif_pthread_t
set_clock_divisor(5, 2);
htif_pthread_t::start();
}
uint32_t mem_mb() {
uint32_t scr_mb = htif_pthread_t::mem_mb();
return (_memsz_mb < scr_mb) ? _memsz_mb : scr_mb;
}
private:
uint32_t _memsz_mb;
};
#endif

View File

@ -30,8 +30,6 @@ void htif_fini(vc_handle failure)
int main(int argc, char** argv)
{
unsigned long memsz_mb = MEM_SIZE / (1024*1024);
for (int i = 1; i < argc; i++)
{
if (!strcmp(argv[i], "+dramsim"))
@ -42,8 +40,7 @@ int main(int argc, char** argv)
memory_channel_mux_select = atoi(argv[i]+27);
}
htif = new htif_emulator_t(memsz_mb,
std::vector<std::string>(argv + 1, argv + argc));
htif = new htif_emulator_t(std::vector<std::string>(argv + 1, argv + argc));
for (int i=0; i<N_MEM_CHANNELS; i++) {
mm[i] = dramsim ? (mm_t*)(new mm_dramsim2_t) : (mm_t*)(new mm_magic_t);
@ -107,13 +104,13 @@ void memory_tick(
mmc->tick
(
vc_getScalar(ar_valid),
vc_4stVectorRef(ar_addr)->d,
vc_4stVectorRef(ar_addr)->d - MEM_BASE,
vc_4stVectorRef(ar_id)->d,
vc_4stVectorRef(ar_size)->d,
vc_4stVectorRef(ar_len)->d,
vc_getScalar(aw_valid),
vc_4stVectorRef(aw_addr)->d,
vc_4stVectorRef(aw_addr)->d - MEM_BASE,
vc_4stVectorRef(aw_id)->d,
vc_4stVectorRef(aw_size)->d,
vc_4stVectorRef(aw_len)->d,