3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-06-28 03:28:49 +00:00
This commit is contained in:
JesseDebuger 2026-06-19 04:11:28 +00:00 committed by GitHub
commit 4afeab075a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 83 additions and 0 deletions

View file

@ -0,0 +1,61 @@
# Test for issue #5835: setundef -undriven should not cause conflicts
# with init attributes on undriven wires.
# Test 1: Basic case from the bug report - undriven wire with init attribute
read_rtlil << EOT
module \top
attribute \init 3
wire width 4 \i
end
EOT
setundef -undriven -undef
# Verify that the init attribute was removed from the undriven wire
select -assert-count 0 w:* a:init %i
# Verify that opt doesn't crash with "Conflicting init values" error
opt
design -reset
# Test 2: setundef -undriven -zero with init attribute
read_rtlil << EOT
module \top
attribute \init 3
wire width 4 \i
end
EOT
setundef -undriven -zero
select -assert-count 0 w:* a:init %i
opt
design -reset
# Test 3: setundef -undriven -one with init attribute
read_rtlil << EOT
module \top
attribute \init 3
wire width 4 \i
end
EOT
setundef -undriven -one
select -assert-count 0 w:* a:init %i
opt
design -reset
# Test 4: Wire driven by a cell should keep its init attribute
read_rtlil << EOT
module \top
wire width 1 input 1 \clk
wire width 1 input 2 \d
attribute \init 1'0
wire width 1 output 3 \q
cell $dff \myff
parameter \CLK_POLARITY 1'1
parameter \WIDTH 1
connect \CLK \clk
connect \D \d
connect \Q \q
end
end
EOT
setundef -undriven -zero
# The init attribute should still be present since the wire is driven by a FF
select -assert-count 1 w:* a:init %i
design -reset