What Synthesis Does With Your RTL
Section 5.3 taught that if-else cascades imply priority multiplexer chains while case statements infer parallel decoders.
While useful for structuring RTL source code, this model does not describe the complete synthesis compilation process.
Synthesis compilers do not translate Verilog syntax literally into physical logic gates.
Understanding the transformation pipeline from behavioral code to physical netlists helps engineers write synthesis-friendly RTL.
Logic Extraction and Boolean Minimization
A synthesis tool first parses RTL syntax into an abstract Boolean logic network. The tool extracts mathematical logic functions independently of the enclosing language syntax. Next, logic optimization engines perform automated Boolean minimization, similar to advanced multi-variable Karnaugh mapping.
If two different RTL descriptions describe the identical Boolean transfer function, the compiler optimizes both implementations into identical gate netlists. Syntax conveys developer intent, but logic optimization determines the physical hardware structure.
Mutual Exclusivity and Priority Flattening
Consider a sequential multiplexer written using if-else syntax:
// Written syntactically as a priority chain with mutually exclusive conditions
always @(*) begin
result = 4'b0000;
if (sel == 2'b00) result = a;
else if (sel == 2'b01) result = b;
else if (sel == 2'b10) result = c;
else result = d;
end
The conditions sel == 2'b00, sel == 2'b01, and sel == 2'b10 are mutually exclusive.
Two conditions can never evaluate to true simultaneously.
The synthesis optimizer detects this condition and flattens the implied priority chain into a balanced, parallel multiplexer.
The generated circuit matches the structure produced by a standard case statement.
In contrast, an interrupt encoder where a Non-Maskable Interrupt (NMI) overrides standard interrupt lines requires genuine priority resolution. When multiple input conditions can assert simultaneously, the compiler preserves the prioritized cascade. Compilers preserve priority only when functional specifications require it.
Physical Technology Mapping
The final synthesis phase is technology mapping. The compiler maps the optimized, technology-independent Boolean network into the physical primitives of the target process:
- ASIC Standard Cell Libraries: Compilers select combinations of NAND, NOR, Inverter, AND-OR-Invert (AOI), and complex compound cells to minimize silicon area and meet timing constraints.
- FPGA Architectures: Compilers partition Boolean equations into Look-Up Tables (LUTs). A 6-input LUT implements any arbitrary 6-input Boolean function. FPGA reports measure circuit size in LUT utilization rather than discrete gate counts.
Verification Exercise
Compare the following two Verilog coding styles:
// Style A: Procedural if-else block
always @(*) begin
if (sel) y = b;
else y = a;
end
// Style B: Continuous conditional assignment
assign y = sel ? b : a;
Explain why synthesis generates identical gate-level netlists for both implementations.
View Solution
Both descriptions implement the identical Boolean transfer function:
$$y = (sel \cdot b) + (\overline{sel} \cdot a)$$
The synthesis compiler extracts the underlying Boolean network from the source code. Because both descriptions represent the identical mathematical function, logic optimization and technology mapping produce identical gate-level netlists. Engineers select between these styles based on code clarity rather than synthesis performance.
Synthesis compilers extract Boolean equations and optimize them before mapping into target gates or LUTs. The next article explores resource sharing and the trade-offs between silicon area and path timing.