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/] [class_table.v] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
`timescale      1ns/1ps
2
 
3
/**********************************************************************
4
**      File: class_table.v
5
**
6
**      Copyright (C) 2014-2017  Alireza Monemi
7
**
8
**      This file is part of ProNoC
9
**
10
**      ProNoC ( stands for Prototype Network-on-chip)  is free software:
11
**      you can redistribute it and/or modify it under the terms of the GNU
12
**      Lesser General Public License as published by the Free Software Foundation,
13
**      either version 2 of the License, or (at your option) any later version.
14
**
15
**      ProNoC is distributed in the hope that it will be useful, but WITHOUT
16
**      ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17
**      or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
18
**      Public License for more details.
19
**
20
**      You should have received a copy of the GNU Lesser General Public
21
**      License along with ProNoC. If not, see <http:**www.gnu.org/licenses/>.
22
**
23
**
24
**      Description:
25
**
26
*************************************/
27
 
28
 
29
 module class_ovc_table #(
30
    parameter C= 4,//number of class 
31
    parameter V= 4, //VC number per port
32
    parameter CVw=(C==0)? V : C * V,
33
    parameter [CVw-1:   0] CLASS_SETTING = {CVw{1'b1}} // shows how each class can use VCs   
34
 
35
 
36
    )
37
    (
38
        class_in,
39
        candidate_ovcs
40
    );
41
 
42
 
43
    function integer log2;
44
      input integer number; begin
45
         log2=(number <=1) ? 1: 0;
46
         while(2**log2<number) begin
47
            log2=log2+1;
48
         end
49
      end
50
    endfunction // log2 
51
 
52
    localparam Cw= (C>1)?  log2(C): 1;
53
 
54
    input [Cw-1    :    0]    class_in;
55
    output[V-1    :    0]    candidate_ovcs;
56
 
57
    genvar i;
58
    generate
59
        if(C == 0 || C == 1) begin: no_class // 
60
 
61
          assign  candidate_ovcs={V{1'b1}};
62
 
63
        end else begin: width_class
64
 
65
           wire [V-1  :   0] class_table [C-1  :   0];
66
           for(i=0;i<C;i=i+1) begin : class_loop
67
               assign class_table[i]= CLASS_SETTING[(i+1)*V-1  :   i*V];
68
           end
69
 
70
 
71
           assign  candidate_ovcs=class_table[class_in];
72
 
73
 
74
 
75
        end
76
     endgenerate
77
 
78
 
79
endmodule
80
 
81
 
82
module vc_priority_based_dest_port #(
83
    parameter P=5,
84
    parameter V=4
85
 
86
)(
87
    dest_port,
88
    vc_pririty
89
);
90
 
91
    localparam      P_1       =  (P-1),
92
                    OFFSET      =  V/(P_1);
93
 
94
    input   [P_1-1        :   0] dest_port;
95
    reg     [V-1          :   0] vc_pririty_init;
96
    output  [V-1          :   0] vc_pririty;
97
 
98
    genvar i;
99
    integer j;
100
    generate
101
        if(P_1 == V  )begin :b1
102
            always @(*) begin vc_pririty_init =  dest_port; end
103
 
104
        end else if (P_1 > V  )begin :b2
105
          for (i=0;i<V; i=i+1)begin:yy
106
            always @(*) begin
107
                  vc_pririty_init[i] = | dest_port[((i+1)*(P_1))/V-1:    (i*(P_1))/V ];
108
            end
109
          end
110
        end else begin :b3
111
            always @(*) begin //P_1 < V
112
                vc_pririty_init={V{1'b0}};
113
                for (j=0;j<P_1; j=j+1)  vc_pririty_init[j+OFFSET] =  dest_port[j];
114
 
115
            end
116
 
117
        end
118
    endgenerate
119
 
120
    assign vc_pririty=(vc_pririty_init==0)? {{(V-1){1'b0}},1'b1}: vc_pririty_init;
121
 
122
endmodule
123
 
124
 
125
 
126
 
127
 
128
 
129
 

powered by: WebSVN 2.1.0

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