|
|
|
@ -3,6 +3,24 @@ |
|
|
|
#ifndef _RISCV_SIM_H |
|
|
|
#define _RISCV_SIM_H |
|
|
|
|
|
|
|
#include "config.h" |
|
|
|
|
|
|
|
#ifdef HAVE_BOOST_ASIO |
|
|
|
#include <boost/algorithm/string.hpp> |
|
|
|
#include <boost/regex.hpp> |
|
|
|
#include <boost/asio.hpp> |
|
|
|
// namespace boost::asio does not work for all environments
|
|
|
|
using boost::asio::ip::tcp; |
|
|
|
using boost::asio::io_service; |
|
|
|
using boost::asio::streambuf; |
|
|
|
// using boost::asio::write does not work either
|
|
|
|
using boost::asio::transfer_all; |
|
|
|
using boost::asio::buffer_cast; |
|
|
|
using boost::erase_all; |
|
|
|
using boost::regex; |
|
|
|
using boost::regex_replace; |
|
|
|
#endif |
|
|
|
|
|
|
|
#include "debug_module.h" |
|
|
|
#include "devices.h" |
|
|
|
#include "log_file.h" |
|
|
|
@ -16,6 +34,10 @@ |
|
|
|
#include <memory> |
|
|
|
#include <sys/types.h> |
|
|
|
|
|
|
|
using std::ostream; |
|
|
|
using std::string; |
|
|
|
using std::cerr; |
|
|
|
|
|
|
|
class mmu_t; |
|
|
|
class remote_bitbang_t; |
|
|
|
|
|
|
|
@ -30,7 +52,11 @@ public: |
|
|
|
std::vector<std::pair<reg_t, abstract_device_t*>> plugin_devices, |
|
|
|
const std::vector<std::string>& args, const std::vector<int> hartids, |
|
|
|
const debug_module_config_t &dm_config, const char *log_path, |
|
|
|
bool dtb_enabled, const char *dtb_file); |
|
|
|
bool dtb_enabled, const char *dtb_file |
|
|
|
#ifdef HAVE_BOOST_ASIO |
|
|
|
, io_service *io_service_ptr_ctor, tcp::acceptor *acceptor_ptr_ctor // option -s
|
|
|
|
#endif |
|
|
|
); |
|
|
|
~sim_t(); |
|
|
|
|
|
|
|
// run the simulation to completion
|
|
|
|
@ -75,6 +101,16 @@ private: |
|
|
|
bus_t bus; |
|
|
|
log_file_t log_file; |
|
|
|
|
|
|
|
#ifdef HAVE_BOOST_ASIO |
|
|
|
// the following are needed for command socket interface
|
|
|
|
boost::asio::io_service *io_service_ptr; |
|
|
|
tcp::acceptor *acceptor_ptr; |
|
|
|
tcp::socket *socket_ptr; |
|
|
|
string rin(streambuf *bout_ptr); // read input command string
|
|
|
|
void wout(streambuf *bout_ptr); // write output to socket
|
|
|
|
#endif |
|
|
|
ostream sout; // used for socket and terminal interface
|
|
|
|
|
|
|
|
processor_t* get_core(const std::string& i); |
|
|
|
void step(size_t n); // step through simulation
|
|
|
|
static const size_t INTERLEAVE = 5000; |
|
|
|
|