1 | /* -*- c++ -*- |
---|
2 | * File : vci_vdspin_initiator_wrapper.h |
---|
3 | * Copyright (c) UPMC, Lip6 |
---|
4 | * Author : Alain Greiner |
---|
5 | * |
---|
6 | * SOCLIB_LGPL_HEADER_BEGIN |
---|
7 | * |
---|
8 | * This file is part of SoCLib, GNU LGPLv2.1. |
---|
9 | * |
---|
10 | * SoCLib is free software; you can redistribute it and/or modify it |
---|
11 | * under the terms of the GNU Lesser General Public License as published |
---|
12 | * by the Free Software Foundation; version 2.1 of the License. |
---|
13 | * |
---|
14 | * SoCLib is distributed in the hope that it will be useful, but |
---|
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | * Lesser General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU Lesser General Public |
---|
20 | * License along with SoCLib; if not, write to the Free Software |
---|
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
---|
22 | * 02110-1301 USA |
---|
23 | * |
---|
24 | * SOCLIB_LGPL_HEADER_END |
---|
25 | */ |
---|
26 | |
---|
27 | ///////////////////////////////////////////////////////////////////////// |
---|
28 | // This component performs the protocol translation between VCI & DSPIN, |
---|
29 | // and can be used to connect a VCI initiator to a DSPIN network. |
---|
30 | // It is implemented as two fully independant sub-components: |
---|
31 | // - translation from a VCI CMD to a DSPIN CMD |
---|
32 | // - translation from a DSPIN RSP to a VCI RSP |
---|
33 | // Each subcomponent contains a FIFO containing DSPIN flits. |
---|
34 | // For the DSPIN interfaces, the widths of the CMD & RSP flits |
---|
35 | // are defined as template parameters for future evolutions, |
---|
36 | // but the VCI to DSPIN translation makes the following assumptions: |
---|
37 | // - DSPIN CMD flit width = 40 bits |
---|
38 | // - DSPIN RSP flit width = 33 bits |
---|
39 | // - VCI address width <= 40 bits |
---|
40 | // - VCI data == 32 bits |
---|
41 | // - VCI plen == 8 bits |
---|
42 | // - VCI srcid <= 14 bits |
---|
43 | // - VCI trdid <= 8 bits |
---|
44 | // - VCI pktid field not transmitted |
---|
45 | // - VCI rerror == 2 bits |
---|
46 | //////////////////////////////////////////////////////////////////////// |
---|
47 | |
---|
48 | #ifndef VCI_VDSPIN_INITIATOR_WRAPPER_H_ |
---|
49 | #define VCI_VDSPIN_INITIATOR_WRAPPER_H_ |
---|
50 | |
---|
51 | #include <systemc> |
---|
52 | #include <assert.h> |
---|
53 | #include "caba_base_module.h" |
---|
54 | #include "vci_target.h" |
---|
55 | #include "generic_fifo.h" |
---|
56 | #include "dspin_interface.h" |
---|
57 | |
---|
58 | namespace soclib { namespace caba { |
---|
59 | |
---|
60 | template<typename vci_param, int dspin_cmd_width, int dspin_rsp_width> |
---|
61 | class VciVdspinInitiatorWrapper |
---|
62 | : public soclib::caba::BaseModule |
---|
63 | { |
---|
64 | // Command FSM |
---|
65 | enum fsm_state_cmd{ |
---|
66 | CMD_IDLE, |
---|
67 | CMD_BROADCAST, |
---|
68 | CMD_RW, |
---|
69 | CMD_WDATA, |
---|
70 | }; |
---|
71 | |
---|
72 | // Response FSM |
---|
73 | enum fsm_state_rsp{ |
---|
74 | RSP_IDLE, |
---|
75 | RSP_READ, |
---|
76 | }; |
---|
77 | |
---|
78 | protected: |
---|
79 | SC_HAS_PROCESS(VciVdspinInitiatorWrapper); |
---|
80 | |
---|
81 | public: |
---|
82 | // ports |
---|
83 | sc_core::sc_in<bool> p_clk; |
---|
84 | sc_core::sc_in<bool> p_resetn; |
---|
85 | soclib::caba::DspinOutput<dspin_cmd_width> p_dspin_out; |
---|
86 | soclib::caba::DspinInput<dspin_rsp_width> p_dspin_in; |
---|
87 | soclib::caba::VciTarget<vci_param> p_vci; |
---|
88 | |
---|
89 | // constructor / destructor |
---|
90 | VciVdspinInitiatorWrapper( sc_module_name name, |
---|
91 | size_t cmd_fifo_depth, |
---|
92 | size_t rsp_fifo_depth); |
---|
93 | private: |
---|
94 | // internal registers |
---|
95 | sc_core::sc_signal<int> r_cmd_fsm; |
---|
96 | sc_core::sc_signal<int> r_rsp_fsm; |
---|
97 | sc_core::sc_signal<sc_uint<dspin_rsp_width> > r_rsp_buf; |
---|
98 | |
---|
99 | // fifos cmd and rsp |
---|
100 | soclib::caba::GenericFifo<sc_uint<dspin_cmd_width> > r_fifo_cmd; |
---|
101 | soclib::caba::GenericFifo<sc_uint<dspin_rsp_width> > r_fifo_rsp; |
---|
102 | |
---|
103 | // methods systemc |
---|
104 | void transition(); |
---|
105 | void genMoore(); |
---|
106 | |
---|
107 | }; |
---|
108 | |
---|
109 | }} // end namespace |
---|
110 | |
---|
111 | #endif // VCI_VDSPIN_INITIATOR_WRAPPER_H_ |
---|
112 | |
---|
113 | // Local Variables: |
---|
114 | // tab-width: 4 |
---|
115 | // c-basic-offset: 4 |
---|
116 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
117 | // indent-tabs-mode: nil |
---|
118 | // End: |
---|
119 | |
---|
120 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|