3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 00:55:32 +00:00

create duplicate IOFFs if multiple output ports are connected to the same register

This commit is contained in:
N. Engelhardt 2025-01-31 11:28:57 +01:00
parent 25b400982b
commit 303a386ecc
3 changed files with 93 additions and 15 deletions

View file

@ -21,6 +21,21 @@ EOF
synth_quicklogic -family qlf_k6n10f -top top
select -assert-count 4 t:dff
design -reset
# test: acceptable for output IOFF promotion; duplicate output FF
read_verilog <<EOF
module top (input clk, input [3:0] a, output [3:0] o, output [3:0] p);
reg [3:0] r;
always @(posedge clk) begin
r <= ~a;
end
assign o = r;
assign p = r;
endmodule
EOF
synth_quicklogic -family qlf_k6n10f -top top
select -assert-count 8 t:dff
design -reset
# test: acceptable for input IOFF promotion
read_verilog <<EOF
@ -170,3 +185,25 @@ endmodule
EOF
synth_quicklogic -family qlf_k6n10f -top top
select -assert-count 0 t:dff
design -reset
# test: duplicate registers driving multiple output ports
read_verilog <<EOF
module top (
input clk,
input en,
input [3:0] a,
output reg [3:0] o_1,
output wire [3:0] o_2
);
always @(posedge clk) begin
o_1[1:0] <= ~a[1:0];
if (en)
o_1[2] <= a[2];
end
always @(*) o_1[3] = a[3];
assign o_2 = o_1;
endmodule
EOF
synth_quicklogic -family qlf_k6n10f -top top
select -assert-count 4 t:dff