round robin arbiter + auto buffered queue + fixed dcache arbiter

This commit is contained in:
Blaise Tine
2020-06-20 17:56:04 -04:00
parent 9c157e4929
commit d3440de403
30 changed files with 339 additions and 209 deletions

View File

@@ -5,49 +5,67 @@ module VX_matrix_arbiter #(
) (
input wire clk,
input wire reset,
input wire [N-1:0] requests,
output wire grant_valid,
input wire [N-1:0] requests,
output wire [`LOG2UP(N)-1:0] grant_index,
output wire [N-1:0] grant_onehot,
output wire [`LOG2UP(N)-1:0] grant_index
output wire grant_valid
);
reg [N-1:0] state [0:N-1];
wire [N-1:0] dis [0:N-1];
if (N == 1) begin
genvar i, j;
for (i = 0; i < N; ++i) begin
for (j = i + 1; j < N; ++j) begin
always @(posedge clk) begin
if (reset) begin
state[i][j] <= 0;
end else begin
state[i][j] <= (state[i][j] || grant_onehot[j]) && ~grant_onehot[i];
`UNUSED_VAR (clk)
`UNUSED_VAR (reset)
assign grant_index = 0;
assign grant_onehot = requests;
assign grant_valid = requests[0];
end else begin
reg [N-1:1] state [0:N-1];
wire [N-1:0] pri [0:N-1];
genvar i, j;
for (i = 0; i < N; ++i) begin
for (j = 0; j < N; ++j) begin
if (j > i) begin
assign pri[j][i] = requests[i] & state[i][j];
end
else if (j < i) begin
assign pri[j][i] = requests[i] & ~state[j][i];
end
else begin
assign pri[j][i] = 0;
end
end
assign grant_onehot[i] = requests[i] & ~(| pri[i]);
end
for (i = 0; i < N; ++i) begin
for (j = i + 1; j < N; ++j) begin
always @(posedge clk) begin
if (reset) begin
state[i][j] <= 0;
end
else begin
state[i][j] <= (state[i][j] || grant_onehot[j]) && ~grant_onehot[i];
end
end
end
end
end
for (i = 0; i < N; ++i) begin
for (j = 0; j < N; ++j) begin
if (j > i) begin
assign dis[j][i] = requests[i] & state[i][j];
end else if (j < i) begin
assign dis[j][i] = requests[i] & ~state[j][i];
end else begin
assign dis[j][i] = 0;
end
end
VX_encoder_onehot #(
.N(N)
) encoder (
.onehot (grant_onehot),
`UNUSED_PIN (valid),
.value (grant_index)
);
assign grant_valid = (| requests);
assign grant_onehot[i] = requests[i] & ~(| dis[i]);
end
VX_encoder_onehot #(
.N(N)
) encoder (
.onehot(grant_onehot),
.valid(grant_valid),
.value(grant_index)
);
endmodule