Add protocol-certification M10 catalog skeletons (2.72.0).
PCIe/CXL keep logical vs physical ids. I2C, CAN, RGMII and missing high-speed processor interfaces get required_checks; numbers stay UNKNOWN/MISSING_SOURCE until an official cite. No invented ohms.
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
"""M10 catalog skeletons: PCIe/CXL logical vs physical, I2C/CAN/RGMII, HS processor ids."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from backend.periscopex.protocol_catalog import (
|
||||
CAN_CHECKS,
|
||||
I2C_CHECKS,
|
||||
PCIE_CHECKS,
|
||||
PCI_PARALLEL_CHECKS,
|
||||
RGMII_CHECKS,
|
||||
build_m0_catalog,
|
||||
load_catalog,
|
||||
parse_catalog,
|
||||
)
|
||||
|
||||
HS_LOGICAL = {
|
||||
"pci", "pci-x", "pcie", "cxl", "ccix", "opencapi",
|
||||
"upi", "dmi", "infinity-fabric", "hypertransport", "ucie",
|
||||
}
|
||||
|
||||
NO_INVENTED = ("90", "100 ", "50 ", "120")
|
||||
|
||||
|
||||
def test_m10_logical_physical_split_pcie_cxl():
|
||||
cat = load_catalog()
|
||||
pcie_log = next(p for p in cat.logical_protocols if p.id == "pcie")
|
||||
cxl_log = next(p for p in cat.logical_protocols if p.id == "cxl")
|
||||
pcie_phy = next(p for p in cat.physical_interfaces if p.id == "pcie-phy-pcb")
|
||||
cxl_phy = next(p for p in cat.physical_interfaces if p.id == "cxl-phy-pcb")
|
||||
assert pcie_log.id != pcie_phy.id
|
||||
assert cxl_log.id != cxl_phy.id
|
||||
assert pcie_phy.logical_protocol_id == "pcie"
|
||||
assert cxl_phy.logical_protocol_id == "cxl"
|
||||
assert pcie_phy.logical_protocol_id != cxl_phy.logical_protocol_id
|
||||
assert pcie_phy.pcb_relevant == "YES"
|
||||
assert cxl_phy.pcb_relevant == "YES"
|
||||
assert set(pcie_phy.required_checks) == set(PCIE_CHECKS)
|
||||
assert set(cxl_phy.required_checks) == set(PCIE_CHECKS)
|
||||
|
||||
|
||||
def test_m10_high_speed_processor_ids_present():
|
||||
cat = load_catalog()
|
||||
logical = {p.id for p in cat.logical_protocols}
|
||||
assert HS_LOGICAL <= logical
|
||||
physical = {p.id: p for p in cat.physical_interfaces}
|
||||
assert physical["pci-pcb"].pcb_relevant == "YES"
|
||||
assert physical["pci-x-pcb"].pcb_relevant == "YES"
|
||||
assert set(physical["pci-pcb"].required_checks) == set(PCI_PARALLEL_CHECKS)
|
||||
assert physical["ccix-phy-pcb"].pcb_relevant == "YES"
|
||||
assert physical["opencapi-phy-pcb"].pcb_relevant == "YES"
|
||||
assert physical["hypertransport-phy-pcb"].pcb_relevant == "YES"
|
||||
assert physical["upi-phy"].pcb_relevant == "CONDITIONAL"
|
||||
assert physical["dmi-phy"].pcb_relevant == "CONDITIONAL"
|
||||
assert physical["infinity-fabric-phy"].pcb_relevant == "CONDITIONAL"
|
||||
assert physical["ucie-die-to-die"].pcb_relevant == "CONDITIONAL"
|
||||
assert physical["ucie-die-to-die"].logical_protocol_id == "ucie"
|
||||
for pid in HS_LOGICAL:
|
||||
ifaces = [p for p in cat.physical_interfaces if p.logical_protocol_id == pid]
|
||||
assert ifaces, pid
|
||||
assert all(p.id != pid for p in ifaces)
|
||||
|
||||
|
||||
def test_m10_i2c_can_rgmii_skeletons_named_checks_no_numbers():
|
||||
cat = load_catalog()
|
||||
i2c = next(p for p in cat.physical_interfaces if p.id == "i2c-pcb")
|
||||
can = next(p for p in cat.physical_interfaces if p.id == "can-pcb")
|
||||
rgmii = next(p for p in cat.physical_interfaces if p.id == "rgmii-pcb")
|
||||
assert i2c.logical_protocol_id == "i2c"
|
||||
assert can.logical_protocol_id == "can"
|
||||
assert rgmii.logical_protocol_id == "rgmii"
|
||||
assert i2c.pcb_relevant == "YES"
|
||||
assert can.pcb_relevant == "YES"
|
||||
assert rgmii.pcb_relevant == "YES"
|
||||
assert set(i2c.required_checks) == set(I2C_CHECKS)
|
||||
assert set(can.required_checks) == set(CAN_CHECKS)
|
||||
assert set(rgmii.required_checks) == set(RGMII_CHECKS)
|
||||
for iface in (i2c, can, rgmii):
|
||||
for c in iface.constraints:
|
||||
assert c.value is None
|
||||
assert c.value_kind in {
|
||||
"MISSING_SOURCE", "UNKNOWN", "PHY_DEPENDENT",
|
||||
"CONTROLLER_DEPENDENT", "VENDOR_DEPENDENT", "NOT_APPLICABLE",
|
||||
}
|
||||
assert c.value_kind != "NUMERIC"
|
||||
|
||||
|
||||
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":
|
||||
assert c.unit is None
|
||||
blob = json.dumps([
|
||||
c.model_dump() for p in loaded.physical_interfaces for c in p.constraints
|
||||
if p.logical_protocol_id in HS_LOGICAL | {"i2c", "can", "rgmii"}
|
||||
])
|
||||
for token in NO_INVENTED:
|
||||
assert token not in blob
|
||||
usb = next(p for p in loaded.physical_interfaces if p.id == "usb2-hs-dpair")
|
||||
z = next(c for c in usb.constraints if c.parameter == "differential_impedance")
|
||||
assert z.value_kind == "MISSING_SOURCE"
|
||||
assert z.value is None
|
||||
assert z.source is None
|
||||
|
||||
|
||||
def test_m10_builder_matches_committed_catalog():
|
||||
loaded = load_catalog()
|
||||
rebuilt = parse_catalog(build_m0_catalog())
|
||||
assert loaded.model_dump() == rebuilt.model_dump()
|
||||
Reference in New Issue
Block a user