本文整理汇总了C++中PacketPtr::needsResponse方法的典型用法代码示例。如果您正苦于以下问题:C++ PacketPtr::needsResponse方法的具体用法?C++ PacketPtr::needsResponse怎么用?C++ PacketPtr::needsResponse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketPtr
的用法示例。
在下文中一共展示了PacketPtr::needsResponse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeData
void PHXSimWrap::writeData(uint id, uint64_t addr, uint64_t clockcycle)
{
PRINTFN("%s: id=%d addr=%#lx clock=%lu\n",__func__,id,addr,clockcycle);
std::multimap< uint64_t, PacketPtr >::iterator it =
m_wr_pktMap.find( addr );
assert( it != m_wr_pktMap.end() );
PacketPtr pkt = it->second;
m_wr_lat.sample( curTick() - pkt->dram_enter_time );
PRINTFN("%s() `%s` addr=%#lx size=%d\n", __func__, pkt->cmdString().c_str(),
(long)pkt->getAddr(), pkt->getSize());
PhysicalMemory::doAtomicAccess( pkt );
if ( pkt->needsResponse() ) {
m_readyQ.push_back(pkt);
} else {
delete pkt;
}
m_wr_pktMap.erase( addr );
}
示例2: recvTiming
bool PHXSimWrap::recvTiming(PacketPtr pkt)
{
uint64_t addr = pkt->getAddr();
PRINTFN("%s: %s %#lx\n", __func__, pkt->cmdString().c_str(), (long)addr);
pkt->dram_enter_time = curTick();
if ( pkt->isRead() ) {
bool ret = m_memorySystem->AddTransaction( false, addr, 0 );
if ( ! ret ) return false;
assert(m_rd_pktMap.find( addr ) == m_rd_pktMap.end());
m_rd_pktMap[ addr ] = pkt;
} else if ( pkt->isWrite() ) {
bool ret = m_memorySystem->AddTransaction( true, addr, 0 );
if ( ! ret ) return false;
std::multimap< uint64_t, PacketPtr >::iterator it;
it = m_wr_pktMap.find( addr );
assert( it == m_wr_pktMap.end());
m_wr_pktMap.insert( pair<uint64_t, PacketPtr>(addr, pkt) );
} else {
if ( pkt->needsResponse() ) {
pkt->makeTimingResponse();
m_readyQ.push_back( pkt );
} else {
delete pkt;
}
}
return true;
}
示例3: if
Tick BridgeClassicToAMBATLM2<BUSWIDTH>::recvAtomic(PacketPtr pkt)
{
tlm::tlm_generic_payload trans;
// std::cout << "In " << sc_core::sc_object::name() << " at time " << sc_time_stamp() << " request from GEM5 with address=0x" << hex << pkt->getAddr() << dec << " size=" << pkt->getSize() << std::endl;
if (pkt->memInhibitAsserted()) {
return 0;
}
if (pkt->cmd == MemCmd::SwapReq)
{
panic("SwapReq not supported\n");
}
else if (pkt->isRead())
{
assert(!pkt->isWrite());
if (pkt->isLLSC()) {
trackLoadLocked(pkt);
}
// if (pkt->isLLSC())
// {
// panic("isLLSC not yet supported for atomic\n");
// }
trans.set_read();
trans.set_address(pkt->getAddr());
trans.set_data_length(pkt->getSize());
trans.set_data_ptr(pkt->getPtr<unsigned char>());
debug_port->transport_dbg(static_cast<tlm::tlm_generic_payload &>(trans));
unsigned char * data = pkt->getPtr<unsigned char>();
// std::cout << "In " << sc_core::sc_object::name() << " at time " << sc_time_stamp() << " sending a READ response to GEM5 with address=0x" << hex << pkt->getAddr() << dec << " size=" << pkt->getSize();
// std::cout << hex << " and data= [";
// for(unsigned j=0;j<pkt->getSize(); j++)
// std::cout << "0x" << uint32_t(data[j]) << ",";
// std::cout << "]" << dec << std::endl;
}
else if (pkt->isWrite())
{
// std::cout << "isWrite " << std::endl;
if (writeOK(pkt))
{
trans.set_write();
/*if (writeOK(pkt)) {
if (pmemAddr)
memcpy(hostAddr, pkt->getPtr<uint8_t>(), pkt->getSize());
assert(!pkt->req->isInstFetch());
}*/
trans.set_address(pkt->getAddr());
trans.set_data_length(pkt->getSize());
trans.set_data_ptr(pkt->getPtr<unsigned char>());
debug_port->transport_dbg(static_cast<tlm::tlm_generic_payload &>(trans));
}
else
std::cout << "recvAtomic !writeOK " << hex << pkt->getAddr() << dec << std::endl;
}
else if (pkt->isInvalidate())
{
//upgrade or invalidate
if (pkt->needsResponse())
{
pkt->makeAtomicResponse();
}
}
else
{
panic("unimplemented");
}
if (pkt->needsResponse())
{
pkt->makeAtomicResponse();
}
return 1000;
}