source: branches/reconfiguration/modules/dspin_local_crossbar/caba/source/include/dspin_local_crossbar.h @ 976

Last change on this file since 976 was 976, checked in by cfuguet, 9 years ago

reconf: introduce the dspin_local_crossbar component in reconfiguration
branch

  • This component will be modified to introduce the support for segment reallocation.
File size: 5.4 KB
Line 
1/* -*- c++ -*-
2  * File : dspin_local_crossbar.h
3  * Copyright (c) UPMC, Lip6
4  * Author : Alain Greiner
5  *
6  * SOCLIB_LGPL_HEADER_BEGIN
7  *
8  * This file is part of SoCLib, GNU LGPLv2.1.
9  *
10  * SoCLib is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU Lesser General Public License as published
12  * by the Free Software Foundation; version 2.1 of the License.
13  *
14  * SoCLib is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with SoCLib; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23  *
24  * SOCLIB_LGPL_HEADER_END
25  *
26  */
27
28#ifndef DSPIN_LOCAL_CROSSBAR_H_
29#define DSPIN_LOCAL_CROSSBAR_H_
30
31#include <systemc>
32#include <cassert>
33#include "alloc_elems.h"
34#include "caba_base_module.h"
35#include "generic_fifo.h"
36#include "dspin_interface.h"
37#include "mapping_table.h"
38#include "address_decoding_table.h"
39
40namespace soclib { namespace caba {
41
42    using namespace sc_core;
43    using namespace soclib::common;
44
45    template<size_t flit_width>
46        class DspinLocalCrossbar
47        : public soclib::caba::BaseModule
48        {
49        // Input Port FSM
50        enum 
51        {
52        INFSM_IDLE,
53        INFSM_REQ,
54        INFSM_ALLOC,
55        INFSM_REQ_BC,
56        INFSM_ALLOC_BC,
57        };
58
59            protected:
60            SC_HAS_PROCESS(DspinLocalCrossbar);
61
62            public:
63
64            // ports
65            sc_in<bool>                     p_clk;
66            sc_in<bool>                     p_resetn;
67            DspinInput<flit_width>                  p_global_in;
68            DspinOutput<flit_width>                     p_global_out;
69            DspinInput<flit_width>*                 p_local_in;
70            DspinOutput<flit_width>*            p_local_out;
71
72        void      print_trace();
73
74            // constructor / destructor
75            DspinLocalCrossbar( sc_module_name      name, 
76                            const MappingTable  &mt,
77                            const size_t        x,              // cluster x coordinate
78                            const size_t        y,              // cluster y coordinate
79                            const size_t        x_width,        // x field width
80                            const size_t        y_width,        // y field width       
81                            const size_t        l_width,        // local field width
82                            const size_t        nb_local_inputs,
83                            const size_t        nb_local_outputs,
84                            const size_t        in_fifo_depth,
85                            const size_t        out_fifo_depth,
86                            const bool          is_cmd,
87                            const bool          use_routing_table,
88                            const bool          broadcast_supported );
89
90        ~DspinLocalCrossbar();
91
92            private:
93
94        // define the FIFO flit
95        typedef struct internal_flit_s
96        {
97            sc_uint<flit_width>  data;
98            bool                 eop;
99        } internal_flit_t;
100
101            // internal registers
102            sc_signal<bool>                             *r_alloc_out;  // output port allocated
103            sc_signal<size_t>               *r_index_out;  // owner input port index
104        internal_flit_t                 *r_buf_in;     // input port fifo extension
105        sc_signal<int>                  *r_fsm_in;     // input port state
106            sc_signal<size_t>               *r_index_in;   // requested output port index
107
108            // fifos
109            soclib::caba::GenericFifo<internal_flit_t>*  r_fifo_in;
110            soclib::caba::GenericFifo<internal_flit_t>*  r_fifo_out;
111
112            // structural parameters
113            const size_t                            m_local_x;
114            const size_t                            m_local_y;
115            const size_t                            m_x_width;
116            const size_t                            m_x_shift;
117            const size_t                            m_x_mask;
118            const size_t                            m_y_width;
119            const size_t                            m_y_shift;
120            const size_t                            m_y_mask;
121            const size_t                            m_l_width;
122            const size_t                            m_l_shift;
123            const size_t                            m_l_mask;
124        const size_t                            m_local_inputs;
125        const size_t                            m_local_outputs;
126        const size_t                            m_addr_width;
127        const bool                              m_is_cmd;
128        const bool                              m_use_routing_table;
129        const bool                              m_broadcast_supported;
130
131        // we define two routing tables, but only one is used
132        AddressDecodingTable<uint64_t, size_t>  m_cmd_rt;
133        AddressDecodingTable<uint32_t, size_t>  m_rsp_rt;
134
135            // methods
136            void      transition();
137            void      genMoore();
138        size_t    route( sc_uint<flit_width> data, size_t index );
139        bool      is_broadcast( sc_uint<flit_width> data );
140        };
141
142}} // end namespace
143               
144#endif // DSPIN_LOCAL_CROSSBAR_H_
145
146// Local Variables:
147// tab-width: 4
148// c-basic-offset: 4
149// c-file-offsets:((innamespace . 0)(inline-open . 0))
150// indent-tabs-mode: nil
151// End:
152
153// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
Note: See TracBrowser for help on using the repository browser.