Pins: replace expected_signal_type field with a model-derived PinSpec

Introduce PinSpec (function/direction/pad/source) as the "expected" half of
pin verification, and make Pin::expected_signal_type() a derived accessor over
spec.function. pin_role() now returns a PinSpec; the connector layout (and,
later, BSDL) feed the same structure.

Pure refactor, behaviour-preserving: vpx_3u_role is still a stub, so every pin
maps to Other exactly as before. The new `pad` field will carry the BSDL
physical pin; direction/function will unlock contention/undriven/NC checks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 12:01:12 +02:00
parent fdf86a2e17
commit 1b507f1752
9 changed files with 88 additions and 23 deletions

54
src/system/pin_spec.hpp Normal file
View File

@@ -0,0 +1,54 @@
#ifndef _PIN_SPEC_HPP_
#define _PIN_SPEC_HPP_
#include "signal_type.hpp"
#include <string>
#pragma once
// Direction of a pin as seen from the component (port/BSDL semantics).
enum class PinDirection { Unknown, In, Out, Bidir, Passive, Power };
// Functional role of a pin. Richer than SignalType (which classifies *nets*):
// this classifies the *pin* itself and carries the TAP roles JTAG checks need.
enum class PinFunction {
Unknown, Power, Ground, Signal, Clock, NoConnect,
JtagTdi, JtagTdo, JtagTms, JtagTck, JtagTrst
};
// Where a pin's expected attributes came from. Lets verify report conflicts and
// lets a user override win over a model-derived value.
enum class SpecSource { None, Imported, ConnectorModel, Bsdl, Inferred, UserOverride };
// Expected, model-derived attributes of a pin (from a connector layout, a BSDL
// model, …). The "expected" half of the expected-vs-observed verify duality;
// the "observed" half stays Pin::signal() + the net + inference.
struct PinSpec {
PinFunction function = PinFunction::Unknown;
PinDirection direction = PinDirection::Unknown;
std::string pad; ///< Physical terminal (package ball/pin); "" if unknown.
SpecSource source = SpecSource::None;
};
// PinFunction -> the net SignalType a pin of that function expects to sit on.
inline SignalType to_signal_type(PinFunction f)
{
switch (f) {
case PinFunction::Power: return SignalType::Power;
case PinFunction::Ground: return SignalType::GndShield;
default: return SignalType::Other;
}
}
// Coarse SignalType -> PinFunction, used when a model only yields a SignalType.
inline PinFunction function_from_signal_type(SignalType t)
{
switch (t) {
case SignalType::Power: return PinFunction::Power;
case SignalType::GndShield: return PinFunction::Ground;
default: return PinFunction::Unknown;
}
}
#endif // _PIN_SPEC_HPP_