Fill protocol packs from recovered USB CTS, Type-C FTS, DVI 1.0, and IEEE 802.3-2012 Section Two (2.74.0).

NUMERIC rows cite document title, revision, section/table, and page. USB Zdiff, Type-C Rp/Rd, 10BASE-T, and 1000BASE-T stay UNKNOWN. PDFs are not in git.
This commit is contained in:
2026-09-22 14:43:26 +02:00
parent 949f5f1541
commit f3be485b75
9 changed files with 1805 additions and 472 deletions
+20 -3
View File
@@ -26,6 +26,7 @@ REQUIRED_LOGICAL = {
"usb2-ls-fs", "usb2-ls", "usb2-fs", "usb2-hs", "usb-c", "usb-c-usb2",
"usb3-x", "usb4", "100base-tx", "10base-t", "1000base-t",
"hdmi-1.4", "hdmi-2.0", "hdmi-frl",
"dvi",
"ddr-family", "ddr4", "lpddr-family", "lpddr4",
"hbm-family", "hbm3", "hyperbus", "qspi", "octal-spi", "emmc", "ufs",
"axi4", "axi4-lite", "ahb", "apb", "wishbone", "avalon-mm", "avalon-st",
@@ -98,12 +99,28 @@ def test_hdmi_mini_is_same_logical_different_connector():
assert mini.connector == "HDMI-C-mini"
def test_catalog_has_no_invented_ohm_numbers():
def test_catalog_numeric_requires_official_cite_no_invented_usb_90ohm():
cat = load_catalog()
usb_z = []
for iface in cat.physical_interfaces:
for c in iface.constraints:
assert c.value is None
assert c.value_kind != "NUMERIC"
if c.value_kind == "NUMERIC":
assert c.value is not None
assert c.source is not None
assert c.source.document and c.source.organization
assert c.source.revision
assert c.source.page
assert c.source.section or c.source.table
if (
iface.logical_protocol_id.startswith("usb")
and c.parameter == "differential_impedance"
):
usb_z.append(c)
assert c.value_kind != "NUMERIC"
assert c.value is None
assert usb_z
blob = json.dumps([c.model_dump() for c in usb_z])
assert "90" not in blob
def test_recommended_is_not_fail_mandatory():
+5 -3
View File
@@ -90,9 +90,11 @@ def test_m10_no_invented_ohms_and_no_usbif_fill():
loaded = load_catalog()
for iface in loaded.physical_interfaces:
for c in iface.constraints:
assert c.value is None
assert c.value_kind != "NUMERIC" or (c.source is not None)
if c.value_kind != "NUMERIC":
if c.value_kind == "NUMERIC":
assert c.source is not None
assert c.source.document
else:
assert c.value is None
assert c.unit is None
blob = json.dumps([
c.model_dump() for p in loaded.physical_interfaces for c in p.constraints
+14 -8
View File
@@ -84,15 +84,21 @@ def test_usb2_and_usb_c_unknown_with_usbif_needed_document_no_90ohm():
or p.id.startswith("usb-")
]
assert usb_ifaces
blob = json.dumps([c.model_dump() for p in usb_ifaces for c in p.constraints])
assert "90" not in blob
z_blob = json.dumps([
c.model_dump() for p in usb_ifaces for c in p.constraints
if c.parameter == "differential_impedance"
])
assert "90" not in z_blob
for p in usb_ifaces:
for c in p.constraints:
assert c.value is None
assert c.value_kind != "NUMERIC"
if c.parameter == "differential_impedance":
assert c.value is None
assert c.value_kind != "NUMERIC"
if c.value_kind in {"UNKNOWN", "MISSING_SOURCE"}:
assert c.needed_document
assert "USB-IF" in c.needed_document or "specification" in c.needed_document.lower()
assert "USB-IF" in c.needed_document or "specification" in c.needed_document.lower() or "Specification" in c.needed_document
if p.logical_protocol_id == "usb-c" and c.parameter in {"rp", "rd"}:
assert c.value_kind == "UNKNOWN"
over = next(p for p in cat.physical_interfaces if p.id == "usb-c-usb2-receptacle")
assert over.logical_protocol_id == "usb2-hs"
assert over.connector == "Type-C"
@@ -202,8 +208,8 @@ def test_mini_hdmi_is_connector_not_protocol_id():
def test_ethernet_hdmi_skeletons_unknown_needed_document():
cat = load_catalog()
for lid in (
"10base-t", "100base-tx", "1000base-t", "2.5gbase-t", "5gbase-t",
"10gbase-t", "sgmii", "1000base-x", "100base-fx", "10gbase-r",
"10base-t", "1000base-t", "2.5gbase-t", "5gbase-t",
"10gbase-t", "sgmii", "1000base-x", "10gbase-r",
"hdmi-1.4", "hdmi-2.0", "hdmi-frl",
):
ifaces = [p for p in cat.physical_interfaces if p.logical_protocol_id == lid]
@@ -218,7 +224,7 @@ def test_ethernet_hdmi_skeletons_unknown_needed_document():
if lid.startswith("hdmi"):
assert "HDMI" in c.needed_document
else:
assert "IEEE" in c.needed_document or "PHY" in (c.needed_document or "")
assert "IEEE" in c.needed_document or "PHY" in (c.needed_document or "") or "SGMII" in (c.needed_document or "")
tmds = next(p for p in cat.physical_interfaces if p.id == "hdmi-1.4-tmds-type-a")
frl = next(p for p in cat.physical_interfaces if p.id == "hdmi-frl-pcb")
assert tmds.logical_protocol_id != frl.logical_protocol_id
+148
View File
@@ -0,0 +1,148 @@
"""Recovered-PDF pack: USB Electrical CTS, Type-C FTS, DVI 1.0, IEEE 802.3-2012 §2."""
from __future__ import annotations
import json
from backend.periscopex.models import (
Component,
ComponentType,
DesignGraph,
Net,
NetType,
PinConnection,
)
from backend.periscopex.protocol_catalog import load_catalog
from backend.periscopex.protocol_recognize import recognize_physical_buses
def _cite_ok(c) -> None:
assert c.value_kind == "NUMERIC"
assert c.value is not None
src = c.source
assert src is not None
assert src.document
assert src.organization
assert src.revision
assert src.page
assert src.section or src.table
def test_usb_cts_hs_numeric_cited_no_zdiff_90():
cat = load_catalog()
hs = next(p for p in cat.physical_interfaces if p.id == "usb2-hs-dpair")
by = {c.parameter: c for c in hs.constraints}
_cite_ok(by["data_rate"])
assert by["data_rate"].value == 480.0
assert by["data_rate"].unit == "Mb/s"
assert by["data_rate"].source.document == "USB 2.0 Electrical Compliance Test Specification"
assert "1.08" in by["data_rate"].source.revision
assert "EL_2" in (by["data_rate"].source.section or "")
assert by["rise_time"].value == 300.0
assert by["fall_time"].value == 300.0
assert by["pull_up"].value == 1500.0
assert by["dc_resistance"].value == 17.0
assert by["dc_resistance_captive_cable_device"].value == 23.0
assert by["dc_resistance_host_hub_downstream"].value == 13.0
for key in (
"data_rate", "rise_time", "fall_time", "pull_up", "dc_resistance",
"dc_resistance_captive_cable_device", "dc_resistance_host_hub_downstream",
):
_cite_ok(by[key])
assert by[key].source.organization == "USB-IF"
z = by["differential_impedance"]
assert z.value_kind == "UNKNOWN"
assert z.value is None
ls = next(p for p in cat.physical_interfaces if p.id == "usb2-ls-dpair")
ls_rate = next(c for c in ls.constraints if c.parameter == "data_rate")
assert ls_rate.value_kind == "UNKNOWN"
blob = json.dumps(z.model_dump())
assert "90" not in blob
def test_type_c_rp_rd_unknown_fts_does_not_state_ohms():
cat = load_catalog()
rec = next(p for p in cat.physical_interfaces if p.id == "usb-c-receptacle")
by = {c.parameter: c for c in rec.constraints}
for p in ("rp", "rd", "ra", "cc"):
assert by[p].value_kind == "UNKNOWN"
assert "Cable and Connector" in (by[p].needed_document or "")
assert by["voltage"].value_kind == "UNKNOWN"
_cite_ok(by["gnd_ir_drop_cable"])
assert by["gnd_ir_drop_cable"].value == 250.0
assert by["gnd_ir_drop_cable"].source_type == "CABLE"
assert by["gnd_ir_drop_cable"].mandatory == "OPTIONAL"
_cite_ok(by["vbus_ir_drop_cable"])
assert by["vbus_ir_drop_cable"].value == 500.0
assert "Functional Test" in by["vbus_ir_drop_cable"].source.document
def test_dvi_not_hdmi_numeric_from_dvi_10():
cat = load_catalog()
logical = {p.id for p in cat.logical_protocols}
assert "dvi" in logical
assert "mini-hdmi" not in logical
dvi = next(p for p in cat.physical_interfaces if p.id == "dvi-1.0-tmds")
assert dvi.logical_protocol_id == "dvi"
assert dvi.connector == "DVI"
by = {c.parameter: c for c in dvi.constraints}
_cite_ok(by["termination"])
assert by["termination"].value == 50.0
assert by["termination"].source.table == "Table 4-2"
_cite_ok(by["differential_impedance"])
assert by["differential_impedance"].value == 100.0
assert by["differential_impedance"].source.table == "Table 4-7"
assert by["differential_impedance"].source.organization == "DDWG"
hdmi = next(p for p in cat.physical_interfaces if p.id == "hdmi-1.4-tmds-type-a")
hz = next(c for c in hdmi.constraints if c.parameter == "differential_impedance")
assert hz.value_kind == "UNKNOWN"
g = DesignGraph(
components={
"J3": Component(
reference="J3", value="DVI-D receptacle",
footprint="DVI_D",
component_type=ComponentType.CONNECTOR,
pins={"1": "TX0+"},
),
},
nets={"TX0+": Net(
name="TX0+", net_type=NetType.SIGNAL,
pins=[PinConnection(component_ref="J3", pin_number="1")],
)},
)
insts = recognize_physical_buses(g)
logs = {i.logical_protocol_id for i in insts}
assert "dvi" in logs
assert "hdmi-1.4" not in logs
assert "hdmi-2.0" not in logs
def test_ieee8023_section2_100base_tx_not_10base_or_1000():
cat = load_catalog()
tx = next(p for p in cat.physical_interfaces if p.id == "100base-tx-mdi")
by = {c.parameter: c for c in tx.constraints}
_cite_ok(by["data_rate"])
assert by["data_rate"].value == 100.0
assert by["data_rate"].source.document.startswith("IEEE Std 802.3-2012")
assert by["data_rate"].source.revision == "2012"
assert by["data_rate"].source.section == "21.1"
_cite_ok(by["cable_channel"])
assert by["cable_channel"].value == 100.0
assert by["cable_channel"].source_type == "CABLE"
assert by["cable_channel"].source.section == "25.4.9.2.2"
z = by["differential_impedance"]
assert z.value_kind == "UNKNOWN"
assert "TP-PMD" in (z.needed_document or "")
ten = next(p for p in cat.physical_interfaces if p.id == "10base-t-mdi")
tdr = next(c for c in ten.constraints if c.parameter == "data_rate")
assert tdr.value_kind == "UNKNOWN"
assert "Clause 14" in (tdr.needed_document or "")
gbe = next(p for p in cat.physical_interfaces if p.id == "1000base-t-mdi")
gdr = next(c for c in gbe.constraints if c.parameter == "data_rate")
assert gdr.value_kind == "UNKNOWN"
assert "Clause 40" in (gdr.needed_document or "")
fx = next(p for p in cat.physical_interfaces if p.id == "100base-fx-pcb")
fxr = next(c for c in fx.constraints if c.parameter == "data_rate")
_cite_ok(fxr)
assert fxr.value == 100.0
assert fxr.source.section == "26.1"