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

select: Add cell type property selector

Looks up the cell type for each cell in the design, returning the value of `CellType::is_<property>`.
Only works for exact match, and only for internal cells.

Also add a simple test checking a small design with an $add cell and an $sdff cell.
This commit is contained in:
Krystine Sherwin 2025-02-21 16:17:23 +13:00
parent 4883c503a8
commit d613913905
No known key found for this signature in database
2 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,42 @@
read_rtlil << EOF
module \sm2
wire input 1 \clk
wire input 2 \rst
wire width 2 input 3 \a
wire width 2 \add_Y
attribute \init 2'00
wire width 2 output 4 \y
cell $add \add
parameter \A_SIGNED 0
parameter \A_WIDTH 2
parameter \B_SIGNED 0
parameter \B_WIDTH 2
parameter \Y_WIDTH 2
connect \A \y
connect \B \a
connect \Y \add_Y
end
cell $sdff \sdff
parameter \CLK_POLARITY 1
parameter \SRST_POLARITY 1
parameter \SRST_VALUE 2'00
parameter \WIDTH 2
connect \CLK \clk
connect \D \add_Y
connect \Q \y
connect \SRST \rst
end
end
EOF
select -assert-count 1 y:evaluable
select -assert-count 1 y:combinatorial
select -assert-count 2 y:synthesizable
select -assert-count 1 y:builtin_ff
select -assert-count 0 y:formal