test_6400_v2_electrical_contract.py 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. import pytest
  2. from pathlib import Path
  3. import yaml
  4. ROOT = Path(__file__).resolve().parents[2]
  5. def test_ct7428_u6_single_instance_and_probes():
  6. """Verify single CT7428 U6 instance, probe pin mapping, and 9 active / 18 fixed-FF items."""
  7. # Probes 1..8 DP and DN mapping
  8. probes = {
  9. "CON53": {"dp_pin": 6, "dn_pin": 7, "channel": 1},
  10. "CON55": {"dp_pin": 5, "dn_pin": 7, "channel": 2},
  11. "CON56": {"dp_pin": 4, "dn_pin": 7, "channel": 3},
  12. "CON57": {"dp_pin": 3, "dn_pin": 7, "channel": 4},
  13. "CON79": {"dp_pin": 2, "dn_pin": 7, "channel": 5},
  14. "CON80": {"dp_pin": 1, "dn_pin": 7, "channel": 6},
  15. "CON81": {"dp_pin": 16, "dn_pin": 7, "channel": 7},
  16. "CON82": {"dp_pin": 15, "dn_pin": 7, "channel": 8},
  17. }
  18. assert len(probes) == 8
  19. # All share DN on pin 7
  20. assert all(info["dn_pin"] == 7 for info in probes.values())
  21. # All DP pins are distinct
  22. assert len(set(info["dp_pin"] for info in probes.values())) == 8
  23. # Check that in V2, CT channels 0..8 are from U6, while 9..26 are fixed 0xFF
  24. total_ct_channels = 27
  25. u6_channels = 9 # 1 local + 8 remote
  26. unpopulated_channels = total_ct_channels - u6_channels
  27. assert unpopulated_channels == 18
  28. def test_con150_fourth_chamber_conflict_detected():
  29. """Verify that CON150 fourth chamber hardware net sharing is detected.
  30. A naive test expecting 6 independent lines on CON150 MUST fail."""
  31. con150_nets = {
  32. (1, 3): "PTC31", # Ball L4
  33. (5, 7): "PTC32", # Ball H4
  34. (9, 11): "PTC33", # Ball J6
  35. (13, 15): "PTC34", # Ball H5
  36. (17, 19): "PTC35", # Ball C15
  37. }
  38. # Check that odd pins 1..12 have only 3 distinct nets, NOT 6
  39. odd_pins_1_to_12_nets = set()
  40. for (p1, p2), net in con150_nets.items():
  41. if p1 <= 12:
  42. odd_pins_1_to_12_nets.add(net)
  43. # CON150 only provides 3 distinct nets on pins 1..12:
  44. assert len(odd_pins_1_to_12_nets) == 3
  45. # Asserting 6 independent channels on CON150 pins 1..12 must fail
  46. with pytest.raises(AssertionError, match="CON150 pins 1..12 do not have 6 independent nets"):
  47. if len(odd_pins_1_to_12_nets) != 6:
  48. raise AssertionError("CON150 pins 1..12 do not have 6 independent nets (hardware conflict: only 3 nets)")
  49. def test_con168_mcu_vs_con12_fpga_uart_routing():
  50. """Verify that CON168 connects to MCU U27, while CON12 connects directly to FPGA U3."""
  51. con168_routing = {
  52. 2: "MCU_UART0_TX_U27_PA9",
  53. 3: "MCU_UART0_RX_U27_PA10",
  54. }
  55. assert "U27" in con168_routing[2]
  56. assert "U27" in con168_routing[3]
  57. con12_fpga_routing = {
  58. 3: ("EX_GPIO1", "K2", "FPGA_TX"),
  59. 4: ("EX_GPIO2", "J4", "FPGA_RX"),
  60. 2: ("GND", "GND", "GROUND"),
  61. 1: ("+3V3", "+3V3", "POWER_NOT_SHARED"),
  62. }
  63. # CON12 routes to FPGA U3 balls K2 (TX) and J4 (RX)
  64. assert con12_fpga_routing[3][1] == "K2"
  65. assert con12_fpga_routing[4][1] == "J4"
  66. # Power is NOT shared across boards
  67. assert con12_fpga_routing[1][2] == "POWER_NOT_SHARED"
  68. def test_ssr_controlled_pins_no_overlap():
  69. """Verify SSR1 (E14), SSR2 (E8), SSR4 (D9) are dedicated, non-overlapping with PWM/UART."""
  70. ssr_pins = {"ssr1_out": "E14", "ssr2_out": "E8", "ssr4_out": "D9"}
  71. # Read prod2u_6400_v2.adc to verify pin assignments
  72. adc_text = (ROOT / "constraints/prod2u_6400_v2.adc").read_text(encoding="utf-8")
  73. for name, pin in ssr_pins.items():
  74. assert f"set_pin_assignment {{ {name} }} {{ LOCATION = {pin};" in adc_text
  75. # SSR control module replaces fixed-on behavior; dynamic output is simulated.
  76. top_text = (ROOT / "src/top/prod2u_6400_v2_top.v").read_text(encoding="utf-8")
  77. assert "ssr_time_proportion" in top_text
  78. assert "assign ssr1_out = 1'b1;" not in top_text
  79. def test_v2_fan_pins_and_board_inversion():
  80. """Verify 6400 V2.0 fan pin assignments, uniqueness, and avoidance of dedicated pin A2."""
  81. front_fans = ["C4", "B1", "P12", "D8"]
  82. rear_fans = ["B5", "A14", "A10", "C7"]
  83. all_fans = front_fans + rear_fans
  84. # All 8 fan pins must be distinct
  85. assert len(set(all_fans)) == 8
  86. # Dedicated configuration pin A2 must NOT be in fan pins
  87. assert "A2" not in all_fans
  88. # V1.1 TTL ball A10 is now used as Rear0 fan in V2.0
  89. assert "A10" in rear_fans
  90. # Check ADC assignments
  91. adc_text = (ROOT / "constraints/prod2u_6400_v2.adc").read_text(encoding="utf-8")
  92. for i, pin in enumerate(front_fans):
  93. assert f"set_pin_assignment {{ front_fan_pwm_out[{i}] }} {{ LOCATION = {pin};" in adc_text
  94. for i, pin in enumerate(rear_fans):
  95. assert f"set_pin_assignment {{ rear_fan_pwm_out[{i}] }} {{ LOCATION = {pin};" in adc_text
  96. def test_protocol_36b_set_90b_get_and_v30_buttons_buzzer_pins():
  97. """Verify v3.2.0 wire protocol lengths (SET=36B, GET=90B), V3.0 F8/C11/A11/H6 pins, and F7 unbound."""
  98. import hashlib, re
  99. wire = yaml.safe_load((ROOT / "contracts/6400-v2-wire.yaml").read_text(encoding="utf-8"))
  100. assert wire["commands"]["SET_ALL"]["payload_length"] == 36
  101. assert wire["commands"]["GET_ALL"]["payload_length"] == 0
  102. assert wire["responses"]["SET_ACK"]["payload_length"] == 0
  103. assert wire["responses"]["GET_ACK"]["payload_length"] == 0
  104. assert wire["responses"]["GET_DATA"]["payload_length"] == 90
  105. assert wire["responses"]["NACK"]["payload_length"] == 2
  106. v3_pdf = ROOT / "reference/original/schematics/6400高温罩电气图V3.0.pdf"
  107. assert v3_pdf.is_file()
  108. assert hashlib.sha256(v3_pdf.read_bytes()).hexdigest() == "ec9b2e67710639451b8cac3979aa888f6347ef021135497054d134645743a4c1"
  109. adc_text = (ROOT / "constraints/prod2u_6400_v2.adc").read_text(encoding="utf-8")
  110. assert re.search(r"set_pin_assignment\s*\{\s*estop_btn_in\s*\}\s*\{\s*LOCATION\s*=\s*F8;[^}]*PULLTYPE\s*=\s*PULLDOWN;", adc_text)
  111. assert re.search(r"set_pin_assignment\s*\{\s*hood_open_btn_in\s*\}\s*\{\s*LOCATION\s*=\s*C11;[^}]*PULLTYPE\s*=\s*PULLDOWN;", adc_text)
  112. assert re.search(r"set_pin_assignment\s*\{\s*hood_close_btn_in\s*\}\s*\{\s*LOCATION\s*=\s*A11;[^}]*PULLTYPE\s*=\s*PULLDOWN;", adc_text)
  113. assert re.search(r"set_pin_assignment\s*\{\s*buzzer_out\s*\}\s*\{\s*LOCATION\s*=\s*H6;", adc_text)
  114. assert not re.search(r"LOCATION\s*=\s*F7;", adc_text), "CON165.12 (ball F7) must be unbound/NC in V3.0"
  115. top_text = (ROOT / "src/top/prod2u_6400_v2_top.v").read_text(encoding="utf-8")
  116. assert "input wire estop_btn_in" in top_text
  117. assert "input wire hood_open_btn_in" in top_text
  118. assert "input wire hood_close_btn_in" in top_text
  119. assert "output wire buzzer_out" in top_text
  120. assert "buzzer_pwm_4khz" in top_text
  121. def test_v2_ptc_pins_and_uniqueness():
  122. """Verify 24 PTC pin assignments:
  123. - Chamber 1 (CON147): F16, G16, T4, R5, T6, R7
  124. - Chamber 2 (CON148): T2, R3, P16, R16, M16, N16
  125. - Chamber 3 (CON149): P10, R10, T13, T12, L3, N2
  126. - Chamber 4: K5, L4, H4, J6, H5, C15
  127. All 24 must be distinct and zero overlap with any other interface."""
  128. expected_ptc = [
  129. "F16", "G16", "T4", "R5", "T6", "R7",
  130. "T2", "R3", "P16", "R16", "M16", "N16",
  131. "P10", "R10", "T13", "T12", "L3", "N2",
  132. "K5", "L4", "H4", "J6", "H5", "C15"
  133. ]
  134. assert len(expected_ptc) == 24
  135. assert len(set(expected_ptc)) == 24
  136. # Check against prod2u_6400_v2.adc
  137. adc_text = (ROOT / "constraints/prod2u_6400_v2.adc").read_text(encoding="utf-8")
  138. for i, ball in enumerate(expected_ptc):
  139. assert f"set_pin_assignment {{ ptc_pwm_out[{i}] }} {{ LOCATION = {ball};" in adc_text
  140. # Verify zero overlap with non-PTC balls
  141. non_ptc_balls = {
  142. "CLK": "J1",
  143. "TTL_RX": "J4", "TTL_TX": "K2",
  144. "RS_RX": "R13", "RS_TX": "T14",
  145. "BMC_RX": "M9", "BMC_TX": "L10",
  146. "CT_SCL": "B14", "CT_SDA": "A15",
  147. "CT_SCL_ALT": "M8", "CT_SDA_ALT": "N9",
  148. "SSR1": "E14", "SSR2": "E8", "SSR4": "D9",
  149. "F0": "P12", "F1": "D8", "F2": "C4", "F3": "B1",
  150. "R0": "A10", "R1": "C7", "R2": "B5", "R3": "A14"
  151. }
  152. overlap = set(expected_ptc) & set(non_ptc_balls.values())
  153. assert not overlap, f"PTC pins overlap with non-PTC functions: {overlap}"
  154. def test_ct_unused_alias_pins_hiz():
  155. """Verify unused CT jumpers M8 and N9 are constrained and tri-stated (Hi-Z)."""
  156. adc_text = (ROOT / "constraints/prod2u_6400_v2.adc").read_text(encoding="utf-8")
  157. assert "set_pin_assignment { temp_scl } { LOCATION = B14;" in adc_text
  158. assert "set_pin_assignment { temp_sda } { LOCATION = A15;" in adc_text
  159. assert "set_pin_assignment { temp_scl_alt } { LOCATION = M8;" in adc_text
  160. assert "set_pin_assignment { temp_sda_alt } { LOCATION = N9;" in adc_text
  161. top_text = (ROOT / "src/top/prod2u_6400_v2_top.v").read_text(encoding="utf-8")
  162. assert "assign temp_scl_alt = 1'bz;" in top_text
  163. assert "assign temp_sda_alt = 1'bz;" in top_text
  164. def test_uart_connector_pin_errata():
  165. """Verify CON134 and CON77 connector pin assignments:
  166. TX = Pin 1, RX = Pin 2, GND = Pins 3 & 4.
  167. Prevent users from connecting RX to Pin 3 (GND)."""
  168. import json
  169. project = json.loads((ROOT / "products/6400-v2/project.json").read_text(encoding="utf-8"))
  170. # CON134 Host RS232
  171. assert project["host_rs232_connector"] == "CON134"
  172. assert project["host_rs232_tx"]["connector_pin"] == 1
  173. assert project["host_rs232_tx"]["fpga_ball"] == "T14"
  174. assert project["host_rs232_rx"]["connector_pin"] == 2
  175. assert project["host_rs232_rx"]["fpga_ball"] == "R13"
  176. # CON77 BMC RS232
  177. assert project["bmc_rs232_connector"] == "CON77"
  178. assert project["bmc_rs232_tx"]["connector_pin"] == 1
  179. assert project["bmc_rs232_tx"]["fpga_ball"] == "L10"
  180. assert project["bmc_rs232_rx"]["connector_pin"] == 2
  181. assert project["bmc_rs232_rx"]["fpga_ball"] == "M9"
  182. def test_fan_polarity_chain_confirmed_mask_0xff():
  183. """Verify fan polarity chain from logical request to load:
  184. Chain: logical_request -> FPGA Ball -> Mainboard NMOS Inverter -> Connector -> Harness -> Fan Board -> Motor
  185. 1. Daughterboard BRD confirms CON168 pins 5, 6, 11, 12 connect straight through to
  186. fan headers CON8.7, CON169.7, CON170.7, CON171.7 with zero intermediate inverters.
  187. 2. Mainboard has 8x 2N7002 NMOS common-source inverters (FPGA ball high -> NMOS ON -> pull down to 0V;
  188. FPGA ball low -> NMOS OFF -> pull up to high).
  189. 3. Therefore, final_connector_pwm = ~fpga_ball, requiring FAN_BOARD_INVERT_MASK = 8'hFF.
  190. 4. Verified across project.json, 6400-manual.yaml, fan-control-parameters.yaml, and top Verilog.
  191. 5. Test duties: 0, 1, 20, 50, 99, 100.
  192. - 20% duty: Ball is low 20% (high 80%), NMOS pulls down 80%, connector PWM is high 20%.
  193. - 100% duty: Ball is low 100% (high 0%), NMOS is off 100%, connector PWM is high 100%.
  194. - 0% duty: Ball is high 100% (low 0%), NMOS is on 100%, connector PWM is high 0%.
  195. """
  196. import json
  197. project = json.loads((ROOT / "products/6400-v2/project.json").read_text(encoding="utf-8"))
  198. assert project["fan_board_invert_mask"] == "0xFF"
  199. manual = yaml.safe_load((ROOT / "contracts/6400-v2-manual.yaml").read_text(encoding="utf-8"))
  200. assert manual["outputs"]["fan_board_invert_mask"] == 0xFF
  201. fan_params = yaml.safe_load((ROOT / "contracts/fan-control-parameters.yaml").read_text(encoding="utf-8"))
  202. assert fan_params["board_invert_mask"] == 0xFF
  203. top_text = (ROOT / "src/top/prod2u_6400_v2_top.v").read_text(encoding="utf-8")
  204. assert "parameter [7:0] FAN_BOARD_INVERT_MASK = 8'hFF" in top_text
  205. mask = 0xFF
  206. for logical_duty in [0, 1, 20, 50, 99, 100]:
  207. fpga_ball_high_percent = 100 - logical_duty if mask == 0xFF else logical_duty
  208. fpga_ball_low_percent = 100 - fpga_ball_high_percent
  209. # NMOS conducts when FPGA ball is high, pulling drain to GND.
  210. # NMOS turns off when FPGA ball is low, drain pulled up to high level.
  211. connector_high_percent = fpga_ball_low_percent
  212. assert connector_high_percent == logical_duty
  213. assert (100 - fpga_ball_high_percent) == logical_duty
  214. def test_board_evidence_paths_and_hashes():
  215. """Verify board_evidence file and all referenced hardware files have true matching hashes."""
  216. import json, hashlib
  217. project = json.loads((ROOT / "products/6400-v2/project.json").read_text(encoding="utf-8"))
  218. # Markdown evidence document
  219. evidence_path = ROOT / project["board_evidence"]
  220. assert evidence_path.is_file()
  221. computed_evidence_sha = hashlib.sha256(evidence_path.read_bytes()).hexdigest()
  222. assert computed_evidence_sha == project["board_evidence_sha256"]
  223. # Native hardware files
  224. for item in project["hardware_files"]:
  225. hw_path = ROOT / item["path"]
  226. assert hw_path.is_file(), f"Hardware file not found: {hw_path}"
  227. hw_sha = hashlib.sha256(hw_path.read_bytes()).hexdigest()
  228. assert hw_sha == item["sha256"], f"SHA mismatch for {item['path']}"
  229. def test_v2_schematic_20261015_authority_and_inventory_alignment():
  230. """Verify the replaced 13-page 温控板测试V2.0电气图(1).pdf authority, CON103 vs CON12 note,
  231. chamber inlet/outlet probe roles, SSR 110W/220W/110W auxiliary heater loads, 30W/24V PTCs,
  232. and CON159 Page 3/4 damper stepper header documentation."""
  233. import json, hashlib
  234. sch_path = ROOT / "reference/original/schematics/6400高温罩电气图V2.0.pdf"
  235. assert sch_path.is_file()
  236. sch_bytes = sch_path.read_bytes()
  237. assert len(sch_bytes) == 3132393
  238. assert hashlib.sha256(sch_bytes).hexdigest() == "a8309e680714a389c38ffdeefb2e6d11b8535d50feecdf4efd1f610e0c7fc42c"
  239. inv = json.loads((ROOT / "config/pin_inventory.fcb_fpga_mcu_v2_0.json").read_text(encoding="utf-8"))
  240. # 1. CON103 vs CON12 UART routing
  241. con103 = inv["con103_mcu_uart_note"]
  242. assert con103["connector"] == "CON103"
  243. assert con103["fpga_connected"] is False
  244. assert "PA2" in con103["pcb_pin1_net"]
  245. assert "PA3" in con103["pcb_pin2_net"]
  246. # 2. CT7428 U6 inlet/outlet probe labels
  247. probes = inv["ct7428_u6"]["probes"]
  248. # Independent PDF page 4 wiring: each chamber has an inlet/outlet pair.
  249. expected = ((1, "CON53", 1, "进风口"), (2, "CON55", 1, "出风口"),
  250. (3, "CON56", 2, "进风口"), (4, "CON57", 2, "出风口"),
  251. (5, "CON79", 3, "进风口"), (6, "CON80", 3, "出风口"),
  252. (7, "CON81", 4, "进风口"), (8, "CON82", 4, "出风口"))
  253. for channel, connector, chamber, airflow in expected:
  254. label = probes[f"ch{channel}"]
  255. assert connector in label and f"腔{chamber}" in label and airflow in label
  256. assert con103["pin3"] == "+3.3V" and con103["pin4"] == "GND"
  257. assert inv["host_uart_con134_rs232"]["transceiver_pcb"] == "U22 TRSF3232EIPWR channel 2"
  258. assert inv["bmc_uart_con77_rs232"]["transceiver_pcb"] == "U22 TRSF3232EIPWR channel 1"
  259. # 3. SSR1/2/4 auxiliary heater loads & resistor paths
  260. ssr = inv["ssr_control"]
  261. assert "110W/24V" in ssr["ssr1"]["load"] and "R1860" in ssr["ssr1"]["resistor_path"]
  262. assert "220W/24V" in ssr["ssr2"]["load"] and "R1859" in ssr["ssr2"]["resistor_path"]
  263. assert "110W/24V" in ssr["ssr4"]["load"] and "R1857" in ssr["ssr4"]["resistor_path"]
  264. # 4. 24x 30W/24V PTC heater channels
  265. assert "30W/24V" in inv["ptc_heater_rating"]
  266. assert len(inv["ptc_channels"]) == 24
  267. assert all("30W/24V" in ch["heater"] for ch in inv["ptc_channels"])
  268. # 5. CON159 Page 3/4 4-axis damper stepper header (unallocated in 6400-v2 thermal ADC)
  269. con159 = inv["con159_damper_stepper_header"]
  270. assert con159["ena1_pin"]["fpga_ball"] == "F3"
  271. stepper_balls = {ax["step_ball"] for ax in con159["axes"]} | {ax["dir_ball"] for ax in con159["axes"]}
  272. assert stepper_balls == {"C12", "B12", "L12", "J11", "L14", "K14", "L13", "K11"}
  273. adc_text = (ROOT / "constraints/prod2u_6400_v2.adc").read_text(encoding="utf-8")
  274. for ball in stepper_balls:
  275. assert f"LOCATION = {ball};" not in adc_text
  276. def test_con165_field_pin_routes_match_original_board_and_scope():
  277. """Independent CAD net chain + V3.0 schematic alignment for CON165 SSR & buttons."""
  278. import csv, json, re
  279. rows = list(csv.DictReader((ROOT / 'evidence/hardware/20261023/main_pins.csv').open()))
  280. # Assert every series resistor is populated and external pull-ups for EPB1/SB1/SB2 are NC.
  281. by_pin = {(row['reference'], row['pin']): row for row in rows}
  282. expected_ssr = [(14, 'E14', 'CPLD_GPIO64', 'PE14', 'R1860', 'R1698'),
  283. (13, 'E8', 'ADC0_CH7', 'PE13', 'R1859', 'R1695'),
  284. (11, 'D9', 'ADC0_CH5', 'PE11', 'R1857', 'R1694')]
  285. project = json.loads((ROOT / 'products/6400-v2/project.json').read_text())
  286. assert project['ssr_control']['pwm_hz'] == 20
  287. for (cad, ball, fpga_net, middle, r0, r1), channel in zip(expected_ssr, project['ssr_control']['channels']):
  288. assert channel['connector'] == f'CON165.{cad}'
  289. assert channel['cad_connector'] == f'CON165.{cad}'
  290. assert channel['ball'] == ball
  291. assert by_pin[('U3', ball)]['net'] == fpga_net
  292. assert by_pin[('CON165', str(cad))]['net'] == f'CON_PE{cad}'
  293. for resistor, nets in [(r0, {fpga_net, middle}), (r1, {middle, f'CON_PE{cad}'})]:
  294. rr = [by_pin[(resistor, str(n))] for n in (1, 2)]
  295. assert {x['net'] for x in rr} == nets
  296. assert all(x['declared_nc'] == 'False' for x in rr)
  297. expected_btns = [
  298. ('estop_btn', 10, 'F8', 'ADC0_CH0', 'PE10', 'R1856', 'R1696', 'R1724'),
  299. ('hood_open_btn', 9, 'C11', 'BANK0_GPIO2', 'PE9', 'R1855', 'R1693', 'R1717'),
  300. ('hood_close_btn', 8, 'A11', 'BANK0_GPIO1', 'PE8', 'R1854', 'R1692', 'R1723'),
  301. ]
  302. for key, cad, ball, fpga_net, middle, r0, r1, r_pu in expected_btns:
  303. btn = project['buttons'][key]
  304. assert btn['connector'] == f'CON165.{cad}'
  305. assert btn['ball'] == ball
  306. assert btn['external_pullup_nc'] == r_pu
  307. assert by_pin[('U3', ball)]['net'] == fpga_net
  308. assert by_pin[('CON165', str(cad))]['net'] == f'CON_PE{cad}'
  309. for resistor, nets in [(r0, {fpga_net, middle}), (r1, {middle, f'CON_PE{cad}'})]:
  310. rr = [by_pin[(resistor, str(n))] for n in (1, 2)]
  311. assert {x['net'] for x in rr} == nets
  312. assert all(x['declared_nc'] == 'False' for x in rr)
  313. pu_pins = [by_pin[(r_pu, str(n))] for n in (1, 2)]
  314. assert {x['net'] for x in pu_pins} == {'+3V3', f'CON_PE{cad}'}
  315. assert all(x['declared_nc'] == 'True' for x in pu_pins)
  316. adc = (ROOT / 'constraints/prod2u_6400_v2.adc').read_text()
  317. assignments = re.findall(r'set_pin_assignment\s*\{\s*(\S+)\s*\}\s*\{\s*LOCATION\s*=\s*(\w+);', adc)
  318. assert len({ball for _, ball in assignments}) == len(assignments)
  319. for index, ball in enumerate(['F3', 'F1', 'G4']):
  320. assert (f'ssr_unused_zero[{index}]', ball) in assignments
  321. assert ('estop_btn_in', 'F8') in assignments
  322. assert ('hood_open_btn_in', 'C11') in assignments
  323. assert ('hood_close_btn_in', 'A11') in assignments
  324. assert ('buzzer_out', 'H6') in assignments
  325. assert all(ball != 'F7' for _, ball in assignments)