|
|
@@ -1,5 +1,5 @@
|
|
|
#!/usr/bin/env python3
|
|
|
-"""Validate a project.json and emit deterministic compile-time artifacts."""
|
|
|
+"""Validate a project configuration and emit deterministic contract artifacts."""
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
@@ -9,29 +9,29 @@ import re
|
|
|
from pathlib import Path
|
|
|
from typing import Any, Mapping
|
|
|
|
|
|
+from jsonschema import Draft202012Validator
|
|
|
+
|
|
|
|
|
|
PROFILE = "prod2u-normal-multiproject-115200-v1"
|
|
|
+SCHEMA_PATH = Path(__file__).resolve().parents[1] / "schemas" / "project.schema.json"
|
|
|
+SOURCE_CLOSURE_PATH = Path(__file__).resolve().parents[1] / "config" / "source_closure.json"
|
|
|
|
|
|
-ACTIVE_SOURCE_PATHS = (
|
|
|
- "src/generated/prod2u_door_temp_params.vh",
|
|
|
- "src/common/uart_rx_byte.v",
|
|
|
- "src/common/uart_tx_byte.v",
|
|
|
- "src/common/crc16_serial.v",
|
|
|
- "src/common/frame_rx.v",
|
|
|
- "src/common/frame_tx.v",
|
|
|
- "src/common/payload_ram.v",
|
|
|
- "src/modules/output_target_ram.v",
|
|
|
- "src/modules/pwm_scheduler.v",
|
|
|
- "src/modules/door_motor_engine.v",
|
|
|
- "src/modules/i2c_word_reader.v",
|
|
|
- "src/modules/temperature_reader.v",
|
|
|
- "src/modules/temperature_ram.v",
|
|
|
- "src/project/command_controller.v",
|
|
|
- "src/project/project_adapter.v",
|
|
|
- "src/rtl/prod2u_por.v",
|
|
|
- "src/rtl/prod2u_p4_i2c_stop_start_read.v",
|
|
|
- "src/top/prod2u_p4_normal_v3_top.v",
|
|
|
-)
|
|
|
+_TOP_LEVEL_KEYS = {
|
|
|
+ "project_id",
|
|
|
+ "profile",
|
|
|
+ "display_name",
|
|
|
+ "device",
|
|
|
+ "uart",
|
|
|
+ "outputs",
|
|
|
+ "motors",
|
|
|
+ "limits",
|
|
|
+ "temperature",
|
|
|
+ "pins",
|
|
|
+ "resource_policy",
|
|
|
+ "protocol",
|
|
|
+ "timeouts",
|
|
|
+ "watchdog",
|
|
|
+}
|
|
|
|
|
|
|
|
|
def _require(condition: bool, message: str) -> None:
|
|
|
@@ -39,74 +39,419 @@ def _require(condition: bool, message: str) -> None:
|
|
|
raise ValueError(message)
|
|
|
|
|
|
|
|
|
+def _load_source_closure() -> tuple[str, ...]:
|
|
|
+ payload = json.loads(SOURCE_CLOSURE_PATH.read_text(encoding="utf-8"))
|
|
|
+ _require(isinstance(payload, Mapping), "source closure root must be an object")
|
|
|
+ _require(payload.get("schema") == "prod2u-source-closure-v1", "source closure schema mismatch")
|
|
|
+ _require(payload.get("project_id") == "prod2u-door-temp", "source closure project_id mismatch")
|
|
|
+ sources = payload.get("sources")
|
|
|
+ _require(isinstance(sources, list) and sources, "source closure must contain a non-empty sources list")
|
|
|
+ normalized = []
|
|
|
+ for value in sources:
|
|
|
+ _require(isinstance(value, str) and value, "source closure entry must be a non-empty string")
|
|
|
+ parts = Path(value).parts
|
|
|
+ _require(".." not in parts and not Path(value).is_absolute(), "source closure entry must be a relative safe path")
|
|
|
+ normalized.append(value)
|
|
|
+ _require(len(normalized) == len(set(normalized)), "source closure contains duplicate paths")
|
|
|
+ missing = [path for path in normalized if not (SOURCE_CLOSURE_PATH.parents[1] / path).is_file()]
|
|
|
+ _require(not missing, f"source closure references missing files: {missing}")
|
|
|
+ return tuple(normalized)
|
|
|
+
|
|
|
+
|
|
|
+ACTIVE_SOURCE_PATHS = _load_source_closure()
|
|
|
+
|
|
|
+
|
|
|
+def _object(value: Any, name: str) -> Mapping[str, Any]:
|
|
|
+ _require(isinstance(value, dict), f"{name} must be an object")
|
|
|
+ return value
|
|
|
+
|
|
|
+
|
|
|
+def _keys(value: Mapping[str, Any], expected: set[str], name: str) -> None:
|
|
|
+ _require(set(value) == expected, f"{name} keys mismatch")
|
|
|
+
|
|
|
+
|
|
|
+def _integer(value: Any, name: str, *, minimum: int | None = None) -> None:
|
|
|
+ _require(isinstance(value, int) and not isinstance(value, bool), f"{name} must be an integer")
|
|
|
+ if minimum is not None:
|
|
|
+ _require(value >= minimum, f"{name} is below the minimum")
|
|
|
+
|
|
|
+
|
|
|
+def _number(value: Any, name: str) -> None:
|
|
|
+ _require(isinstance(value, (int, float)) and not isinstance(value, bool), f"{name} must be numeric")
|
|
|
+
|
|
|
+
|
|
|
+def _list(value: Any, name: str, length: int | None = None) -> list[Any]:
|
|
|
+ _require(isinstance(value, list), f"{name} must be an array")
|
|
|
+ if length is not None:
|
|
|
+ _require(len(value) == length, f"{name} must contain {length} items")
|
|
|
+ return value
|
|
|
+
|
|
|
+
|
|
|
+def _validate_channel(channel: Any, index: int, kind: str) -> None:
|
|
|
+ item = _object(channel, f"{kind}_channels[{index}]")
|
|
|
+ _keys(item, {"index", "name", "signal", "board_signal", "ball", "connector", "connector_pin", "polarity"}, f"{kind}_channels[{index}]")
|
|
|
+ _require(item["index"] == index, f"{kind} channel index mismatch at {index}")
|
|
|
+ _require(item["name"] == f"{kind}{index + 1}", f"{kind} channel name mismatch at {index}")
|
|
|
+ _require(item["signal"] == f"{kind}_pwm_out[{index}]", f"{kind} channel signal mismatch at {index}")
|
|
|
+ _require(isinstance(item["board_signal"], str) and item["board_signal"], f"invalid {kind} board signal at {index}")
|
|
|
+ _require(item["polarity"] in {"active_high", "active_low"}, f"invalid {kind} polarity at {index}")
|
|
|
+ _require(re.fullmatch(r"[A-Z][0-9]+", str(item["ball"])) is not None, f"invalid {kind} ball at {index}")
|
|
|
+ _require(re.fullmatch(r"CON[0-9]+", str(item["connector"])) is not None, f"invalid {kind} connector at {index}")
|
|
|
+ _integer(item["connector_pin"], f"{kind} channel connector pin", minimum=1)
|
|
|
+
|
|
|
+
|
|
|
+def _validate_project(payload: Mapping[str, Any]) -> None:
|
|
|
+ _keys(payload, _TOP_LEVEL_KEYS, "project")
|
|
|
+ _require(re.fullmatch(r"[a-z0-9-]+", str(payload["project_id"])) is not None, "invalid project_id")
|
|
|
+ _require(isinstance(payload["profile"], str) and payload["profile"], "invalid project profile")
|
|
|
+ _require(isinstance(payload["display_name"], str) and payload["display_name"], "invalid display_name")
|
|
|
+
|
|
|
+ device = _object(payload["device"], "device")
|
|
|
+ _keys(device, {"family", "part", "clock_hz", "clock_ball"}, "device")
|
|
|
+ _require(isinstance(device["family"], str) and device["family"], "invalid device family")
|
|
|
+ _require(isinstance(device["part"], str) and device["part"], "invalid device part")
|
|
|
+ _integer(device["clock_hz"], "device.clock_hz", minimum=1)
|
|
|
+ _require(re.fullmatch(r"[A-Z][0-9]+", str(device["clock_ball"])) is not None, "invalid clock ball")
|
|
|
+
|
|
|
+ uart = _object(payload["uart"], "uart")
|
|
|
+ _keys(uart, {"baud", "data_bits", "parity", "stop_bits", "flow_control", "clks_per_bit", "inter_byte_timeout_ms", "rx_ball", "tx_ball"}, "uart")
|
|
|
+ _integer(uart["baud"], "uart.baud", minimum=1)
|
|
|
+ _integer(uart["data_bits"], "uart.data_bits", minimum=1)
|
|
|
+ _integer(uart["stop_bits"], "uart.stop_bits", minimum=1)
|
|
|
+ _integer(uart["clks_per_bit"], "uart.clks_per_bit", minimum=1)
|
|
|
+ _require(uart["parity"] in {"N", "E", "O"}, "invalid UART parity")
|
|
|
+ _require(isinstance(uart["flow_control"], str), "invalid UART flow control")
|
|
|
+ _integer(uart["inter_byte_timeout_ms"], "uart.inter_byte_timeout_ms", minimum=1)
|
|
|
+
|
|
|
+ outputs = _object(payload["outputs"], "outputs")
|
|
|
+ _keys(
|
|
|
+ outputs,
|
|
|
+ {
|
|
|
+ "ptc_count",
|
|
|
+ "fan_count",
|
|
|
+ "ptc_channels",
|
|
|
+ "fan_channels",
|
|
|
+ "pwm_bits",
|
|
|
+ "pwm_internal_width",
|
|
|
+ "pwm_max_duty",
|
|
|
+ "pwm_phase_count",
|
|
|
+ "pwm_slot_clks",
|
|
|
+ "pwm_frequency_hz",
|
|
|
+ "pwm_actual_frequency_hz",
|
|
|
+ "ptc_polarity",
|
|
|
+ "fan_polarity",
|
|
|
+ "ptc_default",
|
|
|
+ "fan_default",
|
|
|
+ "fan_connector_active_level",
|
|
|
+ "fan_board_inverts",
|
|
|
+ "boot_targets",
|
|
|
+ },
|
|
|
+ "outputs",
|
|
|
+ )
|
|
|
+ _integer(outputs["ptc_count"], "outputs.ptc_count", minimum=1)
|
|
|
+ _integer(outputs["fan_count"], "outputs.fan_count", minimum=1)
|
|
|
+ _require(outputs["ptc_count"] == len(outputs["ptc_channels"]), "PTC count/list mismatch")
|
|
|
+ _require(outputs["fan_count"] == len(outputs["fan_channels"]), "FAN count/list mismatch")
|
|
|
+ for index, channel in enumerate(outputs["ptc_channels"]):
|
|
|
+ _validate_channel(channel, index, "ptc")
|
|
|
+ for index, channel in enumerate(outputs["fan_channels"]):
|
|
|
+ _validate_channel(channel, index, "fan")
|
|
|
+ _integer(outputs["pwm_bits"], "outputs.pwm_bits", minimum=1)
|
|
|
+ _integer(outputs["pwm_internal_width"], "outputs.pwm_internal_width", minimum=1)
|
|
|
+ _integer(outputs["pwm_max_duty"], "outputs.pwm_max_duty", minimum=0)
|
|
|
+ _require(outputs["pwm_max_duty"] < (1 << outputs["pwm_bits"]), "PWM maximum exceeds protocol width")
|
|
|
+ _integer(outputs["pwm_phase_count"], "outputs.pwm_phase_count", minimum=1)
|
|
|
+ _integer(outputs["pwm_slot_clks"], "outputs.pwm_slot_clks", minimum=1)
|
|
|
+ _number(outputs["pwm_frequency_hz"], "outputs.pwm_frequency_hz")
|
|
|
+ _number(outputs["pwm_actual_frequency_hz"], "outputs.pwm_actual_frequency_hz")
|
|
|
+ _require(outputs["ptc_polarity"] == "active_high" and outputs["fan_polarity"] == "active_low", "PWM polarity mismatch")
|
|
|
+ _require(0 <= outputs["ptc_default"] <= outputs["pwm_max_duty"], "invalid PTC boot target")
|
|
|
+ _require(0 <= outputs["fan_default"] <= outputs["pwm_max_duty"], "invalid FAN boot target")
|
|
|
+ _require(outputs["fan_connector_active_level"] == "high" and outputs["fan_board_inverts"] is True, "FAN board metadata mismatch")
|
|
|
+ boot_targets = _object(outputs["boot_targets"], "outputs.boot_targets")
|
|
|
+ _keys(boot_targets, {"ptc", "fan"}, "outputs.boot_targets")
|
|
|
+ _require(boot_targets == {"ptc": 0, "fan": 10}, "boot target mapping mismatch")
|
|
|
+
|
|
|
+ motors = _object(payload["motors"], "motors")
|
|
|
+ _keys(
|
|
|
+ motors,
|
|
|
+ {
|
|
|
+ "count",
|
|
|
+ "order",
|
|
|
+ "role",
|
|
|
+ "fixed_steps",
|
|
|
+ "execution",
|
|
|
+ "busy_wait_ms",
|
|
|
+ "step_rate_hz",
|
|
|
+ "step_half_cycles",
|
|
|
+ "dir_setup_cycles",
|
|
|
+ "command_values",
|
|
|
+ "heartbeat_value",
|
|
|
+ "mapping",
|
|
|
+ "enable_n",
|
|
|
+ },
|
|
|
+ "motors",
|
|
|
+ )
|
|
|
+ _integer(motors["count"], "motors.count", minimum=1)
|
|
|
+ _require(len(motors["order"]) == motors["count"] and all(isinstance(axis, str) and axis for axis in motors["order"]), "motor order mismatch")
|
|
|
+ _require(isinstance(motors["role"], str) and motors["role"], "invalid motor role")
|
|
|
+ _require(motors["execution"] in {"overlap", "serial"}, "invalid motor execution")
|
|
|
+ _integer(motors["busy_wait_ms"], "motors.busy_wait_ms", minimum=0)
|
|
|
+ _integer(motors["fixed_steps"], "motors.fixed_steps", minimum=1)
|
|
|
+ _integer(motors["step_rate_hz"], "motors.step_rate_hz", minimum=1)
|
|
|
+ _integer(motors["step_half_cycles"], "motors.step_half_cycles", minimum=1)
|
|
|
+ _integer(motors["dir_setup_cycles"], "motors.dir_setup_cycles", minimum=0)
|
|
|
+ _require(isinstance(motors["command_values"], list) and motors["command_values"], "invalid motor commands")
|
|
|
+ _require(motors["heartbeat_value"] in motors["command_values"], "motor heartbeat is not a command")
|
|
|
+ mapping = _object(motors["mapping"], "motors.mapping")
|
|
|
+ _keys(mapping, {"x", "y"}, "motors.mapping")
|
|
|
+ for axis in ("x", "y"):
|
|
|
+ item = _object(mapping[axis], f"motors.mapping.{axis}")
|
|
|
+ _keys(item, {"axis", "role", "step_ball", "dir_ball"}, f"motors.mapping.{axis}")
|
|
|
+ _require(item["axis"] == axis and item["role"] == "exhaust", f"motor {axis} role mismatch")
|
|
|
+ enable = _object(motors["enable_n"], "motors.enable_n")
|
|
|
+ _keys(enable, {"ball", "active_level", "policy"}, "motors.enable_n")
|
|
|
+ _require(enable == {"ball": "A10", "active_level": "low", "policy": "shared_constant_low"}, "motor enable mapping mismatch")
|
|
|
+
|
|
|
+ limits = _object(payload["limits"], "limits")
|
|
|
+ _keys(limits, {"limit_count", "active_level", "functional_use", "runtime_use", "startup", "channels"}, "limits")
|
|
|
+ _require(limits["limit_count"] == len(limits["channels"]) == 2, "limit count/list mismatch")
|
|
|
+ _require(limits["active_level"] == "high" and limits["functional_use"] is True, "limit policy mismatch")
|
|
|
+ _require(limits["runtime_use"] is False, "runtime limit use must be false")
|
|
|
+ startup = _object(limits["startup"], "limits.startup")
|
|
|
+ _keys(startup, {"enabled", "direction_value", "direction_meaning", "burst_step_count", "burst_step_rate_hz", "inter_burst_ms", "max_bursts", "axis_order", "limit_stop_during_burst", "stop_semantics", "additional_rising_edges_after_synchronized_limit", "runtime_limit_use"}, "limits.startup")
|
|
|
+ _require(startup["enabled"] is True, "startup must be enabled")
|
|
|
+ _require(startup["direction_meaning"] == "close", "startup direction must be close")
|
|
|
+ _require(startup["limit_stop_during_burst"] is True, "startup limit stop during burst must be enabled")
|
|
|
+ _require(startup["stop_semantics"] == "finish_current_high_pulse_then_no_next_rising_edge", "unsupported stop semantics")
|
|
|
+ _require(startup["additional_rising_edges_after_synchronized_limit"] == 0, "additional rising edges after limit must be zero")
|
|
|
+ _require(startup["runtime_limit_use"] is False, "startup runtime limit use must be false")
|
|
|
+ _integer(startup["direction_value"], "limits.startup.direction_value", minimum=0)
|
|
|
+ _integer(startup["burst_step_count"], "limits.startup.burst_step_count", minimum=1)
|
|
|
+ _integer(startup["burst_step_rate_hz"], "limits.startup.burst_step_rate_hz", minimum=1)
|
|
|
+ _integer(startup["inter_burst_ms"], "limits.startup.inter_burst_ms", minimum=0)
|
|
|
+ _integer(startup["max_bursts"], "limits.startup.max_bursts", minimum=1)
|
|
|
+ _require(len(startup["axis_order"]) == limits["limit_count"], "startup axis order mismatch")
|
|
|
+ for index, item in enumerate(limits["channels"]):
|
|
|
+ entry = _object(item, f"limits.channels[{index}]")
|
|
|
+ _keys(entry, {"name", "ball"}, f"limits.channels[{index}]")
|
|
|
+ _require(entry["name"] in {"x_limit_raw", "y_limit_raw"}, "invalid limit name")
|
|
|
+
|
|
|
+ temperature = _object(payload["temperature"], "temperature")
|
|
|
+ _keys(
|
|
|
+ temperature,
|
|
|
+ {
|
|
|
+ "value_count",
|
|
|
+ "device_addresses",
|
|
|
+ "registers",
|
|
|
+ "scl_ball",
|
|
|
+ "sda_ball",
|
|
|
+ "bus",
|
|
|
+ "device",
|
|
|
+ "invalid_value",
|
|
|
+ "maximum_celsius",
|
|
|
+ "conversion",
|
|
|
+ },
|
|
|
+ "temperature",
|
|
|
+ )
|
|
|
+ _integer(temperature["value_count"], "temperature.value_count", minimum=1)
|
|
|
+ _require(temperature["value_count"] == len(temperature["device_addresses"]) * len(temperature["registers"]), "temperature count/list mismatch")
|
|
|
+ _require(all(isinstance(value, int) and 0 <= value < 128 for value in temperature["device_addresses"]), "invalid temperature address")
|
|
|
+ _require(all(isinstance(value, int) and 0 <= value <= 255 for value in temperature["registers"]), "invalid temperature register")
|
|
|
+ _require(isinstance(temperature["device"], str) and temperature["device"], "invalid temperature device")
|
|
|
+ _integer(temperature["invalid_value"], "temperature.invalid_value", minimum=0)
|
|
|
+ _require(temperature["invalid_value"] <= 255, "temperature.invalid_value exceeds byte")
|
|
|
+ _integer(temperature["maximum_celsius"], "temperature.maximum_celsius", minimum=0)
|
|
|
+ conversion = _object(temperature["conversion"], "temperature.conversion")
|
|
|
+ _keys(conversion, {"profile", "raw_shift", "raw_width", "reject_sign_bit"}, "temperature.conversion")
|
|
|
+ _require(conversion == {"profile": "ct7428-msb-integer", "raw_shift": 7, "raw_width": 9, "reject_sign_bit": True}, "temperature conversion mismatch")
|
|
|
+
|
|
|
+ pins = _object(payload["pins"], "pins")
|
|
|
+ _keys(
|
|
|
+ pins,
|
|
|
+ {
|
|
|
+ "host_uart_rx",
|
|
|
+ "host_uart_tx",
|
|
|
+ "temp_scl",
|
|
|
+ "temp_sda",
|
|
|
+ "ptc_pwm",
|
|
|
+ "fan_pwm",
|
|
|
+ "motor_en_n",
|
|
|
+ "x_step",
|
|
|
+ "x_dir",
|
|
|
+ "y_step",
|
|
|
+ "y_dir",
|
|
|
+ "x_limit_raw",
|
|
|
+ "y_limit_raw",
|
|
|
+ },
|
|
|
+ "pins",
|
|
|
+ )
|
|
|
+ _require(pins["host_uart_rx"] == uart["rx_ball"] and pins["host_uart_tx"] == uart["tx_ball"], "UART pin duplication mismatch")
|
|
|
+ _require(pins["temp_scl"] == temperature["scl_ball"] and pins["temp_sda"] == temperature["sda_ball"], "I2C pin duplication mismatch")
|
|
|
+ _require(pins["ptc_pwm"] == [item["ball"] for item in outputs["ptc_channels"]], "PTC pin/list mismatch")
|
|
|
+ _require(
|
|
|
+ pins["fan_pwm"] == [item["ball"] for item in outputs["fan_channels"]],
|
|
|
+ "FAN pin/list mismatch",
|
|
|
+ )
|
|
|
+ _require(pins["motor_en_n"] == enable["ball"], "motor enable pin mismatch")
|
|
|
+ _require(pins["x_step"] == mapping["x"]["step_ball"] and pins["x_dir"] == mapping["x"]["dir_ball"], "X motor pin mismatch")
|
|
|
+ _require(pins["y_step"] == mapping["y"]["step_ball"] and pins["y_dir"] == mapping["y"]["dir_ball"], "Y motor pin mismatch")
|
|
|
+ _require([pins["x_limit_raw"], pins["y_limit_raw"]] == [item["ball"] for item in limits["channels"]], "limit pin mismatch")
|
|
|
+
|
|
|
+ resources = _object(payload["resource_policy"], "resource_policy")
|
|
|
+ _keys(
|
|
|
+ resources,
|
|
|
+ {
|
|
|
+ "target_ram",
|
|
|
+ "request_ram",
|
|
|
+ "temperature_ram",
|
|
|
+ "dsp",
|
|
|
+ "shared_pwm_comparators",
|
|
|
+ "shared_motor_executors",
|
|
|
+ "shared_i2c_readers",
|
|
|
+ },
|
|
|
+ "resource_policy",
|
|
|
+ )
|
|
|
+ for key, value in resources.items():
|
|
|
+ if key in {"target_ram", "request_ram", "temperature_ram"}:
|
|
|
+ _require(
|
|
|
+ value in {"optional", "required", "forbidden"},
|
|
|
+ f"resource_policy.{key} must be optional, required, or forbidden",
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ _integer(value, f"resource_policy.{key}", minimum=0)
|
|
|
+
|
|
|
+ protocol = _object(payload["protocol"], "protocol")
|
|
|
+ _keys(protocol, {"header_hex", "crc", "commands", "set_all", "temperature_data"}, "protocol")
|
|
|
+ _require(isinstance(protocol["header_hex"], str) and protocol["header_hex"], "frame header missing")
|
|
|
+ crc = _object(protocol["crc"], "protocol.crc")
|
|
|
+ _keys(crc, {"name", "polynomial", "initial", "reflect_input", "reflect_output", "xor_output", "coverage", "wire_order"}, "protocol.crc")
|
|
|
+ _require(
|
|
|
+ crc
|
|
|
+ == {
|
|
|
+ "name": "CRC-16/CCITT-FALSE",
|
|
|
+ "polynomial": 0x1021,
|
|
|
+ "initial": 0xFFFF,
|
|
|
+ "reflect_input": False,
|
|
|
+ "reflect_output": False,
|
|
|
+ "xor_output": 0,
|
|
|
+ "coverage": "type_length_payload",
|
|
|
+ "wire_order": "little",
|
|
|
+ },
|
|
|
+ "CRC contract mismatch",
|
|
|
+ )
|
|
|
+ _require(set(protocol["commands"]) == {"set_all", "get_temperature", "temperature_data"}, "protocol command keys mismatch")
|
|
|
+ set_all = _object(protocol["set_all"], "protocol.set_all")
|
|
|
+ _keys(set_all, {"payload_length", "ptc_offset", "fan_offset", "motor_x_offset", "motor_y_offset", "duty_min", "duty_max", "motor_values", "heartbeat", "response"}, "protocol.set_all")
|
|
|
+ _require(set_all["ptc_offset"] == 0, "SET_ALL PTC offset mismatch")
|
|
|
+ _require(set_all["fan_offset"] == outputs["ptc_count"], "SET_ALL FAN offset mismatch")
|
|
|
+ _require(set_all["motor_x_offset"] == outputs["ptc_count"] + outputs["fan_count"], "SET_ALL X offset mismatch")
|
|
|
+ _require(set_all["motor_y_offset"] == set_all["motor_x_offset"] + 1, "SET_ALL Y offset mismatch")
|
|
|
+ _require(set_all["payload_length"] == set_all["motor_y_offset"] + 1, "SET_ALL length mismatch")
|
|
|
+ _require(set_all["duty_min"] <= set_all["duty_max"], "SET_ALL duty range mismatch")
|
|
|
+ _require(isinstance(set_all["motor_values"], list) and set_all["heartbeat"] == [motors["heartbeat_value"]] * len(motors["order"]), "SET_ALL motor contract mismatch")
|
|
|
+ temperature_data = _object(protocol["temperature_data"], "protocol.temperature_data")
|
|
|
+ _keys(temperature_data, {"payload_length", "frame_length"}, "protocol.temperature_data")
|
|
|
+ _require(temperature_data["payload_length"] == temperature["value_count"], "temperature payload length mismatch")
|
|
|
+ _require(temperature_data["frame_length"] == temperature_data["payload_length"] + 6, "temperature frame length mismatch")
|
|
|
+
|
|
|
+ timeouts = _object(payload["timeouts"], "timeouts")
|
|
|
+ _keys(timeouts, {"frame_inter_byte_ms", "host_get_response_ms"}, "timeouts")
|
|
|
+ _integer(timeouts["frame_inter_byte_ms"], "timeouts.frame_inter_byte_ms", minimum=1)
|
|
|
+ _integer(timeouts["host_get_response_ms"], "timeouts.host_get_response_ms", minimum=1)
|
|
|
+
|
|
|
+ watchdog = _object(payload["watchdog"], "watchdog")
|
|
|
+ _keys(watchdog, {"timeout_seconds", "tick_us", "tick_clks", "timeout_ticks", "target"}, "watchdog")
|
|
|
+ _integer(watchdog["timeout_seconds"], "watchdog.timeout_seconds", minimum=1)
|
|
|
+ _integer(watchdog["tick_us"], "watchdog.tick_us", minimum=1)
|
|
|
+ _integer(watchdog["tick_clks"], "watchdog.tick_clks", minimum=1)
|
|
|
+ _require(watchdog["tick_clks"] == device["clock_hz"] * watchdog["tick_us"] // 1_000_000, "watchdog tick clock mismatch")
|
|
|
+ _integer(watchdog["timeout_ticks"], "watchdog.timeout_ticks", minimum=1)
|
|
|
+ _require(watchdog["timeout_ticks"] == watchdog["timeout_seconds"] * 1_000_000 // watchdog["tick_us"], "watchdog tick count mismatch")
|
|
|
+ target = _object(watchdog["target"], "watchdog.target")
|
|
|
+ _keys(target, {"ptc", "fan"}, "watchdog.target")
|
|
|
+ _require(target == {"ptc": 0, "fan": 20}, "watchdog target mismatch")
|
|
|
+
|
|
|
+
|
|
|
def load_project(path: Path) -> dict[str, Any]:
|
|
|
project_path = Path(path)
|
|
|
payload = json.loads(project_path.read_text(encoding="utf-8"))
|
|
|
_require(isinstance(payload, dict), "project root must be an object")
|
|
|
- _require(re.fullmatch(r"[a-z0-9-]+", str(payload.get("project_id", ""))) is not None, "invalid project_id")
|
|
|
- _require(payload.get("profile") == PROFILE, "unsupported project profile")
|
|
|
- device = payload.get("device")
|
|
|
- uart = payload.get("uart")
|
|
|
- outputs = payload.get("outputs")
|
|
|
- motors = payload.get("motors")
|
|
|
- temperature = payload.get("temperature")
|
|
|
- protocol = payload.get("protocol")
|
|
|
- for name, value in (("device", device), ("uart", uart), ("outputs", outputs), ("motors", motors), ("temperature", temperature), ("protocol", protocol)):
|
|
|
- _require(isinstance(value, dict), f"{name} must be an object")
|
|
|
- _require(device["part"] == "EF2L45BG256B" and device["clock_hz"] == 25_000_000, "device constants mismatch")
|
|
|
- _require(uart == {**uart, "baud": 115200, "data_bits": 8, "parity": "N", "stop_bits": 1, "flow_control": "none", "clks_per_bit": 217}, "UART constants mismatch")
|
|
|
- _require(outputs["ptc_count"] == 24 and outputs["fan_count"] == 4 and outputs["pwm_bits"] == 8, "output counts mismatch")
|
|
|
- _require(outputs["pwm_frequency_hz"] == 20, "PWM frequency mismatch")
|
|
|
- _require(outputs["ptc_polarity"] == "active_high" and outputs["fan_polarity"] == "active_low", "PWM polarity mismatch")
|
|
|
- _require(outputs["ptc_default"] == 0 and outputs["fan_default"] == 26, "PWM default mismatch")
|
|
|
- _require(outputs["fan_connector_active_level"] == "high" and outputs["fan_board_inverts"] is True, "FAN board polarity metadata mismatch")
|
|
|
- _require(motors["count"] == 2 and motors["fixed_steps"] == 450 and motors["execution"] == "serial", "motor constants mismatch")
|
|
|
- _require(motors["order"] == ["inlet", "outlet"] and motors["direction_values"] == [0, 1], "motor order mismatch")
|
|
|
- _require(temperature["value_count"] == 27 and temperature["device_addresses"] == [73, 72, 75], "temperature constants mismatch")
|
|
|
- _require(temperature["registers"] == list(range(9)), "temperature register order mismatch")
|
|
|
- _require(protocol["commands"] == {"set_all": 1, "get_temperature": 2, "temperature_data": 130}, "protocol type mismatch")
|
|
|
- _require(protocol["crc"]["polynomial"] == 0x1021 and protocol["crc"]["initial"] == 0xFFFF, "CRC constants mismatch")
|
|
|
- _require(len(payload["pins"]["ptc_pwm"]) == 24 and len(payload["pins"]["fan_pwm"]) == 4, "pin count mismatch")
|
|
|
+ schema = json.loads(SCHEMA_PATH.read_text(encoding="utf-8"))
|
|
|
+ errors = sorted(Draft202012Validator(schema).iter_errors(payload), key=lambda error: list(error.absolute_path))
|
|
|
+ if errors:
|
|
|
+ location = ".".join(str(part) for part in errors[0].absolute_path) or "project"
|
|
|
+ raise ValueError(f"project schema violation at {location}: {errors[0].message}")
|
|
|
+ _validate_project(payload)
|
|
|
return payload
|
|
|
|
|
|
|
|
|
+def _active_interface(project: Mapping[str, Any]) -> tuple[tuple[str, str], ...]:
|
|
|
+ outputs = project["outputs"]
|
|
|
+ pins = project["pins"]
|
|
|
+ motors = project["motors"]
|
|
|
+ limits = project["limits"]
|
|
|
+ return (
|
|
|
+ ("sys_clk", project["device"]["clock_ball"]),
|
|
|
+ ("host_uart_rx", pins["host_uart_rx"]),
|
|
|
+ ("host_uart_tx", pins["host_uart_tx"]),
|
|
|
+ ("temp_scl", pins["temp_scl"]),
|
|
|
+ ("temp_sda", pins["temp_sda"]),
|
|
|
+ *tuple((item["signal"], item["ball"]) for item in outputs["ptc_channels"]),
|
|
|
+ *tuple((item["signal"], item["ball"]) for item in outputs["fan_channels"]),
|
|
|
+ ("motor_en_n", pins["motor_en_n"]),
|
|
|
+ ("x_step", motors["mapping"]["x"]["step_ball"]),
|
|
|
+ ("x_dir", motors["mapping"]["x"]["dir_ball"]),
|
|
|
+ ("y_step", motors["mapping"]["y"]["step_ball"]),
|
|
|
+ ("y_dir", motors["mapping"]["y"]["dir_ball"]),
|
|
|
+ *tuple((item["name"], item["ball"]) for item in limits["channels"]),
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+def render_adc(project: Mapping[str, Any]) -> tuple[tuple[str, str], ...]:
|
|
|
+ """Return the ordered active interface as (signal, ball) pairs."""
|
|
|
+ return _active_interface(project)
|
|
|
+
|
|
|
+
|
|
|
def project_summary(path: Path) -> dict[str, Any]:
|
|
|
project = load_project(path)
|
|
|
- ptc_count = project["outputs"]["ptc_count"]
|
|
|
- fan_count = project["outputs"]["fan_count"]
|
|
|
- pwm_bits = project["outputs"]["pwm_bits"]
|
|
|
- target_frequency_hz = project["outputs"]["pwm_frequency_hz"]
|
|
|
- temperature_count = project["temperature"]["value_count"]
|
|
|
- total_channels = ptc_count + fan_count
|
|
|
- phase_count = 1 << pwm_bits
|
|
|
- ideal_slot = project["device"]["clock_hz"] / (target_frequency_hz * total_channels * phase_count)
|
|
|
- pwm_slot_clks = int(round(ideal_slot))
|
|
|
- pwm_period_clks = pwm_slot_clks * total_channels * phase_count
|
|
|
+ outputs = project["outputs"]
|
|
|
+ temperature = project["temperature"]
|
|
|
+ watchdog = project["watchdog"]
|
|
|
+ total_channels = outputs["ptc_count"] + outputs["fan_count"]
|
|
|
+ pwm_period_clks = outputs["pwm_slot_clks"] * total_channels * outputs["pwm_phase_count"]
|
|
|
actual_frequency_hz = project["device"]["clock_hz"] / pwm_period_clks
|
|
|
- frequency_error_percent = abs(actual_frequency_hz - target_frequency_hz) / target_frequency_hz * 100.0
|
|
|
+ frequency_error_percent = abs(actual_frequency_hz - outputs["pwm_frequency_hz"]) / outputs["pwm_frequency_hz"] * 100.0
|
|
|
return {
|
|
|
"project_id": project["project_id"],
|
|
|
"profile": project["profile"],
|
|
|
"uart_clks_per_bit": project["uart"]["clks_per_bit"],
|
|
|
- "pwm_bits": pwm_bits,
|
|
|
- "pwm_phase_count": phase_count,
|
|
|
- "pwm_frequency_hz": target_frequency_hz,
|
|
|
- "pwm_slot_clks": pwm_slot_clks,
|
|
|
+ "pwm_bits": outputs["pwm_bits"],
|
|
|
+ "pwm_internal_width": outputs["pwm_internal_width"],
|
|
|
+ "pwm_max_duty": outputs["pwm_max_duty"],
|
|
|
+ "pwm_phase_count": outputs["pwm_phase_count"],
|
|
|
+ "pwm_frequency_hz": outputs["pwm_frequency_hz"],
|
|
|
+ "pwm_slot_clks": outputs["pwm_slot_clks"],
|
|
|
"pwm_period_clks": pwm_period_clks,
|
|
|
"pwm_period_seconds": round(pwm_period_clks / project["device"]["clock_hz"], 9),
|
|
|
"actual_frequency_hz": round(actual_frequency_hz, 9),
|
|
|
"frequency_error_percent": round(frequency_error_percent, 9),
|
|
|
- "ptc_default": project["outputs"]["ptc_default"],
|
|
|
- "fan_default": project["outputs"]["fan_default"],
|
|
|
- "ptc_polarity": project["outputs"]["ptc_polarity"],
|
|
|
- "fan_polarity": project["outputs"]["fan_polarity"],
|
|
|
- "fan_connector_active_level": project["outputs"]["fan_connector_active_level"],
|
|
|
- "fan_board_inverts": project["outputs"]["fan_board_inverts"],
|
|
|
- "set_all_payload_len": ptc_count + fan_count + 2,
|
|
|
- "set_all_frame_len": ptc_count + fan_count + 8,
|
|
|
- "temperature_payload_len": temperature_count,
|
|
|
- "temperature_frame_len": temperature_count + 6,
|
|
|
- "temperature_addresses": tuple(project["temperature"]["device_addresses"]),
|
|
|
+ "ptc_default": outputs["ptc_default"],
|
|
|
+ "fan_default": outputs["fan_default"],
|
|
|
+ "ptc_polarity": outputs["ptc_polarity"],
|
|
|
+ "fan_polarity": outputs["fan_polarity"],
|
|
|
+ "fan_connector_active_level": outputs["fan_connector_active_level"],
|
|
|
+ "fan_board_inverts": outputs["fan_board_inverts"],
|
|
|
+ "set_all_payload_len": project["protocol"]["set_all"]["payload_length"],
|
|
|
+ "set_all_frame_len": project["protocol"]["set_all"]["payload_length"] + 6,
|
|
|
+ "temperature_payload_len": temperature["value_count"],
|
|
|
+ "temperature_frame_len": temperature["value_count"] + 6,
|
|
|
+ "temperature_addresses": list(temperature["device_addresses"]),
|
|
|
+ "boot_targets": dict(outputs["boot_targets"]),
|
|
|
+ "watchdog_timeout_seconds": watchdog["timeout_seconds"],
|
|
|
+ "watchdog_tick_clks": watchdog["tick_clks"],
|
|
|
+ "watchdog_timeout_ticks": watchdog["timeout_ticks"],
|
|
|
+ "watchdog_target": dict(watchdog["target"]),
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -133,13 +478,17 @@ def _frame_hex(frame_type: int, payload: bytes) -> str:
|
|
|
def _render_params(project: Mapping[str, Any]) -> str:
|
|
|
outputs = project["outputs"]
|
|
|
motors = project["motors"]
|
|
|
+ limits = project["limits"]
|
|
|
+ startup = limits["startup"]
|
|
|
temperature = project["temperature"]
|
|
|
uart = project["uart"]
|
|
|
- total_channels = outputs["ptc_count"] + outputs["fan_count"]
|
|
|
- phase_count = 1 << outputs["pwm_bits"]
|
|
|
- pwm_slot_clks = int(round(project["device"]["clock_hz"] / (
|
|
|
- outputs["pwm_frequency_hz"] * total_channels * phase_count
|
|
|
- )))
|
|
|
+ watchdog = project["watchdog"]
|
|
|
+ _require(motors["dir_setup_cycles"] % watchdog["tick_clks"] == 0, "motor direction setup is not an integral tick count")
|
|
|
+ motor_dir_setup_ticks = motors["dir_setup_cycles"] // watchdog["tick_clks"]
|
|
|
+ frame_inter_byte_timeout_cycles = project["device"]["clock_hz"] * project["timeouts"]["frame_inter_byte_ms"] // 1000
|
|
|
+ startup_inter_burst_ticks = startup["inter_burst_ms"] * 1000 // watchdog["tick_us"]
|
|
|
+ startup_dir_bit = startup["direction_value"]
|
|
|
+ startup_dir_mask = f"2'b{startup_dir_bit}{startup_dir_bit}"
|
|
|
lines = [
|
|
|
"// Generated from project.json. Do not edit.",
|
|
|
f"`define P4_CLOCK_HZ {project['device']['clock_hz']}",
|
|
|
@@ -147,18 +496,40 @@ def _render_params(project: Mapping[str, Any]) -> str:
|
|
|
f"`define P4_UART_CLKS_PER_BIT {uart['clks_per_bit']}",
|
|
|
f"`define P4_PTC_COUNT {outputs['ptc_count']}",
|
|
|
f"`define P4_FAN_COUNT {outputs['fan_count']}",
|
|
|
+ f"`define P4_OUTPUT_CHANNEL_COUNT {outputs['ptc_count'] + outputs['fan_count']}",
|
|
|
+ f"`define P4_PWM_PROTOCOL_WIDTH {outputs['pwm_bits']}",
|
|
|
+ f"`define P4_PWM_INTERNAL_WIDTH {outputs['pwm_internal_width']}",
|
|
|
+ f"`define P4_PWM_MAX_DUTY {outputs['pwm_max_duty']}",
|
|
|
+ f"`define P4_PWM_PHASE_COUNT {outputs['pwm_phase_count']}",
|
|
|
f"`define P4_PWM_FREQUENCY_HZ {outputs['pwm_frequency_hz']}",
|
|
|
- f"`define P4_PWM_SLOT_CLKS {pwm_slot_clks}",
|
|
|
+ f"`define P4_PWM_SLOT_CLKS {outputs['pwm_slot_clks']}",
|
|
|
+ f"`define P4_SET_ALL_PAYLOAD_LENGTH {project['protocol']['set_all']['payload_length']}",
|
|
|
+ f"`define P4_FRAME_INTER_BYTE_TIMEOUT_CYCLES {frame_inter_byte_timeout_cycles}",
|
|
|
f"`define P4_FIXED_MOTOR_STEPS {motors['fixed_steps']}",
|
|
|
+ f"`define P4_MOTOR_STEP_RATE_HZ {motors['step_rate_hz']}",
|
|
|
f"`define P4_MOTOR_STEP_HALF_CYCLES {motors['step_half_cycles']}",
|
|
|
f"`define P4_MOTOR_DIR_SETUP_CYCLES {motors['dir_setup_cycles']}",
|
|
|
+ f"`define P4_MOTOR_DIR_SETUP_TICKS {motor_dir_setup_ticks}",
|
|
|
+ f"`define P4_MOTOR_HEARTBEAT_COMMAND 2'd{motors['heartbeat_value']}",
|
|
|
f"`define P4_TEMPERATURE_COUNT {temperature['value_count']}",
|
|
|
f"`define P4_TEMPERATURE_COUNT_BYTE 8'h{temperature['value_count']:02X}",
|
|
|
+ f"`define P4_TEMPERATURE_FRAME_LENGTH {temperature['value_count'] + 6}",
|
|
|
f"`define P4_TEMP_MAX_CELSIUS {temperature['maximum_celsius']}",
|
|
|
f"`define P4_PTC_ACTIVE_HIGH {1 if outputs['ptc_polarity'] == 'active_high' else 0}",
|
|
|
f"`define P4_FAN_ACTIVE_HIGH {1 if outputs['fan_polarity'] == 'active_high' else 0}",
|
|
|
f"`define P4_PTC_DEFAULT_TARGET 8'h{outputs['ptc_default']:02X}",
|
|
|
f"`define P4_FAN_DEFAULT_TARGET 8'h{outputs['fan_default']:02X}",
|
|
|
+ f"`define P4_WATCHDOG_TIMEOUT_SECONDS {watchdog['timeout_seconds']}",
|
|
|
+ f"`define P4_WATCHDOG_TICK_US {watchdog['tick_us']}",
|
|
|
+ f"`define P4_WATCHDOG_TICK_CLKS {watchdog['tick_clks']}",
|
|
|
+ f"`define P4_WATCHDOG_TIMEOUT_TICKS {watchdog['timeout_ticks']}",
|
|
|
+ f"`define P4_WATCHDOG_PTC_TARGET 8'h{watchdog['target']['ptc']:02X}",
|
|
|
+ f"`define P4_WATCHDOG_FAN_TARGET 8'h{watchdog['target']['fan']:02X}",
|
|
|
+ f"`define P4_STARTUP_ENABLED {1 if startup['enabled'] else 0}",
|
|
|
+ f"`define P4_STARTUP_DIR_MASK {startup_dir_mask}",
|
|
|
+ f"`define P4_STARTUP_BURST_STEPS {startup['burst_step_count']}",
|
|
|
+ f"`define P4_STARTUP_MAX_BURSTS {startup['max_bursts']}",
|
|
|
+ f"`define P4_STARTUP_INTER_BURST_TICKS {startup_inter_burst_ticks}",
|
|
|
]
|
|
|
lines.extend(
|
|
|
f"`define P4_TEMP_DEVICE_ADDR_{index} 7'h{address:02X}"
|
|
|
@@ -172,33 +543,60 @@ def _render_params(project: Mapping[str, Any]) -> str:
|
|
|
return "\n".join(lines)
|
|
|
|
|
|
|
|
|
+def render_adc_text(project: Mapping[str, Any]) -> str:
|
|
|
+ lines = [
|
|
|
+ "# Generated from project.json. Do not edit.",
|
|
|
+ "# Active interface only; reserved board loads are intentionally absent.",
|
|
|
+ ]
|
|
|
+ active_interface = list(render_adc(project))
|
|
|
+ for signal, ball in active_interface:
|
|
|
+ lines.append(f"set_pin_assignment {{ {signal} }} {{ LOCATION = {ball}; IOSTANDARD = LVCMOS33; PULLTYPE = NONE; }}")
|
|
|
+ return "\n".join(lines) + "\n"
|
|
|
+
|
|
|
+
|
|
|
def generate_project(project_path: Path, output_root: Path) -> dict[str, Any]:
|
|
|
project = load_project(project_path)
|
|
|
- temperature_count = project["temperature"]["value_count"]
|
|
|
output = Path(output_root) / "generated"
|
|
|
output.mkdir(parents=True, exist_ok=True)
|
|
|
- (output / f"{project['project_id'].replace('-', '_')}_params.vh").write_text(_render_params(project), encoding="ascii", newline="\n")
|
|
|
+ (output / f"{project['project_id'].replace('-', '_')}_params.vh").write_text(
|
|
|
+ _render_params(project), encoding="ascii", newline="\n"
|
|
|
+ )
|
|
|
summary = project_summary(project_path)
|
|
|
contract = {
|
|
|
"schema": "prod2u-simple-host-contract-v1",
|
|
|
"project_id": project["project_id"],
|
|
|
"uart": project["uart"],
|
|
|
+ "protocol": project["protocol"],
|
|
|
"commands": {
|
|
|
- "set_all": {"type": "0x01", "payload_length": summary["set_all_payload_len"], "response": "none"},
|
|
|
+ "set_all": {
|
|
|
+ "type": "0x01",
|
|
|
+ "payload_length": summary["set_all_payload_len"],
|
|
|
+ "response": "none",
|
|
|
+ "duty_range": [0, 100],
|
|
|
+ "motor_values": [0, 1, 2],
|
|
|
+ "heartbeat": [0, 0],
|
|
|
+ },
|
|
|
"get_temperature": {"type": "0x02", "payload_length": 0, "response": "TEMPERATURE_DATA"},
|
|
|
- "temperature_data": {"type": "0x82", "payload_length": summary["temperature_payload_len"], "frame_length": summary["temperature_frame_len"]},
|
|
|
+ "temperature_data": {
|
|
|
+ "type": "0x82",
|
|
|
+ "payload_length": summary["temperature_payload_len"],
|
|
|
+ "frame_length": summary["temperature_frame_len"],
|
|
|
+ },
|
|
|
},
|
|
|
- "crc": project["protocol"]["crc"],
|
|
|
+ "outputs": project["outputs"],
|
|
|
"motors": project["motors"],
|
|
|
+ "limits": project["limits"],
|
|
|
"temperature": project["temperature"],
|
|
|
+ "watchdog": project["watchdog"],
|
|
|
}
|
|
|
_write_json(output / "host-contract.json", contract)
|
|
|
_write_json(output / "project-summary.json", summary)
|
|
|
_write_json(
|
|
|
output / "golden-vectors.json",
|
|
|
{
|
|
|
+ "set_all": _frame_hex(0x01, bytes(range(8)) + bytes((10, 20, 30, 40, 1, 2))),
|
|
|
"get_temperature": _frame_hex(0x02, b""),
|
|
|
- "all_invalid_temperature": _frame_hex(0x82, bytes([0xFF] * temperature_count)),
|
|
|
+ "all_invalid_temperature": _frame_hex(0x82, bytes([0xFF] * project["temperature"]["value_count"])),
|
|
|
},
|
|
|
)
|
|
|
_write_json(
|
|
|
@@ -206,10 +604,23 @@ def generate_project(project_path: Path, output_root: Path) -> dict[str, Any]:
|
|
|
{
|
|
|
"schema": "prod2u-simple-source-manifest-template-v1",
|
|
|
"project_id": project["project_id"],
|
|
|
- "sources": list(ACTIVE_SOURCE_PATHS),
|
|
|
+ "sources": list(_load_source_closure()),
|
|
|
"generated_from": "project.json",
|
|
|
+ "contract": {
|
|
|
+ "uart": project["uart"],
|
|
|
+ "protocol": project["protocol"],
|
|
|
+ "set_all_payload_length": summary["set_all_payload_len"],
|
|
|
+ "temperature_frame_length": summary["temperature_frame_len"],
|
|
|
+ },
|
|
|
+ "active_interface": [
|
|
|
+ {"signal": signal, "ball": ball}
|
|
|
+ for signal, ball in render_adc(project)
|
|
|
+ ],
|
|
|
},
|
|
|
)
|
|
|
+ (output / f"{project['project_id'].replace('-', '_')}.adc").write_text(
|
|
|
+ render_adc_text(project), encoding="ascii", newline="\n"
|
|
|
+ )
|
|
|
return summary
|
|
|
|
|
|
|