Skip to content

Conversation

@KrystalDelusion
Copy link
Member

What are the reasons/motivation for this change?

Some cells (e.g. $macc_v2) are marked evaluable, but will raise an abort if called with CellTypes::eval().

Explain how this is achieved.

Instead of falling through to the abort, we can pass a pointer to a boolean to check for errors. Use said check to catch CellTypes::eval() errors and treat them as unevaluable but otherwise continue.

Make sure your change comes with tests. If not possible, share how a reviewer might evaluate it.

Following script based on #5534:

read_rtlil << EOT
module \top
  wire input 1 \a
  wire input 2 \b
  wire output 3 \y
  wire width 32 $mul$<<EOT:15$2_Y

  cell $macc_v2 \test_macc
    parameter \Y_WIDTH 32
    parameter \PRODUCT_NEGATED 1'0
    parameter \NPRODUCTS 1
    parameter \NADDENDS 0
    parameter \C_WIDTHS 1'x
    parameter \C_SIGNED 1'x
    parameter \B_WIDTHS 16'0000000000000001
    parameter \B_SIGNED 1'0
    parameter \A_WIDTHS 16'0000000000000001
    parameter \A_SIGNED 1'0
    parameter \ADDEND_NEGATED 1'x
    connect \Y { $mul$<<EOT:15$2_Y [31:1] \y }
    connect \C { }
    connect \B \b
    connect \A 1'0
  end
end
EOT
sim -n 1

Without this change this will call log_abort(), with this change it will instead display warnings of unsupported cells but otherwise continue (I'm not sure if continuing is always the desired behaviour, but it is consistent with other cells marked evaluable but which don't fit one of the supported patterns).

Some cells (e.g. $macc_v2) are marked evaluable, but will raise an abort if called with `CellTypes::eval()`.
Instead of falling through to the abort, we can pass a pointer to a boolean to check for errors.
Use said check to catch `CellTypes::eval()` errors and treat them as unevaluable but otherwise continue.
Reflows the series of if checks into `if ... else if ... else` so that we can check for errors and set state in one place.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Yosys aborts with exception in simulation pass

3 participants