[Simit-arm-cvs] simit-arm/simulator cache.h,1.3,1.4
Brought to you by:
weiqin04
From: Wei Q. <wei...@us...> - 2005-05-21 20:28:57
|
Update of /cvsroot/simit-arm/simit-arm/simulator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22432/simulator Modified Files: cache.h Log Message: renamed some cache functions Index: cache.h =================================================================== RCS file: /cvsroot/simit-arm/simit-arm/simulator/cache.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cache.h 12 Nov 2004 06:40:32 -0000 1.3 --- cache.h 21 May 2005 20:28:48 -0000 1.4 *************** *** 19,31 **** protected: ! uint32_t cache_index(uint32_t addr) { return (addr/bsize)%(n_block/n_assoc); } ! uint32_t cache_tag(uint32_t addr) { return (addr/(bsize*n_block/n_assoc)); } ! /* ARM uses the round robin policy */ uint32_t choose_round_robin(uint32_t index) { return round_robin_index[index]; --- 19,35 ---- protected: ! uint32_t get_index(uint32_t addr) { return (addr/bsize)%(n_block/n_assoc); } ! uint32_t get_tag(uint32_t addr) { return (addr/(bsize*n_block/n_assoc)); } ! uint32_t get_address(uint32_t index, uint32_t tag) { ! return (tag*(n_block/n_assoc) + index)*bsize; ! } ! ! /* StrongARM uses the round robin policy */ uint32_t choose_round_robin(uint32_t index) { return round_robin_index[index]; *************** *** 37,42 **** /* check if the address is in cache */ ! struct cache_block *lookup(uint32_t addr) { ! uint32_t ind = cache_index(addr), tag = cache_tag(addr); for (uint32_t i=0; i<n_assoc; i++) if (data[ind][i].tag == tag && data[ind][i].valid) --- 41,46 ---- /* check if the address is in cache */ ! struct cache_block *look_up(uint32_t addr) { ! uint32_t ind = get_index(addr), tag = get_tag(addr); for (uint32_t i=0; i<n_assoc; i++) if (data[ind][i].tag == tag && data[ind][i].valid) *************** *** 46,52 **** /* allocate a cache block, return true if eviction happened */ ! struct cache_block *allocateBlock(uint32_t addr, uint32_t size) { ! uint32_t ind = cache_index(addr), tag = cache_tag(addr); cache_block *theblock = &data[ind][choose_round_robin(ind)]; --- 50,56 ---- /* allocate a cache block, return true if eviction happened */ ! struct cache_block *allocate_block(uint32_t addr, uint32_t size) { ! uint32_t ind = get_index(addr), tag = get_tag(addr); cache_block *theblock = &data[ind][choose_round_robin(ind)]; *************** *** 79,85 **** using base_t::name; using base_t::data; ! using base_t::round_robin_index; ! using base_t::lookup; ! using base_t::allocateBlock; public: --- 83,88 ---- using base_t::name; using base_t::data; ! using base_t::look_up; ! using base_t::allocate_block; public: *************** *** 114,118 **** } ! struct cache_block *block = lookup(addr); if (!block) { nReadMisses++; --- 117,121 ---- } ! struct cache_block *block = look_up(addr); if (!block) { nReadMisses++; *************** *** 121,125 **** /* read the block in */ latency = biu.access(r_latency); ! block = allocateBlock(addr, size); return false; --- 124,128 ---- /* read the block in */ latency = biu.access(r_latency); ! block = allocate_block(addr, size); return false; *************** *** 165,170 **** using base_t::data; using base_t::round_robin_index; ! using base_t::lookup; ! using base_t::allocateBlock; private: --- 168,173 ---- using base_t::data; using base_t::round_robin_index; ! using base_t::look_up; ! using base_t::allocate_block; private: *************** *** 222,226 **** if (read_busy) return false; ! struct cache_block *block = lookup(addr); if (!block) { nReadMisses++; --- 225,229 ---- if (read_busy) return false; ! struct cache_block *block = look_up(addr); if (!block) { nReadMisses++; *************** *** 229,233 **** /* read the block in */ latency = biu.access(r_latency); ! block = allocateBlock(addr, size); /* add eviction cost if dirty*/ --- 232,236 ---- /* read the block in */ latency = biu.access(r_latency); ! block = allocate_block(addr, size); /* add eviction cost if dirty*/ *************** *** 255,259 **** //if (write_busy) return false; ! struct cache_block *block = lookup(addr); /* cache hit, good */ if (block) { --- 258,262 ---- //if (write_busy) return false; ! struct cache_block *block = look_up(addr); /* cache hit, good */ if (block) { |