24.21.2.2. gem5 Request

One good way to think about Request vs Packet could be "it is what the instruction definitions see", a bit like ExecContext vs ThreadContext.

Request is passed to the constructor of Packet, and Packet keeps a reference to it:

    Packet(const RequestPtr &_req, MemCmd _cmd)
        :  cmd(_cmd), id((PacketId)_req.get()), req(_req),
           data(nullptr), addr(0), _isSecure(false), size(0),
           _qosValue(0), headerDelay(0), snoopDelay(0),
           payloadDelay(0), senderState(NULL)
    {
        if (req->hasPaddr()) {
            addr = req->getPaddr();
            flags.set(VALID_ADDR);
            _isSecure = req->isSecure();
        }
        if (req->hasSize()) {
            size = req->getSize();
            flags.set(VALID_SIZE);
        }
    }

where RequestPtr is defined as:

typedef std::shared_ptr<Request> RequestPtr;

so we see that shared pointers to requests are basically passed around.

Some key fields include:

  • _paddr:

    /**
        * The physical address of the request. Valid only if validPaddr
        * is set.
        */
    Addr _paddr = 0;
  • _vaddr:

    /** The virtual address of the request. */
    Addr _vaddr = MaxAddr;