本文整理汇总了C++中tlm::tlm_generic_payload类的典型用法代码示例。如果您正苦于以下问题:C++ tlm_generic_payload类的具体用法?C++ tlm_generic_payload怎么用?C++ tlm_generic_payload使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了tlm_generic_payload类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//==============================================================================
/// @fn memory::check_address
//
/// @brief Method to check if the gp is in the address range of this memory
//
/// @details
/// This routine used to check for errors in address space
//
//==============================================================================
tlm::tlm_response_status
memory::check_address
( tlm::tlm_generic_payload &gp
)
{
sc_dt::uint64 address = gp.get_address(); // memory address
unsigned int length = gp.get_data_length(); // data length
std::ostringstream msg;
msg.str("");
if ( address >= m_memory_size )
{
msg << "Target: " << m_ID
<<" address out-of-range";
REPORT_WARNING(filename, __FUNCTION__, msg.str());
return tlm::TLM_ADDRESS_ERROR_RESPONSE; // operation response
}
else
{
if ( (address + length) >= m_memory_size )
{
msg << "Target: " << m_ID
<< " address will go out of bounds";
REPORT_WARNING(filename, __FUNCTION__, msg.str());
return tlm::TLM_ADDRESS_ERROR_RESPONSE; // operation response
}
return tlm::TLM_OK_RESPONSE;
}
} // end check address
示例2: peq_cb
void peq_cb(tlm::tlm_generic_payload& trans, const tlm::tlm_phase& phase)
{
#ifdef DEBUG
if (phase == tlm::END_REQ)
fout << hex << trans.get_address() << " " << name() << " END_REQ at " << sc_time_stamp() << endl;
else if (phase == tlm::BEGIN_RESP)
fout << hex << trans.get_address() << " " << name() << " BEGIN_RESP at " << sc_time_stamp() << endl;
#endif
if (phase == tlm::END_REQ || (&trans == request_in_progress && phase == tlm::BEGIN_RESP))
{
// The end of the BEGIN_REQ phase
request_in_progress = 0;
end_request_event.notify();
}
else if (phase == tlm::BEGIN_REQ || phase == tlm::END_RESP)
SC_REPORT_FATAL("TLM-2", "Illegal transaction phase received by initiator");
if (phase == tlm::BEGIN_RESP)
{
check_transaction( trans );
// Send final phase transition to target
tlm::tlm_phase fw_phase = tlm::END_RESP;
sc_time delay = sc_time(rand_ps(), SC_PS);
socket->nb_transport_fw( trans, fw_phase, delay );
// Ignore return value
}
}
示例3: nb_transport_fw
// Tagged non-blocking transport forward method
virtual tlm::tlm_sync_enum nb_transport_fw(int id,
tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase, sc_time& delay)
{
assert (id < targ_socket.size());
// Forward path
m_id_map[ &trans ] = id;
sc_dt::uint64 address = trans.get_address();
sc_dt::uint64 masked_address;
unsigned int target_nr = decode_address( address, masked_address);
if (target_nr < init_socket.size())
{
// Modify address within transaction
trans.set_address( masked_address );
// Forward transaction to appropriate target
tlm::tlm_sync_enum status = init_socket[target_nr]->nb_transport_fw(trans, phase, delay);
if (status == tlm::TLM_COMPLETED)
// Put back original address
trans.set_address( address );
return status;
}
else
return tlm::TLM_COMPLETED;
}
示例4: b_transport
//======================================================================
/// @fn b_transport
//
/// @brief implementation of the blocking transport for transactions on
/// the SAE memory
//
/// @details IC1 initiators only have write access und LM only has
/// read access. This funtion first verifies that the requested
/// memory access is allowed before executing the operation. <br>
///
//
//======================================================================
void target_sae::b_transport ( int id,
tlm::tlm_generic_payload& tObj,
sc_core::sc_time& delay )
{
tlm::tlm_command cmd = tObj.get_command();
// control access rights
switch(id)
{
case 1: //lmodel
sae_mem.operation(lmodel_id_nr, tObj, delay);
break;
case 0: //ic1
if (cmd == tlm::TLM_READ_COMMAND )
{
tObj.set_response_status(tlm::TLM_COMMAND_ERROR_RESPONSE);
msg << "this component has write-access only!";
ERROR_LOG(filename, __FUNCTION__ , msg.str());
return;
}
sae_mem.operation(ic1_id_nr, tObj, delay);
break;
}
}
示例5: if
void leon3_funcat_trap::TLMMemory::peq_cb( tlm::tlm_generic_payload & trans, const \
tlm::tlm_phase & phase ){
// Payload event queue callback to handle transactions from target
// Transaction could have arrived through return path or backward path
if (phase == tlm::END_REQ || (&trans == request_in_progress && phase == tlm::BEGIN_RESP)){
// The end of the BEGIN_REQ phase
request_in_progress = NULL;
end_request_event.notify();
}
else if (phase == tlm::BEGIN_REQ || phase == tlm::END_RESP){
SC_REPORT_FATAL("TLM-2", "Illegal transaction phase received by initiator");
}
if (phase == tlm::BEGIN_RESP){
if (trans.is_response_error()){
SC_REPORT_ERROR("TLM-2", ("Transaction returned with error, response status = " + \
trans.get_response_string()).c_str());
}
// Send final phase transition to target
tlm::tlm_phase fw_phase = tlm::END_RESP;
sc_time delay = SC_ZERO_TIME;
initSocket->nb_transport_fw(trans, fw_phase, delay);
if (trans.is_response_error()){
SC_REPORT_ERROR("TLM-2", ("Transaction returned with error, response status = " + \
trans.get_response_string()).c_str());
}
this->end_response_event.notify(delay);
}
}
示例6: entry_transport_dbg
//==============================================================================
// dbg_transport implementation calls from initiators
//
//=============================================================================
unsigned int model_jxz_tlm::entry_transport_dbg (tlm::tlm_generic_payload &gp)
{
tlm::tlm_command command = gp.get_command();// memory command
unsigned char *data = gp.get_data_ptr();// data pointer
unsigned int length = gp.get_data_length();// data length
gp.set_response_status(tlm::TLM_COMMAND_ERROR_RESPONSE);
return 0;
}
示例7: b_transport
inline void lt_target::b_transport(tlm::tlm_generic_payload& trans, sc_time& delay){
sc_dt::uint64 adr = trans.get_address() / 4;
unsigned char* ptr = trans.get_data_ptr();
unsigned int len = trans.get_data_length();
unsigned char* byt = trans.get_byte_enable_ptr();
unsigned int blen = trans.get_byte_enable_length();
unsigned int wid = trans.get_streaming_width();
if (adr >= sc_dt::uint64(mem_size) ) {
trans.set_response_status( tlm::TLM_ADDRESS_ERROR_RESPONSE );
return;
}
if ( wid < len ) {
trans.set_response_status( tlm::TLM_BURST_ERROR_RESPONSE );
return;
}
if (trans.is_read()) {
delay += rd_latency;
if ( byt != 0 ) {
for ( unsigned int i = 0; i < len; i++ )
if ( byt[i % blen] == TLM_BYTE_ENABLED ){
ptr[i] = (mem[adr+i/4] >> ((i&3)*8)) & 0xFF;
}
} else {
示例8: if
//==============================================================================
bool
dmi_memory::is_address_dmi
(
tlm::tlm_generic_payload &gp
)
{
m_start_address = gp.get_address();
m_end_address = m_start_address + gp.get_data_length();
std::ostringstream msg;
msg.str("");
msg << "Initiator:" << m_ID;
bool return_status = false;
if ( ( ( m_start_address < ( m_dmi_base_address ) )
|| ( m_end_address > ( m_dmi_base_address + m_dmi_size ) )
)
)
{
// address is outside of the DMI boundaries
msg << " address is not a dmi address";
// msg << "m_start_address= " << m_start_address << " m_address= " << m_address
// << endl << " "
// << "m_end_address= " << m_end_address << " m_offset= " << m_offset << " m_dmi_size= "<< m_dmi_size;
REPORT_INFO(filename, __FUNCTION__, msg.str());
}
else if ( ( gp.get_command () == tlm::TLM_WRITE_COMMAND )
)
{
if ( (m_granted_access != tlm::tlm_dmi::DMI_ACCESS_READ )
&& ( m_granted_access != tlm::tlm_dmi::DMI_ACCESS_NONE)){
msg << " correct address and appropriate access for a GP Write Command "<<endl<<" ";
REPORT_INFO(filename, __FUNCTION__, msg.str());
return_status=true;
}
} //end if
else if ( ( gp.get_command () == tlm::TLM_READ_COMMAND )
)
{
if ( (m_granted_access != tlm::tlm_dmi::DMI_ACCESS_WRITE )
&& ( m_granted_access != tlm::tlm_dmi::DMI_ACCESS_NONE)){
msg << " correct address and appropriate access for a GP Read Command "<<endl<<" ";
REPORT_INFO(filename, __FUNCTION__, msg.str());
return_status=true;
}
} //end if
else {
// access permission does not match access required for operation
msg << " Incompatible GP Command for DMI Access Granted ";
// msg << " Gp.getcommand()= " << gp.get_command();
REPORT_INFO(filename, __FUNCTION__, msg.str());
} //end else
return return_status;
} // end check is dmi
示例9: b_transport
//Method used for receiving acknowledgements of interrupts; the ack consists of
//uninteresting data and the address corresponds to the interrupt signal to
//be lowered
//As a response, I lower the interrupt by sending a NULL pointer on the init_socket
void b_transport(tlm::tlm_generic_payload& trans, sc_time& delay) {
if(this->lastIrq < 0) {
THROW_EXCEPTION("Error, lowering an interrupt which hasn't been raised yet!!");
}
tlm::tlm_command cmd = trans.get_command();
sc_dt::uint64 adr = trans.get_address();
unsigned char* ptr = trans.get_data_ptr();
if(trans.get_command() == tlm::TLM_READ_COMMAND) {
THROW_EXCEPTION("Error, the read request is not currently supported by external PINs");
}
else if(cmd == tlm::TLM_WRITE_COMMAND) {
if(this->lastIrq != adr) {
THROW_EXCEPTION("Error, lowering interrupt " << std::hex << std::showbase << (unsigned)adr << " while " << std::hex << std::showbase << this->lastIrq << " was raised");
}
else {
//finally I can really lower the interrupt: I send 0 on
//the initSocked
unsigned char data = 0;
trans.set_data_ptr(&data);
trans.set_dmi_allowed(false);
trans.set_response_status( tlm::TLM_INCOMPLETE_RESPONSE );
sc_time delay;
this->init_socket->b_transport(trans, delay);
if(trans.is_response_error()) {
std::string errorStr("Error in b_transport of PIN, response status = " + trans.get_response_string());
SC_REPORT_ERROR("TLM-2", errorStr.c_str());
}
this->lastIrq = -1;
}
}
trans.set_response_status(tlm::TLM_OK_RESPONSE);
}
示例10: entry_b_transport
//==============================================================================
// b_transport implementation calls from initiators
//
//=============================================================================
void model_jxz_tlm::entry_b_transport (tlm::tlm_generic_payload &gp, sc_core::
sc_time &delay_time)
{
tlm::tlm_command command = gp.get_command();// memory command
unsigned char *data = gp.get_data_ptr();// data pointer
unsigned int length = gp.get_data_length();// data length
unsigned long timefactor = ((length+BUSWIDTHBYTE-1)/BUSWIDTHBYTE)-1;
bool write_ok = true;
gp.set_response_status(tlm::TLM_COMMAND_ERROR_RESPONSE);
return;
}
示例11: transport_dbg
// Tagged debug transaction method
virtual unsigned int transport_dbg(int id, tlm::tlm_generic_payload& trans)
{
sc_dt::uint64 masked_address;
unsigned int target_nr = decode_address( trans.get_address(), masked_address );
if (target_nr >= init_socket.size())
return 0;
trans.set_address( masked_address );
// Forward debug transaction to appropriate target
return init_socket[target_nr]->transport_dbg( trans );
}
示例12: b_transport
virtual void b_transport(int socketId, tlm::tlm_generic_payload& trans, sc_time & delay) {
// if the address is in range
if (trans.get_address() <= MAX_ADDRESS) {
//forward the message
(*init_sock[trans.get_address()])->b_transport(trans, delay);
} else {
//else error status
trans.set_response_status(tlm::TLM_ADDRESS_ERROR_RESPONSE);
}
}
示例13: b_transport
void FastBus::b_transport(tlm::tlm_generic_payload &trans,
sc_core::sc_time &t) {
ensitlm::addr_t a = trans.get_address();
addr_map_t::iterator it = addr_map.find(addr_range(a, a));
if (it == addr_map.end()) {
std::cerr << name() << ": no target at address "
<< std::showbase << std::hex << a << std::endl;
trans.set_response_status(tlm::TLM_ADDRESS_ERROR_RESPONSE);
return;
}
trans.set_address(a - (*it).first.begin);
initiator[(*it).second]->b_transport(trans, t);
}
示例14: nb_transport_bw
// Tagged non-blocking transport backward method
virtual tlm::tlm_sync_enum nb_transport_bw(int id,
tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase, sc_time& delay)
{
assert (id < init_socket.size());
// Backward path
// Replace original address
sc_dt::uint64 address = trans.get_address();
trans.set_address( compose_address( id, address ) );
return targ_socket[ m_id_map[ &trans ] ]->nb_transport_bw(trans, phase, delay);
}
示例15: b_transport
virtual void b_transport( tlm::tlm_generic_payload& trans, sc_time& delay )
{
unsigned int bel = trans.get_byte_enable_length();
trans2.set_data_ptr( data );
if (bel)
trans2.set_byte_enable_ptr( byte_enable );
trans2.deep_copy_from(trans);
init_socket->b_transport( trans2, delay );
trans.update_original_from( trans2 );
}