forked from amrkhalid-star902/AMBA-BUS-PROTOCOL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fixed_Arbiter.v
52 lines (33 loc) · 903 Bytes
/
Fixed_Arbiter.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
`timescale 1ns / 1ps
module Fixed_Arbiter(
requests,
grant_idx,
grant_onehot,
grant_valid
);
parameter N = 4;
parameter MODE = 0;
parameter REVERSE = 0;
localparam LOGN = $clog2(N);
input [N-1 : 0] requests;
output [LOGN-1 : 0] grant_idx;
output [N-1 : 0] grant_onehot;
output grant_valid;
wire [LOGN-1 : 0] index;
reg [N-1 : 0] onehot;
Lazy_counter lzc(
.In_logic(requests),
.Idx(index),
.valid(grant_valid)
);
defparam lzc.N = N;
defparam lzc.MODE = MODE;
defparam lzc.REVERSE = REVERSE;
assign grant_idx = index;
assign grant_onehot = onehot;
always@(index)
begin
onehot = {N{1'b0}};
onehot[index] = 1'b1;
end
endmodule