3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-08 15:13:24 +00:00
yosys/docs/source
Gary Wong 370d5871f4 verilog: implement SystemVerilog unique/unique0/priority if semantics.
There are two elements involved:

1) Apply the relevant full_case and/or parallel_case attribute(s) to
the generated AST_CASE node(s), so that the existing AST frontend and
subsequent passes will generate RTLIL with appropriate behaviour.
(This is handled in the parser "if_attr" non-terminal.)

2) Rearrange the AST_CASE structure when necessary.  For "priority if"
(i.e., full_case), this requires only ensuring that directly nested
"else if" branches also inherit the full_case attribute.  For
"unique if" and "unique0 if" (i.e., parallel_case+full_case and
parallel_case alone), there are two steps:
    a) Flatten the AST_CASE structure such that any direct "else if"
    branches are mapped to additional AST_CONDs in the parent;
    b) Reverse the "direction" of the test: the constant 1 (true)
    is provided in the AST_CASE node, and the expression(s) in the
    if statement(s) are given in each AST_COND.  This is necessary
    because the constant 1, being the common factor, must occupy the
    shared AST_CASE position.
(This is handled in the parser "TOK_IF" expansion of behavioral_stmt.)

Observe that:
 * The generated AST has not been changed for bare "if"s (those
 without unique/priority).  This should minimise the risk of
 unexpected regressions.

 * It is possible that the flattening described in 2) a) above might
 affect the behaviour of expressions with side effects in "unique if"
 statements (consider "unique if( a ) ...; else if( b++ ) ...": if
 a is true, is b incremented?).  While it might be possible to provide
 precise semantics here, IEEE 1800-2012 12.4.2 seems to be deliberately
 vague ("In unique-if and unique0-if, the conditions may be evaluated
 and compared in any order[...] The presence of side effects in
 conditions may cause nondeterministic results.") and so it seems
 doubtful that there is benefit in Yosys providing stronger promises
 on the interpretation of questionable code.
2025-05-29 20:45:57 -06:00
..
_downloads Replace 010 and 012 with pdf 2023-10-30 10:34:30 +13:00
_images mk: Fall back to cp if rsync is not available 2025-03-24 18:06:17 +01:00
_static Docs: Switch to furo-ys 2024-10-15 07:24:14 +13:00
appendix docs: document that assigns must come before switches in case rules 2024-11-21 22:41:13 +01:00
cell Update codebase for macc_v2 2025-01-24 12:38:03 +01:00
code_examples Reinstate #4768 2025-04-08 11:58:05 +12:00
getting_started Fix Docs issues for offline pdf builds #4777 2025-03-15 12:14:09 +13:00
using_yosys reflow dft docs to 80 cols 2025-04-15 09:57:14 +01:00
yosys_internals verilog: implement SystemVerilog unique/unique0/priority if semantics. 2025-05-29 20:45:57 -06:00
bib.rst Add todo 2023-12-13 10:15:51 +13:00
cell_index.rst Docs: Comments from @jix 2024-10-15 07:37:20 +13:00
cmd_ref.rst Docs: Rename source/temp to source/generated 2024-04-15 10:13:22 +12:00
conf.py Release version 0.53 2025-05-06 07:45:16 +02:00
index.rst Docs: Remove restructure note 2025-01-06 11:08:00 +13:00
introduction.rst Docs: Fix nested list 2024-11-05 13:48:48 +13:00
literature.bib Rst docs conversion (#3496) 2022-11-15 12:55:22 +01:00
requirements.txt Docs: Switch to furo-ys 2024-10-15 07:24:14 +13:00