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

Subversion Repositories async_sdm_noc

[/] [async_sdm_noc/] [branches/] [init/] [vc/] [tb/] [netnode.h] - Blame information for rev 52

Go to most recent revision | 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
 The SystemC module of network node including the processing element and the network interface.
13
 Currently the transmission FIFO is 500 frame deep.
14
 
15
 History:
16
 26/02/2011  Initial version. <wsong83@gmail.com>
17
 04/03/2011  Support VC router. <wsong83@gmail.com>
18
 05/06/2011  Clean up for opensource. <wsong83@gmail.com>
19
 
20
*/
21
 
22
#ifndef NETNODE_H_
23
#define NETNODE_H_
24
 
25
#include "define.h"
26
#include <systemc.h>
27
#include "ni.h"
28
#include "procelem.h"
29
#include "rtdriver.h"
30
 
31
class NetNode : public sc_module {
32
 public:
33
  RTDriver * LIOD; /* driving and convert I/O to/from router local port */
34
  Network_Adapter * NI;         /* network interface */
35
  ProcElem  * PE;               /* processor element */
36
 
37
  // signals for router
38
  sc_out<   sc_logic >         doa ;
39
  sc_out<   sc_lv<SubChN > >   doc ;
40
  sc_in<    sc_lv<ChBW*4 > >   do0 ;
41
  sc_in<    sc_lv<ChBW*4 > >   do1 ;
42
  sc_in<    sc_lv<ChBW*4 > >   do2 ;
43
  sc_in<    sc_lv<ChBW*4 > >   do3 ;
44
  sc_in<    sc_lv<3> >         doft;
45
  sc_in<    sc_lv<SubChN > >   dovc;
46
  sc_in<    sc_lv<SubChN > >   doca;
47
  sc_in<    sc_logic >         dia;
48
  sc_in<    sc_lv<SubChN > >   dic;
49
  sc_out<   sc_lv<ChBW*4 > >   di0;
50
  sc_out<   sc_lv<ChBW*4 > >   di1;
51
  sc_out<   sc_lv<ChBW*4 > >   di2;
52
  sc_out<   sc_lv<ChBW*4 > >   di3;
53
  sc_out<   sc_lv<3> >         dift;
54
  sc_out<   sc_lv<SubChN > >   divc;
55
  sc_out<   sc_lv<SubChN > >   dica;
56
 
57
  sc_in<sc_logic >         rst_n; /* global active-low reset */
58
 
59
  // signals between IOD and NI
60
  sc_fifo<pdu_flit<ChBW> > *   NI2P ; /* flit fifo, from NI to IO driver */
61
  sc_fifo<pdu_flit<ChBW> > *   P2NI ; /* flit fifo, from IO driver to NI */
62
  sc_signal<bool>              CP [SubChN]; /* credit input */
63
  sc_signal<bool>              CPa [SubChN]; /* credit ack */
64
 
65
  // signals between NI and FG/FS
66
  sc_fifo<pdu_frame<ChBW> > *   FIQ; /* the frame fifo, from PE to NI */
67
  sc_fifo<pdu_frame<ChBW> > *   FOQ; /* the frame fifo, from NI to PE */
68
  sc_signal<bool>               brst_n; /* the reset in the SystemC modules */
69
 
70
  int x, y;                     /* private local address */
71
 
72
  SC_CTOR(NetNode)
73
    : doa("doa"), doc("doc"),
74
    do0("do0"), do1("do1"), do2("do2"), do3("do3"),
75
    doft("doft"), dovc("dovc"), doca("doca"),
76
    dia("dia"), dic("dic"),
77
    di0("di0"), di1("di1"), di2("di2"), di3("di3"),
78
    dift("dift"), divc("divc"), dica("dica"),
79
    rst_n("rst_n")
80
      {
81
        // dynamically get the parameters from Verilog test bench
82
        ncsc_get_param("x", x);
83
        ncsc_get_param("y", y);
84
 
85
        // initialization
86
        LIOD = new RTDriver("LIOD");
87
        NI = new Network_Adapter("NI", x, y);
88
        PE = new ProcElem("PE", x, y);
89
        NI2P = new sc_fifo<pdu_flit<ChBW> >(1);
90
        P2NI = new sc_fifo<pdu_flit<ChBW> >(1);
91
        FIQ = new sc_fifo<pdu_frame<ChBW> >(500);/* currently the fifo from PE is 500 frame deep */
92
        FOQ = new sc_fifo<pdu_frame<ChBW> >(1);
93
 
94
        // connections
95
        LIOD->NI2P(*NI2P);
96
        LIOD->P2NI(*P2NI);
97
        LIOD->rtid[0](di0);
98
        LIOD->rtod[0](do0);
99
        LIOD->rtid[1](di1);
100
        LIOD->rtod[1](do1);
101
        LIOD->rtid[2](di2);
102
        LIOD->rtod[2](do2);
103
        LIOD->rtid[3](di3);
104
        LIOD->rtod[3](do3);
105
        LIOD->rtift(dift);
106
        LIOD->rtivc(divc);
107
        LIOD->rtia(dia);
108
        LIOD->rtic(dic);
109
        LIOD->rtica(dica);
110
        LIOD->rtoft(doft);
111
        LIOD->rtovc(dovc);
112
        LIOD->rtoa(doa);
113
        LIOD->rtoc(doc);
114
        LIOD->rtoca(doca);
115
        for(unsigned int j=0; j<SubChN; j++) {
116
          LIOD->CP[j](CP[j]);
117
          LIOD->CPa[j](CPa[j]);
118
        }
119
 
120
        NI->frame_in(*FIQ);
121
        NI->frame_out(*FOQ);
122
        NI->IP(*P2NI);
123
        NI->OP(*NI2P);
124
        for(unsigned int j=0; j<SubChN; j++) {
125
          NI->CP[j](CP[j]);
126
          NI->CPa[j](CPa[j]);
127
        }
128
 
129
        PE->rst_n(brst_n);
130
        PE->Fout(*FIQ);
131
        PE->Fin(*FOQ);
132
 
133
        brst_n.write(false);
134
 
135
        SC_METHOD(rst_proc);
136
        sensitive << rst_n;
137
      }
138
 
139
 
140
  void rst_proc() {
141
    bool mrst_n;
142
    mrst_n = rst_n.read().is_01() ? rst_n.read().to_bool() : false;
143
    brst_n.write(mrst_n);
144
  }
145
};
146
 
147
 
148
#endif

powered by: WebSVN 2.1.0

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