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

Last change on this file since 128 was 128, checked in by alain, 13 years ago

decreasing the number of registers

File size: 4.9 KB
RevLine 
[77]1/* -*- c++ -*-
2 * File         : vci_synthetic_initiator.h
3 * Date         : 26/08/2010
4 * Copyright    : UPMC / LIP6
5 * Authors      : Christophe Choichillon
[123]6 * Version      : 2.0
7 *
[77]8 * SOCLIB_LGPL_HEADER_BEGIN
9 *
10 * This file is part of SoCLib, GNU LGPLv2.1.
11 *
12 * SoCLib is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU Lesser General Public License as published
14 * by the Free Software Foundation; version 2.1 of the License.
15 *
16 * SoCLib is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with SoCLib; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * 02110-1301 USA
25 *
26 * SOCLIB_LGPL_HEADER_END
27 *
28 * Maintainers: christophe.choichillon@lip6.fr
29 */
30
31#ifndef SOCLIB_CABA_SYNTHETIC_INITIATOR_H
32#define SOCLIB_CABA_SYNTHETIC_INITIATOR_H
33
34#include <systemc>
[98]35#include <inttypes.h>
36#include "generic_fifo.h"
37#include "vci_initiator.h"
38#include "soclib_endian.h"
39#include "caba_base_module.h"
40#include "int_tab.h"
41#include "mapping_table.h"
[111]42#include "arithmetics.h"
[77]43
44namespace soclib {  namespace caba {
45    using namespace sc_core;
46
47    template<typename vci_param>
48    class VciSyntheticInitiator
49      : public soclib::caba::BaseModule
50    {
[106]51      typedef uint32_t addr_t;
[77]52      typedef uint32_t data_t;
53      typedef uint32_t tag_t;
54      typedef uint32_t size_t;
55      typedef uint32_t be_t;
56      typedef uint32_t copy_t;
57
58
[128]59      /* States of the VCI CMD fsm */
[77]60      enum vci_fsm_state_e{
61        VCI_IDLE,
62        VCI_SINGLE_SEND,
63        VCI_BC_SEND,
64      };
65
[128]66      enum bc_fsm_state_e{
[123]67        BC_RSP_IDLE,
68        BC_RSP_WAIT_RSP
69      };
70
71
[81]72     
[77]73
74    protected:
75
76      SC_HAS_PROCESS(VciSyntheticInitiator);
77   
78    public:
79      sc_in<bool>                               p_clk;
80      sc_in<bool>                               p_resetn;
81      soclib::caba::VciInitiator<vci_param>     p_vci; 
82
83      VciSyntheticInitiator(
[78]84                sc_module_name name,
[102]85                const soclib::common::MappingTable &mt,
86                const soclib::common::IntTab       &vci_index,
87                const uint32_t length,    // Packet length (flit numbers)
[106]88                const uint32_t rho,       // Packets ratio on the network
[102]89                const uint32_t depth,     // Fifo depth
90                const uint32_t xmesh,   
91                const uint32_t ymesh,
92                const uint32_t bc_period = 0, // Broadcast period, if no broadcast => 0
93                const uint32_t xmin = 0, 
94                const uint32_t xmax = 0,
95                const uint32_t ymin = 0,
96                const uint32_t ymax = 0
[78]97                );                                 
[77]98
99      ~VciSyntheticInitiator();
100
101      void transition();
102
103      void genMoore();
104
[115]105      uint32_t destAdress();
[77]106
[115]107      uint32_t destAdress(uint32_t *rand_seed);
108
[106]109      void printStats();
110
111      void print_trace();
112
[77]113    private:
114
115      // Component attributes
[128]116      const size_t                m_length;             // Number of words to write
117      const size_t                m_rho;                // offered load * 1000
118      const size_t                m_depth;              // Fifo depth
119      const size_t                m_xmesh;     
120      const size_t                m_ymesh;
121      const size_t                m_bc_period;          // Broadcast period, if no broadcast => 0
122      const size_t                m_xmin; 
123      const size_t                m_xmax;
124      const size_t                m_ymin;
125      const size_t                m_ymax;
126      const size_t                m_srcid;
127      static const int            m_tab_size = 1 << vci_param::T;
[77]128
[81]129
[128]130      // Fifo transmitting requests from the generator FSM to the VCI FSM
131      GenericFifo<uint64_t>     r_date_fifo;
132      GenericFifo<bool>         r_bc_fifo;
[122]133
[128]134      // VCI CMD FSM
[123]135      sc_signal<int>            r_cmd_fsm;
[128]136      sc_signal<addr_t>         r_cmd_address;  // Address for the single transaction
137      sc_signal<int>            r_cmd_trdid;    // TRDID for the single transaction
138      sc_signal<size_t>         r_cmd_count;    // Numbers of words sent
139      sc_signal<uint32_t>       r_cmd_seed;     // seed for reproducible address generation
[122]140
[128]141      // Broadcast FSM
142      sc_signal<bool>           r_bc_fsm;       // FSM state
143      sc_signal<uint64_t>       r_bc_date;      // broadcast transaction requested date
144      sc_signal<uint32_t>       r_bc_nrsp;      // Expected number of responses for a broadcast command
[77]145       
[128]146      // Pending transaction FSMs
147      sc_signal<bool>*          r_pending_fsm;  // FSM states
148      sc_signal<uint64_t>*      r_pending_date; // single transaction requested date
[77]149
[128]150      // Instrumentation registers
151      sc_signal<uint64_t>       r_cpt_cycles;   // Local time
152      sc_signal<uint64_t>       r_cpt_period;   // Number of cycles between 2 broadcast transactions
153      sc_signal<size_t>         r_nb_single;    // Total number of single transactions
154      sc_signal<uint64_t>       r_latency_single;       // Total cumulated latency for single transactions
155      sc_signal<size_t>         r_nb_bc;        // Total number of bc transactions
156      sc_signal<uint64_t>       r_latency_bc;   // Total cumulated latency for broadcast transactions
[81]157
[78]158    }; // end class VciSyntheticInitiator
[77]159 
160  }}
161
162#endif
Note: See TracBrowser for help on using the repository browser.