Hi Tao, Shuchang,

Please note that there are uncacheable requests that do not necessarily have 
the size 64 bytes. Thus, rather use bytesPerCacheLine than pkt->getSize() for 
this.

Andreas

From: 锟斤拷锟介畅 <[email protected]<mailto:[email protected]>>
Reply-To: gem5 users mailing list 
<[email protected]<mailto:[email protected]>>
Date: Tuesday, 29 January 2013 01:58
To: gem5 users mailing list <[email protected]<mailto:[email protected]>>
Subject: Re: [gem5-users] question about reading out a whole DRAM row data

Hi Tao:

Thanks for your  reply. :)


Shuchang

2013/1/28 Tao Zhang <[email protected]<mailto:[email protected]>>
Hi Shuchang,

If we assume the memory space in both host machine and simulator is continuous, 
then we can calculate the row address as follows.

unsigned myRowSize = pkt->getSize() * linesPerRow;

uint8_t* myRowAddr = pmemAddr + (pkt->getAddr() - range.start) / myRowSize * 
myRowSize;

or

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

-Tao


On 01/28/2013 03:18 AM, 锟斤拷锟介畅 wrote:
Hi Tao, thanks for your quickly reply.

I have read the codes of function access(PacketPtr pkt) in abstract_mem.cc. The 
main difference is that, in the given function access(), the operation is the 
granularity of a cache line (64-Byte, actually it is a specified column of a 
whole row; while for my codes, I want to copy the whole row in to data 
structure row_data (That's why I need to multiply another 64. Here the 64 
equals the parameter linesPerRowBuffer).

In other words, in the function access(), memory access is to only one column 
of a row, while I want to access the entire row.

My concern is that, whether myHostAddr can point to the start address of the 
row (given pkt->getAddr)?


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

Regards,
Shuchang

2013/1/28 Tao Zhang <[email protected]<mailto:[email protected]>>
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]<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





_______________________________________________
gem5-users mailing list
[email protected]<mailto:[email protected]>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users



_______________________________________________
gem5-users mailing list
[email protected]<mailto:[email protected]>http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

_______________________________________________
gem5-users mailing list
[email protected]<mailto:[email protected]>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


-- 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