Skip to content

ROHD Hierarchy: an API for compact, generic traversal of a remote design#653

Open
desmonddak wants to merge 5 commits intointel:mainfrom
desmonddak:rohd_hierarchy
Open

ROHD Hierarchy: an API for compact, generic traversal of a remote design#653
desmonddak wants to merge 5 commits intointel:mainfrom
desmonddak:rohd_hierarchy

Conversation

@desmonddak
Copy link
Copy Markdown
Contributor

…pact, canonical addresses

Description & Motivation

It would be nice to have a hierarchy api that allows us to remotely traverse a design hierarchy using compact addressing to support a devtools-based debugger. For example, if we receive a dictionary of the design, we can communicate requests for more data from the design by using a compressed addressing scheme like (5th instance, 4th instance below that, 15th signal) to receive a set of data on that signal. If we need 1000s of simulation values, for example, we do not need to transmit all names, providing an order of magnitude savings in transmission bandwidth.

This capability allows us to incrementally a design view over multiple data requests. For now, we primarily have two: a 'slim' view, which is the full hierarchy with names, and then a full view, which is all connectivity. This can be extended to allow for a more incremental dictionary load to allow a remote agent to use limited memory to transit a very large design.

Related Issue(s)

None.

Testing

Tests are provided with a small design fixture using a new netlist format in JSON, equivalent to Yosys JSON. A future netlist synthesizer will provide design data nd this rohd_hierarchy adapter will allow us to communicate between remote agents.

Backwards-compatibility

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

No

Documentation

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

A README.md is included to describe the motivation, architecture, and key features of the api.

Copy link
Copy Markdown
Contributor

@mkorbel1 mkorbel1 left a comment

Choose a reason for hiding this comment

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

Will be reviewing this next, couple quick comments until I have a moment to continue. This looks really great so far!

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.

should we include (either copy/paste or via some sort of include if that is supported sufficiently) the rest of the analyzer rules from base ROHD?

}
}
}

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.

Split classes into individual files?

@mkorbel1
Copy link
Copy Markdown
Contributor

mkorbel1 commented May 7, 2026

Question: how do you imagine this package being used/depended on? Would we release it as a separate package on pub.dev?

/// ## Quick Start
/// ```dart
/// // 1. Create hierarchy
/// final root = HierarchyNode(id: 'top', name: 'top',
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.

nit: multi-line code comment not formatted as nicely as it could have been

/// The kind of node in the hardware hierarchy.
enum HierarchyKind {
/// A module definition in the hierarchy.
module,
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.

should this be called "definition" instead to contrast with "instance"? and actually, more generally, what is a definition in a hierarchy?

/// Use this before a [HierarchyNode] exists (e.g. when deciding whether
/// to recurse into a Yosys cell definition). For an existing node, use
/// the instance getter [isPrimitiveCell] instead.
static bool isPrimitiveType(String cellType) => cellType.startsWith(r'$');
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.

question: is this yosys conventions leaking into a generic abstraction or is it fine to keep them coupled like this?

/// Hierarchical address for this node.
/// Assigned by [buildAddresses] to enable efficient navigation.
/// Format: [child0, child1, ..., childN] for nested modules.
HierarchyAddress? address;
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.

something feels off about this not being immutable (final) and requires a function later to update it. is there a way to make this safer/more automatic?

required String direction,
int width = 1,
String? id,
String type = 'wire',
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.

"wire" is an SV type -- do we want that to be the default here? in ROHD everything is Logic and ports are by default logic as well in generated SV, wheras LogicNet inOut ports would map to wire

/// Check if a [node] or any of its descendants match [searchTerm].
///
/// The search term is split on `/` or `.` into hierarchical segments.
/// Each segment is matched case-insensitively via substring containment
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.

question: why case insensitive?

root, [root.name], parts, 0, results, effectiveLimit);
return results;
}

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.

general question: have you considered fuzzy searches?

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.

question: will this package eventually support tracing connectivity? e.g. connection extractor in rohd bridge?

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.

why not included in appropriate locations?

});

// ------------------------------------------------------------------
// VCD-style dot-separated paths
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.

"vcd style"? another new term?

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.

2 participants