OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [rtl/] [src_noc/] [noc_top.sv] - Blame information for rev 54

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 54 alirezamon
`include "pronoc_def.v"
2 48 alirezamon
/**********************************************************************
3
**    File:  noc_top.sv
4
**
5
**    Copyright (C) 2014-2017  Alireza Monemi
6
**
7
**    This file is part of ProNoC
8
**
9
**    ProNoC ( stands for Prototype Network-on-chip)  is free software:
10
**    you can redistribute it and/or modify it under the terms of the GNU
11
**    Lesser General Public License as published by the Free Software Foundation,
12
**    either version 2 of the License, or (at your option) any later version.
13
**
14
**     ProNoC is distributed in the hope that it will be useful, but WITHOUT
15
**     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16
**     or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
17
**     Public License for more details.
18
**
19
**     You should have received a copy of the GNU Lesser General Public
20
**     License along with ProNoC. If not, see .
21
**
22
**
23
**    Description:
24
**    the NoC top module.
25
**
26
**************************************************************/
27
 
28
 
29
 
30
module  noc_top
31
        import pronoc_pkg::*;
32
(
33
        reset,
34
        clk,
35
        chan_in_all,
36 54 alirezamon
        chan_out_all,
37
        router_event
38 48 alirezamon
);
39
 
40
 
41
        input   clk,reset;
42 54 alirezamon
        //Endpoints ports
43 48 alirezamon
        input   smartflit_chanel_t chan_in_all  [NE-1 : 0];
44
        output  smartflit_chanel_t chan_out_all [NE-1 : 0];
45 54 alirezamon
        //Events
46
        output  router_event_t  router_event [NR-1 : 0][MAX_P-1 : 0];
47 48 alirezamon
 
48
 
49
 
50
 
51
        generate
52
        /* verilator lint_off WIDTH */
53
        if (TOPOLOGY ==    "MESH" || TOPOLOGY ==    "FMESH" || TOPOLOGY ==  "TORUS" || TOPOLOGY == "RING" || TOPOLOGY == "LINE") begin : tori_noc
54
        /* verilator lint_on WIDTH */
55
                mesh_torus_noc_top noc_top (
56
                        .reset         (reset        ),
57
                        .clk           (clk          ),
58
                        .chan_in_all   (chan_in_all  ),
59 54 alirezamon
                        .chan_out_all  (chan_out_all ),
60
                        .router_event  (router_event )
61 48 alirezamon
                );
62
 
63
 
64
    end else if (TOPOLOGY == "FATTREE") begin : fat_
65
 
66
        fattree_noc_top noc_top (
67
                        .reset         (reset        ),
68
                        .clk           (clk          ),
69
                        .chan_in_all   (chan_in_all  ),
70 54 alirezamon
                        .chan_out_all  (chan_out_all ),
71
                        .router_event  (router_event )
72 48 alirezamon
        );
73
 
74
 
75
    end else if (TOPOLOGY == "TREE") begin : tree_
76
        tree_noc_top  noc_top (
77
                .reset         (reset        ),
78
                .clk           (clk          ),
79
                .chan_in_all   (chan_in_all  ),
80 54 alirezamon
                .chan_out_all  (chan_out_all ),
81
                .router_event  (router_event )
82 48 alirezamon
        );
83
    end else if (TOPOLOGY == "STAR") begin : star_
84
        star_noc_top  noc_top (
85
                        .reset         (reset        ),
86
                        .clk           (clk          ),
87
                        .chan_in_all   (chan_in_all  ),
88 54 alirezamon
                        .chan_out_all  (chan_out_all ),
89
                        .router_event  (router_event )
90 48 alirezamon
                );
91
 
92
    end else begin :custom_
93
 
94
        custom_noc_top noc_top (
95
                        .reset         (reset        ),
96
                        .clk           (clk          ),
97
                        .chan_in_all   (chan_in_all  ),
98 54 alirezamon
                        .chan_out_all  (chan_out_all ),
99
                        .router_event  (router_event )
100 48 alirezamon
                );
101
 
102
    end
103
    endgenerate
104
endmodule
105
 
106
 
107
 
108
 
109
 
110
 
111
/**********************************
112 54 alirezamon
The noc top module that can be called in Verilog module.
113 48 alirezamon
 
114
***********************************/
115
 
116
module  noc_top_v
117
   import pronoc_pkg::*;
118
   (
119
    flit_out_all,
120
    flit_out_wr_all,
121
    credit_in_all,
122
    flit_in_all,
123
    flit_in_wr_all,
124
    credit_out_all,
125
    reset,
126
    clk
127
 );
128
 
129
 
130
        input   clk,reset;
131
        output [NEFw-1 : 0] flit_out_all;
132
    output [NE-1 : 0] flit_out_wr_all;
133
    input  [NEV-1 : 0] credit_in_all;
134
    input  [NEFw-1 : 0] flit_in_all;
135
    input  [NE-1 : 0] flit_in_wr_all;
136
    output [NEV-1 : 0] credit_out_all;
137
 
138
 
139
        //struct typed array ports which cannot be caled in verilog
140
        smartflit_chanel_t chan_in_all  [NE-1 : 0];
141
        smartflit_chanel_t chan_out_all [NE-1 : 0];
142
 
143
        noc_top the_top(
144
                .reset(reset),
145
                .clk(clk),
146
                .chan_in_all(chan_in_all),
147 54 alirezamon
                .chan_out_all(chan_out_all),
148
                .router_event  (  )
149 48 alirezamon
        );
150
 
151
 
152
 
153
 
154
        genvar i;
155
        generate
156
        for (i=0; i
157
                assign chan_in_all[i].flit_chanel.flit    = flit_in_all [Fw*(i+1)-1 : Fw*i];
158
                assign chan_in_all[i].flit_chanel.credit  = credit_in_all [V*(i+1)-1 : V*i];
159
                assign chan_in_all[i].flit_chanel.flit_wr  = flit_in_wr_all[i];
160
 
161
                assign flit_out_all [Fw*(i+1)-1 : Fw*i] = chan_out_all[i].flit_chanel.flit;
162
                assign credit_out_all [V*(i+1)-1 : V*i] = chan_out_all[i].flit_chanel.credit;
163
                assign flit_out_wr_all[i] = chan_out_all[i].flit_chanel.flit_wr;
164
 
165
        end
166
        endgenerate
167
 
168
endmodule
169
 

powered by: WebSVN 2.1.0

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