Repository navigation
Conversation
Resolve the year-old LogicEnum branch conflicts against current synthesis naming, assignment, and configuration APIs.
# Conflicts: # lib/src/synthesizers/systemverilog/systemverilog_synthesis_result.dart # lib/src/synthesizers/systemverilog/systemverilog_synthesizer_configuration.dart
|
Please establish the Const / enum-literal contract explicitly The intended distinction should be documented and tested: LogicEnum is a signal with a domain mapping and a driveable clone. One important release consideration: it changes FiniteStateMachine to require StateIdentifier extends Enum. That is a real breaking change and needs a migration note. We will need some appropriate extension for netlist to represent enums like it represents constants (they do not evaporate) along with tests. This is likely a major change for netlist, including a version update to show it has enum declarations. |
Description & Motivation
Adds
LogicEnum<T extends Enum>, a strongly typed hardware signal that maps Dart enum values to hardware encodings.LogicEnumpreserves enum information through simulation, conditional logic, FSMs, module hierarchy, and SystemVerilog synthesis. Generated SystemVerilog uses enum typedefs and symbolic values by default, whilegenerateEnums: falseretains packed-logic output for tool compatibility.The implementation validates mappings and assignments, supports explicit sparse encodings, and preserves enum types across typed inputs and outputs. Struct support and typed enum
inoutports remain out of scope.Related Issue(s)
Addresses #139 and the enum portion of #594. Related to #592.
Testing
Added comprehensive
LogicEnumunit and integration coverage, including simulation, conditionals, FSMs, hierarchy, arrays and structures, typed ports, and SystemVerilog generation in enabled and disabled modes.Generated SystemVerilog is compiled and behaviorally compared with Icarus Verilog. The full non-benchmark suite passes with 1,357 tests and one expected skip, and all 49 enum tests pass on Node.
Backwards-compatibility
This is mostly additive, and designs that do not use
LogicEnumare unaffected.FiniteStateMachine<StateIdentifier>now requires an enum state identifier, and its state signals areLogicEnuminstances. Existing enum-based FSMs remain compatible becauseLogicEnumextendsLogic.SystemVerilog enum generation is enabled by default for
LogicEnumsignals and can be disabled withSystemVerilogSynthesizerConfiguration(generateEnums: false).Documentation
The new public APIs and configuration options include Dartdoc. The FSM tests also demonstrate typed enum signals and direct enum assignments. A separate user-guide page is not included.