adding stream arbiter
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
`include "VX_platform.vh"
|
||||
|
||||
module VX_fixed_arbiter #(
|
||||
parameter N = 1
|
||||
parameter NUM_REQS = 1,
|
||||
parameter LOCK_ENABLE = 0,
|
||||
parameter LOG_NUM_REQS = $clog2(NUM_REQS)
|
||||
) (
|
||||
input wire clk,
|
||||
input wire reset,
|
||||
input wire [N-1:0] requests,
|
||||
output wire [`LOG2UP(N)-1:0] grant_index,
|
||||
output wire [N-1:0] grant_onehot,
|
||||
output wire grant_valid
|
||||
input wire clk,
|
||||
input wire reset,
|
||||
input wire [NUM_REQS-1:0] requests,
|
||||
input wire enable,
|
||||
output wire [LOG_NUM_REQS-1:0] grant_index,
|
||||
output wire [NUM_REQS-1:0] grant_onehot,
|
||||
output wire grant_valid
|
||||
);
|
||||
|
||||
`UNUSED_VAR (clk)
|
||||
`UNUSED_VAR (reset)
|
||||
`UNUSED_VAR (enable)
|
||||
|
||||
if (N == 1) begin
|
||||
if (NUM_REQS == 1) begin
|
||||
|
||||
assign grant_index = 0;
|
||||
assign grant_onehot = requests;
|
||||
@@ -22,22 +26,21 @@ module VX_fixed_arbiter #(
|
||||
|
||||
end else begin
|
||||
|
||||
reg [N-1:0] grant_onehot_r;
|
||||
|
||||
VX_priority_encoder # (
|
||||
.N(N)
|
||||
.N(NUM_REQS)
|
||||
) priority_encoder (
|
||||
.data_in (requests),
|
||||
.data_out (grant_index),
|
||||
.valid_out (grant_valid)
|
||||
);
|
||||
|
||||
reg [NUM_REQS-1:0] grant_onehot_r;
|
||||
always @(*) begin
|
||||
grant_onehot_r = N'(0);
|
||||
grant_onehot_r = NUM_REQS'(0);
|
||||
grant_onehot_r[grant_index] = 1;
|
||||
end
|
||||
assign grant_onehot = grant_onehot_r;
|
||||
|
||||
|
||||
assign grant_onehot = grant_onehot_r;
|
||||
end
|
||||
|
||||
endmodule
|
||||
Reference in New Issue
Block a user