Hi Shuschang,

As Tao pointed out, it's worth having a look at the code in AbstractMemory that 
actually interacts with the backing store of the memory.

When it comes to the amount to read out, have a look at the parameters 
bytesPerCacheLine and linesPerRowBuffer (as it depends on the memory type).

Good luck with your modifications.

Andreas

From: Tao Zhang <[email protected]<mailto:[email protected]>>
Reply-To: gem5 users mailing list 
<[email protected]<mailto:[email protected]>>
Date: Sunday, 27 January 2013 19:49
To: 'gem5 users mailing list' <[email protected]<mailto:[email protected]>>
Subject: Re: [gem5-users] question about reading out a whole DRAM row data

Hi Shuchang,

In my opinion, your code are almost correct expect that the pkt->getSize() does 
return the cacheline size (64 in byte). You don鈥檛 need to multiply another 64 
again.

In fact, AbstractMemory has the function 鈥渁ccess(PacketPtr pkt)鈥?in which the 
data is also copied. You can read the code between line 352 and 372 in 
abstract_mem.cc to see how the data is copied. It does almost the same thing as 
you do. As a result, you can simply extend the  AbstractMemory and use the 
access() to make sure the data is in pkt->getPtr<uint8_t>(); What you only need 
to do is to copy this data to your raw data pointer.

-Tao

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of 锟斤拷锟介畅
Sent: Sunday, January 27, 2013 6:31 AM
To: [email protected]<mailto:[email protected]>
Subject: [gem5-users] question about reading out a whole DRAM row data

Hi all,


I am trying to modify the SimpleDRAM module to profile the data contents in 
phymem.

In simple_dram.cc, the docodeAddr() function shows how to get the rank and the 
bank addresses for given request pkt.
I wonder, given pkt->getAddr(), how to calculate the row address?
It seems that, a dram row contains 64 (linesPerRow = 64) 64-Byte data blocks, 
and I want to read out the whole row data into a self-defined data structure ( 
namely row_data).

The detailed codes are like this:

uint8_t *myHostAddr = pmemAddr + (pkt->getAddr() - pkt->getAddr() % 
linesPerRow)  - range.start;

int row_size = pkt->getSize()*64;
uint8_t row_data[row_size];
memcpy(row_data, myHostAddr , row_size ); // read the whole MEM row data out 
into the array structure: row_data


I am not sure whether the calculation of the row address is right. Any advice 
will be appreciated.

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
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to