
RTL Synthesis- Part I
NPTEL-NOC IITM
Overview
This video introduces RTL synthesis, the initial stage of logic synthesis in VLSI design. It explains how RTL code, typically written in Verilog, is translated into a netlist of generic logic gates. The process involves parsing the code to create a hierarchical data structure, followed by elaboration to establish connections between modules and instances. The video also details how various Verilog constructs like 'assign' statements, 'if-else', 'case', and 'always' blocks are synthesized into combinational logic or sequential elements like flip-flops and latches, while also highlighting constructs that are not synthesizable.
Save this permanently with flashcards, quizzes, and AI chat
Chapters
- RTL synthesis is the first step in logic synthesis, translating Verilog code into a netlist of generic logic gates.
- It involves parsing, elaboration, and translation of Verilog constructs into logic.
- Parsing breaks down code into tokens and builds a hierarchical syntax tree.
- Elaboration links instances to their master modules and checks for connection errors.
- Lexical analysis breaks RTL code into tokens (keywords, identifiers, operators).
- Syntax analysis checks if the code follows Verilog grammar, reporting errors if not.
- A syntax tree (or parse tree) is built as a hierarchical data structure representing the code's structure.
- Parent-child relationships in the tree mirror containment in the RTL code (e.g., a module contains statements).
- Elaboration connects instantiated modules (instances) to their master module definitions.
- It verifies the legitimacy of connections, checking port names and bus widths.
- During elaboration, the tool infers port directions if not explicitly defined, sometimes making simplistic assumptions (e.g., all ports as inputs).
- Errors like missing master module definitions (leading to black boxes) or incorrect port connections are reported.
- Elaboration handles parameterized modules by creating specialized versions for each unique set of parameter values.
- A parameterized module (e.g., 'counter' with parameter 'WIDTH') can have different interface sizes based on the parameter's value.
- For each instance with a different parameter value, the tool may internally generate a new module with a name reflecting the parameter and its value (e.g., 'counter_WIDTH_8').
- Not all Verilog constructs are synthesizable; some are intended only for simulation/verification.
- Synthesizability is tool-dependent; designers must know which constructs their tool supports.
- Non-synthesizable constructs include delay specifications (`#delay`), `initial` blocks, `fork-join`, `force-release`, `real`/`time` data types, and system tasks like `$display`.
- Delay specifications are ignored during synthesis, treating the assignment as immediate.
- Continuous `assign` statements synthesize into combinational logic gates based on the right-hand side (RHS) expression.
- Operators like AND, OR, and ternary operators map directly to AND gates, OR gates, and multiplexers, respectively.
- `if-else` statements synthesize into multiplexers, where the condition determines the select line.
- `case` statements also synthesize into multiplexers or select logic, with the case expression forming the select lines.
- Edge-sensitive `always` blocks (e.g., triggered by `posedge clk`) synthesize into sequential elements like flip-flops.
- Asynchronous resets in `always` blocks lead to flip-flops with asynchronous reset pins.
- Synchronous resets are implemented within the clock edge logic, often using multiplexers.
- The synthesis tool aims for functional equivalence, potentially using different gate implementations than shown.
- Blocking assignments (`=`) in `always` blocks execute sequentially and can lead to simplified logic (e.g., a single flip-flop).
- Non-blocking assignments (`<=`) evaluate RHS first and schedule LHS updates, typically synthesizing into shift registers or multiple flip-flops.
- Level-sensitive `always` blocks infer combinational logic if all paths assign a value, or latches if a variable retains its old value in some paths.
- Latches can be inferred unintentionally due to incomplete case statements or missing assignments in conditional branches.
- Latches are often inferred unintentionally when combinational logic is intended.
- Missing assignments in conditional branches (like `case` or `if-else`) cause variables to retain their old values, leading to latch inference.
- Using a `default` clause in `case` statements ensures all possibilities are covered, preventing latches.
- Assigning default values to signals at the beginning of an `always` block can also help avoid latches.
Key takeaways
- RTL synthesis translates human-readable Verilog code into a hardware-understandable netlist of logic gates.
- Parsing and elaboration are foundational steps that structure the code and verify its connectivity.
- Synthesizable Verilog constructs map directly to hardware elements like gates, flip-flops, and multiplexers.
- Non-synthesizable constructs, like delays and system tasks, are ignored or cause errors during synthesis.
- The distinction between blocking and non-blocking assignments significantly impacts the synthesized sequential logic.
- Careful coding, especially in `always` blocks and `case` statements, is essential to avoid inferring unintended latches.
- Understanding tool-specific behavior is important, as synthesizability and implementation details can vary.
Key terms
Test your understanding
- What is the primary goal of RTL synthesis in the VLSI design flow?
- How does the process of parsing contribute to the RTL synthesis workflow?
- What is the role of elaboration, and what types of errors can it detect?
- Why is it important to distinguish between synthesizable and non-synthesizable Verilog constructs?
- How do `if-else` and `case` statements typically translate into hardware during synthesis?
- What is the functional difference between blocking and non-blocking assignments in an `always` block, and how does it affect synthesis?
- What conditions can lead to the unintentional inference of latches during RTL synthesis, and how can this be prevented?