From d3b3f6baf6d7097bec9d6769005f2491c2835405 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Tue, 18 Feb 2025 13:50:24 +0100 Subject: [PATCH] abstract: test -state --- tests/various/abstract.ys | 215 +++++++++++++++++--------------------- 1 file changed, 98 insertions(+), 117 deletions(-) diff --git a/tests/various/abstract.ys b/tests/various/abstract.ys index 0892ca1c4c4..30aa8eb3997 100644 --- a/tests/various/abstract.ys +++ b/tests/various/abstract.ys @@ -10,15 +10,59 @@ endmodule EOT proc -# show -prefix before_base +design -save half_clock + +# ----------------------------------------------------------------------------- +# An empty selection causes no change +select -none + +logger -expect log "Abstracted 0 stateful cells" 1 + abstract -state -enablen magic +logger -check-expected + +logger -expect log "Abstracted 0 init bits" 1 + abstract -init +logger -check-expected + +logger -expect log "Abstracted 0 driver ports" 1 + abstract -value -enablen magic +logger -check-expected + +select -clear +# ----------------------------------------------------------------------------- +design -load half_clock +# Basic -state test abstract -state -enablen magic check -assert -# show -prefix after_base - +# Connections to dff D input port +select -set conn_to_d t:$dff %x:+[D] t:$dff %d +# The D input port is fed with a mux +select -set mux @conn_to_d %ci t:$mux %i +select -assert-count 1 @mux +# The S input port is fed with the magic wire +select -assert-count 1 @mux %x:+[S] w:magic %i +# The A input port is fed with an anyseq +select -assert-count 1 @mux %x:+[A] %ci t:$anyseq %i +# The B input port is fed with the negated Q +select -set not @mux %x:+[B] %ci t:$not %i +select -assert-count 1 @not %x:+[A] o:Q %i + +design -load half_clock +# Same thing, inverted polarity +abstract -state -enable magic +check -assert +select -set conn_to_d t:$dff %x:+[D] t:$dff %d +select -set mux @conn_to_d %ci t:$mux %i +select -assert-count 1 @mux +select -assert-count 1 @mux %x:+[S] w:magic %i +# so we get swapped A and B +select -assert-count 1 @mux %x:+[B] %ci t:$anyseq %i +select -set not @mux %x:+[A] %ci t:$not %i +select -assert-count 1 @not %x:+[A] o:Q %i +# ----------------------------------------------------------------------------- design -reset read_verilog <