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’t need to multiply
another 64 again. 

 

In fact, AbstractMemory has the function “access(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]] On
Behalf Of 单书畅
Sent: Sunday, January 27, 2013 6:31 AM
To: [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]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to