RTL Lint Diagnostics: Black Boxes, Loops, and Width Mismatches
System DesignModel answerLast updated
Explain the root cause, hardware risk, and fix strategy for three common RTL lint findings in Verilog/SystemVerilog static analysis.
RTL Lint Diagnostics
You are developing a block in Verilog or SystemVerilog. After running a lint tool, you see three categories of findings:
- A module is flagged as an unresolved instance (sometimes called a black box)
- A combinational feedback loop is reported
- An assignment width mismatch is flagged (left-hand and right-hand sides have different bit widths)
For each finding, address the following:
- What coding or flow situation typically produces it?
- What is the actual hardware or verification risk if it goes unaddressed?
- How would you track it down and resolve it?
Close with a short explanation of why lint belongs in a digital design flow at all — not just as a nice-to-have, but as a practical engineering gate.
A strong answer gives concrete root causes (with short code examples where helpful), explains the real consequence in terms of simulation, synthesis, or silicon, and describes a systematic fix rather than just suppressing the warning.
Hints
Hint 1
For the unresolved instance, think about what the tool can and cannot check when it has no visibility into a module's internals — and consider both accidental and intentional causes.
Hint 2
For the combinational loop, think about what static timing analysis does when it encounters a cycle, and what the physical hardware actually does at runtime.
Hint 3
For width mismatches, Verilog has well-defined but silent rules for truncation and extension — ask yourself when those silent rules produce wrong behavior and what explicit constructs make the intent unambiguous.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Approach
Lint is static analysis: it reads RTL without simulating it and flags code that is syntactically legal but structurally suspicious. The best answers are organized around three things per finding — root cause, real consequence, systematic fix — and close with why the tool earns its place in the flow.
1. Unresolved Instance (Black Box)
Root cause
The lint tool found an instantiation with no matching module definition in scope. Common triggers:
- The source file is missing from the filelist or the library search paths are misconfigured.
- A typo or case mismatch in the module or instance name.
- The definition is inside an
`ifdefblock that is not active in the lint invocation. - The module is intentionally opaque: an encrypted third-party IP, a hard macro (SRAM, PLL, analog block), or a standard-cell library element with no RTL model.
Hardware and verification risk
When a module is opaque, nothing inside it is checked. Port widths, directions, unconnected signals, and any logic buried in that hierarchy are all invisible to the tool. Its outputs appear undriven to downstream checks, which can mask real clock-domain crossing, X-propagation, or connectivity problems. The dangerous edge case is a misspelled module name: what should be real logic silently becomes a hollow shell, and synthesis may optimize away the entire instance without warning.
Investigation and fix
- Search the codebase for the module definition and confirm it appears in the filelist.
- Verify that
+define+flags match what was active during compilation. - For genuinely opaque blocks (hard macros, encrypted IP), provide a behavioral stub with correct port declarations and direction attributes so port-level checks can still run. A Liberty
.libview works for purely synthesis-oriented flows. - Waive only intentional black boxes, one per module with a comment explaining why — never use a global suppression that hides real missing files.
2. Combinational Feedback Loop
Root cause
A signal's combinational logic path feeds back to its own input with no register breaking the cycle. Typical patterns:
// a depends on b, b depends on a — classic loop
assign a = en ? b : 1'b0;
assign b = a | req;
Other sources: reading a "next-state" variable where the registered "current-state" was intended, or a handshake where valid depends combinationally on ready and ready depends combinationally on valid.
Hardware and verification risk
In silicon, a combinational loop can oscillate or settle to a value that depends on gate delays, which vary with process, voltage, and temperature. Behavior becomes non-deterministic and non-reproducible. Static timing analysis cannot compute a path delay through a cycle; the tool breaks it at an arbitrary node, making timing reports unreliable or meaningless for that region. In simulation, event-ordering can hide the problem or cause a zero-delay loop that hangs the simulator. If it reaches tape-out, it is typically an unfixable silicon bug.
Investigation and fix
Use the loop path the lint tool reports to trace every node in the cycle. Then decide what the designer actually intended:
-
Feedback should be sequential. Break the loop with a register using the standard next/current split:
always_comb state_d = f(state_q, inputs); // reads only the registered _q always_ff @(posedge clk or negedge rst_n) if (!rst_n) state_q <= IDLE; else state_q <= state_d; -
Dependency is spurious. Restructure so the signal is derived from primary inputs and registered values only, eliminating the circular reference.
-
Handshake loop. Follow the AXI rule:
validmust not depend combinationally onready. If the protocol requires it, insert a register slice or skid buffer to break the cycle.
Note: an incomplete sensitivity list or missing else in always_comb infers a latch, which is a separate but related warning. The fix is explicit default assignments at the top of the block.
3. Assignment Width Mismatch
Root cause
The bit widths on the two sides of an assignment, port connection, or comparison do not match:
logic [7:0] a, b;
logic [7:0] sum;
logic [3:0] small;
assign sum = a + b; // arithmetic result is 9 bits; carry is silently lost
assign small = a; // upper 4 bits silently truncated
if (cnt == 5) ... // literal 5 is 32 bits; comparison is widened unexpectedly
Mismatches on module port connections (wiring a [15:0] bus to a [7:0] port), signed/unsigned mixing, and stale hard-coded widths after a parameter change are also common sources.
Hardware and verification risk
Verilog has well-defined but silent truncation and extension rules. Simulation and synthesis both apply the same rule, so nothing looks obviously wrong until a corner case exercises the lost bits. Practical consequences include: carry bits dropped from adders, counters that wrap at the wrong value, address bits that alias, and incorrect sign extension when mixing signed and unsigned operands (which makes the entire expression unsigned). Port connection mismatches leave bits undriven or floating, feeding X-propagation into downstream logic.
Investigation and fix
For each warning, determine what was actually intended — width is part of the specification, not just style.
- Size the result to hold all significant bits:
logic [8:0] sum; - Make truncation explicit with a slice:
small = a[3:0]; - Make extension explicit:
{4'b0, small}for zero-extension,{{4{small[3]}}, small}for sign extension. - Use sized literals (
4'd5) and SystemVerilog casts (8'(x),signed'(x)) rather than unsized constants. - Derive widths from parameters and
$clog2/$bitsso they stay consistent when the design is reparameterized, rather than scattering magic numbers.
Waive only intentional cases — for example, a deliberate modulo-2^N wraparound counter — with a comment explaining the design decision.
Why Lint Belongs in the Flow
Lint finds whole categories of bugs in seconds with no testbench. That makes it the cheapest filter available. More importantly, it catches synthesis/simulation mismatches — latches inferred by incomplete assignments, multiply-driven nets, blocking assignments in clocked blocks — that simulation alone can miss because both the simulator and synthesizer will silently agree on the "wrong" behavior.
A clean lint run, with reviewed and documented waivers, is a practical regression gate: run it before check-in so new warnings surface immediately rather than accumulating. It also enforces team coding conventions (reset style, naming, no initial in synthesizable code) and pairs naturally with CDC and reset-domain crossing checks that operate on the same static model.
The key distinction worth stating explicitly: a warning should be resolved, not silently suppressed. Each waiver should have an owner and a documented rationale, so the difference between "intentional black box for encrypted IP" and "file accidentally missing from the filelist" stays visible.
Common Mistakes to Avoid
- Treating global waiver files as a cleanup strategy — this defeats the tool entirely.
- Confusing a combinational loop with a latch. They are distinct; the lint tool usually reports them separately and the fixes differ.
- Assuming a width mismatch is harmless because "simulation passes." The truncation is consistent, so it only fails at the numeric boundary that the testbench never exercised.
- Omitting stubs for hard macros and then wondering why CDC or X-analysis reports seem incomplete.