full_case and parallel_case
Standard Verilog syntax lacks native keywords to declare that a case statement covers all possible inputs or that its branches are mutually exclusive. EDA vendors historically introduced synthesis pragmas to communicate these architectural assumptions. However, pragmas frequently cause simulation-synthesis mismatches.
Synthesis Pragmas
Pragmas are specified as Verilog attributes or embedded comments:
(* full_case *) // Asserts that all input conditions are listed
(* parallel_case *) // Asserts that case branches are mutually exclusive
In legacy code, pragmas appear as comments: // synopsys full_case parallel_case.
These directives are not part of the standard simulation semantics. Logic synthesis tools alter hardware gate inference based on pragmas, while simulation engines ignore them completely.
The full_case Pragma
The full_case pragma tells the synthesis tool that unlisted input combinations will never occur in physical operation. The synthesis tool treats unlisted combinations as “don’t cares” and eliminates default logic to minimize gate area.
If an unlisted state occurs during hardware operation, the physical circuit behaves unpredictably. However, the simulation engine (which ignores the pragma) executes standard Verilog semantics and retains the previous value, modeling a transparent latch.
Instead of declaring full_case, write an explicit default assignment:
default: result = 8'hxx; // Provides don't-care optimization visible to both tools
An explicit default assignment guides synthesis optimization while ensuring that simulation models the identical hardware behavior.
The parallel_case Pragma
The parallel_case pragma tells the synthesis tool that no two branches can match simultaneously. The synthesis tool eliminates priority multiplexer chains and builds a flat parallel decoder.
If branches overlap, simulation evaluates the first matching branch in priority order. In physical hardware, the parallel decoder asserts multiple drivers simultaneously, corrupting the output.
Instead of declaring parallel_case, design branch constants to be mutually exclusive.
SystemVerilog Replacements: unique and priority
SystemVerilog (IEEE 1800) replaces vendor pragmas with formal language keywords that simulators actively verify:
unique case: Asserts that exactly one branch matches. The simulator generates runtime warnings if multiple branches match or if no branch matches.unique0 case: Asserts that at most one branch matches. The simulator generates warnings only if multiple branches match.priority case: Asserts that at least one branch matches. The simulator generates warnings if no branch matches and no default exists.
These keywords enforce verification checks during functional simulation, eliminating the hazards of legacy synthesis pragmas.
The next article compares priority encoders and parallel decoders, providing guidelines for selecting between them in digital RTL.