Changeset 287 for trunk/modules


Ignore:
Timestamp:
Jan 15, 2013, 5:54:45 PM (11 years ago)
Author:
joannou
Message:

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)

Location:
trunk/modules
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_vdspin_initiator_wrapper/caba/source/include/vci_vdspin_initiator_wrapper.h

    r150 r287  
    55  *
    66  * SOCLIB_LGPL_HEADER_BEGIN
    7   * 
     7  *
    88  * This file is part of SoCLib, GNU LGPLv2.1.
    9   * 
     9  *
    1010  * SoCLib is free software; you can redistribute it and/or modify it
    1111  * under the terms of the GNU Lesser General Public License as published
    1212  * by the Free Software Foundation; version 2.1 of the License.
    13   * 
     13  *
    1414  * SoCLib is distributed in the hope that it will be useful, but
    1515  * WITHOUT ANY WARRANTY; without even the implied warranty of
    1616  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1717  * Lesser General Public License for more details.
    18   * 
     18  *
    1919  * You should have received a copy of the GNU Lesser General Public
    2020  * License along with SoCLib; if not, write to the Free Software
    2121  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    2222  * 02110-1301 USA
    23   * 
     23  *
    2424  * SOCLIB_LGPL_HEADER_END
     25  *
     26  * Maintainers: alexandre.joannou@lip6.fr
     27  *
    2528  */
    2629
     
    4144// - VCI plen             == 8  bits
    4245// - VCI srcid            <= 14 bits
    43 // - VCI trdid            <= 8  bits
    44 // - VCI pktid field not transmitted
    45 // - VCI rerror           == 2 bits
     46// - VCI trdid            <= 4  bits
     47// - VCI pktid            <= 4  bits
     48// - VCI rerror           == 1  bit
    4649////////////////////////////////////////////////////////////////////////
    4750
     
    6063template<typename vci_param, int dspin_cmd_width, int dspin_rsp_width>
    6164class VciVdspinInitiatorWrapper
    62         : public soclib::caba::BaseModule
     65    : public soclib::caba::BaseModule
    6366{
    64     // Command FSM 
     67    // Command FSM
    6568    enum fsm_state_cmd{
    66         CMD_IDLE,
    67         CMD_BROADCAST,
    68         CMD_READ,
    69         CMD_WRITE,
    70         CMD_WDATA,
     69    CMD_IDLE,
     70    CMD_BROADCAST,
     71    CMD_READ,
     72    CMD_WRITE,
     73    CMD_WDATA,
    7174    };
    7275
    7376    // Response FSM
    7477    enum fsm_state_rsp{
    75         RSP_IDLE,
    76         RSP_READ,               
    77         RSP_WRITE,     
     78    RSP_IDLE,
     79    RSP_DSPIN_SINGLE_FLIT,
     80    RSP_DSPIN_MULTI_FLIT,
    7881    };
    7982
     
    8386public:
    8487    // ports
    85     sc_core::sc_in<bool>                                        p_clk;
    86     sc_core::sc_in<bool>                                        p_resetn;
    87     soclib::caba::DspinOutput<dspin_cmd_width>                  p_dspin_out;
    88     soclib::caba::DspinInput<dspin_rsp_width>                   p_dspin_in;
    89     soclib::caba::VciTarget<vci_param>                          p_vci;
     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;
    9093
    9194    // constructor / destructor
    92     VciVdspinInitiatorWrapper(  sc_module_name                  name,
    93                                 size_t                          cmd_fifo_depth,
    94                                 size_t                          rsp_fifo_depth);
     95    VciVdspinInitiatorWrapper(  sc_module_name              name,
     96                                size_t                      cmd_fifo_depth,
     97                                size_t                      rsp_fifo_depth  );
    9598private:
    9699    // internal registers
    97     sc_core::sc_signal<int>                                     r_cmd_fsm;
    98     sc_core::sc_signal<int>                                     r_rsp_fsm;
    99     sc_core::sc_signal<sc_uint<dspin_rsp_width> >               r_rsp_buf;
     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;
    100103
    101104    // fifos cmd and rsp
    102     soclib::caba::GenericFifo<sc_uint<dspin_cmd_width> >        r_fifo_cmd;
    103     soclib::caba::GenericFifo<sc_uint<dspin_rsp_width> >        r_fifo_rsp;
     105    soclib::caba::GenericFifo<sc_uint<dspin_cmd_width> >    r_fifo_cmd;
     106    soclib::caba::GenericFifo<sc_uint<dspin_rsp_width> >    r_fifo_rsp;
    104107
    105108    // methods systemc
     
    113116
    114117}} // end namespace
    115                
     118
    116119#endif // VCI_VDSPIN_INITIATOR_WRAPPER_H_
    117120
  • trunk/modules/vci_vdspin_initiator_wrapper/caba/source/src/vci_vdspin_initiator_wrapper.cpp

    r284 r287  
    2323  *
    2424  * SOCLIB_LGPL_HEADER_END
     25  *
     26  * Maintainers: alexandre.joannou@lip6.fr
     27  *
    2528  */
    2629
     
    3134#define tmpl(x) template<typename vci_param, int dspin_cmd_width, int dspin_rsp_width> x VciVdspinInitiatorWrapper<vci_param, dspin_cmd_width, dspin_rsp_width>
    3235
    33 //////////////////////////////////////////////////////////:////////////////////////////////
    34 tmpl(/**/)::VciVdspinInitiatorWrapper(sc_module_name             name,
    35                       size_t                cmd_fifo_depth,
    36                       size_t                rsp_fifo_depth)
    37            : soclib::caba::BaseModule(name),
    38                  p_clk("p_clk"),
    39                  p_resetn("p_resetn"),
    40                  p_dspin_out("p_dspin_out"),
    41                  p_dspin_in("p_dspin_in"),
    42                  p_vci("p_vci"),
    43                  r_cmd_fsm("r_cmd_fsm"),
    44                  r_rsp_fsm("r_rsp_fsm"),
    45              r_fifo_cmd("r_fifo_cmd", cmd_fifo_depth),
    46              r_fifo_rsp("r_fifo_rsp", rsp_fifo_depth)
     36//////////////////////////////////////////////////////////////////////////////////////////
     37tmpl(/**/)::VciVdspinInitiatorWrapper(  sc_module_name  name,
     38                                        size_t          cmd_fifo_depth,
     39                                        size_t          rsp_fifo_depth  )
     40            :  soclib::caba::BaseModule(name),
     41                p_clk("p_clk"),
     42                p_resetn("p_resetn"),
     43                p_dspin_out("p_dspin_out"),
     44                p_dspin_in("p_dspin_in"),
     45                p_vci("p_vci"),
     46                r_cmd_fsm("r_cmd_fsm"),
     47                r_rsp_fsm("r_rsp_fsm"),
     48                r_fifo_cmd("r_fifo_cmd", cmd_fifo_depth),
     49                r_fifo_rsp("r_fifo_rsp", rsp_fifo_depth)
    4750{
    4851    SC_METHOD (transition);
    4952    dont_initialize();
    5053    sensitive << p_clk.pos();
     54
    5155    SC_METHOD (genMoore);
    5256    dont_initialize();
     
    5660    assert( (dspin_rsp_width == 33) && "The DSPIN RSP flit width must have 33 bits");
    5761    assert( (vci_param::N    <= 40) && "The VCI ADDRESS field cannot have more than 40 bits");
    58     assert( (vci_param::B    == 4) && "The VCI DATA filds must have 32 bits");
    59     assert( (vci_param::K    == 8) && "The VCI PLEN field cannot have more than 8 bits");
    60     assert( (vci_param::S    <= 14) && "The VCI SRCID field cannot have more than 8 bits");
    61     assert( (vci_param::T    <= 8) && "The VCI TRDID field cannot have more than 8 bits");
    62     assert( (vci_param::E    == 2) && "The VCI RERROR field cannot have more than 2 bits");
     62    assert( (vci_param::B    == 4 ) && "The VCI DATA filds must have 32 bits");
     63    assert( (vci_param::K    == 8 ) && "The VCI PLEN field cannot have more than 8 bits");
     64    assert( (vci_param::S    <= 14) && "The VCI SRCID field cannot have more than 14 bits");
     65    assert( (vci_param::T    <= 4 ) && "The VCI TRDID field cannot have more than 4 bits");
     66    assert( (vci_param::P    <= 4 ) && "The VCI PKTID field cannot have more than 4 bits");
     67    assert( (vci_param::E    <= 2 ) && "The VCI RERROR field cannot have more than 2 bits");
    6368
    6469} //  end constructor
     
    6873{
    6974    sc_uint<dspin_cmd_width>    cmd_fifo_data;
    70     bool                cmd_fifo_write;
    71     bool                cmd_fifo_read;
     75    bool                        cmd_fifo_write;
     76    bool                        cmd_fifo_read;
    7277
    7378    sc_uint<dspin_rsp_width>    rsp_fifo_data;
    74     bool                rsp_fifo_write;
    75     bool                rsp_fifo_read;
     79    bool                        rsp_fifo_write;
     80    bool                        rsp_fifo_read;
    7681
    7782    if (p_resetn == false)
    78         {
     83    {
    7984        r_fifo_cmd.init();
    8085        r_fifo_rsp.init();
     
    123128                    else                      address = address << (39 - vci_param::N);
    124129
    125                     if ( is_broadcast )    // VCI broacast command
     130                    if ( is_broadcast ) // VCI broacast command
    126131                    {
    127132                        r_cmd_fsm     = CMD_BROADCAST;
     
    131136                                                        0x0000000001LL;
    132137                    }
    133                     else if (is_read )            // VCI READ  command
     138                    else if (is_read )  // VCI READ  command
    134139                    {
    135140                        r_cmd_fsm     = CMD_READ;
    136141                        cmd_fifo_data = address & 0x7FFFFFFFFELL;
    137142                    }
    138                     else                 // VCI WRITE command
     143                    else                // VCI WRITE command
    139144                    {
    140145                        r_cmd_fsm     = CMD_WRITE;
     
    144149         break;
    145150        }
    146         case CMD_BROADCAST:        // write second DSPIN flit in case of broadcast
     151        case CMD_BROADCAST:             // write second DSPIN flit in case of broadcast
    147152            {
    148153                if( p_vci.cmdval && r_fifo_cmd.wok() )
     
    158163                break;
    159164            }
    160             case CMD_READ:    // write second DSPIN flit in case of read/write
     165            case CMD_READ:              // write second DSPIN flit in case of read/write
    161166            case CMD_WRITE:
    162167            {
     
    179184                    if ( p_vci.cons.read()   ) cmd_fifo_data = cmd_fifo_data | 0x0000200000LL ;
    180185
    181                     if( r_cmd_fsm == CMD_READ )  // read command
     186                    if( r_cmd_fsm == CMD_READ ) // read command
    182187                    {
    183188                        r_cmd_fsm = CMD_IDLE;
    184189                        cmd_fifo_data = cmd_fifo_data    | 0x8000000000LL ;
    185190                    }
    186                     else            // write command
     191                    else                        // write command
    187192                    {
    188193                        r_cmd_fsm = CMD_WDATA;
     
    221226    // The FIFO output is analysed and translated to a VCI packet
    222227    //////////////////////////////////////////////////////////////
    223     // - A N+1 flits DSPIN read response packet is translated
     228    // - A N+1 flits DSPIN response packet is translated
    224229    //   to a N flits VCI response.
    225     // - A single flit DSPIN write response packet is translated
    226     //   to a single flit VCI response.
     230    // - A single flit DSPIN response packet is translated
     231    //   to a single flit VCI response with RDATA = 0.
    227232    // A valid DSPIN flit in the fifo_rsp is always consumed
    228233    // in the CMD_IDLE state, but no VCI flit is transmitted.
    229     // The VCI flits are sent in the RSP_READ & RSP_WRITE states.
     234    // The VCI flits are sent in the RSP_DSPIN_SINGLE_FLIT &
     235    // RSP_DSPIN_MULTI_FLIT states.
    230236    //////////////////////////////////////////////////////////////
    231237
     
    235241
    236242    // r_rsp_fsm, rsp_fifo_read
    237         rsp_fifo_read = false;        // default value
    238 
    239     switch(r_rsp_fsm) {
     243    rsp_fifo_read = false;        // default value
     244
     245    switch(r_rsp_fsm)
     246    {
    240247        case RSP_IDLE:
    241             {
    242         if( r_fifo_rsp.rok() )
    243                 {
    244             rsp_fifo_read = true;
    245                     r_rsp_buf = r_fifo_rsp.read();
    246                     if ( (r_fifo_rsp.read() & 0x000020000LL) == 0 )  r_rsp_fsm = RSP_READ;
    247                     else                              r_rsp_fsm = RSP_WRITE;
    248         }
    249         break;
    250             }
    251         case RSP_READ:
    252248        {
    253         if( r_fifo_rsp.rok() && p_vci.rspack.read() )
    254                 {
    255             rsp_fifo_read = true;
    256                     if ( (r_fifo_rsp.read() & 0x100000000LL) ) r_rsp_fsm = RSP_IDLE;
    257         }
    258         break;
    259             }
    260             case RSP_WRITE:
    261             {
    262                 if ( p_vci.rspack.read() ) r_rsp_fsm = RSP_IDLE;
    263             }
     249            if( r_fifo_rsp.rok() )
     250            {
     251                rsp_fifo_read = true;
     252                r_rsp_buf = r_fifo_rsp.read();
     253                if ( (r_fifo_rsp.read() & 0x100000000LL) == 0x100000000LL )
     254                    r_rsp_fsm = RSP_DSPIN_SINGLE_FLIT;
     255                else
     256                    r_rsp_fsm = RSP_DSPIN_MULTI_FLIT;
     257            }
     258            break;
     259        }
     260        case RSP_DSPIN_SINGLE_FLIT:
     261        {
     262            if ( p_vci.rspack.read() )
     263                r_rsp_fsm = RSP_IDLE;
     264            break;
     265        }
     266        case RSP_DSPIN_MULTI_FLIT:
     267        {
     268            if( r_fifo_rsp.rok() && p_vci.rspack.read() )
     269            {
     270                rsp_fifo_read = true;
     271                if ( (r_fifo_rsp.read() & 0x100000000LL) == 0x100000000LL )
     272                    r_rsp_fsm = RSP_IDLE;
     273            }
     274            break;
     275        }
    264276    } // end switch r_rsp_fsm
    265277
     
    275287{
    276288    // VCI CMD interface
    277         if ( ( r_cmd_fsm.read() == CMD_IDLE ) || ( r_cmd_fsm.read() == CMD_WRITE ) )
    278         {
    279             p_vci.cmdack = false;
    280         }
     289    if ( ( r_cmd_fsm.read() == CMD_IDLE ) || ( r_cmd_fsm.read() == CMD_WRITE ) )
     290    {
     291        p_vci.cmdack = false;
     292    }
    281293    else
    282         {
    283             p_vci.cmdack = r_fifo_cmd.wok();
    284         }
     294    {
     295        p_vci.cmdack = r_fifo_cmd.wok();
     296    }
    285297
    286298    // VCI RSP interface
    287299    if ( r_rsp_fsm.read() == RSP_IDLE )
    288         {
    289             p_vci.rspval = false;
    290         }
    291         else if ( r_rsp_fsm.read() == RSP_WRITE )
    292         {
    293             p_vci.rspval = true;
    294             p_vci.rdata  = 0;
    295             p_vci.rsrcid = (sc_uint<vci_param::S>)((r_rsp_buf.read() & 0x0FFFC0000LL) >> 18);
    296             p_vci.rpktid = (sc_uint<vci_param::T>)((r_rsp_buf.read() & 0x000000F00LL) >> 8);
    297             p_vci.rtrdid = (sc_uint<vci_param::P>)((r_rsp_buf.read() & 0x00000F000LL) >> 12);
    298             p_vci.rerror = (sc_uint<vci_param::E>)((r_rsp_buf.read() & 0x000030000LL) >> 16);
    299             p_vci.reop   = true;
    300         }
    301         else if ( r_rsp_fsm.read() == RSP_READ )
    302         {
    303             p_vci.rspval = r_fifo_rsp.rok();
    304             p_vci.rdata  = (sc_uint<8*vci_param::B>)(r_fifo_rsp.read() & 0x0FFFFFFFFLL);
    305             p_vci.rsrcid = (sc_uint<vci_param::S>)((r_rsp_buf.read()   & 0x0FFFC0000LL) >> 18);
    306             p_vci.rpktid = (sc_uint<vci_param::T>)((r_rsp_buf.read()   & 0x000000F00LL) >> 8);
    307             p_vci.rtrdid = (sc_uint<vci_param::P>)((r_rsp_buf.read()   & 0x00000F000LL) >> 12);
    308             p_vci.rerror = (sc_uint<vci_param::E>)((r_rsp_buf.read()   & 0x000030000LL) >> 16);
    309             p_vci.reop   = ((r_fifo_rsp.read() & 0x100000000LL) == 0x100000000LL);
    310         }
    311 
    312         // DSPIN_OUT interface
    313         p_dspin_out.write = r_fifo_cmd.rok();
    314         p_dspin_out.data  = r_fifo_cmd.read();
    315 
    316         // DSPIN_IN interface
    317         p_dspin_in.read   = r_fifo_rsp.wok();
     300    {
     301        p_vci.rspval = false;
     302    }
     303    else if ( r_rsp_fsm.read() == RSP_DSPIN_SINGLE_FLIT )
     304    {
     305        p_vci.rspval = true;
     306        p_vci.rdata  = 0;
     307        p_vci.rsrcid = (sc_uint<vci_param::S>)((r_rsp_buf.read() & 0x0FFFC0000LL) >> 18);
     308        p_vci.rpktid = (sc_uint<vci_param::T>)((r_rsp_buf.read() & 0x000000F00LL) >> 8);
     309        p_vci.rtrdid = (sc_uint<vci_param::P>)((r_rsp_buf.read() & 0x00000F000LL) >> 12);
     310        p_vci.rerror = (sc_uint<vci_param::E>)((r_rsp_buf.read() & 0x000030000LL) >> 16);
     311        p_vci.reop   = true;
     312    }
     313    else if ( r_rsp_fsm.read() == RSP_DSPIN_MULTI_FLIT )
     314    {
     315        p_vci.rspval = r_fifo_rsp.rok();
     316        p_vci.rdata  = (sc_uint<8*vci_param::B>)(r_fifo_rsp.read() & 0x0FFFFFFFFLL);
     317        p_vci.rsrcid = (sc_uint<vci_param::S>)((r_rsp_buf.read()   & 0x0FFFC0000LL) >> 18);
     318        p_vci.rpktid = (sc_uint<vci_param::T>)((r_rsp_buf.read()   & 0x000000F00LL) >> 8);
     319        p_vci.rtrdid = (sc_uint<vci_param::P>)((r_rsp_buf.read()   & 0x00000F000LL) >> 12);
     320        p_vci.rerror = (sc_uint<vci_param::E>)((r_rsp_buf.read()   & 0x000030000LL) >> 16);
     321        p_vci.reop   = ((r_fifo_rsp.read() & 0x100000000LL) == 0x100000000LL);
     322    }
     323
     324    // DSPIN_OUT interface
     325    p_dspin_out.write = r_fifo_cmd.rok();
     326    p_dspin_out.data  = r_fifo_cmd.read();
     327
     328    // DSPIN_IN interface
     329    p_dspin_in.read   = r_fifo_rsp.wok();
    318330
    319331}; // end genMoore
     
    330342    };
    331343    const char* rsp_str[] = {
    332     "RSP_IDLE     ",
    333     "RSP_READ     ",
    334     "RSP_WRITE    ",
     344    "RSP_IDLE             ",
     345    "RSP_DSPIN_SINGLE_FLIT",
     346    "RSP_DSPIN_MULTI_FLIT ",
    335347    };
    336348
  • trunk/modules/vci_vdspin_target_wrapper/caba/source/include/vci_vdspin_target_wrapper.h

    r185 r287  
    55  *
    66  * SOCLIB_LGPL_HEADER_BEGIN
    7   * 
     7  *
    88  * This file is part of SoCLib, GNU LGPLv2.1.
    9   * 
     9  *
    1010  * SoCLib is free software; you can redistribute it and/or modify it
    1111  * under the terms of the GNU Lesser General Public License as published
    1212  * by the Free Software Foundation; version 2.1 of the License.
    13   * 
     13  *
    1414  * SoCLib is distributed in the hope that it will be useful, but
    1515  * WITHOUT ANY WARRANTY; without even the implied warranty of
    1616  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1717  * Lesser General Public License for more details.
    18   * 
     18  *
    1919  * You should have received a copy of the GNU Lesser General Public
    2020  * License along with SoCLib; if not, write to the Free Software
    2121  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    2222  * 02110-1301 USA
    23   * 
     23  *
    2424  * SOCLIB_LGPL_HEADER_END
     25  *
     26  * Maintainers: alexandre.joannou@lip6.fr
     27  *
    2528  */
    2629
     
    3942// - VCI address width    <= 40 bits
    4043// - 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
     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
    4649////////////////////////////////////////////////////////////////////////
    4750
     
    6265template<typename vci_param, int dspin_cmd_width, int dspin_rsp_width>
    6366class VciVdspinTargetWrapper
    64         : public soclib::caba::BaseModule
     67    : public soclib::caba::BaseModule
    6568{
    6669
    67     // Command FSM 
     70    // Command FSM
    6871    enum fsm_state_cmd{
    6972    CMD_IDLE,
     
    7780    enum fsm_state_rsp{
    7881    RSP_IDLE,
    79     RSP_READ,
    80     RSP_WRITE,
     82    RSP_DSPIN_SINGLE_FLIT,
     83    RSP_DSPIN_MULTI_FLIT,
    8184    };
    8285
     
    8689public:
    8790    // ports
    88     sc_core::sc_in<bool>                                        p_clk;
    89     sc_core::sc_in<bool>                                        p_resetn;
    90     soclib::caba::DspinOutput<dspin_rsp_width>                  p_dspin_out;
    91     soclib::caba::DspinInput<dspin_cmd_width>                   p_dspin_in;
    92     soclib::caba::VciInitiator<vci_param>                       p_vci;
     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;
    9396
    9497    // constructor / destructor
    95     VciVdspinTargetWrapper(     sc_module_name                  name,
    96                                 size_t                          cmd_fifo_depth,
    97                                 size_t                          rsp_fifo_depth);
     98    VciVdspinTargetWrapper( sc_module_name                  name,
     99                            size_t                          cmd_fifo_depth,
     100                            size_t                          rsp_fifo_depth  );
    98101private:
    99102    // internal registers
    100     sc_core::sc_signal<int>                                     r_cmd_fsm;
    101     sc_core::sc_signal<sc_uint<dspin_cmd_width> >               r_cmd_buf0;
    102     sc_core::sc_signal<sc_uint<dspin_cmd_width> >               r_cmd_buf1;
    103     sc_core::sc_signal<int>                                     r_rsp_fsm;
    104     sc_core::sc_signal<size_t>                                  r_flit_count;
     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;
    105108
    106109    // fifos cmd and rsp
    107     soclib::caba::GenericFifo<sc_uint<dspin_cmd_width> >        r_fifo_cmd;
    108     soclib::caba::GenericFifo<sc_uint<dspin_rsp_width> >        r_fifo_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;
    109112
    110113    // methods systemc
     
    118121
    119122}} // end namespace
    120                
     123
    121124#endif // VCI_VDSPIN_TARGET_WRAPPER_H_
    122125
  • trunk/modules/vci_vdspin_target_wrapper/caba/source/src/vci_vdspin_target_wrapper.cpp

    r284 r287  
    2323  *
    2424  * SOCLIB_LGPL_HEADER_END
     25  *
     26  * Maintainers: alexandre.joannou@lip6.fr
     27  *
    2528  */
    2629
     
    3336#define tmpl(x) template<typename vci_param, int dspin_cmd_width, int dspin_rsp_width> x VciVdspinTargetWrapper<vci_param, dspin_cmd_width, dspin_rsp_width>
    3437
    35 //////////////////////////////////////////////////////////:////////////////////////////////
    36 tmpl(/**/)::VciVdspinTargetWrapper(sc_module_name             name,
    37                         size_t                cmd_fifo_depth,
    38                    size_t                rsp_fifo_depth)
    39            : soclib::caba::BaseModule(name),
    40                  p_clk("p_clk"),
    41                  p_resetn("p_resetn"),
    42                  p_dspin_out("p_dspin_out"),
    43                  p_dspin_in("p_dspin_in"),
    44                  p_vci("p_vci"),
    45                  r_cmd_fsm("r_cmd_fsm"),
    46                  r_rsp_fsm("r_rsp_fsm"),
    47              r_fifo_cmd("r_fifo_cmd", cmd_fifo_depth),
    48              r_fifo_rsp("r_fifo_rsp", rsp_fifo_depth)
    49     {
     38//////////////////////////////////////////////////////////////////////////////////////////
     39tmpl(/**/)::VciVdspinTargetWrapper( sc_module_name  name,
     40                                    size_t          cmd_fifo_depth,
     41                                    size_t          rsp_fifo_depth  )
     42        soclib::caba::BaseModule(name),
     43            p_clk("p_clk"),
     44            p_resetn("p_resetn"),
     45            p_dspin_out("p_dspin_out"),
     46            p_dspin_in("p_dspin_in"),
     47            p_vci("p_vci"),
     48            r_cmd_fsm("r_cmd_fsm"),
     49            r_rsp_fsm("r_rsp_fsm"),
     50            r_fifo_cmd("r_fifo_cmd", cmd_fifo_depth),
     51            r_fifo_rsp("r_fifo_rsp", rsp_fifo_depth)
     52{
    5053    SC_METHOD (transition);
    5154    dont_initialize();
    5255    sensitive << p_clk.pos();
     56
    5357    SC_METHOD (genMoore);
    5458    dont_initialize();
    5559    sensitive  << p_clk.neg();
    5660
    57         assert( (dspin_cmd_width == 40) && "The DSPIN CMD flit width must have 40 bits");
    58         assert( (dspin_rsp_width == 33) && "The DSPIN RSP flit width must have 33 bits");
    59         assert( (vci_param::N    <= 40) && "The VCI ADDRESS field cannot have more than 40 bits");
    60         assert( (vci_param::B    == 4) && "The VCI DATA filds must have 32 bits");
    61         assert( (vci_param::K    == 8) && "The VCI PLEN field cannot have more than 8 bits");
    62         assert( (vci_param::S    <= 14) && "The VCI SRCID field cannot have more than 8 bits");
    63         assert( (vci_param::T    <= 8) && "The VCI TRDID field cannot have more than 8 bits");
    64         assert( (vci_param::E    == 2) && "The VCI RERROR field cannot have more than 2 bits");
    65 
    66     } //  end constructor
     61    assert( (dspin_cmd_width == 40) && "The DSPIN CMD flit width must have 40 bits");
     62    assert( (dspin_rsp_width == 33) && "The DSPIN RSP flit width must have 33 bits");
     63    assert( (vci_param::N    <= 40) && "The VCI ADDRESS field cannot have more than 40 bits");
     64    assert( (vci_param::B    == 4 ) && "The VCI DATA filds must have 32 bits");
     65    assert( (vci_param::K    == 8 ) && "The VCI PLEN field cannot have more than 8 bits");
     66    assert( (vci_param::S    <= 14) && "The VCI SRCID field cannot have more than 14 bits");
     67    assert( (vci_param::T    <= 4 ) && "The VCI TRDID field cannot have more than 4 bits");
     68    assert( (vci_param::P    <= 4 ) && "The VCI PKTID field cannot have more than 4 bits");
     69    assert( (vci_param::E    <= 2 ) && "The VCI RERROR field cannot have more than 2 bits");
     70
     71} //  end constructor
    6772
    6873/////////////////////////
    6974tmpl(void)::transition()
    7075{
    71     sc_uint<dspin_cmd_width>        cmd_fifo_data;
    72     bool                    cmd_fifo_write;
    73     bool                    cmd_fifo_read;
    74 
    75     sc_uint<dspin_rsp_width>        rsp_fifo_data;
    76     bool                    rsp_fifo_write;
    77     bool                    rsp_fifo_read;
     76    sc_uint<dspin_cmd_width>    cmd_fifo_data;
     77    bool                        cmd_fifo_write;
     78    bool                        cmd_fifo_read;
     79
     80    sc_uint<dspin_rsp_width>    rsp_fifo_data;
     81    bool                        rsp_fifo_write;
     82    bool                        rsp_fifo_read;
    7883
    7984    if (p_resetn == false)
    80         {
     85    {
    8186        r_fifo_cmd.init();
    8287        r_fifo_rsp.init();
     
    9196    // and the DSPIN packet is stored in the fifo_rsp
    9297    /////////////////////////////////////////////////////////////
    93     // - A single flit VCI write response packet is translated
    94     //   to a single flit DSPIN response.
    95     // - A N flits VCI read response packet is translated
    96     //   to a N+1 flits DSPIN response
     98    // - A single flit VCI response packet with a 0 RDATA value
     99    //   is translated to a single flit DSPIN response.
     100    // - All other VCI responses are translated to a multi-flit
     101    //   DSPIN response.
    97102    // In the RSP_IDLE state, the first DSPIN flit is written
    98103    // in fifo_rsp , but no VCI flit is consumed. The VCI flits
    99     // are consumed in the RSP_READ or RSP_WRITE states.
     104    // are consumed in the RSP_DSPIN_SINGLE_FLIT, or the
     105    // SP_DSPIN_MULTI_FLIT states.
    100106    //////////////////////////////////////////////////////////////
    101107
     
    104110
    105111    // r_rsp_fsm, rsp_fifo_write and rsp_fifo_data
    106         rsp_fifo_write = false;        // default value
    107 
    108     switch(r_rsp_fsm) {
     112    rsp_fifo_write = false;        // default value
     113
     114    switch(r_rsp_fsm)
     115    {
    109116        case RSP_IDLE:        // write first DSPIN flit into rsp_fifo
    110             {
    111                 if( p_vci.rspval && r_fifo_rsp.wok() )
     117        {
     118            if( p_vci.rspval.read() && r_fifo_rsp.wok() )
     119            {
     120                bool is_single_flit = ( p_vci.reop.read() && ( p_vci.rdata.read() == 0) );
     121
     122                rsp_fifo_write = true;
     123                rsp_fifo_data  = (((sc_uint<dspin_rsp_width>)p_vci.rsrcid.read()) << 18) |
     124                                 (((sc_uint<dspin_rsp_width>)p_vci.rerror.read()) << 16) |
     125                                 (((sc_uint<dspin_rsp_width>)p_vci.rtrdid.read()) << 12) |
     126                                 (((sc_uint<dspin_rsp_width>)p_vci.rpktid.read()) << 8);
     127                if ( is_single_flit )
    112128                {
    113                     bool is_read = ( (p_vci.rerror.read() & 0x2) == 0);
    114 
    115                     rsp_fifo_write = true;
    116                     rsp_fifo_data = (((sc_uint<dspin_rsp_width>)p_vci.rsrcid.read()) << 18) |
    117                                     (((sc_uint<dspin_rsp_width>)p_vci.rerror.read()) << 16) |
    118                                     (((sc_uint<dspin_rsp_width>)p_vci.rtrdid.read()) << 12) |
    119                                     (((sc_uint<dspin_rsp_width>)p_vci.rpktid.read()) << 8);
    120                     if ( is_read )
    121                     {
    122                         r_rsp_fsm = RSP_READ;
    123                     }
    124                     else
    125                     {
    126                         rsp_fifo_data = rsp_fifo_data | 0x100000000LL;
    127                         r_rsp_fsm = RSP_WRITE;
    128                     }
     129                    rsp_fifo_data = rsp_fifo_data | 0x100000000LL; // EOP = 1
     130                    rsp_fifo_data = rsp_fifo_data & 0x1FFFFFFFELL; // BC  = 0
     131                    r_rsp_fsm = RSP_DSPIN_SINGLE_FLIT;
    129132                }
    130                 break;
    131             }
    132         case RSP_READ:        // write DSPIN data flit in case of read
    133             {
    134                 if( p_vci.rspval && r_fifo_rsp.wok() )
     133                else
    135134                {
    136                     rsp_fifo_write   = true;
    137                     rsp_fifo_data = ((sc_uint<dspin_rsp_width>)p_vci.rdata.read());
    138                     if ( p_vci.reop )
    139                     {
    140                         rsp_fifo_data = rsp_fifo_data | 0x100000000LL;
    141                         r_rsp_fsm = RSP_IDLE;
    142                     }
     135                    rsp_fifo_data = rsp_fifo_data & 0x0FFFFFFFFLL; // EOP = 0
     136                    rsp_fifo_data = rsp_fifo_data & 0x1FFFFFFFELL; // BC  = 0
     137                    r_rsp_fsm = RSP_DSPIN_MULTI_FLIT;
    143138                }
    144                 break;
    145             }
    146             case RSP_WRITE:
    147             {
    148                 rsp_fifo_write = false;
    149                 if ( r_fifo_rsp.wok() ) r_rsp_fsm = RSP_IDLE;
    150                 break;
    151             }
     139            }
     140            break;
     141        }
     142        case RSP_DSPIN_SINGLE_FLIT:
     143        {
     144            rsp_fifo_write = false;
     145            if ( r_fifo_rsp.wok() )
     146                r_rsp_fsm = RSP_IDLE;
     147            break;
     148        }
     149        case RSP_DSPIN_MULTI_FLIT:        // write DSPIN data flit
     150        {
     151            if( p_vci.rspval && r_fifo_rsp.wok() )
     152            {
     153                rsp_fifo_write   = true;
     154                rsp_fifo_data = ((sc_uint<dspin_rsp_width>)p_vci.rdata.read());
     155                if ( p_vci.reop )
     156                {
     157                    rsp_fifo_data = rsp_fifo_data | 0x100000000LL; // EOP = 1
     158                    r_rsp_fsm = RSP_IDLE;
     159                }
     160            }
     161            break;
     162        }
    152163    } // end switch r_cmd_fsm
    153164
     
    157168    if((rsp_fifo_write == false) && (rsp_fifo_read == true))  { r_fifo_rsp.simple_get(); }
    158169
    159         //////////////////////////////////////////////////////////////
     170    //////////////////////////////////////////////////////////////
    160171    // DSPIN command packet to VCI command packet
    161     // The DSPIN packet is stored in the fifo_rsp
     172    // The DSPIN packet is stored in the fifo_cmd
    162173    // The FIFO output is analysed and translated to a VCI packet
    163         //////////////////////////////////////////////////////////////
    164         // - A 2 flits DSPIN broadcast command is translated
    165         //   to a 1 flit VCI broadcast command.
    166         // - A 2 flits DSPIN read command is translated
    167         //   to a 1 flit VCI read command.
    168         // - A N+2 flits DSPIN write command is translated
    169         //   to a N flits VCI write command.
    170         // The VCI flits are sent in the CMD_READ, CMD_WDATA
    171         // & CMD_BROADCAST states.
    172         // The r_cmd_buf0 et r_cmd_buf1 buffers are used to store
    173         // the two first DSPIN flits (in case of write).
    174         //////////////////////////////////////////////////////////////
     174    //////////////////////////////////////////////////////////////
     175    // - A 2 flits DSPIN broadcast command is translated
     176    //   to a 1 flit VCI broadcast command.
     177    // - A 2 flits DSPIN read command is translated
     178    //   to a 1 flit VCI read command.
     179    // - A N+2 flits DSPIN write command is translated
     180    //   to a N flits VCI write command.
     181    // The VCI flits are sent in the CMD_READ, CMD_WDATA
     182    // & CMD_BROADCAST states.
     183    // The r_cmd_buf0 et r_cmd_buf1 buffers are used to store
     184    // the two first DSPIN flits (in case of write).
     185    //////////////////////////////////////////////////////////////
    175186
    176187    // cmd_fifo_write, cmd_fifo_data
     
    179190
    180191    // r_cmd_fsm, cmd_fifo_read
    181         cmd_fifo_read = false;         // default value
    182 
    183     switch(r_cmd_fsm) {
     192    cmd_fifo_read = false;         // default value
     193
     194    switch(r_cmd_fsm)
     195    {
    184196        case CMD_IDLE:
    185             {
    186         if( r_fifo_cmd.rok() )
    187                 {
    188                     bool is_broadcast = ( (r_fifo_cmd.read() & 0x1) == 0x1);
    189 
    190             cmd_fifo_read = true;
    191                     r_cmd_buf0    = r_fifo_cmd.read();         // save address
    192                     if ( is_broadcast ) r_cmd_fsm = CMD_BROADCAST;
    193                     else        r_cmd_fsm = CMD_RW;
    194         }
    195         break;
    196             }
     197        {
     198            if( r_fifo_cmd.rok() )
     199            {
     200                bool is_broadcast = ( (r_fifo_cmd.read() & 0x1) == 0x1);
     201
     202                cmd_fifo_read = true;
     203                r_cmd_buf0    = r_fifo_cmd.read();         // save address
     204
     205                if ( is_broadcast )
     206                    r_cmd_fsm = CMD_BROADCAST;
     207                else
     208                    r_cmd_fsm = CMD_RW;
     209            }
     210            break;
     211        }
    197212        case CMD_BROADCAST:
    198213        {
    199         if( r_fifo_cmd.rok() && p_vci.cmdack )
    200                 {
    201                     cmd_fifo_read = true;
     214            if( r_fifo_cmd.rok() && p_vci.cmdack )
     215            {
     216                cmd_fifo_read = true;
     217                r_cmd_fsm = CMD_IDLE;
     218            }
     219            break;
     220        }
     221        case CMD_RW:
     222        {
     223            if( r_fifo_cmd.rok() )
     224            {
     225                cmd_fifo_read = true;
     226                r_cmd_buf1 = r_fifo_cmd.read();        // save command parameters
     227                // read command if EOP
     228                if ( (r_fifo_cmd.read() & 0x8000000000LL) )
     229                    r_cmd_fsm = CMD_READ;
     230                else
     231                    r_cmd_fsm = CMD_WDATA;
     232                r_flit_count = 0;
     233            }
     234            break;
     235        }
     236        case CMD_READ:
     237        {
     238            if ( p_vci.cmdack.read() )
     239                r_cmd_fsm = CMD_IDLE;
     240            break;
     241        }
     242        case CMD_WDATA:
     243        {
     244            if( r_fifo_cmd.rok() && p_vci.cmdack.read() )
     245            {
     246                if ( (r_cmd_buf1.read() & 0x0000200000LL) == 0 )
     247                    r_flit_count = r_flit_count + 1;
     248                cmd_fifo_read = true;
     249                if ( (r_fifo_cmd.read() & 0x8000000000LL) )
    202250                    r_cmd_fsm = CMD_IDLE;
    203                 }
    204                 break;
    205             }
    206             case CMD_RW:
    207             {
    208         if( r_fifo_cmd.rok() )
    209                 {
    210                     cmd_fifo_read = true;
    211                     r_cmd_buf1 = r_fifo_cmd.read();        // save command parameters
    212                     // read command if EOP
    213                     if ( (r_fifo_cmd.read() & 0x8000000000LL) )   r_cmd_fsm = CMD_READ;
    214                     else                      r_cmd_fsm = CMD_WDATA;
    215                     r_flit_count = 0;
    216         }
    217         break;
    218             }
    219             case CMD_READ:
    220             {
    221                 if ( p_vci.cmdack.read() ) r_cmd_fsm = CMD_IDLE;
    222                 break;
    223             }
    224             case CMD_WDATA:
    225             {
    226         if( r_fifo_cmd.rok() && p_vci.cmdack.read() )
    227                 {
    228                     if ( (r_cmd_buf1.read() & 0x0000200000LL) == 0 )     r_flit_count = r_flit_count + 1;
    229                     cmd_fifo_read = true;
    230                     if ( (r_fifo_cmd.read() & 0x8000000000LL) )     r_cmd_fsm = CMD_IDLE;
    231         }
    232                 break;
    233             }
     251            }
     252            break;
     253        }
    234254    } // end switch r_cmd_fsm
    235255
     
    245265{
    246266    // VCI RSP interface
    247         if ( r_rsp_fsm.read() == RSP_IDLE )    p_vci.rspack = false;
    248     else                                       p_vci.rspack = r_fifo_rsp.wok();
     267    if ( r_rsp_fsm.read() == RSP_IDLE ) p_vci.rspack = false;
     268    else                                p_vci.rspack = r_fifo_rsp.wok();
    249269
    250270    // VCI CMD interface
    251271    if ( (r_cmd_fsm.read() == CMD_IDLE) || (r_cmd_fsm.read() == CMD_RW) )
     272    {
     273        p_vci.cmdval = false;
     274    }
     275    else if ( r_cmd_fsm.read() == CMD_BROADCAST )    // VCI CMD broadcast
     276    {
     277        if ( r_fifo_cmd.rok() )
     278        {
     279            sc_uint<dspin_cmd_width>  minmax = r_cmd_buf0.read() & 0x7FFFF80000LL;
     280            if ( vci_param::N == 40 ) minmax = (minmax << 1);
     281            else              minmax = (minmax >> (39 - vci_param::N) );
     282            p_vci.cmdval  = true;
     283            p_vci.address = (sc_uint<vci_param::N>)minmax | 0x3;
     284            p_vci.cmd     = vci_param::CMD_WRITE;
     285            p_vci.wdata   = (sc_uint<8*vci_param::B>)(r_fifo_cmd.read() & 0x00FFFFFFFFLL);
     286            p_vci.be      = (sc_uint<vci_param::B>)((r_fifo_cmd.read()  & 0x0F00000000LL) >> 32);
     287            p_vci.srcid   = (sc_uint<vci_param::S>)((r_cmd_buf0.read()  & 0x000007FFE0LL) >> 5);
     288            p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf0.read()  & 0x000000001ELL) >> 1);
     289            p_vci.pktid   = 0;
     290            p_vci.plen    = vci_param::B;
     291            p_vci.contig  = true;
     292            p_vci.cons    = false;
     293            p_vci.eop     = true;
     294        }
     295        else
    252296        {
    253297            p_vci.cmdval = false;
    254298        }
    255         else if ( r_cmd_fsm.read() == CMD_BROADCAST )    // VCI CMD broadcast
    256         {
    257             if ( r_fifo_cmd.rok() )
    258             {
    259                 sc_uint<dspin_cmd_width>  minmax = r_cmd_buf0.read() & 0x7FFFF80000LL;
    260                 if ( vci_param::N == 40 ) minmax = (minmax << 1);
    261                 else              minmax = (minmax >> (39 - vci_param::N) );
    262                 p_vci.cmdval  = true;
    263                 p_vci.address = (sc_uint<vci_param::N>)minmax | 0x3;
    264                 p_vci.cmd     = vci_param::CMD_WRITE;
    265                 p_vci.wdata   = (sc_uint<8*vci_param::B>)(r_fifo_cmd.read() & 0x00FFFFFFFFLL);
    266                 p_vci.be      = (sc_uint<vci_param::B>)((r_fifo_cmd.read()  & 0x0F00000000LL) >> 32);
    267                 p_vci.srcid   = (sc_uint<vci_param::S>)((r_cmd_buf0.read()  & 0x000007FFE0LL) >> 5);
    268                 p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf0.read()  & 0x000000001ELL) >> 1);
    269                 p_vci.pktid   = 0;
    270                 p_vci.plen    = vci_param::B;
    271                 p_vci.contig  = true;
    272                 p_vci.cons    = false;
    273                 p_vci.eop     = true;
    274             }
    275             else
    276             {
    277                 p_vci.cmdval = false;
    278             }
    279         }
    280         else if ( r_cmd_fsm.read() == CMD_READ )    // VCI CMD read
     299    }
     300    else if ( r_cmd_fsm.read() == CMD_READ )    // VCI CMD read
     301    {
     302        sc_uint<vci_param::N> address;
     303        if ( vci_param::N == 40 ) address = (r_cmd_buf0.read() << 1);
     304        else                      address = (r_cmd_buf0.read() >> (39 - vci_param::N) );
     305        p_vci.cmdval  = true;
     306        p_vci.address = address;
     307        p_vci.cmd     = (sc_uint<2>)((r_cmd_buf1.read()            & 0x0001800000LL) >> 23);
     308        p_vci.wdata   = 0;
     309        p_vci.be      = (sc_uint<vci_param::B>)((r_cmd_buf1.read() & 0x000000001ELL) >> 1);
     310        p_vci.srcid   = (sc_uint<vci_param::S>)((r_cmd_buf1.read() & 0x7FFE000000LL) >> 25);
     311        p_vci.pktid   = (sc_uint<vci_param::P>)((r_cmd_buf1.read() & 0x00000001E0LL) >> 5);
     312        p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf1.read() & 0x0000001E00LL) >> 9);
     313        p_vci.plen    = (sc_uint<vci_param::K>)((r_cmd_buf1.read() & 0x00001FE000LL) >> 13);
     314        p_vci.contig  = ((r_cmd_buf1.read() & 0x0000400000LL) != 0);
     315        p_vci.cons    = ((r_cmd_buf1.read() & 0x0000200000LL) != 0);
     316        p_vci.eop     = true;
     317    }
     318    else if ( r_cmd_fsm.read() == CMD_WDATA )    // VCI write command
     319    {
     320        if ( r_fifo_cmd.rok() )
    281321        {
    282322            sc_uint<vci_param::N> address;
     
    284324            else                      address = (r_cmd_buf0.read() >> (39 - vci_param::N) );
    285325            p_vci.cmdval  = true;
    286             p_vci.address = address;
    287             p_vci.cmd     = (sc_uint<2>)((r_cmd_buf1.read()            & 0x0001800000LL) >> 23);
    288             p_vci.wdata   = 0;
    289             p_vci.be      = (sc_uint<vci_param::B>)((r_cmd_buf1.read() & 0x000000001ELL) >> 1);
    290             p_vci.srcid   = (sc_uint<vci_param::S>)((r_cmd_buf1.read() & 0x7FFE000000LL) >> 25);
    291             p_vci.pktid   = (sc_uint<vci_param::P>)((r_cmd_buf1.read() & 0x00000001E0LL) >> 5);
    292             p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf1.read() & 0x0000001E00LL) >> 9);
    293             p_vci.plen    = (sc_uint<vci_param::K>)((r_cmd_buf1.read() & 0x00001FE000LL) >> 13);
     326            p_vci.address = address + (r_flit_count.read()*vci_param::B);
     327            p_vci.cmd     = (sc_uint<2>)((r_cmd_buf1.read()             & 0x0001800000LL) >> 23);
     328            p_vci.wdata   = (sc_uint<8*vci_param::B>)(r_fifo_cmd.read() & 0x00FFFFFFFFLL);
     329            p_vci.be      = (sc_uint<vci_param::B>)((r_fifo_cmd.read()  & 0x0F00000000LL) >> 32);
     330            p_vci.srcid   = (sc_uint<vci_param::S>)((r_cmd_buf1.read()  & 0x7FFE000000LL) >> 25);
     331            p_vci.pktid   = (sc_uint<vci_param::P>)((r_cmd_buf1.read()  & 0x00000001E0LL) >> 5);
     332            p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf1.read()  & 0x0000001E00LL) >> 9);
     333            p_vci.plen    = (sc_uint<vci_param::K>)((r_cmd_buf1.read()  & 0x00001FE000LL) >> 13);
    294334            p_vci.contig  = ((r_cmd_buf1.read() & 0x0000400000LL) != 0);
    295335            p_vci.cons    = ((r_cmd_buf1.read() & 0x0000200000LL) != 0);
    296             p_vci.eop     = true;
     336            p_vci.eop     = ((r_fifo_cmd.read() & 0x8000000000LL) == 0x8000000000LL);
     337        }
     338        else
     339        {
     340            p_vci.cmdval = false;
     341        }
    297342    }
    298         else if ( r_cmd_fsm.read() == CMD_WDATA )    // VCI write command
    299         {
    300             if ( r_fifo_cmd.rok() )
    301             {
    302                 sc_uint<vci_param::N> address;
    303                 if ( vci_param::N == 40 ) address = (r_cmd_buf0.read() << 1);
    304                 else                      address = (r_cmd_buf0.read() >> (39 - vci_param::N) );
    305                 p_vci.cmdval  = true;
    306                 p_vci.address = address + (r_flit_count.read()*vci_param::B);
    307                 p_vci.cmd     = (sc_uint<2>)((r_cmd_buf1.read()             & 0x0001800000LL) >> 23);
    308                 p_vci.wdata   = (sc_uint<8*vci_param::B>)(r_fifo_cmd.read() & 0x00FFFFFFFFLL);
    309                 p_vci.be      = (sc_uint<vci_param::B>)((r_fifo_cmd.read()  & 0x0F00000000LL) >> 32);
    310                 p_vci.srcid   = (sc_uint<vci_param::S>)((r_cmd_buf1.read()  & 0x7FFE000000LL) >> 25);
    311                 p_vci.pktid   = (sc_uint<vci_param::P>)((r_cmd_buf1.read()  & 0x00000001E0LL) >> 5);
    312                 p_vci.trdid   = (sc_uint<vci_param::T>)((r_cmd_buf1.read()  & 0x0000001E00LL) >> 9);
    313                 p_vci.plen    = (sc_uint<vci_param::K>)((r_cmd_buf1.read()  & 0x00001FE000LL) >> 13);
    314                 p_vci.contig  = ((r_cmd_buf1.read() & 0x0000400000LL) != 0);
    315                 p_vci.cons    = ((r_cmd_buf1.read() & 0x0000200000LL) != 0);
    316                 p_vci.eop     = ((r_fifo_cmd.read() & 0x8000000000LL) == 0x8000000000LL);
    317             }
    318             else
    319             {
    320                 p_vci.cmdval = false;
    321             }
    322         }
    323343
    324344    // DSPIN_OUT interface
     
    342362    };
    343363    const char* rsp_str[] = {
    344     "RSP_IDLE     ",
    345     "RSP_READ     ",
    346     "RSP_WRITE    ",
     364    "RSP_IDLE             ",
     365    "RSP_DSPIN_SINGLE_FLIT",
     366    "RSP_DSPIN_MULTI_FLIT ",
    347367    };
    348368    std::cout << name() << " : " << cmd_str[r_cmd_fsm.read()]
Note: See TracChangeset for help on using the changeset viewer.