source: trunk/modules/vci_vdspin_target_wrapper/caba/source/include/vci_vdspin_target_wrapper.h @ 287

Last change on this file since 287 was 287, checked in by joannou, 11 years ago

Updated vci_vdspin_initiator_wrapper and vci_vdspin_target_wrapper to fit new spec :
A single flit VCI response packet with a rdata=0 is translated to a single flit DSPIN response packet.
(All other responses need multi flit DSPIN response packets)

File size: 4.2 KB
Line 
1/* -*- c++ -*-
2  * File : vci_vdspin_target_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  * Maintainers: alexandre.joannou@lip6.fr
27  *
28  */
29
30/////////////////////////////////////////////////////////////////////////
31// This component performs the protocol translation between VCI & DSPIN,
32// and can be used to connect a VCI target to a DSPIN netnork.
33// It is implemented as two fully independant sub-components:
34// - translation from a DSPIN CMD to a VCI CMD
35// - translation from a VCI RSP to a DSPIN 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
46// - VCI trdid            <= 4  bits
47// - VCI pktid            <= 4  bits
48// - VCI rerror           == 1  bit
49////////////////////////////////////////////////////////////////////////
50
51#ifndef VCI_VDSPIN_TARGET_WRAPPER_H_
52#define VCI_VDSPIN_TARGET_WRAPPER_H_
53
54#include <systemc>
55#include <assert.h>
56#include "caba_base_module.h"
57#include "vci_initiator.h"
58#include "generic_fifo.h"
59#include "dspin_interface.h"
60#include "static_fast_int.h"
61
62namespace soclib { namespace caba {
63
64
65template<typename vci_param, int dspin_cmd_width, int dspin_rsp_width>
66class VciVdspinTargetWrapper
67    : public soclib::caba::BaseModule
68{
69
70    // Command FSM
71    enum fsm_state_cmd{
72    CMD_IDLE,
73    CMD_BROADCAST,
74    CMD_RW,
75    CMD_READ,
76    CMD_WDATA,
77    };
78
79    // Response FSM
80    enum fsm_state_rsp{
81    RSP_IDLE,
82    RSP_DSPIN_SINGLE_FLIT,
83    RSP_DSPIN_MULTI_FLIT,
84    };
85
86protected:
87    SC_HAS_PROCESS(VciVdspinTargetWrapper);
88
89public:
90    // ports
91    sc_core::sc_in<bool>                                    p_clk;
92    sc_core::sc_in<bool>                                    p_resetn;
93    soclib::caba::DspinOutput<dspin_rsp_width>              p_dspin_out;
94    soclib::caba::DspinInput<dspin_cmd_width>               p_dspin_in;
95    soclib::caba::VciInitiator<vci_param>                   p_vci;
96
97    // constructor / destructor
98    VciVdspinTargetWrapper( sc_module_name                  name,
99                            size_t                          cmd_fifo_depth,
100                            size_t                          rsp_fifo_depth  );
101private:
102    // internal registers
103    sc_core::sc_signal<int>                                 r_cmd_fsm;
104    sc_core::sc_signal<sc_uint<dspin_cmd_width> >           r_cmd_buf0;
105    sc_core::sc_signal<sc_uint<dspin_cmd_width> >           r_cmd_buf1;
106    sc_core::sc_signal<int>                                 r_rsp_fsm;
107    sc_core::sc_signal<size_t>                              r_flit_count;
108
109    // fifos cmd and rsp
110    soclib::caba::GenericFifo<sc_uint<dspin_cmd_width> >    r_fifo_cmd;
111    soclib::caba::GenericFifo<sc_uint<dspin_rsp_width> >    r_fifo_rsp;
112
113    // methods systemc
114    void transition();
115    void genMoore();
116
117public:
118    void print_trace();
119
120};
121
122}} // end namespace
123
124#endif // VCI_VDSPIN_TARGET_WRAPPER_H_
125
126// Local Variables:
127// tab-width: 4
128// c-basic-offset: 4
129// c-file-offsets:((innamespace . 0)(inline-open . 0))
130// indent-tabs-mode: nil
131// End:
132
133// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
Note: See TracBrowser for help on using the repository browser.