TimerTable.cc (11108:6342ddf6d733) | TimerTable.cc (11111:6da33e720481) |
---|---|
1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 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; --- 20 unchanged lines hidden (view full) --- 29#include "mem/ruby/structures/TimerTable.hh" 30 31#include "mem/ruby/system/RubySystem.hh" 32 33TimerTable::TimerTable() 34 : m_next_time(0) 35{ 36 m_consumer_ptr = NULL; | 1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 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; --- 20 unchanged lines hidden (view full) --- 29#include "mem/ruby/structures/TimerTable.hh" 30 31#include "mem/ruby/system/RubySystem.hh" 32 33TimerTable::TimerTable() 34 : m_next_time(0) 35{ 36 m_consumer_ptr = NULL; |
37 m_clockobj_ptr = NULL; 38 | |
39 m_next_valid = false; 40 m_next_address = 0; 41} 42 43bool | 37 m_next_valid = false; 38 m_next_address = 0; 39} 40 41bool |
44TimerTable::isReady() const | 42TimerTable::isReady(Tick curTime) const |
45{ 46 if (m_map.empty()) 47 return false; 48 49 if (!m_next_valid) { 50 updateNext(); 51 } 52 assert(m_next_valid); | 43{ 44 if (m_map.empty()) 45 return false; 46 47 if (!m_next_valid) { 48 updateNext(); 49 } 50 assert(m_next_valid); |
53 return (m_clockobj_ptr->curCycle() >= m_next_time); | 51 return (curTime >= m_next_time); |
54} 55 56Addr | 52} 53 54Addr |
57TimerTable::readyAddress() const | 55TimerTable::nextAddress() const |
58{ | 56{ |
59 assert(isReady()); 60 | |
61 if (!m_next_valid) { 62 updateNext(); 63 } 64 assert(m_next_valid); 65 return m_next_address; 66} 67 68void | 57 if (!m_next_valid) { 58 updateNext(); 59 } 60 assert(m_next_valid); 61 return m_next_address; 62} 63 64void |
69TimerTable::set(Addr address, Cycles relative_latency) | 65TimerTable::set(Addr address, Tick ready_time) |
70{ 71 assert(address == makeLineAddress(address)); | 66{ 67 assert(address == makeLineAddress(address)); |
72 assert(relative_latency > 0); | |
73 assert(!m_map.count(address)); 74 | 68 assert(!m_map.count(address)); 69 |
75 Cycles ready_time = m_clockobj_ptr->curCycle() + relative_latency; | |
76 m_map[address] = ready_time; 77 assert(m_consumer_ptr != NULL); | 70 m_map[address] = ready_time; 71 assert(m_consumer_ptr != NULL); |
78 m_consumer_ptr-> 79 scheduleEventAbsolute(m_clockobj_ptr->clockPeriod() * ready_time); | 72 m_consumer_ptr->scheduleEventAbsolute(ready_time); |
80 m_next_valid = false; 81 82 // Don't always recalculate the next ready address 83 if (ready_time <= m_next_time) { 84 m_next_valid = false; 85 } 86} 87 --- 42 unchanged lines hidden --- | 73 m_next_valid = false; 74 75 // Don't always recalculate the next ready address 76 if (ready_time <= m_next_time) { 77 m_next_valid = false; 78 } 79} 80 --- 42 unchanged lines hidden --- |