TimerTable.cc (10920:58fbfddff18d) TimerTable.cc (11025:4872dbdea907)
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;

--- 22 unchanged lines hidden (view full) ---

31
32TimerTable::TimerTable()
33 : m_next_time(0)
34{
35 m_consumer_ptr = NULL;
36 m_clockobj_ptr = NULL;
37
38 m_next_valid = false;
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;

--- 22 unchanged lines hidden (view full) ---

31
32TimerTable::TimerTable()
33 : m_next_time(0)
34{
35 m_consumer_ptr = NULL;
36 m_clockobj_ptr = NULL;
37
38 m_next_valid = false;
39 m_next_address = Address(0);
39 m_next_address = 0;
40}
41
42bool
43TimerTable::isReady() const
44{
45 if (m_map.empty())
46 return false;
47
48 if (!m_next_valid) {
49 updateNext();
50 }
51 assert(m_next_valid);
52 return (m_clockobj_ptr->curCycle() >= m_next_time);
53}
54
40}
41
42bool
43TimerTable::isReady() const
44{
45 if (m_map.empty())
46 return false;
47
48 if (!m_next_valid) {
49 updateNext();
50 }
51 assert(m_next_valid);
52 return (m_clockobj_ptr->curCycle() >= m_next_time);
53}
54
55const Address&
55Addr
56TimerTable::readyAddress() const
57{
58 assert(isReady());
59
60 if (!m_next_valid) {
61 updateNext();
62 }
63 assert(m_next_valid);
64 return m_next_address;
65}
66
67void
56TimerTable::readyAddress() const
57{
58 assert(isReady());
59
60 if (!m_next_valid) {
61 updateNext();
62 }
63 assert(m_next_valid);
64 return m_next_address;
65}
66
67void
68TimerTable::set(const Address& address, Cycles relative_latency)
68TimerTable::set(Addr address, Cycles relative_latency)
69{
69{
70 assert(address == line_address(address));
70 assert(address == makeLineAddress(address));
71 assert(relative_latency > 0);
72 assert(!m_map.count(address));
73
74 Cycles ready_time = m_clockobj_ptr->curCycle() + relative_latency;
75 m_map[address] = ready_time;
76 assert(m_consumer_ptr != NULL);
77 m_consumer_ptr->
78 scheduleEventAbsolute(m_clockobj_ptr->clockPeriod() * ready_time);
79 m_next_valid = false;
80
81 // Don't always recalculate the next ready address
82 if (ready_time <= m_next_time) {
83 m_next_valid = false;
84 }
85}
86
87void
71 assert(relative_latency > 0);
72 assert(!m_map.count(address));
73
74 Cycles ready_time = m_clockobj_ptr->curCycle() + relative_latency;
75 m_map[address] = ready_time;
76 assert(m_consumer_ptr != NULL);
77 m_consumer_ptr->
78 scheduleEventAbsolute(m_clockobj_ptr->clockPeriod() * ready_time);
79 m_next_valid = false;
80
81 // Don't always recalculate the next ready address
82 if (ready_time <= m_next_time) {
83 m_next_valid = false;
84 }
85}
86
87void
88TimerTable::unset(const Address& address)
88TimerTable::unset(Addr address)
89{
89{
90 assert(address == line_address(address));
90 assert(address == makeLineAddress(address));
91 assert(m_map.count(address));
92 m_map.erase(address);
93
94 // Don't always recalculate the next ready address
95 if (address == m_next_address) {
96 m_next_valid = false;
97 }
98}

--- 30 unchanged lines hidden ---
91 assert(m_map.count(address));
92 m_map.erase(address);
93
94 // Don't always recalculate the next ready address
95 if (address == m_next_address) {
96 m_next_valid = false;
97 }
98}

--- 30 unchanged lines hidden ---