3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-06-02 15:18:07 +00:00

proc_mux, genrtlil: make use of case_src for better case condition vs block tracking

This commit is contained in:
Emil J. Tywoniak 2025-12-11 00:45:30 +01:00
parent a217a5c716
commit a24c260998
4 changed files with 45 additions and 6 deletions

View file

@ -90,3 +90,25 @@ module tiny2(
endcase
end
endmodule
module ifelse(input clk,
input cond1,
input cond2,
output reg [1:0] out
);
always @(posedge clk) begin
if (cond1) begin
out <= 0;
end else begin
if(cond2)
begin
out <= 1;
end
else
begin
out <= 2;
end
end
end
endmodule

View file

@ -28,3 +28,10 @@ select -assert-count 5 nested/t:$pmux
select -assert-count 1 nested/t:$pmux a:src=proc_mux_src.v:21.5-21.20|proc_mux_src.v:26.5-26.20|proc_mux_src.v:32.5-45.12|proc_mux_src.v:48.5-48.19 %i
# No nesting for output reg arith
select -assert-count 1 nested/t:$pmux a:src=proc_mux_src.v:23.5-23.18|proc_mux_src.v:28.5-28.18|proc_mux_src.v:31.5-31.18|proc_mux_src.v:50.5-50.18 %i
# if/elseif can't be turned into a $pmux
# Otherwise, behaves as expected
select -assert-count 0 ifelse/t:$pmux
select -assert-count 2 ifelse/t:$mux
select -assert-count 1 ifelse/t:$mux a:src=proc_mux_src.v:102.4-102.12|proc_mux_src.v:103.11-112.6 %i
select -assert-count 1 ifelse/t:$mux a:src=proc_mux_src.v:106.6-106.14|proc_mux_src.v:110.6-110.14 %i