2#include "SpartaTLMTargetGasket.hpp"
3#include "MemoryRequest.hpp"
4#include "SpartaMemory.hpp"
10namespace sparta_target
13 static const char *filename =
"SpartaTLMTargetGasket.cpp";
15 int SpartaTLMTargetGasket::nextID = 0;
16 tlm::tlm_sync_enum SpartaTLMTargetGasket::nb_transport_fw(tlm::tlm_generic_payload &gp,
17 tlm::tlm_phase &phase,
18 sc_core::sc_time &delay_time)
20 tlm::tlm_sync_enum return_val = tlm::TLM_COMPLETED;
25 std::cout <<
"Info: Gasket: BEGIN_REQ" << std::endl;
30 target_memory_.get_delay(gp, delay_time);
32#ifdef DIRECT_MEMORY_OPERATION
33 delay_time += accept_delay_;
34 response_PEQ_.notify(gp, delay_time);
42 MemoryRequest request = {
43 (gp.get_command() == tlm::TLM_READ_COMMAND ?
44 MemoryRequest::Command::READ :
45 MemoryRequest::Command::WRITE),
60 out_memory_request_.send(request,
getClock()->getCycle
61 (sparta::sparta_sysc_utils::calculateSpartaOffset(
getClock(),
62 delay_time.value())));
64 delay_time = accept_delay_;
69 return_val = tlm::TLM_ACCEPTED;
73 std::cout <<
"Info: Gasket: END_RESP" << std::endl;
74 return_val = tlm::TLM_COMPLETED;
78 return_val = tlm::TLM_ACCEPTED;
85 void SpartaTLMTargetGasket::send_end_request_(
const MemoryRequest &req)
90 void SpartaTLMTargetGasket::forwardMemoryResponse_(
const MemoryRequest &req)
92 std::ostringstream msg;
96 tlm::tlm_phase resp = tlm::BEGIN_RESP;
97 sc_core::sc_time delay = sc_core::SC_ZERO_TIME;
104 auto &gp = *((tlm::tlm_generic_payload *)req.meta_data);
105 gp.set_response_status(tlm::TLM_OK_RESPONSE);
110 auto status = memory_socket_->nb_transport_bw(*((tlm::tlm_generic_payload *)req.meta_data),
116 case tlm::TLM_COMPLETED:
123 case tlm::TLM_ACCEPTED:
130 case tlm::TLM_UPDATED:
132 if (!begin_resp_method_prev_warning_)
134 msg <<
"Target: " << ID_
135 <<
" TLM_UPDATED invalid response to BEGIN_RESP";
136 REPORT_WARNING(filename, __FUNCTION__, msg.str());
139 begin_resp_method_prev_warning_ =
true;
146 if (!begin_resp_method_prev_warning_)
148 msg <<
"Target: " << ID_
149 <<
" undefined return status ";
150 REPORT_WARNING(filename, __FUNCTION__, msg.str());
153 begin_resp_method_prev_warning_ =
true;
#define SPARTA_EXPECT_FALSE(x)
A macro for hinting to the compiler a particular condition should be considered most likely false.
Glue code that connect the Sparta scheduler to SystemC.
const Clock * getClock() const
log::MessageSource info_logger_
Default info logger.