Prod2U CPLD Operating Rules
This checkout implements the Prod2U door-temperature controller. The active product contract is projects/prod2u-door-temp/project.json, projects/prod2u-door-temp/requirements.zh-CN.md, and docs/prod2u-door-temp-protocol.zh-CN.md. Generated contracts, constraints, source manifests, tests, TD inputs, and packages must derive from that contract.
The detailed design authority is CPLD_多项目_UART协议_项目适配_Codex并行Harness_详细设计_v1.0.md.
Execution priorities
- Core limit one-shot behavior and startup close/seek first.
- Keep behavior simple and deterministic inside the declared constraints.
- Form a minimally usable, synthesizable version quickly.
- Reduce LUT and Slice after core function is correct.
- Generalization, security, exception coverage, compatibility, long-term maintenance, performance tuning, and perfect documentation are lower priority.
"Reliable" means deterministic under these assumptions: host obeys command order; no new command is sent while a motor is running; duty is 0..100; motor command is 00/01/02; no undeclared concurrency; hardware wiring matches the current project/ADC.
Model and effort policy
MODEL_POLICY=unconstrained.
REASONING_EFFORT_POLICY=unconstrained.
MODEL_OR_EFFORT_IS_ACCEPTANCE_GATE=false.
Dynamic agent rules
- No fixed sub-agent roster, fixed Team A/B/C/D, fixed agent count, agent registry, message bus, dedicated agent database, complex run-state, role definitions copied for every tool, or heavy JSON evidence.
- The root
AGENTS.md is the single long-term, tool-independent rule source.
- Tool-specific rules (
.devin/, .cursor/, .codex/, .agents/) are only kept if they are thin tool adapters that point here; they must not reproduce the full product contract or define a static team.
- Sub-agents are created dynamically only for independent, temporary tasks and end when that task ends. Different writers never modify the same file or logic without coordination.
Git and worktree rules
- Do not reset, clean, stash, restore, overwrite, or delete changes from unknown sources.
- Work directly on
dev only when it is clean and no other session is touching the same files.
- When
dev is dirty or another session is active, use a temporary branch/worktree.
- Temporary branches/worktrees are conflict-prevention measures, not a long-lived branch system.
- All accepted production code, tests, and docs must end up in
dev.
- Delete temporary branches/worktrees created for this task once they are no longer needed.
Product contract
- UART: 25 MHz, 115200 8N1, 217 clocks/bit, A5 5A framing, CRC-16/CCITT-FALSE.
- Supported frame types:
0x01 SET_ALL, 0x02 GET_TEMPERATURE, 0x82 TEMPERATURE_DATA.
- SET_ALL payload: 8 PTC values, 4 FAN values, X/Y motor commands (14 bytes total).
- PTC active high; FAN active low at FPGA output.
- PWM ~20 Hz.
- Watchdog 10 s -> PTC 0, FAN 20.
- Ordinary motor move: 450 steps at 1000 steps/s. X and Y may overlap.
- No ACK, BUSY, ERROR, command queue, preemption, legacy protocol compatibility, background temperature scan, or runtime limit usage.
Limit one-shot contract
- X limit: CON30 pin3 / FPGA B9. Y limit: CON12 pin3 / FPGA A11. Active high.
- Limit is used only once per FPGA power-on, global hardware reset, or reconfiguration.
- Startup closes both dampers: PTC 0%, FAN 10%, motor EN_n 0, DIR = 1 (close).
- Per axis:
- If synchronized limit is already high: axis does not move, marked reached.
- Else start a burst of up to 450 full STEP rising edges at 1000 steps/s.
- After a full burst, hold STEP low for 50 ms, then start the next burst.
- Max 10 bursts. After 10 bursts not reached: mark exhausted, do not retry, do not send fault frame.
- X and Y may move concurrently and stop independently.
- When limit is observed high inside the current 450-step burst:
- The stopped axis produces no new STEP rising edge.
- If STEP is low, no next rising edge is produced.
- If STEP is high, the current high pulse completes its full half-cycle and falls; no new rising edge after that.
startup_done is sticky. It is only cleared by the next FPGA power-on, global hardware reset, or reconfiguration.
- After
startup_done:
- startup motor start = 0, active mask = 0, stop mask = 0;
- the limit stop mask to the motor engine is 0;
- the startup FSM does not return to check/move states;
- the burst counter does not restart;
- limit changes have no effect on calibration, interrupts, stops, position, or ordinary motor moves.
- During
startup_done == 0:
- SET_ALL and GET_TEMPERATURE are dropped; no caching, no response, no watchdog feed.
- The simplest implementation keeps the frame parser reset/flushed so partial frames cannot become valid commands later.
Evidence boundaries
- Distinguish source, simulation, formal, TD, package, and physical-hardware evidence.
fail, blocked, not_run, placeholder, or exploratory evidence is never a pass.
- Receipts bind run ID, exact full commit, project hash, source-manifest hash, command, tool version, status, and applicable bitstream hash.
Protected operations
- Never access COM or JTAG, program hardware, install drivers, modify global PATH, or create ChatGPT Adviser artifacts.
- Hardware validation is
not_run unless explicitly authorized in a future task.