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_clockobj_ptr = NULL;
38
39 m_next_valid = false;
40 m_next_address = 0;
41}
42
43bool
44TimerTable::isReady() const
45{
46 if (m_map.empty())
47 return false;
48
49 if (!m_next_valid) {
50 updateNext();
51 }
52 assert(m_next_valid);
53 return (m_clockobj_ptr->curCycle() >= m_next_time);
54}
55
56Addr
57TimerTable::readyAddress() const
58{
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
69TimerTable::set(Addr address, Cycles relative_latency)
70{
71 assert(address == makeLineAddress(address));
72 assert(relative_latency > 0);
73 assert(!m_map.count(address));
74
75 Cycles ready_time = m_clockobj_ptr->curCycle() + relative_latency;
76 m_map[address] = ready_time;
77 assert(m_consumer_ptr != NULL);
78 m_consumer_ptr->
79 scheduleEventAbsolute(m_clockobj_ptr->clockPeriod() * 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 ---