[549] | 1 | /* -*- c++ -*- |
---|
| 2 | * |
---|
| 3 | * File : dspin_router_tsar.h |
---|
| 4 | * Copyright (c) UPMC, Lip6 |
---|
| 5 | * Authors : Alain Greiner |
---|
| 6 | * |
---|
| 7 | * SOCLIB_LGPL_HEADER_BEGIN |
---|
| 8 | * |
---|
| 9 | * This file is part of SoCLib, GNU LGPLv2.1. |
---|
| 10 | * |
---|
| 11 | * SoCLib is free software; you can redistribute it and/or modify it |
---|
| 12 | * under the terms of the GNU Lesser General Public License as published |
---|
| 13 | * by the Free Software Foundation; version 2.1 of the License. |
---|
| 14 | * |
---|
| 15 | * SoCLib is distributed in the hope that it will be useful, but |
---|
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 18 | * Lesser General Public License for more details. |
---|
| 19 | * |
---|
| 20 | * You should have received a copy of the GNU Lesser General Public |
---|
| 21 | * License along with SoCLib; if not, write to the Free Software |
---|
| 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
---|
| 23 | * 02110-1301 USA |
---|
| 24 | * |
---|
| 25 | * SOCLIB_LGPL_HEADER_END |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | //////////////////////////////////////////////////////////////////////////////// |
---|
[578] | 30 | // This component implements a variant of the standard (SocLib) DSPIN router: |
---|
[549] | 31 | // The routing function has been modified to handle the special case of |
---|
| 32 | // cluster_iob0 (containing component IOB0) and cluster_iob1 (containing |
---|
| 33 | // component IOB1). In those two cluster, the response router must decode |
---|
| 34 | // both the SRCID global bits AND the SRCID local bits to distinguish |
---|
| 35 | // between the IOB and MEMC initiators. |
---|
| 36 | // This component contains the following modifications: |
---|
| 37 | // - 4 extra constructor arguments, |
---|
| 38 | // - 6 new member variables |
---|
| 39 | // - a modified routing function |
---|
| 40 | //////////////////////////////////////////////////////////////////////////////// |
---|
| 41 | |
---|
| 42 | #ifndef DSPIN_ROUTER_TSAR_H_ |
---|
| 43 | #define DSPIN_ROUTER_TSAR_H_ |
---|
| 44 | |
---|
| 45 | #include <systemc> |
---|
| 46 | #include "caba_base_module.h" |
---|
| 47 | #include "generic_fifo.h" |
---|
| 48 | #include "dspin_interface.h" |
---|
| 49 | #include "alloc_elems.h" |
---|
| 50 | |
---|
| 51 | namespace soclib { namespace caba { |
---|
| 52 | |
---|
| 53 | using namespace sc_core; |
---|
| 54 | |
---|
| 55 | template<int flit_width> |
---|
| 56 | class DspinRouterTsar |
---|
| 57 | : public soclib::caba::BaseModule |
---|
| 58 | { |
---|
| 59 | // Port indexing |
---|
| 60 | enum |
---|
| 61 | { |
---|
| 62 | DSPIN_NORTH = 0, |
---|
| 63 | DSPIN_SOUTH = 1, |
---|
| 64 | DSPIN_EAST = 2, |
---|
| 65 | DSPIN_WEST = 3, |
---|
| 66 | DSPIN_LOCAL = 4, |
---|
| 67 | }; |
---|
| 68 | |
---|
| 69 | // Input Port FSM |
---|
| 70 | enum |
---|
| 71 | { |
---|
| 72 | INFSM_IDLE, |
---|
| 73 | INFSM_REQ, |
---|
| 74 | INFSM_ALLOC, |
---|
| 75 | }; |
---|
| 76 | |
---|
| 77 | protected: |
---|
| 78 | SC_HAS_PROCESS(DspinRouterTsar); |
---|
| 79 | |
---|
| 80 | public: |
---|
| 81 | |
---|
| 82 | // ports |
---|
| 83 | sc_in<bool> p_clk; |
---|
| 84 | sc_in<bool> p_resetn; |
---|
| 85 | DspinInput<flit_width> *p_in; |
---|
| 86 | DspinOutput<flit_width> *p_out; |
---|
| 87 | |
---|
| 88 | // constructor |
---|
| 89 | DspinRouterTsar( |
---|
| 90 | sc_module_name name, |
---|
| 91 | const size_t x, // x coordinate |
---|
| 92 | const size_t y, // y cordinate |
---|
| 93 | const size_t x_width, // x field width in first flit |
---|
| 94 | const size_t y_width, // y field width in first flit |
---|
| 95 | const size_t in_fifo_depth, // input fifo depth |
---|
| 96 | const size_t out_fifo_depth, // output fifo depth |
---|
[578] | 97 | const bool is_iob0, // cluster containing IOB0 |
---|
| 98 | const bool is_iob1, // cluster containing IOB0 |
---|
| 99 | const bool is_rsp, // only response router is modified |
---|
| 100 | const size_t l_width); // local srcid width |
---|
[549] | 101 | private: |
---|
| 102 | |
---|
| 103 | // define the FIFO flit |
---|
| 104 | typedef struct internal_flit_s |
---|
| 105 | { |
---|
| 106 | sc_uint<flit_width> data; |
---|
| 107 | bool eop; |
---|
| 108 | } internal_flit_t; |
---|
| 109 | |
---|
| 110 | // registers |
---|
| 111 | sc_signal<bool> *r_alloc_out; |
---|
| 112 | sc_signal<size_t> *r_index_out; |
---|
| 113 | sc_signal<int> *r_fsm_in; |
---|
| 114 | sc_signal<size_t> *r_index_in; |
---|
| 115 | |
---|
| 116 | // fifos |
---|
| 117 | soclib::caba::GenericFifo<internal_flit_t>* r_fifo_in; |
---|
| 118 | soclib::caba::GenericFifo<internal_flit_t>* r_fifo_out; |
---|
| 119 | |
---|
| 120 | // structural parameters |
---|
| 121 | size_t m_local_x; |
---|
| 122 | size_t m_local_y; |
---|
| 123 | size_t m_x_width; |
---|
| 124 | size_t m_x_shift; |
---|
| 125 | size_t m_x_mask; |
---|
| 126 | size_t m_y_width; |
---|
| 127 | size_t m_y_shift; |
---|
| 128 | size_t m_y_mask; |
---|
| 129 | size_t m_l_width; |
---|
| 130 | size_t m_l_shift; |
---|
| 131 | size_t m_l_mask; |
---|
| 132 | bool m_is_iob0; |
---|
| 133 | bool m_is_iob1; |
---|
[578] | 134 | bool m_is_rsp; |
---|
[549] | 135 | |
---|
| 136 | // methods |
---|
| 137 | void transition(); |
---|
| 138 | void genMoore(); |
---|
| 139 | size_t route( sc_uint<flit_width> data ); |
---|
| 140 | |
---|
| 141 | public: |
---|
| 142 | |
---|
| 143 | void print_trace(); |
---|
| 144 | }; |
---|
| 145 | |
---|
| 146 | }} // end namespace |
---|
| 147 | |
---|
| 148 | #endif // DSPIN_ROUTER_TSAR_H_ |
---|
| 149 | |
---|
| 150 | // Local Variables: |
---|
| 151 | // tab-width: 4 |
---|
| 152 | // c-basic-offset: 4 |
---|
| 153 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 154 | // indent-tabs-mode: nil |
---|
| 155 | // End: |
---|
| 156 | |
---|
| 157 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|