Skip to content

Module services api - #673

Open
desmonddak wants to merge 101 commits into
intel:mainfrom
desmonddak:module_services_api
Open

Module services api#673
desmonddak wants to merge 101 commits into
intel:mainfrom
desmonddak:module_services_api

Conversation

@desmonddak

Copy link
Copy Markdown
Contributor

Description & Motivation

This is a subset of the PR #669 that introduces the new API for Services attached to a module (outputters like wave dumpers, netlisters, translators, tracing services, etc).

Related Issue(s)

None

Testing

This runs a full dart test with the new API in place in the tests.

Backwards-compatibility

Is this a breaking change that will not be backwards-compatible? If yes, how so?

No, we retain the old interfaces but they should eventually be deprecated.
WaveDumper
generateSynth
...

Documentation

Does the change require any updates to documentation? If so, where? Are they included?

Some examples have been modified to match.

desmonddak and others added 30 commits April 17, 2026 08:30
Clarify comment

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This aligns central_naming with the simplified naming approach already
adopted by all downstream branches (module_services, netlist, source_debug,
systemc_trace, fst-writer).

Changes:
- Remove Namer._instanceNames cache field
- Remove Namer.instanceNameOf(Module) method
- Update synthesizers to use Namer.allocateName(String) directly
- Remove destination tracking from _BusSubsetForStructSlice

Benefit: Eliminates duplication across 5+ branches, making each branch
truly orthogonal and mergeable without conflicts.

Trade-off: Instance names no longer cached across synthesis passes, but all
downstreams already use this simpler approach.
# Conflicts:
#	tool/gh_codespaces/install_dart.sh
instanceNameOf(Module) allocates a collision-free instance name on the
first call and returns the cached result thereafter.  The _instanceNames
Map is keyed by Module.instanceNameKey so repeated synthesis passes over
the same hierarchy always produce stable names.

This method belongs in central_naming because it is pure naming
infrastructure with no dependency on any feature branch.
- Update comment: 'allocateName' → 'instanceNameOf'
- Add 'submodule instance names are stable across repeated definitions'
  test (the canonical 'run synthesis twice, same names' regression test)

Both belong here since they directly exercise Namer.instanceNameOf,
which is now defined in central_naming.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces module-scoped SystemVerilog and waveform services, while also adding substantial netlist, typed-array, DevTools, example, and documentation changes.

Changes:

  • Adds ModuleService, SystemVerilogService, WaveformService, and convenience APIs.
  • Expands netlist synthesis and typed logic-array support.
  • Migrates tests, examples, DevTools integrations, and documentation.

Reviewed changes

Copilot reviewed 176 out of 177 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tool/gh_actions/install_node.sh Updates copyright.
tool/gh_actions/check_tmp_test.sh Updates copyright.
tool/generate_gate_catalog.dart Adds fixture generation tool.
test/waveform_service_test.dart Tests waveform service and compatibility API.
test/typed_port_test.dart Migrates synthesis calls.
test/systemverilog_port_types_test.dart Uses SystemVerilog service.
test/synth_structure_layout_test.dart Tests structure layout utilities.
test/swizzle_test.dart Migrates synthesis calls.
test/sv_param_passthrough_test.dart Migrates synthesis call.
test/sv_gen_test.dart Migrates synthesis tests.
test/struct_port_pruning_test.dart Adds struct-port pruning tests.
test/sequential_test.dart Migrates synthesis call.
test/replication_test.dart Migrates synthesis calls.
test/provider_consumer_w_modify_test.dart Migrates synthesis call.
test/provider_consumer_test.dart Migrates synthesis call.
test/pipeline_test.dart Updates copyright.
test/pair_interface_test.dart Migrates synthesis call.
test/pair_interface_hier_w_modify_test.dart Migrates synthesis call.
test/pair_interface_hier_test.dart Migrates synthesis call.
test/net_test.dart Migrates synthesis calls.
test/net_bus_test.dart Migrates synthesis calls.
test/nested_array_struct_port_synthesis_test.dart Restricts platform and migrates API.
test/naming_namespace_test.dart Migrates synthesis calls.
test/naming_cases_test.dart Migrates synthesis call.
test/name_test.dart Migrates synthesis and exception checks.
test/multimodule5_test.dart Migrates synthesis call.
test/multimodule4_test.dart Migrates synthesis call.
test/module_test.dart Tests convenience output methods.
test/module_services_test.dart Tests registry and SystemVerilog service.
test/module_merging_test.dart Migrates synthesis calls.
test/math_test.dart Migrates synthesis calls.
test/mac_unit_test.dart Tests MAC pipeline stalling.
test/logic_test.dart Updates copyright.
test/logic_structure_test.dart Tests structure flattening and constants.
test/logic_name_test.dart Migrates synthesis calls.
test/logic_name_config_test.dart Migrates synthesis calls.
test/logic_array_test.dart Migrates synthesis calls.
test/inout_loopback_test.dart Migrates synthesis calls.
test/gate_test.dart Migrates synthesis calls.
test/fsm_test.dart Migrates synthesis calls.
test/flop_test.dart Updates copyright.
test/external_test.dart Migrates synthesis call.
test/counter_wintf_test.dart Migrates synthesis call.
test/counter_test.dart Updates waveform example comment.
test/const_radix_test.dart Migrates synthesis calls.
test/config_test.dart Tests new and deprecated synthesis APIs.
test/comb_mod_test.dart Updates copyright.
test/comb_math_test.dart Updates copyright.
test/collapse_test.dart Migrates synthesis calls.
test/bus_test.dart Migrates synthesis calls.
test/benchmark_test.dart Updates copyright.
test/assignment_test.dart Updates copyright.
rohd-multipackage.code-workspace Removes checked-in workspace.
rohd_extension/package.json Adds command activation events.
rohd_extension/dart/lib/dtd_service.dart Improves connection diagnostics.
rohd_devtools_extension/tool/test_devtools_install.dart Checks binary asset manifest.
rohd_devtools_extension/packages/rohd_devtools_widgets/test/signal_value_format_registry_test.dart Tests signal value formatting.
rohd_devtools_extension/packages/rohd_devtools_widgets/README.md Documents shared widgets.
rohd_devtools_extension/packages/rohd_devtools_widgets/pubspec.yaml Adds hierarchy dependency.
rohd_devtools_extension/packages/rohd_devtools_widgets/lib/rohd_devtools_widgets.dart Exports format registry.
rohd_devtools_extension/lib/rohd_devtools/ui/signal_table.dart Updates copyright.
rohd_devtools_extension/lib/rohd_devtools/services/vm_service_signal_value_source.dart Renames evaluated JSON accessors.
rohd_devtools_extension/lib/rohd_devtools/services/tree_service.dart Updates hierarchy evaluation.
pubspec.yaml Raises minimum Dart SDK.
packages/rohd_waveform/lib/src/waveform_repository.dart Simplifies asynchronous retrieval.
packages/rohd_waveform/lib/src/waveform_api.dart Simplifies default futures.
packages/rohd_waveform/analysis_options.yaml Adds analyzer exclusions.
packages/rohd_hierarchy/test/occurrence_trie_test.dart Tests occurrence trie.
packages/rohd_hierarchy/test/hierarchy_model_test.dart Adds cross-platform model tests.
packages/rohd_hierarchy/test/filter_bank_integration_test.dart Moves portable tests and restricts VM tests.
packages/rohd_hierarchy/pubspec.yaml Enables package publishing.
packages/rohd_hierarchy/lib/src/occurrence_trie.dart Adds occurrence-address trie.
packages/rohd_hierarchy/lib/src/hierarchy_models.dart Exports occurrence trie.
packages/rohd_hierarchy/analysis_options.yaml Adds analyzer exclusions.
lib/src/utilities/simcompare.dart Migrates synthesis and improves cleanup.
lib/src/synthesizers/utilities/utilities.dart Exports synthesis helpers.
lib/src/synthesizers/utilities/synth_structure_slice.dart Adds structure slice helper.
lib/src/synthesizers/utilities/synth_structure_layout.dart Adds packed structure layout.
lib/src/synthesizers/utilities/synth_structure_concat.dart Adds structure concatenation helper.
lib/src/synthesizers/utilities/synth_module_stop_policy.dart Adds hierarchy stopping policy.
lib/src/synthesizers/utilities/synth_logic.dart Adds nullable selected-name accessor.
lib/src/synthesizers/utilities/synth_assignment.dart Updates copyright.
lib/src/synthesizers/utilities/synth_array_slice.dart Adds array slice helper.
lib/src/synthesizers/utilities/synth_array_concat.dart Adds array concatenation helper.
lib/src/synthesizers/systemverilog/systemverilog.dart Exports SystemVerilog service.
lib/src/synthesizers/systemverilog/system_verilog_service.dart Implements SystemVerilog service.
lib/src/synthesizers/synthesizers.dart Exports netlist APIs.
lib/src/synthesizers/synthesis_result.dart Updates copyright.
lib/src/synthesizers/netlist/netlist.dart Adds netlist barrel export.
lib/src/synthesizers/netlist/netlist_validation.dart Adds structural validation.
lib/src/synthesizers/netlist/netlist_synthesizer_configuration.dart Adds netlist configuration.
lib/src/synthesizers/netlist/netlist_synthesis_result.dart Adds immutable netlist result.
lib/src/synthesizers/netlist/netlist_synth_module_definition.dart Adds netlist-specific module processing.
lib/src/signals/wire_net.dart Updates copyright.
lib/src/signals/signals.dart Includes typed/value array parts.
lib/src/signals/logic_value_array_of.dart Adds typed value arrays.
lib/src/signals/logic_structure.dart Adds flattening and constant detection.
lib/src/signals/logic_array_of.dart Adds typed logic arrays.
lib/src/signals/const.dart Reformats constructors.
lib/src/modules/conditionals/flop.dart Exposes constant reset value.
lib/src/module.dart Adds output convenience APIs.
lib/src/diagnostics/module_services.dart Adds service registry.
lib/src/diagnostics/module_service.dart Adds service and artifact contracts.
lib/src/diagnostics/inspector_service.dart Bridges hierarchy registration.
lib/src/diagnostics/diagnostics.dart Adds diagnostics barrel export.
lib/src/collections/iterable_removable_queue.dart Removes redundant null assertions.
lib/rohd.dart Exports new public APIs.
example/tree.dart Uses SystemVerilog service.
example/oven_fsm.dart Uses waveform service.
example/logic_array.dart Uses service APIs.
example/fir_filter.dart Uses service APIs.
example/filter_bank/shared_data_bus.dart Adds shared bidirectional bus.
example/filter_bank/mac_unit.dart Adds pipelined MAC module.
example/filter_bank/filter_sample.dart Adds structured filter sample.
example/filter_bank/filter_data_interface.dart Adds filter interface.
example/filter_bank/filter_controller.dart Adds filter controller FSM.
example/filter_bank/filter_bank_modules.dart Exports filter-bank modules.
example/filter_bank/coeff_bank.dart Adds coefficient bank.
example/filter_bank.dart Adds filter-bank simulation.
example/example.dart Uses service APIs.
doc/user_guide/_docs/A21-generation.md Documents generation services.
doc/user_guide/_docs/A20-logic-arrays.md Documents typed arrays.
doc/user_guide/_docs/A19-logic-structures.md Documents structure flattening.
doc/tutorials/chapter_9/rohd_vf.md Migrates waveform tutorial.
doc/tutorials/chapter_9/rohd_vf_example/lib/rohd_vf_example.dart Migrates waveform example.
doc/tutorials/chapter_8/oven_fsm.dart Migrates waveform API.
doc/tutorials/chapter_8/counter_interface.dart Migrates service APIs.
doc/tutorials/chapter_8/carry_save_multiplier.dart Migrates waveform API.
doc/tutorials/chapter_8/answers/exercise_3_pipeline.dart Migrates service APIs.
doc/tutorials/chapter_8/answers/exercise_2_toycapsule_fsm.dart Migrates service APIs.
doc/tutorials/chapter_8/answers/exercise_1_spi.dart Migrates service APIs.
doc/tutorials/chapter_8/03_pipeline.md Migrates waveform documentation.
doc/tutorials/chapter_8/02_finite_state_machine.md Migrates waveform documentation.
doc/tutorials/chapter_8/01_interface.md Migrates service documentation.
doc/tutorials/chapter_7/shift_register.dart Migrates waveform API.
doc/tutorials/chapter_7/answers/exercise_1_d_flip_flop.dart Migrates service APIs.
doc/tutorials/chapter_7/00_sequential_logic.md Migrates service documentation.
doc/tutorials/chapter_5/n_bit_adder.dart Updates synthesis example.
doc/tutorials/chapter_5/answers/n_bit_subtractor.dart Migrates synthesis API.
doc/tutorials/chapter_5/answers/full_subtractor.dart Migrates synthesis API.
doc/tutorials/chapter_5/answers/full_adder.dart Migrates synthesis API.
doc/tutorials/chapter_5/00_basic_modules.md Migrates synthesis documentation.
doc/tutorials/chapter_4/basic_generation_sv.dart Migrates synthesis API.
doc/tutorials/chapter_4/answers/exercise_2_sv.dart Migrates synthesis API.
doc/tutorials/chapter_4/answers/exercise_1_sv.dart Migrates synthesis API.
doc/tutorials/chapter_3/full_adder.dart Migrates synthesis API.
doc/tutorials/chapter_3/answers/exercise_sv.dart Migrates synthesis API.
doc/tutorials/chapter_2/helper.dart Migrates synthesis helper.
doc/tutorials/chapter_1/01_setup_installation.md Migrates introductory examples.
dart_test.yaml Configures benchmark timeout.
CONTRIBUTING.md Updates links and copyright template.
CHANGELOG.md Documents next-release APIs.
benchmark/wave_dump_benchmark.dart Migrates waveform benchmark.
benchmark/many_submodules_benchmark.dart Migrates synthesis benchmark.
.github/workflows/general.yml Removes trailing blank line.
.devcontainer/devcontainer.json Adds Node.js 24 feature.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rohd_devtools_extension/lib/rohd_devtools/services/tree_service.dart Outdated
Comment thread lib/src/diagnostics/inspector_service.dart
Comment thread lib/src/module.dart Outdated
Comment thread pubspec.yaml Outdated
Comment thread lib/src/synthesizers/netlist/netlist_validation.dart Outdated
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread lib/src/synthesizers/systemverilog/system_verilog_service.dart
Comment thread lib/src/synthesizers/netlist/netlist_synthesizer_configuration.dart Outdated
Comment thread lib/src/diagnostics/waveform_service.dart Outdated
Comment thread lib/src/modules/conditionals/flop.dart Outdated

/// Returns the constant reset value if one was provided, or null if the
/// reset value is a port or no reset exists.
LogicValue? get constantResetValue =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is back again

Comment thread lib/src/module.dart Outdated
Comment thread doc/tutorials/chapter_8/02_finite_state_machine.md
Comment thread rohd_devtools_extension/lib/rohd_devtools/services/tree_service.dart Outdated
Comment thread lib/src/diagnostics/inspector_service.dart
Comment thread pubspec.yaml Outdated
@desmonddak

Copy link
Copy Markdown
Contributor Author

On .constantResetValue():

For example, the netlist mapper reads it when converting a FlipFlop with a constant asynchronous reset into a Yosys $adff cell:

if (hasReset && !hasDynamicResetValue) {
  parameters['ARST_VALUE'] =
      flipFlop.constantResetValue!.toString(includeWidth: false);
}

The actual call is in netlist_cell_mapper.dart.

Given:

final q = flop(
  clk,
  d,
  reset: reset,
  resetValue: 9,
  asyncReset: true,
);

constantResetValue returns the width-adjusted LogicValue for 9. The mapper uses it to emit the equivalent netlist parameter:

ARST_VALUE = 9

For a reset value supplied through a Logic port instead, constantResetValue returns null, and the mapper uses the dynamic reset-value input rather than a constant parameter.

@desmonddak
desmonddak force-pushed the module_services_api branch from c48a1c2 to 061d254 Compare August 24, 2026 21:20
@desmonddak desmonddak mentioned this pull request Aug 24, 2026
@desmonddak
desmonddak requested a review from mkorbel1 August 25, 2026 14:55
desmonddak and others added 2 commits August 25, 2026 15:21
Resolve the duplicated netlist_pre history against the identical Netlist tree now on main while preserving the module services API changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep generateSynth free of service-registration side effects and retain the existing ModuleNotBuiltException contract while routing output through SystemVerilogService.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@desmonddak
desmonddak force-pushed the module_services_api branch from 4811ed8 to 44fc0ed Compare August 25, 2026 22:52
desmonddak and others added 3 commits August 25, 2026 16:02
Restore copyright-only and whitespace-only files that had no substantive 2026 change, while retaining 2026 dates for files changed by earlier PRs. Make the Dart SDK upper bound explicit at 4.0.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread lib/src/module.dart Outdated
String generateSynth({
/// For additional output controls and access to synthesis results, use
/// [SystemVerilogService] directly.
SystemVerilogService dumpSystemVerilog({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should return a string not a service!

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.

3 participants