2 * Copyright (c) 2008 Princeton University
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * Authors: Niket Agarwal
31 #ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUT_VC_STATE_D_HH__
32 #define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUT_VC_STATE_D_HH__
34 #include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
35 #include "mem/ruby/network/garnet/NetworkHeader.hh"
40 OutVcState_d(int id, GarnetNetwork_d *network_ptr);
42 int get_inport() { return m_in_port; }
43 int get_invc() { return m_in_vc; }
44 int get_credit_count() { return m_credit_count; }
48 // only need to initialize credit count for data VCs
49 // constructor sets this to BuffersPerCtrlVC by default
51 if (m_network_ptr->get_vnet_type(m_id) == DATA_VNET_)
52 m_credit_count = m_network_ptr->getBuffersPerDataVC();
55 void set_inport(int port) { m_in_port = port; }
56 void set_invc(int vc) { m_in_vc = vc; }
58 isInState(VC_state_type state, Time request_time)
60 return ((m_vc_state == state) && (request_time >= m_time) );
63 setState(VC_state_type state, Time time)
68 inline bool has_credits() { return (m_credit_count > 0); }
69 inline void increment_credit() { m_credit_count++; }
70 inline void decrement_credit() { m_credit_count--; }
73 GarnetNetwork_d *m_network_ptr;
76 VC_state_type m_vc_state;
82 #endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUT_VC_STATE_D_HH__