PCB Design Rule Check with a Local LLM and EMI Ray-Tracing Simulation: A Case Study

    How to combine a rule engine, a locally deployed large language model, and electromagnetic simulation to review PCB design rule check results. This article walks through a real adapter-board migration project, covering cross-tool format conversion pitfalls, 2,075 DRC violations, LLM-assisted analysis, and ray-tracing simulation that validated the findings.

    1. Background and Engineering Goals

    In high-speed digital design, PCB design rule checking (DRC) is the first line of defense for manufacturability and signal integrity. However, when design source files come from different EDA ecosystems, format conversion often introduces additional risk. The case described here involves an adapter carrier board that connects an earlier compute module to a standard motherboard: 171.71 × 100.28 mm, 4 layers, 1.6 mm thick, with 106 footprints, 3,066 track segments, and 911 vias — a medium-complexity design. The engineering task was to migrate the design from a cloud-based EDA platform to an open-source PCB design tool (referred to below as “the target tool”), run a full-board rule check, use a locally deployed LLM to review the results at a semantic level, and finally verify the severity of critical violations through electromagnetic interference (EMI) ray-tracing simulation.

    The goal was not merely to produce a report, but to establish a repeatable review methodology that combines a rule engine with AI assistance. Experience shows that many DRC violations are not simple clearance issues; they arise from intertwined factors such as hierarchical nets, unusual via structures, and discontinuities between differential pairs and reference planes. Traditional static checking scripts struggle to capture these semantic clues, while large language models are well suited to extracting relationships from structured JSON.

    2. Cross-Platform Format Conversion and Import Pitfalls

    2.1 Choosing a Conversion Path

    The original design file was stored in the standard edition of a cloud EDA platform. Initial attempts using the standard edition’s export function showed it only supported generic interchange formats and did not directly support the target tool. Some suggested converting to an intermediate format first, then converting again, but research revealed that the platform’s professional edition offered a direct export option for the target tool’s format, bypassing the redundant intermediate step. The lesson: when migrating between heterogeneous design tools, checking for a native export interface first is usually more efficient and lossless than hunting for a “universal translator.”

    2.2 Typical Import Anomalies in the Target Tool

    Immediately after importing, three environment-level issues appeared:

    • Via width access assertion: When a script tried to read a via’s width without explicitly passing a layer argument, the core library threw an assertion (GetWidth called without a layer argument). In the newer version, via properties are layer-aware, so a reference layer must be specified to obtain physical dimensions. This was not data corruption but an API semantic update requiring callers to adjust parameter passing.

    • Plugin registration race condition: When running a custom DRC extension, registration occasionally failed with assert "PgmOrNull()" failed in register_action(). Investigation showed the plugin manager was being called by a concurrent thread before initialization completed. The fix was to register only after the host program finished loading the plugin system, or add a synchronization lock in the startup script.

    • Missing font warnings: After import, a persistent warning appeared (“Arial Negreta cursiva not found”). This affected annotation rendering but not data correctness. The fix was to install the missing font manually or switch to the default font to prevent pop-ups from interfering with subsequent automation.

    These pitfalls illustrate a general rule of toolchain migration: newer tools often enforce stricter data models, so implicit assumptions in older designs can become explicit errors. Engineers should budget debugging time rather than expect a one-click import.

    3. Full-Board DRC Results and Locating Critical Defects

    3.1 Violation Summary

    After import, a full-board DRC run produced 2,075 violations: 1,635 errors, 445 warnings, plus 59 unrouted nets. The results were exported as structured JSON for programmatic processing. An initial review showed the violations were not evenly distributed but clustered in specific areas — typically a sign of systematic design errors rather than random placement mistakes.

    3.2 The Most Severe Defect: Ground Via Intrusion

    The most critical violation involved a large mounting hole (MH7), 4.013 mm in diameter, directly crossed by 20 differential traces, with a maximum intrusion of -1.7625 mm — meaning the differential pair conductors’ edges were embedded inside the via’s metal ring. This caused direct shorts between 8 high-speed signal nets (TX6±, TX7±, RX10±, RX11±) and ground. Fabricated in this state, the board would inevitably fail electrical testing — a “hard” defect requiring rework.

    Analysis of the region’s topology showed the root cause was a poor fan-out strategy: when routing differential pairs out from the module connector, the designer failed to adequately avoid the screw mounting holes, forcing the traces through the via’s mounting area. A traditional clearance check only reports “insufficient distance” and cannot distinguish whether the trace or the via is intruding. The target tool’s 3D view or net coloring quickly pinpoints the conflict region, as illustrated in Figure 1 (image omitted here).

    3.3 Other Systematic Defects

    • 68 dangling vias: Vias with one end unconnected to any copper, likely left over from copy-paste operations or missing net labels. Dangling vias introduce antenna effects and become EMI risks.
    • 200 unterminated track endpoints: These breaks can leave signal paths incomplete, violating connectivity rules. Some occur in BGA areas, possibly because footprints were modified after routing without a synchronized update.
    • 150 zero-width annular rings: The inner-layer solder rings are entirely missing. Even with correct electrical connectivity, mechanical strength and reliability cannot be guaranteed.

    These numbers are not abstract statistics but hard facts locatable coordinate by coordinate. The DRC report lists the layer, net name, coordinates, and reference rule for each violation, providing a direct basis for repair.

    4. LLM-Assisted Review in Practice

    4.1 Model Selection and Deployment

    To perform semantic-level analysis of the DRC results — for example, determining “which combinations of violations cause functional failures” or “which warnings can be safely ignored” — a locally deployed LLM was introduced. After comparing models of different parameter sizes, a 14B model (a representative Qwen-series model, not named specifically here) was chosen, running on a local inference service (port 8083). It occupied about 22.8 GB of VRAM on a host GPU with 32 GB of professional-grade memory.

    The main motivations for local deployment were data privacy and responsiveness — design files are typically corporate confidential and cannot be uploaded to external APIs. A local model enables fully offline operation and allows custom inference parameters tailored to the task.

    4.2 Two Classic Integration Pitfalls

    • Missing credential configuration: On first call, the inference framework reported no credential for provider route "local-v100". Troubleshooting revealed that although the inference provider was defined, the environment variable LOCAL_LLM_API_KEY was not set. Even though the local service requires no actual authentication, the framework’s interceptor still insists the variable exists. The fix: explicitly set a dummy value (such as an empty string) in the startup script to bypass the auth check.

    • Context window overflow: Passing the entire DRC JSON file (about 66k tokens) directly to the model triggered request (66798 tokens) exceeds the available context size (65536 tokens). The lesson: don’t blindly feed full data. Instead, design a layered summarization strategy — first have the model process rule classification statistics, then generate detailed analysis for specific regions. The final approach used chunked extraction: filter the top 50 highest-severity errors as the primary input, then have the model output a risk ranking and suggested repair order.

    4.3 Practical Value of Model Output

    The model produced a structured report on the DRC results, including:

    • Causal chain analysis: For example, it identified the link between the MH7 via intrusion and differential pair routing direction, noting that “the via sits in the differential pair’s layer-transition region, and the reference plane is discontinuous, aggravating impedance mismatch and potentially causing EMI.”
    • Priority ranking: Errors were ordered as “short-circuit risk” > “connectivity” > “manufacturing yield” > “EMI risk,” helping engineers focus resources on high-impact items.
    • Repair suggestions: For dangling vias, check the arrangement of adjacent nets; for zero-width annular rings, increase the pad ring size or review the stackup generation rules.

    Although the model cannot execute repairs automatically, it significantly shortened the time needed to read three thousand report lines manually, concentrating attention on the decisions that truly matter.

    5. Verification Through EMI Ray-Tracing Simulation

    DRC conclusions are mostly based on geometric rules, but the final design must pass electromagnetic compatibility assessment. To verify the inference that “MH7 via intrusion causes severe EMI,” a ray-tracing-based simulation tool was used for field-circuit co-analysis. The method abstracts the PCB’s metal structures into multiple reflecting/scattering surfaces and computes the near-field distribution by tracing ray propagation paths.

    5.1 Simulation Setup

    The geometry of the critical nets (TX6±, TX7±, RX10±, RX11±) was extracted, together with reference planes and the via array, to build a simplified model. The excitation source was a 1 GHz differential signal, and the computation covered a 20 mm × 20 mm region centered on MH7. The simulation frequency matched the fundamental frequency of this generation’s module interface, avoiding the added complexity of high-frequency harmonics.

    5.2 Simulation Results

    The resulting electric field distribution showed a distinct hot spot around the MH7 via, with peak field strength about 6.8 dB higher than in an intact control group. Further analysis showed that differential traces intruding into the via barrel changed the local impedance, increasing reflection and radiation — highly consistent with the quantified DRC figure of “-1.7625 mm maximum intrusion.” The simulation also indicated that at 1 GHz, this hot spot couples into the adjacent power plane, generating common-mode noise that could violate standards such as IEC 61000-4-2.

    5.3 Feedback into the Review Process

    This simulation result in turn validated the soundness of the DRC rules — the design rules had set a minimum “trace-to-via-edge” clearance of 0.25 mm precisely to prevent this kind of coupling. It also confirmed the LLM’s recommendation to prioritize MH7. The review process thus formed a closed loop: geometric rules find problems, AI-assisted parsing sets priorities, electromagnetic simulation confirms physical impact, and an actionable modification list is produced.

    6. Lessons Learned and a Reusable Methodology

    The core takeaways from this case can be summarized in four points:

    • Budget debugging time for format conversion: Any toolchain migration can trigger new-version assertions or plugin conflicts. Schedule dedicated time for this in the project plan rather than handling it ad hoc.
    • DRC results must be visualized: Severity is impossible to grasp from numbers alone. Using the tool’s 3D view or layer overlays quickly reveals systematic layout defects.
    • A local LLM is an efficient interpreter: Converting structured reports into natural-language summaries and recommendations significantly reduces engineers’ cognitive load, but watch the context length limit and use chunking strategies.
    • EMI simulation provides physical evidence: When DRC warnings involve high-speed signals, quantifying risk through ray-tracing or full-wave simulation avoids over- or under-repair.

    This workflow has been consolidated into a script set: DSN (design netlist) import, DRC execution, JSON export, local model invocation, and summary report generation, all fully automated. Future projects can reuse the template by adjusting rule parameters and model prompts.

    7. Future Directions

    As design complexity keeps rising, rule checking alone is no longer sufficient. The plan is to extend the local model into post-routing verification — for example, having it analyze crosstalk simulation results and recommend layout adjustments based on accumulated experience. Multi-model collaboration is also under consideration: a smaller model for rapid violation filtering and a larger model for deep reasoning. The prerequisite is that inference latency must meet real-time requirements; the 14B model currently achieves acceptable speed on consumer-grade GPUs (roughly 20 tokens per second), sufficient for near-real-time interaction.

    In short, this practice validated that a “rule engine + generative AI + electromagnetic simulation” review framework is feasible. It relies on no specific vendor’s tools, is built entirely on open interfaces and custom scripts, and offers a cost-effective safeguard for high-performance PCB design.