util/tlm/src/sc_slave_port.cc
/**
 * Convert a gem5 packet to a TLM payload by copying all the relevant
 * information to a previously allocated tlm payload
 */
Convert a gem5 packet to a TLM payload by copying all the relevant
information to a previously allocated tlm payload
Convert a gem5 packet to a TLM payload by copying all the relevant information to a previously allocated tlm payload
void
packet2payload(gem5::PacketPtr packet, tlm::tlm_generic_payload &trans)
{
    trans.set_address(packet->getAddr());
    sc_assert(trans.has_mm());
    unsigned int size = packet->getSize();
    unsigned char *data = packet->getPtr<unsigned char>();
    trans.set_data_length(size);
    trans.set_streaming_width(size);
    trans.set_data_ptr(data);
    if (packet->isRead()) {
        trans.set_command(tlm::TLM_READ_COMMAND);
    }
    else if (packet->isInvalidate()) {
    } else if (packet->isWrite()) {
        trans.set_command(tlm::TLM_WRITE_COMMAND);
    } else {
        SC_REPORT_FATAL("SCSlavePort", "No R/W packet");
    }
}
void packet2payload ( gem5 :: PacketPtr packet , tlm :: tlm_generic_payload & trans ) { trans . set_address ( packet -> getAddr ( ) ) ; sc_assert ( trans . has_mm ( ) ) ; unsigned int size = packet -> getSize ( ) ; unsigned char * data = packet -> getPtr < unsigned char > ( ) ; trans . set_data_length ( size ) ; trans . set_streaming_width ( size ) ; trans . set_data_ptr ( data ) ; if ( packet -> isRead ( ) ) { trans . set_command ( tlm :: TLM_READ_COMMAND ) ; } else if ( packet -> isInvalidate ( ) ) { } else if ( packet -> isWrite ( ) ) { trans . set_command ( tlm :: TLM_WRITE_COMMAND ) ; } else { SC_REPORT_FATAL ( " " , " " ) ; } }
Convert a gem5 packet to a TLM payload by copying all the relevant
 information to a previously allocated tlm payload
Convert a gem5 packet to a TLM payload by copying all the relevant information to a previously allocated tlm payload
/* Check if this transaction was allocated by mm */ /* Do nothing */