minor udpate

This commit is contained in:
Blaise Tine 2024-08-21 03:38:15 -07:00
parent 771a10ea0c
commit 9797c6c48a
2 changed files with 8 additions and 7 deletions

View file

@ -40,17 +40,17 @@ module VX_cyclic_arbiter #(
localparam IS_POW2 = (1 << LOG_NUM_REQS) == NUM_REQS;
wire [LOG_NUM_REQS-1:0] grant_index_um;
wire [LOG_NUM_REQS-1:0] grant_index_um, grant_index_ql;
reg [LOG_NUM_REQS-1:0] grant_index_r;
always @(posedge clk) begin
if (reset) begin
grant_index_r <= '0;
end else if (grant_valid && grant_ready) begin
if (!IS_POW2 && grant_index == LOG_NUM_REQS'(NUM_REQS-1)) begin
if (!IS_POW2 && grant_index_ql == LOG_NUM_REQS'(NUM_REQS-1)) begin
grant_index_r <= '0;
end else begin
grant_index_r <= grant_index + LOG_NUM_REQS'(1);
grant_index_r <= grant_index_ql + LOG_NUM_REQS'(1);
end
end
end
@ -64,8 +64,10 @@ module VX_cyclic_arbiter #(
.valid_out (grant_valid)
);
assign grant_index = requests[grant_index_r] ? grant_index_r : grant_index_um;
assign grant_onehot = NUM_REQS'(1) << grant_index;
assign grant_index_ql = requests[grant_index_r] ? grant_index_r : grant_index_um;
assign grant_index = grant_index_ql;
assign grant_onehot = NUM_REQS'(1) << grant_index_ql;
end

View file

@ -65,11 +65,10 @@ module VX_priority_encoder #(
) lzc (
.data_in (reversed),
.data_out (index_out),
`UNUSED_PIN (valid_out)
.valid_out(valid_out)
);
assign onehot_out = scan_lo & {(~scan_lo[N-2:0]), 1'b1};
assign valid_out = scan_lo[N-1];
end else if (MODEL == 2) begin