Hello all,

I want to swap the sets[set] (the sets is   SetType *sets  ) which just visited 
with sets[0]

 

I add the code at base_set_assoc,hh

  CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat) override
    {
        Addr tag = extractTag(addr);
        int set = extractSet(addr);
        BlkType *blk = sets[set].findBlk(tag, is_secure);

        // Access all tags in parallel, hence one in each way.  The data side
        // either accesses all blocks in parallel, or one block sequentially on
        // a hit.  Sequential access with a miss doesn't access data.
        tagAccesses += allocAssoc;
        if (sequentialAccess) {
            if (blk != nullptr) {
                dataAccesses += 1;
            }
        } else {
            dataAccesses += allocAssoc;
        }

        if (blk != nullptr) {
            // If a cache hit
            lat = accessLatency;

            // Check if the block to be accessed is available. If not,
            // apply the accessLatency on top of block->whenReady.
            if (blk->whenReady > curTick() &&
                cache->ticksToCycles(blk->whenReady - curTick()) >
               accessLatency){
                lat = cache->ticksToCycles(blk->whenReady - curTick()) +
              accessLatency;
            }
            blk->refCount += 1;

        } else {
            // If a cache miss
            lat = lookupLatency;
        }

// add by me
 moveToQuickSet(sets,set);

//end add
        return blk;
    }

//add by me
void
moveToQuickSet(SetType *sets,int set){
  
   if (sets[set]==0)
 return;

     
 SetType *next =&sets[set];
         
  //assert(i<numSets);

  SetType *p =&sets[0];
  swapset(p,next);
              
 }
void swapset(SetType * p1,SetType *p2){
  SetType temp;
 temp=*p1;
 *p1=*p2;
*p2=temp;
}

//end by me

 

 

But encountered such a problem when I run the gem5:

my common line: lili@ubuntu:~/gem5$ build/X86/gem5.debug configs/example/se.py 
--cmd=tests/test-progs/hello/bin/x86/linux/hello --caches 
--cpu-type=TimingSimpleCPU

the problem detailed:


gem5.debug: build/X86/mem/cache/cache.cc:935: Packet* 
Cache::createMissPacket(PacketPtr, CacheBlk*, bool) const: Assertion 
`!blk->isWritable()' failed.
Program aborted at tick 153500
--- BEGIN LIBC BACKTRACE ---
/home/lili/gem5/build/X86/gem5.debug(_Z15print_backtracev+0x23)[0x2dc9da2]
/home/lili/gem5/build/X86/gem5.debug(_Z12abortHandleri+0x5f)[0x2dd1961]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f5958e18340]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x39)[0x7f5957346cc9]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7f595734a0d8]
/lib/x86_64-linux-gnu/libc.so.6(+0x2fb86)[0x7f595733fb86]
/lib/x86_64-linux-gnu/libc.so.6(+0x2fc32)[0x7f595733fc32]
/home/lili/gem5/build/X86/gem5.debug(_ZNK5Cache16createMissPacketEP6PacketP8CacheBlkb+0x229)[0x1ff541d]
/home/lili/gem5/build/X86/gem5.debug(_ZN5Cache19sendMSHRQueuePacketEP4MSHR+0x51a)[0x1ffbc8c]
/home/lili/gem5/build/X86/gem5.debug(_ZN4MSHR10sendPacketER5Cache+0x23)[0x1ffe169]
/home/lili/gem5/build/X86/gem5.debug(_ZN5Cache19CacheReqPacketQueue18sendDeferredPacketEv+0xbf)[0x1ffc591]
/home/lili/gem5/build/X86/gem5.debug(_ZN11PacketQueue16processSendEventEv+0x4b)[0x2d4ff79]
/home/lili/gem5/build/X86/gem5.debug[0x2d4f441]
/home/lili/gem5/build/X86/gem5.debug[0x2d5037a]
/home/lili/gem5/build/X86/gem5.debug(_ZNKSt8functionIFvvEEclEv+0x32)[0x1f5cc2c]
/home/lili/gem5/build/X86/gem5.debug(_ZN20EventFunctionWrapper7processEv+0x1c)[0x1f5c3e6]
/home/lili/gem5/build/X86/gem5.debug(_ZN10EventQueue10serviceOneEv+0xda)[0x2dcf176]
/home/lili/gem5/build/X86/gem5.debug(_Z9doSimLoopP10EventQueue+0x1eb)[0x2dd705a]
/home/lili/gem5/build/X86/gem5.debug(_Z8simulatem+0x2c9)[0x2dd6cb9]
/home/lili/gem5/build/X86/gem5.debug(_ZN8pybind116detail15argument_loaderIJmEE9call_implIP22GlobalSimLoopExitEventRPFS5_mEJLm0EEEET_OT0_NS0_14index_sequenceIJXspT1_EEEE+0x3c)[0x26e8288]
/home/lili/gem5/build/X86/gem5.debug(_ZN8pybind116detail15argument_loaderIImEE4callIP22GlobalSimLoopExitEventRPFS5_mEEENSt9enable_ifIXntsrSt7is_voidIT_E5valueESB_E4typeEOT0_+0x32)[0x26e6418]
/home/lili/gem5/build/X86/gem5.debug(_ZZN8pybind1112cpp_function10initializeIRPFP22GlobalSimLoopExitEventmES3_ImEINS_4nameENS_5scopeENS_7siblingENS_5arg_vEEEEvOT_PFT0_DpT1_EDpRKT2_ENKUlRNS_6detail13function_callEE1_clESO_+0x94)[0x26e2446]
/home/lili/gem5/build/X86/gem5.debug(_ZZN8pybind1112cpp_function10initializeIRPFP22GlobalSimLoopExitEventmES3_ImEINS_4nameENS_5scopeENS_7siblingENS_5arg_vEEEEvOT_PFT0_DpT1_EDpRKT2_ENUlRNS_6detail13function_callEE1_4_FUNESO_+0x1d)[0x26e2497]
/home/lili/gem5/build/X86/gem5.debug(_ZN8pybind1112cpp_function10dispatcherEP7_objectS2_S2_+0x9d5)[0x26832a6]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x45f7)[0x7f59589df5b7]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d)[0x7f59589e1c3d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x48d8)[0x7f59589df898]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x4b59)[0x7f59589dfb19]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x4b59)[0x7f59589dfb19]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d)[0x7f59589e1c3d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCode+0x32)[0x7f59589e1f22]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x563e)[0x7f59589e05fe]
--- END LIBC BACKTRACE ---
Aborted (core dumped)

 

Any tips are appreciated !

regards,

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

Reply via email to