-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNW_vc_allocator.v
executable file
·137 lines (121 loc) · 4.39 KB
/
NW_vc_allocator.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* -------------------------------------------------------------------------------
* (C)2007 Robert Mullins
* Computer Architecture Group, Computer Laboratory
* University of Cambridge, UK.
* -------------------------------------------------------------------------------
*
* VC allocator
*
* Allocates new virtual-channels for newly arrived packets.
*
* Supported VC allocation architectures:
*
* (A) "fifo_free_pool" - Free VC pool is organised as a FIFO, at most one VC
* may be allocated per output port per clock cycle
*
* In this case we just need P x PV:1 arbiters
*
* (B) "unrestricted" - Peh/Dally style VC allocation.
* Takes place in two stages:
*
* stage 1. Each waiting packet determines which VC it will request.
* (v:1 arbitration). Can support VC alloc. mask here (from
* packet header or static or dynamic..)
*
*
* stage 2. Access to each output VC is arbitrated (PV x PV:1 arbiters)
*
*/
module NW_vc_allocator (req, output_port, // VC request, for which port?
req_priority, // prioritized requests?
vc_new, vc_new_valid, // newly allocated VC ids
// ** restricted FIFO case **
next_free_vc, // next free VC at each output port
no_free_vc, // free VC fifo empty?
pop_free_vc, // VC consumed at output port
// ** unrestricted case **
vc_mask, // which VCs is input VC permitted to request
// vc_sel_priority, // Priorities for VC selection stage
vc_allocated, // which VCs were allocated on this cycle?
vc_requested, // which VCs were requested by each input VC?
vc_alloc_status, // which VCs are free?
flit, // head of each VC buffer
vc_credits, // Credits available at each VC at each output port
clk, rst_n);
`include "NW_functions.v"
//parameter type flit_priority_t = flit_pri_t;
parameter buf_len=4;
parameter xs=4;
parameter ys=4;
parameter np=5;
parameter nv=4;
parameter dynamic_priority_vc_alloc = 0;
parameter vcalloc_unrestricted = 0;
// specifically for unrestricted VC pool case
// parameter type vc_priority_t = bit unsigned [2:0];
// parameter prioritize_vc_selection = 0;
// parameter use_vc_allocation_mask = 1;
parameter vcselect_bydestinationnode = 0;
parameter vcselect_leastfullbuffer = 0;
parameter vcselect_arbstateupdate = 0;
parameter vcselect_usepacketmask = 0;
//-----
input [np-1:0][nv-1:0] req;
input flit_priority_t req_priority [np-1:0][nv-1:0];
input output_port_t output_port [np-1:0][nv-1:0];
input [np-1:0][nv-1:0] next_free_vc;
input [np-1:0] no_free_vc; // free VC fifo empty?
output [np-1:0][nv-1:0][nv-1:0] vc_new;
output [np-1:0][nv-1:0] vc_new_valid;
output [np-1:0] pop_free_vc;
input [np-1:0][nv-1:0][nv-1:0] vc_mask;
// input vc_priority_t vc_sel_priority [np-1:0][nv-1:0][nv-1:0];
output [np-1:0][nv-1:0] vc_allocated;
output [np-1:0][nv-1:0][nv-1:0] vc_requested;
input [np-1:0][nv-1:0] vc_alloc_status;
input flit_t flit [np-1:0][nv-1:0];
input [np-1:0][nv-1:0][clogb2(buf_len+1)-1:0] vc_credits;
input clk, rst_n;
generate
if (!vcalloc_unrestricted) begin
/*NW_vc_restricted_allocator
#(.np(np), .nv(nv),
.dynamic_priority_vc_alloc(dynamic_priority_vc_alloc))
restricted
(
.req,
.output_port,
.req_priority,
.vc_new,
.vc_new_valid,
.next_free_vc,
.no_free_vc,
.pop_free_vc,
.clk, .rst_n
);*/
end else begin // if (!vcalloc_unrestricted)
NW_vc_unrestricted_allocator
#(.np(np), .nv(nv), .xs(xs), .ys(ys), .buf_len(buf_len),
.dynamic_priority_vc_alloc(dynamic_priority_vc_alloc),
.vcselect_bydestinationnode(vcselect_bydestinationnode),
.vcselect_leastfullbuffer(vcselect_leastfullbuffer),
.vcselect_arbstateupdate(vcselect_arbstateupdate),
.vcselect_usepacketmask(vcselect_usepacketmask))
unrestricted
(
.req,
.output_port,
//.vc_mask,
.req_priority,
// .vc_sel_priority,
.vc_status(vc_alloc_status),
.vc_new,
.vc_new_valid,
.vc_allocated,
.vc_requested,
.flit, .vc_credits,
.clk, .rst_n
);
end
endgenerate
endmodule // NW_vc_allocator