OpenCores
URL https://opencores.org/ocsvn/async_sdm_noc/async_sdm_noc/trunk

Subversion Repositories async_sdm_noc

[/] [async_sdm_noc/] [trunk/] [vc/] [tb/] [ni.h] - Diff between revs 45 and 47

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 45 Rev 47
/*
/*
 Asynchronous SDM NoC
 Asynchronous SDM NoC
 (C)2011 Wei Song
 (C)2011 Wei Song
 Advanced Processor Technologies Group
 Advanced Processor Technologies Group
 Computer Science, the Univ. of Manchester, UK
 Computer Science, the Univ. of Manchester, UK
 
 
 Authors:
 Authors:
 Wei Song     wsong83@gmail.com
 Wei Song     wsong83@gmail.com
 
 
 License: LGPL 3.0 or later
 License: LGPL 3.0 or later
 
 
 Network interface for the VC router.
 Network interface for the VC router.
 
 
 History:
 History:
 20/08/2008  Initial version. <wsong83@gmail.com>
 20/08/2008  Initial version. <wsong83@gmail.com>
 30/09/2010  Use template style packet definition. <wsong83@gmail.com>
 30/09/2010  Use template style packet definition. <wsong83@gmail.com>
 05/06/2011  Clean up for opensource. <wsong83@gmail.com>
 05/06/2011  Clean up for opensource. <wsong83@gmail.com>
 
 
*/
*/
 
 
#ifndef NETWORK_ADAPTER_H_
#ifndef NETWORK_ADAPTER_H_
#define NETWORK_ADAPTER_H_
#define NETWORK_ADAPTER_H_
 
 
#include "define.h"
#include "define.h"
#include <systemc.h>
#include <systemc.h>
 
 
SC_MODULE(Network_Adapter)
SC_MODULE(Network_Adapter)
{
{
 
 
public:
public:
    SC_HAS_PROCESS(Network_Adapter);
    SC_HAS_PROCESS(Network_Adapter);
    Network_Adapter(
    Network_Adapter(
             sc_module_name     name // module name
             sc_module_name     name // module name
            ,unsigned int       x    // location x
            ,unsigned int       x    // location x
            ,unsigned int       y    // location y
            ,unsigned int       y    // location y
        );
        );
    ~Network_Adapter();
    ~Network_Adapter();
 
 
    // interface with processor
    // interface with processor
    sc_port<sc_fifo_in_if<FRAME> >      frame_in; // frame for transmission
    sc_port<sc_fifo_in_if<FRAME> >      frame_in; // frame for transmission
    sc_port<sc_fifo_out_if<FRAME> >     frame_out; // frame for receiving
    sc_port<sc_fifo_out_if<FRAME> >     frame_out; // frame for receiving
 
 
    // interface with router
    // interface with router
    sc_port<sc_fifo_in_if<FLIT> > IP;  // input port from IO driver
    sc_port<sc_fifo_in_if<FLIT> > IP;  // input port from IO driver
    sc_port<sc_fifo_out_if<FLIT> > OP; // output port to IO driver
    sc_port<sc_fifo_out_if<FLIT> > OP; // output port to IO driver
    sc_in<bool> CP [SubChN];           // the credit input from the router input buffer
    sc_in<bool> CP [SubChN];           // the credit input from the router input buffer
    sc_out<bool> CPa [SubChN];         // ack to the credit
    sc_out<bool> CPa [SubChN];         // ack to the credit
 
 
private:
private:
    unsigned int loc_x,loc_y; // location information
    unsigned int loc_x,loc_y; // location information
 
 
    sc_fifo<FLIT>                       oflit; // the current flit under transmission
    sc_fifo<FLIT>                       oflit; // the current flit under transmission
    sc_fifo<FLIT>                       iflit [SubChN]; // the current flits under receiving from all input VCs
    sc_fifo<FLIT>                       iflit [SubChN]; // the current flits under receiving from all input VCs
    unsigned int                        token [SubChN]; // the token ready for each output VC
    unsigned int                        token [SubChN]; // the token ready for each output VC
    sc_event                            token_arrive [SubChN]; // the token ready event
    sc_event                            token_arrive [SubChN]; // the token ready event
 
 
    // functional thread
    // functional thread
    void ibuffer_thread(unsigned int);                // input buffer respond thread
    void ibuffer_thread(unsigned int);                // input buffer respond thread
    void obuffer_thread(unsigned int);                // output buffer respond thread
    void obuffer_thread(unsigned int);                // output buffer respond thread
    void oport();                                     // the thread transmitting flit
    void oport();                                     // the thread transmitting flit
    void iport();                                     // the thread receiving flits
    void iport();                                     // the thread receiving flits
    void credit_update(unsigned int);                 // receive credits and update the available tokens
    void credit_update(unsigned int);                 // receive credits and update the available tokens
 
 
    // other functions
    // other functions
    bool check_frame(const FRAME& frame);           // check the correctness of frame received
    bool check_frame(const FRAME& frame);           // check the correctness of frame received
};
};
 
 
#endif
#endif
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.