risc-v-tlm/inc/Trace.h

62 lines
1.0 KiB
C
Raw Normal View History

/*!
\file Trace.h
\brief Basic TLM-2 Trace module
\author Màrius Montón
\date September 2018
*/
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef __TRACE_H__
#define __TRACE_H__
#include <iostream>
#include <fstream>
#define SC_INCLUDE_DYNAMIC_PROCESSES
#include "systemc"
#include "tlm.h"
#include "tlm_utils/simple_target_socket.h"
2018-09-21 17:23:31 +08:00
/**
* @brief Simple trace peripheral
*
* This peripheral outputs to cout any character written to its unique register
*/
class Trace: sc_core::sc_module {
public:
2019-09-08 17:41:06 +08:00
/**
* @brief Bus socket
*/
tlm_utils::simple_target_socket<Trace> socket;
/**
* @brief Constructor
* @param name Module name
*/
2021-04-26 01:52:12 +08:00
explicit Trace(sc_core::sc_module_name const &name);
/**
* @brief Destructor
*/
2021-04-26 01:52:12 +08:00
~Trace() override;
2019-09-08 17:41:06 +08:00
private:
// TLM-2 blocking transport method
virtual void b_transport(tlm::tlm_generic_payload &trans,
sc_core::sc_time &delay);
void xtermLaunch(char *slaveName) const;
2021-04-26 06:20:29 +08:00
void xtermKill();
2021-04-26 01:52:12 +08:00
void xtermSetup();
2021-04-26 01:52:12 +08:00
int ptSlave{};
int ptMaster{};
int xtermPid{};
};
#endif