Documentation
¶
Overview ¶
Package diff computes a semantic diff between two netlist IR Designs. It operates purely on the IR (CONSTRAINTS C1), with no I/O and no platform calls, so the same diff runs over any format that reads into the IR. Design and rationale are in docsite/content/architecture/semantic-diff.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComponentChange ¶
ComponentChange records one changed field on a component present in both designs.
type NetChange ¶
type NetChange struct {
Kind NetChangeKind
Name string
OldName string
Added []string
Removed []string
OldProv *ir.Provenance
NewProv *ir.Provenance
// Approx is the near-match pass's evidence, non-nil only for NetRenamedApprox.
Approx *RenameEvidence
}
NetChange is one classified net-level change. Name is the net's name in the design where it exists (the new name for a rename); OldName is set only for renames. Added/Removed hold the "refdes.pin" connection deltas for a Hard change. OldProv/NewProv locate the net in each revision's source (nil on the side where the net does not exist).
type NetChangeKind ¶
type NetChangeKind string
NetChangeKind classifies a net change, following the ground-truth taxonomy engineers use (New / Deleted / rename / connectivity vs attribute-only). Equal nets are not changes, so they are kept apart in Report.Equal and reported only when a caller asks (agni issue 818).
const ( NetNew NetChangeKind = "new" // present only in the new design NetDeleted NetChangeKind = "deleted" // present only in the old design NetRenamed NetChangeKind = "renamed" // same connectivity, different name // NetRenamedApprox is a net the near-match pass believes was renamed while ALSO changing, which // the exact pass cannot recover because its signature no longer matches. It is a distinct kind // because it is the engine's best assignment among candidates rather than a fact, so a consumer // that must not act on a guess can filter on it. Approx carries the evidence. NetRenamedApprox NetChangeKind = "renamed-approx" NetHard NetChangeKind = "hard" // connectivity (pin membership) changed NetSoft NetChangeKind = "soft" // attribute-only change; connectivity identical // NetEqual is a net present in both designs under one name with identical connectivity and // attributes. It is never in Report.Nets, only in Report.Equal. NetEqual NetChangeKind = "equal" )
type RenameEvidence ¶ added in v0.2.0
type RenameEvidence struct {
OldCoverage float64 // fraction of the old net's endpoints that survived
OldCoverageSignificant float64 // the same, ignoring insignificant endpoint classes
NewCoverageSignificant float64 // fraction of the new net's significant endpoints that are old
Overlap int // endpoints in both
OverlapSignificant int // significant endpoints in both
OldEndpoints int // size of the old net
NewEndpoints int // size of the new net
OldSignificant int // significant endpoints on the old net
NewSignificant int // significant endpoints on the new net
}
RenameEvidence is why the near-match pass paired one deleted net with one added net, so a reader can DISAGREE with the pairing. It is set only on NetRenamedApprox. The significant figures are the ones insensitive to probe churn; see docsite/content/architecture/semantic-diff.md#near-matches-off-by-default.
type RenameOptions ¶ added in v0.2.0
type RenameOptions struct {
// Enabled gates the whole pass. False reproduces the exact-signature output exactly.
Enabled bool
// MinOldCoverage is the fraction of the OLD net's endpoints that must survive into the
// candidate. Lower catches heavier rewires and starts pairing nets that merely overlap.
MinOldCoverage float64
// MinOldCoverageSignificant is the same fraction over significant endpoints only. It does most
// of the work, because probe churn cannot move it.
MinOldCoverageSignificant float64
// MinNewCoverage is the fraction of the NEW net made up of old endpoints. It guards the
// asymmetric case, where a large net containing all of a small one is not its rename.
MinNewCoverage float64
// MinNewCoverageSignificant is that guard over significant endpoints.
MinNewCoverageSignificant float64
// MaxAddedSignificantFloor is how many significant endpoints a net may GAIN and still read as
// itself, when half its old significant count is smaller. The floor lets a two-endpoint net
// become four.
MaxAddedSignificantFloor int
// MinSignificantEndpoints is the floor below which no near-match is attempted. A net with one
// significant endpoint has no shape to match on.
MinSignificantEndpoints int
// InsignificantClasses are the device classes excluded from the overlap arithmetic, by
// ir.Component.DeviceClasses rather than by ref-des spelling. A house that treats mounting holes
// or fiducials as probe-like churn adds them here.
InsignificantClasses []string
}
RenameOptions tunes the NEAR-match rename pass: how much a net may change and still read as itself. Zero value is disabled, so a caller that passes nothing gets the exact-signature behaviour and nothing else.
These are a value rather than ambient state (C22), because a dense board with heavy test point coverage wants different numbers from a small module.
The thresholds come in significant/all pairs. Significant counts only endpoints whose component is not in InsignificantClasses, which makes the pass insensitive to probe churn. The knob table is in docsite/content/architecture/semantic-diff.md#near-matches-off-by-default.
func DefaultRenameOptions ¶ added in v0.2.0
func DefaultRenameOptions() RenameOptions
DefaultRenameOptions returns the calibrated thresholds, with Enabled false.
They are the settled values of a netlist comparison tool run against real revision pairs for years. Looser values mis-paired unrelated power rails and tighter ones missed renames where one decoupling capacitor was added or removed. Produce a precision number before trusting them on a corpus that matters.
type Report ¶
type Report struct {
ComponentsAdded []string
ComponentsRemoved []string
ComponentsChanged []ComponentChange
Nets []NetChange
// Equal holds the nets that did not change, as NetEqual entries sorted by name, so a revision
// report listing every net under its outcome need not rebuild them by subtracting the changes
// (agni issue 818). Render and the wire leave them out unless asked.
Equal []NetChange
}
Report is the result of diffing two designs.
func Designs ¶
func Designs(a, b *ir.Design, opts ...RenameOptions) *Report
Designs diffs a (old) against b (new).
Passing no opts, or a RenameOptions with Enabled false, runs the exact passes alone. The near-match pass is opt-in because it guesses, and a gate reading the output should say whether it wants that. Later options win, so a caller may layer a default and an override.