Verification guide
Learning navigation
Verification guide
Verification foundations
Formal Verification
Formal methods use mathematical reasoning to prove properties across all inputs within a model, complementing simulation-based testing.
Formal Verification vs. Simulation
Simulation:
- Tests selected scenarios
- Cannot guarantee correctness
- Example: "FIFO works when written 100 times"
Formal Verification:
- Proves properties for ALL possible cases
- Mathematical guarantee of correctness
- Example: "FIFO never overflows under ANY conditions"
Key Advantage:
One formal proof is worth millions of simulations!
Formal Verification Techniques
1. Model Checking
- Exhaustively explores all possible states
- Verifies properties for each state
- Works best for smaller designs or properties
- Tools: Cadence SMV, Siemens Questa Formal
2. Theorem Proving
- Uses mathematical logic to prove properties
- Can handle large, complex designs
- Requires more expert knowledge
- Tools: ACL2, Isabelle
3. Equivalence Checking
- Proves two designs are functionally equivalent
- Used after synthesis/optimization
- Ensures optimizations didn't break functionality
- Tools: Conformal, Questa Formal
4. Property Checking (Assertions)
- Verifies specific properties using assertions
- Can be checked in simulation or formally
- User-defined properties
- Languages: SVA (SystemVerilog Assertions), PSL
When to Use Formal Verification
Good Candidates:
- Protocols: Verify protocol compliance (AXI, APB, etc.)
- Arbiters: Verify no deadlock or starvation
- Cache logic: Verify coherency properties
- Control units: Verify state machines and controllers
- Critical paths: Verify high-risk functionality
Difficult Cases:
- Large arithmetic: Complex calculations hard to prove
- Data processing: Algorithm correctness hard to prove
- Analog circuits: Most formal tools are for digital only
- Behavioral properties: Some properties hard to express formally
Formal Verification Workflow
- Define Properties: Write assertions/properties to verify
- Create Assumptions: Specify valid input constraints
- Run Formal Tool: Tool tries to find violations
- Analyze Results:
- PROVED: Property holds for all cases
- FAILED: Counterexample shows violation
- TIMEOUT: Too complex, may need refinement
- Iterate: Fix bugs or refine properties
Comparison: Formal vs Simulation
| Aspect | Simulation | Formal |
|---|---|---|
| Coverage | Selected scenarios | ALL possible cases |
| Guarantee | None (probabilistic) | Mathematical proof |
| Scalability | Good for large designs | Limited to smaller properties |
| Time to Setup | Fast | Slow (needs properties) |
| Expertise Required | Medium | High |
| Cost | Low-Medium | High |
Formal Verification Best Practices
- Start simple: Prove basic properties first
- Use for critical components: Don't try to verify everything
- Combine with simulation: Use both techniques together
- Invest in training: Formal verification requires expertise
- Automate property checking: Run checks as part of regression