Skip to content

Commit ccec60e

Browse files
committed
stream_fork_blocking: add dynamic and static modules
1 parent 47b020a commit ccec60e

3 files changed

Lines changed: 63 additions & 0 deletions

File tree

Bender.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ sources:
6868
- src/sync_wedge.sv
6969
- src/unread.sv
7070
- src/read.sv
71+
- src/stream_fork_blocking_dynamic.sv
72+
- src/stream_fork_blocking.sv
7173
# Level 1
7274
- src/addr_decode_dync.sv
7375
- src/cdc_2phase.sv

src/stream_fork_blocking.sv

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (c) 2025 ETH Zurich, University of Bologna
2+
//
3+
// Copyright and related rights are licensed under the Solderpad Hardware
4+
// License, Version 0.51 (the "License"); you may not use this file except in
5+
// compliance with the License. You may obtain a copy of the License at
6+
// http://solderpad.org/licenses/SHL-0.51. Unless required by applicable law
7+
// or agreed to in writing, software, hardware and materials distributed under
8+
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9+
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
10+
// specific language governing permissions and limitations under the License.
11+
12+
module stream_fork_blocking #(
13+
parameter int unsigned N_OUP = 0 // Synopsys DC requires a default value for parameters.
14+
) (
15+
input logic valid_i,
16+
output logic ready_o,
17+
output logic [N_OUP-1:0] valid_o,
18+
input logic [N_OUP-1:0] ready_i
19+
);
20+
21+
stream_fork_blocking_dynamic #(
22+
.N_OUP (N_OUP)
23+
) u_stream_fork_blocking_dynamic (
24+
.valid_i,
25+
.ready_o,
26+
.sel_i ({N_OUP{1'b1}}),
27+
.valid_o,
28+
.ready_i
29+
);
30+
31+
endmodule
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2025 ETH Zurich, University of Bologna
2+
//
3+
// Copyright and related rights are licensed under the Solderpad Hardware
4+
// License, Version 0.51 (the "License"); you may not use this file except in
5+
// compliance with the License. You may obtain a copy of the License at
6+
// http://solderpad.org/licenses/SHL-0.51. Unless required by applicable law
7+
// or agreed to in writing, software, hardware and materials distributed under
8+
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9+
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
10+
// specific language governing permissions and limitations under the License.
11+
12+
module stream_fork_blocking_dynamic #(
13+
parameter int unsigned N_OUP = 0 // Synopsys DC requires a default value for parameters.
14+
) (
15+
input logic valid_i,
16+
output logic ready_o,
17+
input logic [N_OUP-1:0] sel_i,
18+
output logic [N_OUP-1:0] valid_o,
19+
input logic [N_OUP-1:0] ready_i
20+
);
21+
22+
// Block data input unless:
23+
// - at least one output is selected
24+
// - AND all selected outputs are ready
25+
assign ready_o = |sel_i && &(ready_i & sel_i);
26+
27+
// Drive valid_o high only for selected outputs when valid_i is asserted and all are ready
28+
assign valid_o = {N_OUP{valid_i && ready_o}} & sel_i;
29+
30+
endmodule

0 commit comments

Comments
 (0)