[148] | 1 | /* -*- c++ -*- |
---|
| 2 | * File : vci_vdspin_initiator_wrapper.h |
---|
| 3 | * Copyright (c) UPMC, Lip6 |
---|
| 4 | * Author : Alain Greiner |
---|
| 5 | * |
---|
| 6 | * SOCLIB_LGPL_HEADER_BEGIN |
---|
[287] | 7 | * |
---|
[148] | 8 | * This file is part of SoCLib, GNU LGPLv2.1. |
---|
[287] | 9 | * |
---|
[148] | 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. |
---|
[287] | 13 | * |
---|
[148] | 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. |
---|
[287] | 18 | * |
---|
[148] | 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 |
---|
[287] | 23 | * |
---|
[148] | 24 | * SOCLIB_LGPL_HEADER_END |
---|
[287] | 25 | * |
---|
| 26 | * Maintainers: alexandre.joannou@lip6.fr |
---|
| 27 | * |
---|
[148] | 28 | */ |
---|
| 29 | |
---|
| 30 | ///////////////////////////////////////////////////////////////////////// |
---|
| 31 | // This component performs the protocol translation between VCI & DSPIN, |
---|
| 32 | // and can be used to connect a VCI initiator to a DSPIN network. |
---|
| 33 | // It is implemented as two fully independant sub-components: |
---|
| 34 | // - translation from a VCI CMD to a DSPIN CMD |
---|
| 35 | // - translation from a DSPIN RSP to a VCI RSP |
---|
| 36 | // Each subcomponent contains a FIFO containing DSPIN flits. |
---|
| 37 | // For the DSPIN interfaces, the widths of the CMD & RSP flits |
---|
| 38 | // are defined as template parameters for future evolutions, |
---|
| 39 | // but the VCI to DSPIN translation makes the following assumptions: |
---|
| 40 | // - DSPIN CMD flit width = 40 bits |
---|
| 41 | // - DSPIN RSP flit width = 33 bits |
---|
| 42 | // - VCI address width <= 40 bits |
---|
| 43 | // - VCI data == 32 bits |
---|
| 44 | // - VCI plen == 8 bits |
---|
| 45 | // - VCI srcid <= 14 bits |
---|
[287] | 46 | // - VCI trdid <= 4 bits |
---|
| 47 | // - VCI pktid <= 4 bits |
---|
| 48 | // - VCI rerror == 1 bit |
---|
[148] | 49 | //////////////////////////////////////////////////////////////////////// |
---|
| 50 | |
---|
| 51 | #ifndef VCI_VDSPIN_INITIATOR_WRAPPER_H_ |
---|
| 52 | #define VCI_VDSPIN_INITIATOR_WRAPPER_H_ |
---|
| 53 | |
---|
| 54 | #include <systemc> |
---|
| 55 | #include <assert.h> |
---|
| 56 | #include "caba_base_module.h" |
---|
| 57 | #include "vci_target.h" |
---|
| 58 | #include "generic_fifo.h" |
---|
| 59 | #include "dspin_interface.h" |
---|
| 60 | |
---|
| 61 | namespace soclib { namespace caba { |
---|
| 62 | |
---|
| 63 | template<typename vci_param, int dspin_cmd_width, int dspin_rsp_width> |
---|
| 64 | class VciVdspinInitiatorWrapper |
---|
[287] | 65 | : public soclib::caba::BaseModule |
---|
[148] | 66 | { |
---|
[287] | 67 | // Command FSM |
---|
[148] | 68 | enum fsm_state_cmd{ |
---|
[287] | 69 | CMD_IDLE, |
---|
| 70 | CMD_BROADCAST, |
---|
| 71 | CMD_READ, |
---|
| 72 | CMD_WRITE, |
---|
| 73 | CMD_WDATA, |
---|
[148] | 74 | }; |
---|
| 75 | |
---|
| 76 | // Response FSM |
---|
| 77 | enum fsm_state_rsp{ |
---|
[287] | 78 | RSP_IDLE, |
---|
| 79 | RSP_DSPIN_SINGLE_FLIT, |
---|
| 80 | RSP_DSPIN_MULTI_FLIT, |
---|
[148] | 81 | }; |
---|
| 82 | |
---|
| 83 | protected: |
---|
| 84 | SC_HAS_PROCESS(VciVdspinInitiatorWrapper); |
---|
| 85 | |
---|
| 86 | public: |
---|
| 87 | // ports |
---|
[287] | 88 | sc_core::sc_in<bool> p_clk; |
---|
| 89 | sc_core::sc_in<bool> p_resetn; |
---|
| 90 | soclib::caba::DspinOutput<dspin_cmd_width> p_dspin_out; |
---|
| 91 | soclib::caba::DspinInput<dspin_rsp_width> p_dspin_in; |
---|
| 92 | soclib::caba::VciTarget<vci_param> p_vci; |
---|
[148] | 93 | |
---|
| 94 | // constructor / destructor |
---|
[287] | 95 | VciVdspinInitiatorWrapper( sc_module_name name, |
---|
| 96 | size_t cmd_fifo_depth, |
---|
| 97 | size_t rsp_fifo_depth ); |
---|
[148] | 98 | private: |
---|
| 99 | // internal registers |
---|
[287] | 100 | sc_core::sc_signal<int> r_cmd_fsm; |
---|
| 101 | sc_core::sc_signal<int> r_rsp_fsm; |
---|
| 102 | sc_core::sc_signal<sc_uint<dspin_rsp_width> > r_rsp_buf; |
---|
[148] | 103 | |
---|
| 104 | // fifos cmd and rsp |
---|
[287] | 105 | soclib::caba::GenericFifo<sc_uint<dspin_cmd_width> > r_fifo_cmd; |
---|
| 106 | soclib::caba::GenericFifo<sc_uint<dspin_rsp_width> > r_fifo_rsp; |
---|
[148] | 107 | |
---|
| 108 | // methods systemc |
---|
| 109 | void transition(); |
---|
| 110 | void genMoore(); |
---|
| 111 | |
---|
[150] | 112 | public: |
---|
| 113 | void print_trace(); |
---|
| 114 | |
---|
[148] | 115 | }; |
---|
| 116 | |
---|
| 117 | }} // end namespace |
---|
[287] | 118 | |
---|
[148] | 119 | #endif // VCI_VDSPIN_INITIATOR_WRAPPER_H_ |
---|
| 120 | |
---|
| 121 | // Local Variables: |
---|
| 122 | // tab-width: 4 |
---|
| 123 | // c-basic-offset: 4 |
---|
| 124 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 125 | // indent-tabs-mode: nil |
---|
| 126 | // End: |
---|
| 127 | |
---|
| 128 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|