yosys/kernel
Zachary Snow fe74b0cd95 verilog: significant block scoping improvements
This change set contains a number of bug fixes and improvements related to
scoping and resolution in generate and procedural blocks. While many of the
frontend changes are interdependent, it may be possible bring the techmap
changes in under a separate PR.

Declarations within unnamed generate blocks previously encountered issues
because the data declarations were left un-prefixed, breaking proper scoping.
The LRM outlines behavior for generating names for unnamed generate blocks. The
original goal was to add this implicit labelling, but doing so exposed a number
of issues downstream. Additional testing highlighted other closely related scope
resolution issues, which have been fixed. This change also adds support for
block item declarations within unnamed blocks in SystemVerilog mode.

1. Unlabled generate blocks are now implicitly named according to the LRM in
   `label_genblks`, which is invoked at the beginning of module elaboration
2. The Verilog parser no longer wraps explicitly named generate blocks in a
   synthetic unnamed generate block to avoid creating extra hierarchy levels
   where they should not exist
3. The techmap phase now allows special control identifiers to be used outside
   of the topmost scope, which is necessary because such wires and cells often
   appear in unlabeled generate blocks, which now prefix the declarations within
4. Some techlibs required modifications because they relied on the previous
   invalid scope resolution behavior
5. `expand_genblock` has been simplified, now only expanding the outermost
   scope, completely deferring the inspection and elaboration of nested scopes;
   names are now resolved by looking in the innermost scope and stepping outward
6. Loop variables now always become localparams during unrolling, allowing them
   to be resolved and shadowed like any other identifier
7. Identifiers in synthetic function call scopes are now prefixed and resolved
   in largely the same manner as other blocks
     before: `$func$\func_01$tests/simple/scopes.blk.v:60$5$\blk\x`
      after: `\func_01$func$tests/simple/scopes.v:60$5.blk.x`
8. Support identifiers referencing a local generate scope nested more
   than 1 level deep, i.e. `B.C.x` while within generate scope `A`, or using a
   prefix of a current or parent scope, i.e. `B.C.D.x` while in `A.B`, `A.B.C`,
   or `A.B.C.D`
9. Variables can now be declared within unnamed blocks in SystemVerilog mode

Addresses the following issues: 656, 2423, 2493
2021-01-31 09:42:09 -05:00
..
bitpattern.h Removed unnecessary cast. 2015-09-01 12:40:36 +02:00
calc.cc Respect \A_SIGNED for $shift 2020-08-18 19:36:24 +02:00
cellaigs.cc kernel: big fat patch to use more ID::*, otherwise ID(*) 2020-04-02 09:51:32 -07:00
cellaigs.h Fixed trailing whitespaces 2015-07-02 11:14:30 +02:00
celledges.cc Add flooring division operator 2020-05-28 22:59:04 +02:00
celledges.h Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
celltypes.h celltypes: Fix EN port name for some FF types. 2020-07-20 23:04:10 +02:00
consteval.h kernel: big fat patch to use more ID::*, otherwise ID(*) 2020-04-02 09:51:32 -07:00
constids.inc techmap: Add _TECHMAP_CELLNAME_ special parameter. 2020-07-21 15:00:54 +02:00
cost.h Use ID() in kernel/*, add simple ID:: hack (to be improved upon later) 2019-08-11 11:39:46 +02:00
driver.cc tcl -h message only if YOSYS_ENABLE_TCL defined. 2020-11-23 21:48:44 -05:00
ff.h async2sync: Support all FF types. 2020-07-30 20:22:03 +02:00
ffinit.h ffinit: Fortify the code a bit. 2020-07-28 17:21:15 +02:00
hashlib.h dict: Remove guard for past-the-end iterators that might mask problems in static analysis. 2020-06-19 21:04:29 +00:00
log.cc Replace "ILANG" with "RTLIL" everywhere. 2020-08-26 17:29:32 +00:00
log.h Merge pull request #2168 from whitequark/assert-unused-exprs 2020-06-25 18:21:51 +02:00
macc.h Use (and ignore) the expression provided to log_assert in NDEBUG builds. 2020-06-19 15:48:58 +00:00
mem.cc Add new helper structures to represent memories. 2020-10-21 17:51:20 +02:00
mem.h Add new helper structures to represent memories. 2020-10-21 17:51:20 +02:00
modtools.h Remove YS_ATTRIBUTE(unused) where present just for log_assert()/log_debug(). 2020-06-19 15:48:58 +00:00
register.cc Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
register.h Use C++11 final/override keywords. 2020-06-18 23:34:52 +00:00
rtlil.cc bugpoint: add -wires option. 2020-12-07 09:24:35 +00:00
rtlil.h verilog: significant block scoping improvements 2021-01-31 09:42:09 -05:00
satgen.cc Respect \A_SIGNED for $shift 2020-08-18 19:36:24 +02:00
satgen.h satgen: Add support for dffe, sdff, sdffe, sdffce cells. 2020-07-24 03:19:21 +02:00
sigtools.h kernel: const Wire* overload -> Wire* !!! 2020-03-26 16:21:30 -07:00
timinginfo.h timinginfo: Error instead of segfault on const signals. 2020-12-15 00:51:16 +01:00
utils.h Fixed trailing whitespaces 2015-07-02 11:14:30 +02:00
yosys.cc Expose abc and data paths as globals 2020-11-06 14:17:15 +01:00
yosys.h kernel/yosys.h: undef CONST on WIN32 2020-12-28 02:21:19 +01:00