| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- #!/usr/bin/env python3
- """Generate the mrdimm-chamber ADC pin constraints from V1.2 authority evidence.
- Generated from 8000 Electrical Schematic V1.2 & FCB V1.2 Cadence BRD netlist.
- 12 Stepper Motors (M1..M12 via CON104..CON115) + 24 Limit Switches (LS1..12, HS1..12 via CON12/126/127/128/129/138).
- """
- from __future__ import annotations
- import argparse
- import json
- from pathlib import Path
- ROOT = Path(__file__).resolve().parents[1]
- OUT = ROOT / "constraints"
- # 12 Stepper Motors: (step_ball, dir_ball, connector)
- MOTORS = [
- ("C12", "B12", "CON104", "M1"),
- ("L12", "J11", "CON105", "M2"),
- ("L14", "K14", "CON106", "M3"),
- ("G14", "G15", "CON113", "M4"),
- ("L13", "K11", "CON107", "M5"),
- ("K12", "K13", "CON108", "M6"),
- ("J14", "J12", "CON109", "M7"),
- ("G13", "F14", "CON114", "M8"),
- ("H13", "J13", "CON110", "M9"),
- ("H11", "H12", "CON111", "M10"),
- ("G11", "H14", "CON112", "M11"),
- ("F12", "D15", "CON115", "M12"),
- ]
- # 12 Lower Limits (LS1..LS12) and 12 Upper Limits (HS1..HS12)
- LIMITS_LS = [
- ("A5", "CON12.1", "LS1"),
- ("C8", "CON12.3", "LS2"),
- ("D7", "CON126.1", "LS3"),
- ("A4", "CON126.3", "LS4"),
- ("A3", "CON127.1", "LS5"),
- ("A12", "CON127.3", "LS6"),
- ("L16", "CON128.1", "LS7"),
- ("K15", "CON128.3", "LS8"),
- ("K16", "CON129.1", "LS9"),
- ("H15", "CON129.3", "LS10"),
- ("T3", "CON138.1", "LS11"),
- ("P4", "CON138.3", "LS12"),
- ]
- LIMITS_HS = [
- ("B6", "CON12.2", "HS1"),
- ("A8", "CON12.4", "HS2"),
- ("E7", "CON126.2", "HS3"),
- ("C5", "CON126.4", "HS4"),
- ("B4", "CON127.2", "HS5"),
- ("B11", "CON127.4", "HS6"),
- ("L15", "CON128.2", "HS7"),
- ("J16", "CON128.4", "HS8"),
- ("J15", "CON129.2", "HS9"),
- ("H16", "CON129.4", "HS10"),
- ("R4", "CON138.2", "HS11"),
- ("T5", "CON138.4", "HS12"),
- ]
- HEATERS = [
- ("F16", "HEAT1"),
- ("G16", "HEAT2"),
- ("T4", "HEAT3"),
- ("R5", "HEAT4"),
- ("T6", "HEAT5"),
- ("R7", "HEAT6"),
- ("M1", "HEAT7"),
- ("N1", "HEAT8"),
- ("P1", "HEAT9"),
- ("R1", "HEAT10"),
- ("T2", "HEAT11"),
- ("R3", "HEAT12"),
- ("P16", "HEAT13"),
- ("R16", "HEAT14"),
- ("M16", "HEAT15"),
- ("N16", "HEAT16"),
- ("P8", "HEAT17"),
- ("P7", "HEAT18"),
- ("T9", "HEAT19"),
- ("P9", "HEAT20"),
- ("P10", "HEAT21"),
- ("R10", "HEAT22"),
- ("T13", "HEAT23"),
- ("T12", "HEAT24"),
- ]
- FANS = [
- ("B1", "chamber1 fan"),
- ("C4", "chamber2 fan"),
- ("B5", "chamber3 fan"),
- ("A14", "chamber4 fan"),
- ]
- def generate(root: Path | None = None) -> dict[Path, bytes]:
- base = root if root is not None else ROOT
- lines: list[str] = [
- "# mrdimm-chamber FCB V1.2 authority constraints (r3 full wiring correction)",
- "# Generated from 8000 Electrical Schematic V1.2 & FCB V1.2 Cadence BRD netlist.",
- "# 12 Stepper Motors (M1..M12 via CON104..CON115) + 24 Limit Switches (LS1..12, HS1..12 via CON12/126/127/128/129/138).",
- "",
- "# System Clock",
- "set_pin_assignment { sys_clk } { LOCATION = J1; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }",
- "",
- "# Host RS232 (CON78) & Host 3.3V TTL (CON140); CON146 is a 12V LED/buzzer circuit",
- "set_pin_assignment { host_rs232_tx } { LOCATION = M10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; } # CON78.1",
- "set_pin_assignment { host_rs232_rx } { LOCATION = N11; IOSTANDARD = LVCMOS33; PULLTYPE = PULLUP; } # CON78.2",
- "set_pin_assignment { host_ttl_tx } { LOCATION = T11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; } # CON140.1 via R1261 (0 ohm)",
- "set_pin_assignment { host_ttl_rx } { LOCATION = P13; IOSTANDARD = LVCMOS33; PULLTYPE = PULLUP; } # CON140.2 via R1262 (0 ohm)",
- "",
- "# BMC RS232 via U22 TRSF3232E, CON77.3/4 = GND",
- "set_pin_assignment { bmc_rs232_tx } { LOCATION = L10; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; } # CON77.1",
- "set_pin_assignment { bmc_rs232_rx } { LOCATION = M9; IOSTANDARD = LVCMOS33; PULLTYPE = PULLUP; } # CON77.2",
- "",
- "# CT7428 actual populated bus: B14/A15 via R1123/R1124; MCU I2C0 must be Hi-Z",
- "set_pin_assignment { temp_scl } { LOCATION = B14; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; } # CT7428 bus",
- "set_pin_assignment { temp_sda } { LOCATION = A15; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; } # CT7428 bus",
- "",
- "# Chamber 1..4 Physical PTC Heaters (24 channels, active high)",
- ]
- for i, (ball, name) in enumerate(HEATERS):
- pad_idx = f"[{i}]"
- lines.append(f"set_pin_assignment {{ ptc_pwm_out{pad_idx:<4} }} {{ LOCATION = {ball:<4}; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }} # {name}")
- lines.append("")
- lines.append("# Chamber 1..4 FAN Outputs (FAN_BOARD_INVERT_MASK = 4'hF, board inverted)")
- for i, (ball, name) in enumerate(FANS):
- lines.append(f"set_pin_assignment {{ fan_pwm_out[{i}] }} {{ LOCATION = {ball:<4}; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }} # {name}")
- lines.append("")
- lines.append("# Motor Global Enable (CON120.2 via Q145 buffer)")
- lines.append("set_pin_assignment { motor_en_n } { LOCATION = C11; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }")
- lines.append("")
- lines.append("# 12 Stepper Motor STEP Pulse Gates (motor_step_gate[0..11], 2N7002 open-drain buffer)")
- for i, (step_ball, _, con, m) in enumerate(MOTORS):
- pad_idx = f"[{i}]"
- lines.append(f"set_pin_assignment {{ motor_step_gate{pad_idx:<4} }} {{ LOCATION = {step_ball:<4}; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }} # {m:<4} ({con}.2)")
- lines.append("")
- lines.append("# 12 Stepper Motor DIR Direction Gates (motor_dir_gate[0..11], 2N7002 open-drain buffer)")
- for i, (_, dir_ball, con, m) in enumerate(MOTORS):
- pad_idx = f"[{i}]"
- lines.append(f"set_pin_assignment {{ motor_dir_gate{pad_idx:<4} }} {{ LOCATION = {dir_ball:<4}; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }} # {m:<4} ({con}.3)")
- lines.append("")
- lines.append("# 12 Lower Limit Switch Inputs (limit_lower_raw[0..11], 2-stage sync)")
- for i, (ball, con, ls) in enumerate(LIMITS_LS):
- pad_idx = f"[{i}]"
- lines.append(f"set_pin_assignment {{ limit_lower_raw{pad_idx:<4} }} {{ LOCATION = {ball:<4}; IOSTANDARD = LVCMOS33; PULLTYPE = PULLUP; }} # {ls:<4} ({con})")
- lines.append("")
- lines.append("# 12 Upper Limit Switch Inputs (limit_upper_raw[0..11], 2-stage sync)")
- for i, (ball, con, hs) in enumerate(LIMITS_HS):
- pad_idx = f"[{i}]"
- lines.append(f"set_pin_assignment {{ limit_upper_raw{pad_idx:<4} }} {{ LOCATION = {ball:<4}; IOSTANDARD = LVCMOS33; PULLTYPE = PULLUP; }} # {hs:<4} ({con})")
- lines.append("")
- lines.append("# V3.1.0 Minimal Hood Switch Input (active-HIGH when pressed, default LOW/0 via PULLDOWN; CON140.3 R1335=NC)")
- lines.append("set_pin_assignment { hood_switch_in } { LOCATION = L3; IOSTANDARD = LVCMOS33; PULLTYPE = PULLDOWN; } # CON140.3 EX_GPIO31")
- lines.append("")
- lines.append("# V3.1.0 MCU-Triggered Buzzer Output (active-HIGH 12V high-side switch Q10621/Q10620 -> CON146.1)")
- lines.append("set_pin_assignment { buzzer_out } { LOCATION = H6; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; } # CON146.1 SW_KEYLED3")
- text = "\n".join(lines) + "\n"
- return {base / "constraints/prod2u_mrdimm.adc": text.encode("utf-8")}
- def main() -> int:
- ap = argparse.ArgumentParser()
- ap.add_argument("--check", action="store_true")
- args = ap.parse_args()
- for path, data in generate().items():
- if args.check:
- if not path.is_file() or path.read_bytes() != data:
- print("generated drift: constraints/prod2u_mrdimm.adc")
- return 1
- else:
- path.parent.mkdir(parents=True, exist_ok=True)
- path.write_bytes(data)
- print(f"Generated {path}")
- return 0
- if __name__ == "__main__":
- raise SystemExit(main())
|