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] - Blame information for rev 47

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 44 wsong0210
/*
2
 Asynchronous SDM NoC
3
 (C)2011 Wei Song
4
 Advanced Processor Technologies Group
5
 Computer Science, the Univ. of Manchester, UK
6
 
7
 Authors:
8
 Wei Song     wsong83@gmail.com
9
 
10
 License: LGPL 3.0 or later
11
 
12
 Network interface for the VC router.
13
 
14
 History:
15
 20/08/2008  Initial version. <wsong83@gmail.com>
16
 30/09/2010  Use template style packet definition. <wsong83@gmail.com>
17
 05/06/2011  Clean up for opensource. <wsong83@gmail.com>
18
 
19
*/
20
 
21
#ifndef NETWORK_ADAPTER_H_
22
#define NETWORK_ADAPTER_H_
23
 
24
#include "define.h"
25
#include <systemc.h>
26
 
27
SC_MODULE(Network_Adapter)
28
{
29
 
30
public:
31
    SC_HAS_PROCESS(Network_Adapter);
32
    Network_Adapter(
33
             sc_module_name     name // module name
34
            ,unsigned int       x    // location x
35
            ,unsigned int       y    // location y
36
        );
37
    ~Network_Adapter();
38
 
39
    // interface with processor
40
    sc_port<sc_fifo_in_if<FRAME> >      frame_in; // frame for transmission
41
    sc_port<sc_fifo_out_if<FRAME> >     frame_out; // frame for receiving
42
 
43
    // interface with router
44 45 wsong0210
    sc_port<sc_fifo_in_if<FLIT> > IP;  // input port from IO driver
45
    sc_port<sc_fifo_out_if<FLIT> > OP; // output port to IO driver
46 44 wsong0210
    sc_in<bool> CP [SubChN];           // the credit input from the router input buffer
47
    sc_out<bool> CPa [SubChN];         // ack to the credit
48
 
49
private:
50
    unsigned int loc_x,loc_y; // location information
51
 
52
    sc_fifo<FLIT>                       oflit; // the current flit under transmission
53
    sc_fifo<FLIT>                       iflit [SubChN]; // the current flits under receiving from all input VCs
54
    unsigned int                        token [SubChN]; // the token ready for each output VC
55
    sc_event                            token_arrive [SubChN]; // the token ready event
56
 
57
    // functional thread
58
    void ibuffer_thread(unsigned int);                // input buffer respond thread
59
    void obuffer_thread(unsigned int);                // output buffer respond thread
60
    void oport();                                     // the thread transmitting flit
61
    void iport();                                     // the thread receiving flits
62
    void credit_update(unsigned int);                 // receive credits and update the available tokens
63
 
64
    // other functions
65
    bool check_frame(const FRAME& frame);           // check the correctness of frame received
66
};
67
 
68
#endif
69
 

powered by: WebSVN 2.1.0

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