using onehot multiplexer to reduce critical path
This commit is contained in:
@@ -67,7 +67,6 @@ module VX_onehot_encoder #(
|
||||
reg [LN-1:0] index_r;
|
||||
|
||||
if (REVERSE) begin
|
||||
|
||||
always @(*) begin
|
||||
index_r = 'x;
|
||||
for (integer i = N-1; i >= 0; --i) begin
|
||||
@@ -76,7 +75,6 @@ module VX_onehot_encoder #(
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end else begin
|
||||
always @(*) begin
|
||||
index_r = 'x;
|
||||
|
||||
20
hw/rtl/libs/VX_onehot_mux.v
Normal file
20
hw/rtl/libs/VX_onehot_mux.v
Normal file
@@ -0,0 +1,20 @@
|
||||
`include "VX_platform.vh"
|
||||
|
||||
module VX_onehot_mux #(
|
||||
parameter DATAW = 1,
|
||||
parameter COUNT = 1
|
||||
) (
|
||||
input wire [COUNT-1:0][DATAW-1:0] data_in,
|
||||
input wire [COUNT-1:0] sel_in,
|
||||
output wire [DATAW-1:0] data_out
|
||||
);
|
||||
if (COUNT > 1) begin
|
||||
for (genvar i = 0; i < COUNT; ++i) begin
|
||||
assign data_out = sel_in[i] ? data_in[i] : 'z;
|
||||
end
|
||||
end else begin
|
||||
`UNUSED_VAR (sel_in)
|
||||
assign data_out = data_in;
|
||||
end
|
||||
|
||||
endmodule
|
||||
@@ -24,8 +24,7 @@ module VX_stream_arbiter #(
|
||||
if (NUM_REQS > 1) begin
|
||||
wire sel_valid;
|
||||
wire sel_ready;
|
||||
wire [LOG_NUM_REQS-1:0] sel_idx;
|
||||
wire [NUM_REQS-1:0] sel_1hot;
|
||||
wire [NUM_REQS-1:0] sel_1hot;
|
||||
|
||||
if (TYPE == "X") begin
|
||||
VX_fixed_arbiter #(
|
||||
@@ -37,8 +36,8 @@ module VX_stream_arbiter #(
|
||||
.requests (valid_in),
|
||||
.enable (sel_ready),
|
||||
.grant_valid (sel_valid),
|
||||
.grant_index (sel_idx),
|
||||
.grant_onehot (sel_1hot)
|
||||
.grant_onehot (sel_1hot),
|
||||
`UNUSED_PIN (grant_index)
|
||||
);
|
||||
end else if (TYPE == "R") begin
|
||||
VX_rr_arbiter #(
|
||||
@@ -50,8 +49,8 @@ module VX_stream_arbiter #(
|
||||
.requests (valid_in),
|
||||
.enable (sel_ready),
|
||||
.grant_valid (sel_valid),
|
||||
.grant_index (sel_idx),
|
||||
.grant_onehot (sel_1hot)
|
||||
.grant_onehot (sel_1hot),
|
||||
`UNUSED_PIN (grant_index)
|
||||
);
|
||||
end else if (TYPE == "F") begin
|
||||
VX_fair_arbiter #(
|
||||
@@ -63,8 +62,8 @@ module VX_stream_arbiter #(
|
||||
.requests (valid_in),
|
||||
.enable (sel_ready),
|
||||
.grant_valid (sel_valid),
|
||||
.grant_index (sel_idx),
|
||||
.grant_onehot (sel_1hot)
|
||||
.grant_onehot (sel_1hot),
|
||||
`UNUSED_PIN (grant_index)
|
||||
);
|
||||
end else if (TYPE == "M") begin
|
||||
VX_matrix_arbiter #(
|
||||
@@ -76,13 +75,24 @@ module VX_stream_arbiter #(
|
||||
.requests (valid_in),
|
||||
.enable (sel_ready),
|
||||
.grant_valid (sel_valid),
|
||||
.grant_index (sel_idx),
|
||||
.grant_onehot (sel_1hot)
|
||||
.grant_onehot (sel_1hot),
|
||||
`UNUSED_PIN (grant_index)
|
||||
);
|
||||
end else begin
|
||||
$error ("invalid parameter");
|
||||
end
|
||||
|
||||
wire [DATAW-1:0] data_in_sel;
|
||||
|
||||
VX_onehot_mux #(
|
||||
.DATAW (DATAW),
|
||||
.COUNT (NUM_REQS)
|
||||
) data_in_mux (
|
||||
.data_in (data_in),
|
||||
.sel_in (sel_1hot),
|
||||
.data_out (data_in_sel)
|
||||
);
|
||||
|
||||
VX_skid_buffer #(
|
||||
.DATAW (DATAW),
|
||||
.PASSTHRU (!BUFFERED)
|
||||
@@ -90,7 +100,7 @@ module VX_stream_arbiter #(
|
||||
.clk (clk),
|
||||
.reset (reset),
|
||||
.valid_in (sel_valid),
|
||||
.data_in (data_in[sel_idx]),
|
||||
.data_in (data_in_sel),
|
||||
.ready_in (sel_ready),
|
||||
.valid_out (valid_out),
|
||||
.data_out (data_out),
|
||||
|
||||
Reference in New Issue
Block a user