I recommend that you have a look at the source of how AtomicSimpleCPU
does an ifetch under Eclipse. It should be easy to understand
everything quickly from there.

The Packet address is physical (which notably what caches and DRAM
work on), just have a look at the constructor of packet:

    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();

So you have to do translation before. Translation sets the physical
address on the Request, which contains both _paddr and _vaddr fields.

Another option is to have a look at how some of the memory tests are doing it.

On Wed, Aug 12, 2020 at 1:55 AM ABD ALRHMAN ABO ALKHEEL via gem5-users
<gem5-users@gem5.org> wrote:
>
> Hi,
>
> Thank you for your email.
>
> Do you have any idea how to construct a packet with a request to read from 
> the memory address? For instance, let us assume that the address that I want 
> to read the data from it is (0x2345),  I want to read the 256 bytes of this 
> address (0x2300-0x23ff)? I want to do that for debugging like this 
> https://www.gem5.org/_pages/static/scripts/part2/memoryobject/simple_memobj.cc.
>
> Any help would be appreciated.
>
> Thanks
>
> ________________________________
> From: Ahmed, Md Rubel via gem5-users <gem5-users@gem5.org>
> Sent: Wednesday, August 12, 2020 12:44 AM
> To: gem5 users mailing list <gem5-users@gem5.org>
> Cc: Ahmed, Md Rubel <mdrubelah...@usf.edu>
> Subject: [gem5-users] Re: Memory Addresses in Gem5
>
> Hi,
>
> pkt->getAddr()  returns memory address. pkt->print() also returns block 
> address and offset.
>
> Thanks
> ________________________________
> From: ABD ALRHMAN ABO ALKHEEL via gem5-users <gem5-users@gem5.org>
> Sent: Tuesday, August 11, 2020 6:32 PM
> To: gem5 users mailing list <gem5-users@gem5.org>; gem5-users 
> <gem5-users-boun...@gem5.org>
> Cc: ABD ALRHMAN ABO ALKHEEL <abdkeel...@hotmail.com>
> Subject: [gem5-users] Memory Addresses in Gem5
>
> Hi All,
>
> Does the packet in gem5 have the memory address? for example, does this 
> pkt->getAddr() return the memory address or not? If so, is that address 
> physical or virtual?
>
> Thanks
>
> [EXTERNAL EMAIL] DO NOT CLICK links or attachments unless you recognize the 
> sender and know the content is safe.
>
> _______________________________________________
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to