{
return (tag);
}
-
- /**
- * Read the data out of the internal storage of a cache block. FALRU
- * currently doesn't support data storage.
- * @param blk The cache block to read.
- * @param data The buffer to read the data into.
- * @return The data from the cache block.
- */
- void readData(FALRUBlk *blk, uint8_t *data)
- {
- }
-
- /**
- * Write data into the internal storage of a cache block. FALRU
- * currently doesn't support data storage.
- * @param blk The cache block to be written.
- * @param data The data to write.
- * @param size The number of bytes to write.
- * @param writebacks A list for any writebacks to be performed. May be
- * needed when writing to a compressed block.
- */
- void writeData(FALRUBlk *blk, uint8_t *data, int size,
- PacketList &writebacks)
- {
- }
};
#endif
}
}
-void
-IIC::readData(IICTag *blk, uint8_t *data)
-{
- assert(blk->size <= trivialSize || blk->numData > 0);
- int data_size = blk->size;
- if (data_size > trivialSize) {
- for (int i = 0; i < blk->numData; ++i){
- memcpy(data+i*subSize,
- &(dataBlks[blk->data_ptr[i]][0]),
- (data_size>subSize)?subSize:data_size);
- data_size -= subSize;
- }
- } else {
- memcpy(data,blk->trivialData,data_size);
- }
-}
-
-void
-IIC::writeData(IICTag *blk, uint8_t *write_data, int size,
- PacketList & writebacks)
-{
- DPRINTF(IIC, "Writing %d bytes to %x\n", size,
- blk->tag<<tagShift);
- // Find the number of subblocks needed, (round up)
- int num_subs = (size + (subSize -1))/subSize;
- if (size <= trivialSize) {
- num_subs = 0;
- }
- assert(num_subs <= numSub);
- if (num_subs > blk->numData) {
- // need to allocate more data blocks
- for (int i = blk->numData; i < num_subs; ++i){
- blk->data_ptr[i] = getFreeDataBlock(writebacks);
- dataReferenceCount[blk->data_ptr[i]] += 1;
- }
- } else if (num_subs < blk->numData){
- // can free data blocks
- for (int i=num_subs; i < blk->numData; ++i){
- // decrement reference count and compare to zero
- if (--dataReferenceCount[blk->data_ptr[i]] == 0) {
- freeDataBlock(blk->data_ptr[i]);
- }
- }
- }
-
- blk->numData = num_subs;
- blk->size = size;
- assert(size <= trivialSize || blk->numData > 0);
- if (size > trivialSize){
- for (int i = 0; i < blk->numData; ++i){
- memcpy(&dataBlks[blk->data_ptr[i]][0], write_data + i*subSize,
- (size>subSize)?subSize:size);
- size -= subSize;
- }
- } else {
- memcpy(blk->trivialData,write_data,size);
- }
-}
-
-
void
IIC::cleanupRefs()
{
void insertBlock(Addr addr, BlkType *blk);
- /**
- * Read the data from the internal storage of the given cache block.
- * @param blk The block to read the data from.
- * @param data The buffer to read the data into.
- * @return The cache block's data.
- */
- void readData(IICTag *blk, uint8_t *data);
-
- /**
- * Write the data into the internal storage of the given cache block.
- * @param blk The block to write to.
- * @param data The data to write.
- * @param size The number of bytes to write.
- * @param writebacks A list for any writebacks to be performed. May be
- * needed when writing to a compressed block.
- */
- void writeData(IICTag *blk, uint8_t *data, int size,
- PacketList & writebacks);
-
/**
* Called at end of simulation to complete average block reference stats.
*/
virtual void cleanupRefs();
+
private:
/**
* Return the hash of the address.
return hitLatency;
}
- /**
- * Read the data out of the internal storage of the given cache block.
- * @param blk The cache block to read.
- * @param data The buffer to read the data into.
- * @return The cache block's data.
- */
- void readData(LRUBlk *blk, uint8_t *data)
- {
- std::memcpy(data, blk->data, blk->size);
- }
-
- /**
- * Write data into the internal storage of the given cache block. Since in
- * LRU does not store data differently this just needs to update the size.
- * @param blk The cache block to write.
- * @param data The data to write.
- * @param size The number of bytes to write.
- * @param writebacks A list for any writebacks to be performed. May be
- * needed when writing to a compressed block.
- */
- void writeData(LRUBlk *blk, uint8_t *data, int size,
- PacketList & writebacks)
- {
- assert(size <= blkSize);
- blk->size = size;
- }
-
/**
* Called at end of simulation to complete average block reference stats.
*/