2014-09-12 19:15:04 +02:00
|
|
|
// See LICENSE for license details.
|
|
|
|
|
2013-01-25 08:56:45 +01:00
|
|
|
#ifndef _HTIF_EMULATOR_H
|
|
|
|
#define _HTIF_EMULATOR_H
|
|
|
|
|
|
|
|
#include <fesvr/htif_pthread.h>
|
|
|
|
|
|
|
|
class htif_emulator_t : public htif_pthread_t
|
|
|
|
{
|
|
|
|
public:
|
2015-09-15 19:29:45 +02:00
|
|
|
htif_emulator_t(uint32_t memsz_mb, const std::vector<std::string>& args)
|
2013-01-25 08:56:45 +01:00
|
|
|
: htif_pthread_t(args)
|
|
|
|
{
|
2015-09-15 19:29:45 +02:00
|
|
|
this->_memsz_mb = memsz_mb;
|
2013-01-25 08:56:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void set_clock_divisor(int divisor, int hold_cycles)
|
|
|
|
{
|
|
|
|
write_cr(-1, 63, divisor | hold_cycles << 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
void start()
|
|
|
|
{
|
|
|
|
set_clock_divisor(5, 2);
|
|
|
|
htif_pthread_t::start();
|
|
|
|
}
|
2015-09-15 19:29:45 +02:00
|
|
|
|
2015-09-25 18:02:35 +02:00
|
|
|
uint32_t mem_mb() {
|
|
|
|
uint32_t scr_mb = htif_pthread_t::mem_mb();
|
|
|
|
return (_memsz_mb < scr_mb) ? _memsz_mb : scr_mb;
|
|
|
|
}
|
2015-09-15 19:29:45 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint32_t _memsz_mb;
|
2013-01-25 08:56:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|