GLS · Chapter 12 · GLS Debug Methodology
RTL-vs-GLS Comparison & Mismatch Isolation
Running RTL and gate-level simulation on the same stimulus and comparing them is a powerful way to isolate a gate-level mismatch. RTL is usually the golden reference, so a failure that appears only in GLS points to a gate-level-specific cause such as an uninitialized unknown, a timing violation, a reset issue, a clock-domain-crossing effect, power behavior, or test logic. But RTL is not always golden for unknowns: because RTL is optimistic about them, a gate-level unknown can be correct where RTL hid a real bug. This lesson shows how to compare the two runs, isolate the mismatch to a module and signal, find the first divergence, and judge by the source of the difference rather than assuming the gate-level run is wrong.
Foundation12 min readGLSRTLMismatchIsolationX-Optimism
Chapter 12 · Section 12.5 · GLS Debug Methodology
Project thread — this generalizes the RTL-vs-GLS X-optimism story of 6.4 into a debug technique. This lesson isolates any RTL-vs-GLS mismatch; 12.6 catalogs the recurring mistakes.
1. Why Should I Learn This?
Comparing RTL and GLS isolates a gate-level bug fast — if you judge it correctly.
- A GLS-only failure → a gate-level-specific cause (X/timing/reset/CDC/power/DFT).
- Isolate by diffing at ports/hierarchy boundaries → module → signal → first divergence.
- Caveat: RTL is not always golden for
X— a GLSXcan be right (6.4).
This turns 6.4's insight into a repeatable isolation technique.
2. Real Silicon Story — the mismatch that proved GLS right
A GLS run mismatched RTL on a signal. The reflex was "GLS is wrong — RTL is golden" and to hunt for a gate-level artifact.
There was no artifact. The signal depended on an uninitialized control that RTL's X-optimism (6.4) had resolved to a definite value (hiding the bug), while GLS faithfully propagated X — so the GLS X was correct and the RTL value was the misleading one. RTL was not golden here. Fixing the uninitialized source (the real bug) made both runs agree — with the right value.
Lesson: an RTL-vs-GLS mismatch doesn't automatically mean GLS is wrong. Judge by the source — RTL's X-optimism (6.4) can make a GLS X the correct one and RTL the misleading one.
3. Concept — comparing and isolating
The comparison (isolation power):
- Run RTL and GLS on the same stimulus; compare their signals.
- Where they agree, the gate-level behavior matches intent; where they diverge, you've localized a difference.
How to isolate a mismatch:
- Dump both runs on identical stimulus.
- Diff at boundaries — compare at ports / hierarchy boundaries (with a strobe after settling, 5.4) to narrow to a module, then to a signal.
- Find the first divergence (12.2) — the earliest diverging signal/time.
- Classify (12.1) — is the GLS-only difference an
X-source (Ch6), timing (Ch8), reset (Ch7), CDC (Ch9), power (Ch10), or DFT (Ch11) effect?
RTL as reference — with the caveat:
- RTL is usually golden — it defines intended behavior, so a GLS-only failure is usually a gate-level-specific cause to fix.
- BUT RTL is not golden for
X. RTL is X-optimistic (6.4): it resolves unknowns to a branch, so it can hide a real bug that GLS's faithfulX-propagation exposes. - Therefore: judge by source, not by which run looks cleaner. A GLS
Xthat traces to a real uninitialized/timing source is correct — RTL was the misleading one.
Decision:
- GLS artifact (setup/expected-
X, 12.1) → fix the run. - GLS-exposed real bug (RTL-optimism hid it, or a real timing/reset issue) → fix the design.
- Real RTL-vs-GLS logic difference (rare, e.g. a synthesis issue) → investigate.
Scope (accuracy):
- The comparison isolates; judge by source (not "RTL golden" blindly). GLS stays dynamic (0.3).
4. Mental Model — two witnesses, and neither is automatically right about X
RTL and GLS are two witnesses to the same events (same stimulus).
- Where they agree, you trust the account; where they disagree, you've found the contested moment (the mismatch) — narrow to when and where (first divergence, boundary diff).
- The usual assumption is that RTL (the intent) is the reliable witness — so a GLS-only discrepancy is a gate-level detail to explain.
- But on questions of
X(uncertainty), the RTL witness is an optimist who confidently fills in gaps (6.4) — it may state a definite value it couldn't actually know, while the GLS witness honestly says "unknown." - So you don't just believe the "confident" witness — you check the evidence (the source of the difference). If GLS's
Xtraces to a real uninitialized/timing cause, the honest witness was right and the optimist misled you.
Two witnesses; agree = trust; disagree = investigate — and don't assume the confident one is right about the unknowns.
5. Working Example - isolating a mismatch
Isolating and judging a mismatch (tool-neutral):
# RTL-vs-GLS mismatch isolation - REPRESENTATIVE (tool-neutral)
# 1) run RTL and GLS on the SAME stimulus; diff signals at ports (strobe after settle, 5.4)
# mismatch at: u_dut.out[3] (RTL=1, GLS=X)
# 2) narrow to module: diff at u_dut.u_ctrl boundary -> mismatch at u_ctrl.sel (RTL=0, GLS=X)
# 3) first divergence (12.2): u_ctrl.sel diverges first
# 4) classify + JUDGE BY SOURCE:
# GLS sel=X traces to an UNINITIALIZED flop (Ch6/7) -> a REAL bug RTL-optimism HID (6.4)
# => GLS X is CORRECT; RTL is the misleading one -> FIX THE DESIGN (init/reset the source)
# (if instead GLS X traced to a mis-scoped check / missing SDF -> GLS ARTIFACT -> fix the run)Practical context (representative, tool-neutral):
# RTL-vs-GLS comparison (tool-neutral):
# 1) run BOTH on the SAME stimulus; dump signals
# 2) diff at PORTS / hierarchy BOUNDARIES (strobe after settle, 5.4) -> narrow to module -> signal
# 3) find the FIRST divergence (12.2); classify (12.1)
# 4) JUDGE BY SOURCE:
# GLS X from real uninitialized/timing source -> RTL-optimism HID a real bug (6.4) -> fix DESIGN
# GLS X from setup/expected (SDF/check/corner) -> GLS artifact -> fix the RUN
# NEVER assume 'RTL golden' for X -- judge by source.RTL definite vs GLS X (GLS correct), as a real waveform:
RTL-vs-GLS mismatch: RTL shows a definite value (optimism), GLS shows X — and the GLS X is correct
8 cycles6. Debugging Session — a GLS-only mismatch: GLS wrong, or RTL hiding a bug?
A GLS-only mismatch is assumed to mean GLS is wrong (RTL is golden), but tracing the difference to its source shows RTL X-optimism hid a real uninitialized bug that the GLS X correctly exposes; judge by source, not by which run looks cleaner
RTL NOT ALWAYS GOLDEN FOR X — JUDGE BY SOURCE (6.4)A signal mismatches between RTL and GLS (RTL definite, GLS X). The reflex is "GLS is wrong — RTL is golden" and to hunt for a gate-level artifact.
RTL is not golden for X. Isolating the mismatch (diff at boundaries → module → signal, 12.2) and tracing the GLS X to its source (12.3) shows it comes from a real uninitialized control (Ch6/7). RTL's X-optimism (6.4) resolved that unknown to a definite branch — hiding the bug — while GLS faithfully propagated X. So the GLS X is correct (it exposes a real uninitialized source), and the RTL value is the misleading one. Assuming "RTL golden" and hunting for a GLS artifact would waste effort and, worse, dismiss a real bug. The mismatch had to be judged by source — and the source was a genuine design defect RTL happened to mask. (The opposite verdict — GLS artifact — is also possible: if the GLS X had traced to a mis-scoped check or missing SDF, then it would be a GLS artifact to fix in the run. The point is you can't tell without tracing the source.)
Isolate then judge by source: run RTL and GLS on the same stimulus, diff at ports/boundaries (strobe, 5.4) to narrow to a module then a signal, find the first divergence (12.2), and trace the difference to its source (12.3). Then decide by the source, not by "which run looks cleaner": a GLS X from a real uninitialized/timing source means RTL-optimism hid a real bug — fix the design; a GLS X from a setup/expected cause (missing SDF, mis-scoped check, wrong corner) is a GLS artifact — fix the run. The lesson: compare RTL and GLS on the same stimulus to isolate a mismatch (diff at boundaries → first divergence → classify), but judge by the source — RTL is usually golden, yet RTL X-optimism (6.4) means a GLS X can be correct where RTL hid a real bug, so never assume 'GLS is wrong.' (The comparison isolates; the source decides; GLS stays dynamic, 0.3.)
7. Common Mistakes
- Assuming "RTL is golden" for
X. RTL-optimism (6.4) can make a GLSXthe correct one. - Judging by "which run looks cleaner" instead of the source.
- Not isolating — diff at ports/boundaries to narrow to a module/signal.
- Not finding the first divergence (12.2) before classifying.
- Dismissing a GLS
Xas an artifact without tracing its source.
8. Industry Best Practices
- Run RTL and GLS on identical stimulus and diff at ports/boundaries (strobe, 5.4).
- Isolate to a module → signal → first divergence (12.2).
- Judge by source — GLS artifact (fix run) vs GLS-exposed real bug (fix design).
- Remember RTL isn't golden for
X(6.4) — trace before concluding. - Fix at the source; verify both runs agree with the right value.
Senior Engineer Thinking
- Beginner: "GLS disagrees with RTL — GLS must be wrong."
- Senior: "RTL is usually golden, but not for
X— RTL-optimism hides bugs GLS exposes. Let me isolate the mismatch and trace the source: real uninitialized cause → RTL hid a bug (fix design); setup/expected → GLS artifact (fix run)."
The senior isolates the mismatch and judges by source, never assuming RTL is golden for X.
Silicon Impact
RTL-vs-GLS comparison is a fast isolation technique — but its judgment is where it protects (or endangers) the tape-out. Assume "RTL is golden" blindly and you'll dismiss a GLS X as an artifact when it's actually exposing a real bug RTL's optimism hid (6.4) — letting an uninitialized-control/reset bug reach silicon (0.3). Conversely, treating every GLS-only difference as a real design bug wastes effort on setup artifacts. The discipline — isolate to the first divergence, trace to the source, judge by the source — is what makes the comparison conclusive: a GLS X from a real uninitialized/timing source is a design fix; one from a mis-scoped check or missing SDF is a run fix. This generalizes 6.4's insight into the everyday debug loop, keeping RTL a reference without making it an infallible oracle for X.
Engineering Checklist
- Ran RTL and GLS on identical stimulus; diffed at ports/boundaries (strobe, 5.4).
- Isolated to a module → signal → first divergence (12.2).
- Traced the difference to its source (12.3).
- Judged by source (GLS artifact → run; GLS-exposed real bug → design).
- Did not assume "RTL golden" for
X(6.4).
Try Yourself
- Run RTL and GLS on the same stimulus with an uninitialized control; diff at the ports.
- Observe: RTL shows a definite value; GLS shows
X— a mismatch. - Change: trace the GLS
Xto its source — it's the uninitialized control (a real bug RTL-optimism hid, 6.4). - Expect: the GLS
Xwas correct; fix the design (init the source) and both runs agree with the right value. Then contrive a GLS artifact (missing SDF) and confirm that one is a run fix — proving you judge by source.
RTL-vs-GLS comparison uses two runs in any simulator. No paid tool required.
Interview Perspective
- Weak: "RTL is golden, so any GLS mismatch means GLS is wrong."
- Good: "I compare RTL and GLS on the same stimulus, isolate the mismatch to a signal, and find a gate-level cause."
- Senior: "I diff RTL and GLS at boundaries, isolate to the first divergence, and — crucially — judge by the source. RTL is usually golden, but not for
X: RTL-optimism (6.4) hides bugs GLS exposes, so a GLSXcan be the correct one. A GLSXfrom a real uninitialized/timing source is a design fix; from a mis-scoped check or missing SDF it's a run fix. I never assume 'GLS is wrong.'"
9. Interview / Review Questions
10. Key Takeaways
- Run RTL and GLS on the same stimulus and compare to isolate a mismatch — where they diverge localizes a difference.
- Isolate: diff at ports/hierarchy boundaries (strobe after settling, 5.4) → narrow to a module → signal → first divergence (12.2) → classify (12.1).
- RTL is usually golden — a GLS-only failure is usually a gate-level-specific cause (X/timing/reset/CDC/power/DFT) to fix in the design or run.
- But RTL is not golden for
X— RTL is X-optimistic (6.4), so a GLSXcan be correct where RTL hid a real bug; judge by the source, not by which run looks cleaner. - Verdict by source: GLS
Xfrom a real uninitialized/timing source → fix the design (RTL hid it); GLSXfrom a setup/expected cause → GLS artifact, fix the run. The comparison isolates; the source decides. Next: 12.6 — common GLS mistakes & how to avoid them.
Quick Revision
Compare RTL vs GLS on the SAME stimulus to ISOLATE a mismatch: diff at ports/boundaries (strobe 5.4) → module → signal → first divergence (12.2) → classify. RTL usually golden → GLS-only failure = gate-level cause. CAVEAT: RTL NOT golden for
X— RTL-optimism (6.4) means a GLSXcan be CORRECT (RTL hid a bug). JUDGE BY SOURCE: real uninit/timing source → fix DESIGN; setup/expected → GLS artifact, fix RUN. Next: 12.6 — common GLS mistakes.