mirror of https://github.com/YosysHQ/yosys.git
e36c71b5b7
This makes clk2fflogic add an attr to $ff cells that carry the state of the emulated async FF. The $ff output doesn't have any async updates that happened in the current cycle, but the $ff input does, so the $ff input corresponds to the async FF's output in the original design. Hence this patch also makes the following changes to passes besides clk2fflogic (but only for FFs with the clk2fflogic attr set): * opt_clean treats the input as a register name (instead of the output) * rename -witness ensures that the input has a public name * the formal backends (smt2, btor, aiger) will use the input's name for the initial state of the FF in witness files * when sim reads a yw witness that assigns an initial value to the input signal, the state update is redirected to the output This ensures that yosys witness files for clk2fflogic designs have useful and stable public signal names. It also makes it possible to simulate a clk2fflogic witness on the original design (with some limitations when the original design is already using $ff cells). It might seem like setting the output of a clk2fflogic FF to update the input's initial value might not work in general, but it works fine for these reasons: * Witnesses for FFs are only present in the initial cycle, so we do not care about any later cycles. * The logic that clk2fflogic generates loops the output of the genreated FF back to the input, with muxes in between to apply any edge or level sensitive updates. So when there are no active updates in the current gclk cycle, there is a combinational path from the output back to the input. * The logic clk2fflogic generates makes sure that an edge sensitive update cannot be active in the first cycle (i.e. the past initial value is assumed to be whatever it needs to be to avoid an edge). * When a level sensitive update is active in the first gclk cycle, it is actively driving the output for the whole gclk cycle, so ignoring any witness initialization is the correct behavior. |
||
---|---|---|
.. | ||
Makefile.inc | ||
muxpack.cc | ||
opt.cc | ||
opt_clean.cc | ||
opt_demorgan.cc | ||
opt_dff.cc | ||
opt_expr.cc | ||
opt_ffinv.cc | ||
opt_lut.cc | ||
opt_lut_ins.cc | ||
opt_mem.cc | ||
opt_mem_feedback.cc | ||
opt_mem_priority.cc | ||
opt_mem_widen.cc | ||
opt_merge.cc | ||
opt_muxtree.cc | ||
opt_reduce.cc | ||
opt_share.cc | ||
pmux2shiftx.cc | ||
rmports.cc | ||
share.cc | ||
wreduce.cc |