Deleted Added
sdiff udiff text old ( 11108:6342ddf6d733 ) new ( 11111:6da33e720481 )
full compact
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_next_valid = false;
38 m_next_address = 0;
39}
40
41bool
42TimerTable::isReady(Tick curTime) const
43{
44 if (m_map.empty())
45 return false;
46
47 if (!m_next_valid) {
48 updateNext();
49 }
50 assert(m_next_valid);
51 return (curTime >= m_next_time);
52}
53
54Addr
55TimerTable::nextAddress() const
56{
57 if (!m_next_valid) {
58 updateNext();
59 }
60 assert(m_next_valid);
61 return m_next_address;
62}
63
64void
65TimerTable::set(Addr address, Tick ready_time)
66{
67 assert(address == makeLineAddress(address));
68 assert(!m_map.count(address));
69
70 m_map[address] = ready_time;
71 assert(m_consumer_ptr != NULL);
72 m_consumer_ptr->scheduleEventAbsolute(ready_time);
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 ---