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

Last change on this file since 131 was 131, checked in by choichil, 13 years ago

Initiator with only one FSM for responses

File size: 5.2 KB
Line 
1/* -*- c++ -*-
2 * File         : vci_synthetic_initiator.h
3 * Date         : 26/08/2010
4 * Copyright    : UPMC / LIP6
5 * Authors      : Christophe Choichillon
6 * Version      : 2.1
7 *
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 * Versions :
29 *           - 1.0 Sending only one request at a time
30 *           - 2.0 Sending multiple transactions and broadcast responses
31 *                 identified with pktid (deprecated)
32 *           - 2.1 Broadcast responses identified with the value 0 of trdid
33 *
34 * Maintainers: christophe.choichillon@lip6.fr
35 */
36
37#ifndef SOCLIB_CABA_SYNTHETIC_INITIATOR_H
38#define SOCLIB_CABA_SYNTHETIC_INITIATOR_H
39
40#include <cassert>
41#include <systemc>
42#include <inttypes.h>
43#include "generic_fifo.h"
44#include "vci_initiator.h"
45#include "soclib_endian.h"
46#include "caba_base_module.h"
47#include "int_tab.h"
48#include "mapping_table.h"
49#include "arithmetics.h"
50
51namespace soclib {  namespace caba {
52    using namespace sc_core;
53
54    template<typename vci_param>
55    class VciSyntheticInitiator
56      : public soclib::caba::BaseModule
57    {
58      typedef uint32_t addr_t;
59      typedef uint32_t data_t;
60      typedef uint32_t tag_t;
61      typedef uint32_t size_t;
62      typedef uint32_t be_t;
63      typedef uint32_t copy_t;
64
65
66      /* States of the VCI CMD fsm */
67      enum vci_fsm_state_e{
68        VCI_IDLE,
69        VCI_SINGLE_SEND,
70        VCI_BC_SEND,
71        VCI_SINGLE_REGISTER
72      };
73
74      enum bc_fsm_state_e{
75        BC_RSP_IDLE,
76        BC_RSP_WAIT_RSP
77      };
78
79
80     
81
82    protected:
83
84      SC_HAS_PROCESS(VciSyntheticInitiator);
85   
86    public:
87      sc_in<bool>                               p_clk;
88      sc_in<bool>                               p_resetn;
89      soclib::caba::VciInitiator<vci_param>     p_vci; 
90
91      VciSyntheticInitiator(
92                sc_module_name name,
93                const soclib::common::MappingTable &mt,
94                const soclib::common::IntTab       &vci_index,
95                const uint32_t length,    // Packet length (flit numbers)
96                const uint32_t rho,       // Packets ratio on the network
97                const uint32_t depth,     // Fifo depth
98                const uint32_t xmesh,   
99                const uint32_t ymesh,
100                const uint32_t bc_period = 0, // Broadcast period, if no broadcast => 0
101                const uint32_t xmin = 0, 
102                const uint32_t xmax = 0,
103                const uint32_t ymin = 0,
104                const uint32_t ymax = 0
105                );                                 
106
107      ~VciSyntheticInitiator();
108
109      void transition();
110
111      void genMoore();
112
113      uint32_t destAdress();
114
115      uint32_t destAdress(uint32_t *rand_seed);
116
117      void printStats();
118
119      void print_trace();
120
121    private:
122
123      // Component attributes
124      const size_t                m_length;             // Number of words to write
125      const size_t                m_rho;                // offered load * 1000
126      const size_t                m_depth;              // Fifo depth
127      const size_t                m_xmesh;     
128      const size_t                m_ymesh;
129      const size_t                m_bc_period;          // Broadcast period, if no broadcast => 0
130      const size_t                m_xmin; 
131      const size_t                m_xmax;
132      const size_t                m_ymin;
133      const size_t                m_ymax;
134      const size_t                m_srcid;
135      static const int            m_tab_size = 1 << vci_param::T;
136
137
138      // Fifo transmitting requests from the generator FSM to the VCI FSM
139      GenericFifo<uint64_t>     r_date_fifo;
140      GenericFifo<bool>         r_bc_fifo;
141
142      // VCI CMD FSM
143      sc_signal<int>            r_cmd_fsm;
144      sc_signal<addr_t>         r_cmd_address;  // Address for the single transaction
145      sc_signal<int>            r_cmd_trdid;    // TRDID for the single transaction
146      sc_signal<size_t>         r_cmd_count;    // Numbers of words sent
147      sc_signal<uint32_t>       r_cmd_seed;     // seed for reproducible address generation
148
149      // Broadcast FSM
150      //sc_signal<bool>           r_bc_fsm;     // FSM state
151      //sc_signal<uint64_t>             r_bc_date;      // broadcast transaction requested date
152      sc_signal<uint32_t>       r_bc_nrsp;      // Expected number of responses for a broadcast command
153       
154      // Pending transaction FSMs
155      sc_signal<bool>*          r_pending_fsm;  // FSM states
156      sc_signal<uint64_t>*      r_pending_date; // single transaction requested date
157
158      // Instrumentation registers
159      sc_signal<uint64_t>       r_cpt_cycles;   // Local time
160      sc_signal<uint64_t>       r_cpt_period;   // Number of cycles between 2 broadcast transactions
161      sc_signal<size_t>         r_nb_single;    // Total number of single transactions
162      sc_signal<uint64_t>       r_latency_single;       // Total cumulated latency for single transactions
163      sc_signal<size_t>         r_nb_bc;        // Total number of bc transactions
164      sc_signal<uint64_t>       r_latency_bc;   // Total cumulated latency for broadcast transactions
165
166    }; // end class VciSyntheticInitiator
167 
168  }}
169
170#endif
Note: See TracBrowser for help on using the repository browser.