1/* 2 * Copyright (c) 2012 Advanced Micro Devices, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 34 unchanged lines hidden (view full) --- 43 if (banks != 0) { 44 bankBits = floorLog2(banks); 45 } 46 47 busyBanks.resize(banks); 48} 49 50bool |
51BankedArray::tryAccess(int64 idx) |
52{ 53 if (accessLatency == 0) 54 return true; 55 56 unsigned int bank = mapIndexToBank(idx); 57 assert(bank < banks); 58 59 if (busyBanks[bank].endAccess >= curTick()) { --- 11 unchanged lines hidden (view full) --- 71 busyBanks[bank].startAccess = curTick(); 72 busyBanks[bank].endAccess = curTick() + 73 (accessLatency-1) * g_system_ptr->clockPeriod(); 74 75 return true; 76} 77 78unsigned int |
79BankedArray::mapIndexToBank(int64 idx) |
80{ 81 if (banks == 1) { 82 return 0; 83 } 84 return idx % banks; 85} |