Hi Shuchang,

As you suggest, the memory does what most memories do…it writes data when it 
sees a write command, and it reads data on a read command :-). The abstract 
memory corresponds to a contiguous address range in the host memory (using 
mmap).

Andreas

From: shanshuchang <shanshuch...@ict.ac.cn<mailto:shanshuch...@ict.ac.cn>>
Reply-To: gem5 users mailing list 
<gem5-users@gem5.org<mailto:gem5-users@gem5.org>>
Date: Wednesday, 19 December 2012 09:07
To: "gem5-users@gem5.org<mailto:gem5-users@gem5.org>" 
<gem5-users@gem5.org<mailto:gem5-users@gem5.org>>
Subject: [gem5-users] question about memory data

Hi all:

I am a newer to GEM5 simulator. I want to get the exact memory data stored in 
the simulated system. I have noted that there is a function 
AbstractMemory::access(PacketPtr pkt) in abstract_mem.cc.


 if (pkt->isRead()) {
        assert(!pkt->isWrite());
        if (pkt->isLLSC()) {
            trackLoadLocked(pkt);
        }
        if (pmemAddr)
            memcpy(pkt->getPtr<uint8_t>(), hostAddr, pkt->getSize());
        TRACE_PACKET(pkt->req->isInstFetch() ? "IFetch" : "Read");
        numReads[pkt->req->masterId()]++;
        bytesRead[pkt->req->masterId()] += pkt->getSize();
        if (pkt->req->isInstFetch())
            bytesInstRead[pkt->req->masterId()] += pkt->getSize();
    } else if (pkt->isWrite()) {
        if (writeOK(pkt)) {
            if (pmemAddr)
                memcpy(hostAddr, pkt->getPtr<uint8_t>(), pkt->getSize());

I guess that, the exact operation of memcpy() is to read (write) data from 
(into) the memory in case of  read (write) operations (indicated by 
pkt->isWrite()). Am I right here?


Regards,
Shuchang

-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to