source: trunk/modules/vci_synthetic_initator/caba/sources/include/vci_synthetic_initator.h @ 93

Last change on this file since 93 was 81, checked in by choichil, 14 years ago

vci_synthetic_initiator draft

File size: 3.5 KB
Line 
1/* -*- c++ -*-
2 * File         : vci_synthetic_initiator.h
3 * Date         : 26/08/2010
4 * Copyright    : UPMC / LIP6
5 * Authors      : Christophe Choichillon
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 * Maintainers: christophe.choichillon@lip6.fr
28 */
29
30#ifndef SOCLIB_CABA_SYNTHETIC_INITIATOR_H
31#define SOCLIB_CABA_SYNTHETIC_INITIATOR_H
32
33#include <systemc>
34
35namespace soclib {  namespace caba {
36    using namespace sc_core;
37
38    template<typename vci_param>
39    class VciSyntheticInitiator
40      : public soclib::caba::BaseModule
41    {
42      typedef uint32_t addr_t;
43      typedef uint32_t data_t;
44      typedef uint32_t tag_t;
45      typedef uint32_t size_t;
46      typedef uint32_t be_t;
47      typedef uint32_t copy_t;
48
49
50      /* States of the GENERATOR fsm */
51      enum vci_fsm_state_e{
52        VCI_IDLE,
53        VCI_SINGLE_SEND,
54        VCI_SINGLE_RECEIVE,
55        VCI_BC_SEND,
56        VCI_BC_RECEIVE
57      };
58      enum gen_fsm_state_e{
59        A_IDLE,
60        A_DATA
61      };
62
63      uint64_t     m_cpt_cycles;            // Counter of cycles
64     
65
66    protected:
67
68      SC_HAS_PROCESS(VciSyntheticInitiator);
69   
70    public:
71      sc_in<bool>                               p_clk;
72      sc_in<bool>                               p_resetn;
73      soclib::caba::VciInitiator<vci_param>     p_vci; 
74
75      VciSyntheticInitiator(
76                sc_module_name name,
77                size_t length,    // Packet length (flit numbers)
78                float  rho,       // Packets ratio on the network
79                size_t depth,     // Fifo depth
80                size_t x,         // X location of the synthetic initiator
81                size_t y,         // Y location of the synthetic initiator
82                size_t xmesh,   
83                size_t ymesh,
84                size_t bc_period, // Broadcast period, if no broadcast => 0
85                size_t xmin, 
86                size_t xmax,
87                size_t ymin,
88                size_t ymax,
89                const soclib::common::IntTab &vci_index
90                );                                 
91
92      ~VciSyntheticInitiator();
93
94      void transition();
95
96      void genMoore();
97
98      void destAdress(size_t X_local, size_t Y_local, size_t &X_dest, size_t &Y_dest);
99
100    private:
101
102      // Component attributes
103      const size_t                        m_length;             // Number of flits of a packet
104      const size_t                        m_rho;                // Rate of packets in the network wanted
105      const size_t                        m_depth;              // Fifo depth
106      const size_t                        m_x;                  // X location
107      const size_t                        m_y;                  // Y location
108      const size_t                        m_xmesh;     
109      const size_t                        m_ymesh;
110      const size_t                        m_bc_period;          // Broadcast period, if no broadcast => 0
111      const size_t                        m_xmin; 
112      const size_t                        m_xmax;
113      const size_t                        m_ymin;
114      const size_t                        m_ymax;
115
116      size_t       m_count;
117      size_t       m_npackets;              // Total number of packets already sent
118
119      // Fifo transmitting date to the VCI FSM
120      GenericFifo<uint64_t>    m_date_fifo;
121
122      sc_signal<int>         r_vci_fsm;
123       
124      sc_signal<size_t>      r_index;
125
126      sc_signal<bool>        r_broadcast_req;
127
128    }; // end class VciSyntheticInitiator
129 
130  }}
131
132#endif
Note: See TracBrowser for help on using the repository browser.