Cache Simulation code