gem5-users@gem5.org

The gem5 Users mailing list

View all threads

Write to cache

NS
Nazmus Sakib
Tue, Jun 11, 2024 2:33 AM

Hello. I have some questions regarding writes.

In base.cc, updateBlockData() method calls writeDataToBlock() of PacketPtr class.

Following are my questions:

Inside writedatatoblock(), there is : writeData(blk_data + getOffset(blkSize));
here, blk_data is a 8 bit value (uint8_t). But in the comments it say, blk_data is pointer to the cache block we are trying to write to. Shouldn't an address (pointed to by blk_data) be of 64/32 bit ?
Also, why the add with getOffset() ? To ensure we are writing to the correct offset from the starting addr of "blk_data" field in "cache block" object?
2.
In the writedata() method, I can see two different ways, depending on the flag isMaskedWrite.
Suppose I wanted to "byteEnable" some bytes of a cacheline at L1 to be written to L2, and not "byteEnabled" bytes are not written in L2. Any idea how to approach this ?

Thank you !!

Hello. I have some questions regarding writes. In base.cc, updateBlockData() method calls writeDataToBlock() of PacketPtr class. Following are my questions: 1. Inside writedatatoblock(), there is : writeData(blk_data + getOffset(blkSize)); here, blk_data is a 8 bit value (uint8_t). But in the comments it say, blk_data is pointer to the cache block we are trying to write to. Shouldn't an address (pointed to by blk_data) be of 64/32 bit ? Also, why the add with getOffset() ? To ensure we are writing to the correct offset from the starting addr of "blk_data" field in "cache block" object? 2. In the writedata() method, I can see two different ways, depending on the flag isMaskedWrite. Suppose I wanted to "byteEnable" some bytes of a cacheline at L1 to be written to L2, and not "byteEnabled" bytes are not written in L2. Any idea how to approach this ? Thank you !!