Let me speak with the details in the code:

in access():
if (pkt->cmd == MemCmd::Writeback) {
        if (blk == NULL) {
            blk = allocateBlock(pkt->getAddr(), writebacks);
            tags->insertBlock(pkt->getAddr(), blk, id);
       }
}

That says, we are accessing cache to read a blk. If the command is
writeback and the that block is not present in the cache, it is then
inserted to cache.



in handleResponse():
    blk = handleFill(pkt, blk, writebacks);

in handleFill():
    if (blk == NULL) {
        blk = allocateBlock(addr, writebacks);
        if (blk == NULL) {
            blk = tempBlock;
            tempBlock->set = tags->extractSet(addr);
            tempBlock->tag = tags->extractTag(addr);
            DPRINTF(Cache, "using temp block for %x\n", addr);
        } else {
            int id = pkt->req->masterId();
            tags->insertBlock(pkt->getAddr(), blk, id);
        }

I can not find what you said in the code.
Can you please explain more?

Regards,

On 4/13/12, Steve Reinhardt <[email protected]> wrote:
> If you are replacing a dirty block, you need to read that block out of the
> cache before the new block shows up, so that you have somewhere to put the
> new block.  Thus you don't want to wait until the new block shows up (which
> is when handleFill() is called) to identify the victim.  This also allows
> you to potentially initiate the writeback while still waiting for the miss
> response.
>
> Steve
>
> On Fri, Apr 13, 2012 at 3:14 AM, Mahmood Naderan
> <[email protected]>wrote:
>
>> I noticed that miss and hit count are done in access(). That is fine.
>> However what I don't understand is that why *allocateBlock()* is
>> called in access()?
>>
>> If it has a reason, then what is handleFill() ?
>>
>> Thanks for any suggestion
>>
>> On 4/12/12, Mahmood Naderan <[email protected]> wrote:
>> > Hi
>> > There is something vague in cache_impl.hh. There is a access function
>> > in timingAccess():
>> > bool satisfied = access(pkt, blk, lat, writebacks);
>> >
>> > This function will call
>> > blk = allocateBlock(pkt->getAddr(), writebacks);
>> >
>> > within that, a victim is selected
>> > BlkType *blk = tags->findVictim(addr, writebacks);
>> >
>> > The question is why a victim is selected on a cache access? Don't we
>> > have handleFill()?
>> >
>> > In another word, when a block is being accessed, we favor only true or
>> > false. Selecting a victim for replacement is done in another function
>> > which is named handleFill()
>> >
>> > I think this is redundant action. Can someone clarify that?
>> > --
>> > // Naderan *Mahmood;
>> >
>>
>>
>> --
>> --
>> // Naderan *Mahmood;
>> _______________________________________________
>> gem5-users mailing list
>> [email protected]
>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>
>


-- 
--
// Naderan *Mahmood;
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to