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

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

Synthetic Initiator before being change for multiple requests

File size: 4.7 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     TODO : Adding the broadcast latency
31 */
32
33#ifndef SOCLIB_CABA_SYNTHETIC_INITIATOR_H
34#define SOCLIB_CABA_SYNTHETIC_INITIATOR_H
35
36#include <systemc>
37#include <inttypes.h>
38#include "generic_fifo.h"
39#include "vci_initiator.h"
40#include "soclib_endian.h"
41#include "caba_base_module.h"
42#include "int_tab.h"
43#include "mapping_table.h"
44#include "arithmetics.h"
45
46namespace soclib {  namespace caba {
47    using namespace sc_core;
48
49    template<typename vci_param>
50    class VciSyntheticInitiator
51      : public soclib::caba::BaseModule
52    {
53      typedef uint32_t addr_t;
54      typedef uint32_t data_t;
55      typedef uint32_t tag_t;
56      typedef uint32_t size_t;
57      typedef uint32_t be_t;
58      typedef uint32_t copy_t;
59
60
61      /* States of the GENERATOR fsm */
62      enum vci_fsm_state_e{
63        VCI_IDLE,
64        VCI_SINGLE_SEND,
65        VCI_SINGLE_RECEIVE,
66        VCI_BC_SEND,
67        VCI_BC_RECEIVE
68      };
69//      enum gen_fsm_state_e{
70//        A_IDLE,
71//        A_DATA
72//      };
73
74      uint64_t     m_cpt_cycles;            // Counter of cycles
75     
76
77    protected:
78
79      SC_HAS_PROCESS(VciSyntheticInitiator);
80   
81    public:
82      sc_in<bool>                               p_clk;
83      sc_in<bool>                               p_resetn;
84      soclib::caba::VciInitiator<vci_param>     p_vci; 
85
86      VciSyntheticInitiator(
87                sc_module_name name,
88                const soclib::common::MappingTable &mt,
89                const soclib::common::IntTab       &vci_index,
90                const uint32_t length,    // Packet length (flit numbers)
91                const uint32_t rho,       // Packets ratio on the network
92                //const float    rho,       // Packets ratio on the network
93                const uint32_t depth,     // Fifo depth
94                const uint32_t xmesh,   
95                const uint32_t ymesh,
96                const uint32_t bc_period = 0, // Broadcast period, if no broadcast => 0
97                const uint32_t xmin = 0, 
98                const uint32_t xmax = 0,
99                const uint32_t ymin = 0,
100                const uint32_t ymax = 0
101                );                                 
102
103      ~VciSyntheticInitiator();
104
105      void transition();
106
107      void genMoore();
108
109      uint32_t destAdress();
110
111      uint32_t destAdress(uint32_t *rand_seed);
112
113      void printStats();
114
115      void print_trace();
116
117    private:
118
119      // Component attributes
120      const size_t                        m_length;             // Number of words to write
121      const size_t                        m_rho;                // Rate of packets in the network wanted
122      //const float                       m_rho;                // Rate of packets in the network wanted
123      const size_t                        m_depth;              // Fifo depth
124      const size_t                        m_xmesh;     
125      const size_t                        m_ymesh;
126      const size_t                        m_bc_period;          // Broadcast period, if no broadcast => 0
127      const size_t                        m_xmin; 
128      const size_t                        m_xmax;
129      const size_t                        m_ymin;
130      const size_t                        m_ymax;
131      const size_t                        m_srcid;
132
133      size_t                              m_count;                  // Numbers of words sent
134      size_t                              m_npackets;               // Total number of packets already sent
135      uint64_t                            m_start_latency1;         // Start time of sending packet wanted
136      uint64_t                            m_start_latency2;         // Start time of sending packet
137      uint64_t                            m_latency1;               // Average latency wanted
138      uint64_t                            m_latency2;               // Average latency
139      size_t                              m_bc_nrsp;                // Expected number of responses for a broadcast command
140      addr_t                              m_address_to_send;        // Address to send the write command
141      uint32_t                            m_local_seed;
142
143      uint64_t                            m_start_latency_bc;
144      uint64_t                            m_latency_bc;
145      uint64_t                            m_nb_bc;
146
147      // Fifo transmitting date to the VCI FSM
148      GenericFifo<uint32_t>    m_date_fifo;
149
150      //sc_signal<int>           r_cmd_fsm;
151      sc_signal<int>           r_vci_fsm;
152
153      sc_signal<int>           r_bc_rsp_fsm;
154       
155      sc_signal<size_t>        r_index;
156
157      sc_signal<bool>          r_broadcast_req;
158
159
160    }; // end class VciSyntheticInitiator
161 
162  }}
163
164#endif
Note: See TracBrowser for help on using the repository browser.