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 | |
---|
35 | namespace 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 | uint32_t m_cpt_cycles; // Counter of cycles |
---|
64 | |
---|
65 | protected: |
---|
66 | |
---|
67 | SC_HAS_PROCESS(VciSyntheticInitiator); |
---|
68 | |
---|
69 | public: |
---|
70 | sc_in<bool> p_clk; |
---|
71 | sc_in<bool> p_resetn; |
---|
72 | soclib::caba::VciInitiator<vci_param> p_vci; |
---|
73 | |
---|
74 | VciSyntheticInitiator( |
---|
75 | sc_module_name name, |
---|
76 | size_t length, // Packet length (flit numbers) |
---|
77 | float rho, // Packets ratio on the network |
---|
78 | size_t depth, // Fifo depth |
---|
79 | size_t x, // |
---|
80 | size_t y, // |
---|
81 | size_t xmesh, |
---|
82 | size_t ymesh, |
---|
83 | size_t bc_period, // Broadcast period, if no broadcast => 0 |
---|
84 | size_t xmin, |
---|
85 | size_t xmax, |
---|
86 | size_t ymin, |
---|
87 | size_t ymax |
---|
88 | const soclib::common::IntTab &vci_index, |
---|
89 | ); |
---|
90 | |
---|
91 | ~VciSyntheticInitiator(); |
---|
92 | |
---|
93 | void transition(); |
---|
94 | |
---|
95 | void genMoore(); |
---|
96 | |
---|
97 | void print_stats(); |
---|
98 | |
---|
99 | private: |
---|
100 | |
---|
101 | // Component attributes |
---|
102 | const size_t m_length; // Number of flits of a packet |
---|
103 | const size_t m_rho; // Rate of packets in the network wanted |
---|
104 | const size_t m_depth, // Fifo depth |
---|
105 | const size_t m_x, // |
---|
106 | const size_t m_y, // |
---|
107 | const size_t m_xmesh, |
---|
108 | const size_t m_ymesh, |
---|
109 | const size_t m_bc_period, // Broadcast period, if no broadcast => 0 |
---|
110 | const size_t m_xmin, |
---|
111 | const size_t m_xmax, |
---|
112 | const size_t m_ymin, |
---|
113 | const size_t m_ymax |
---|
114 | |
---|
115 | // Fifo transmitting date to the VCI FSM |
---|
116 | GenericFifo<uint64_t> m_date_fifo; |
---|
117 | |
---|
118 | sc_signal<int> r_vci_fsm; |
---|
119 | |
---|
120 | sc_signal<size_t> r_index; |
---|
121 | |
---|
122 | }; // end class VciSyntheticInitiator |
---|
123 | |
---|
124 | }} |
---|
125 | |
---|
126 | #endif |
---|