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_OUTPUT_UNIT_D_HH__
32 #define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUTPUT_UNIT_D_HH__
37 #include "mem/ruby/network/garnet/NetworkHeader.hh"
38 #include "mem/ruby/common/Consumer.hh"
39 #include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
40 #include "mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh"
41 #include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
42 #include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh"
46 class OutputUnit_d : public Consumer
49 OutputUnit_d(int id, Router_d *router);
51 void set_out_link(NetworkLink_d *link);
52 void set_credit_link(CreditLink_d *credit_link);
54 flitBuffer_d* getOutQueue();
55 void printConfig(std::ostream& out);
56 void update_vc(int vc, int in_port, int in_vc);
57 void print(std::ostream& out) const {};
58 void decrement_credit(int out_vc);
61 get_credit_cnt(int vc)
63 return m_outvc_state[vc]->get_credit_count();
69 return m_out_link->get_id();
73 set_vc_state(VC_state_type state, int vc)
75 m_outvc_state[vc]->setState(state, g_eventQueue_ptr->getTime() + 1);
81 return (m_outvc_state[vc]->isInState(IDLE_,
82 g_eventQueue_ptr->getTime()));
86 insert_flit(flit_d *t_flit)
88 m_out_buffer->insert(t_flit);
89 g_eventQueue_ptr->scheduleEvent(m_out_link, 1);
96 NetworkLink_d *m_out_link;
97 CreditLink_d *m_credit_link;
99 flitBuffer_d *m_out_buffer; // This is for the network link to consume
100 std::vector<OutVcState_d *> m_outvc_state; // vc state of downstream router
104 #endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_OUTPUT_UNIT_D_HH__