A comprehensive Verilog testbench framework for code coverage analysis using QuestaSim. Includes automated test execution, coverage report generation, and test result summarization. Designed as a reusable template for Verilog simulation projects.
cd sim/
./run.csh # Run all testcases with coverage
./report.csh # Generate summary reportcat rep.log # Quick summary
cat coverage/summary_report.txt # Detailed coverage report.
├── rtl/ # RTL design files
│ └── top.v # XOR gate design
├── tb/ # Testbench
│ └── testbench.v # Main testbench module
├── testcases/ # Test stimuli
│ ├── onerun.v # Test scenario 1
│ └── tworun.v # Test scenario 2
├── sim/ # Simulation environment
│ ├── Makefile # Build automation
│ ├── compile.f # Compilation file list
│ ├── pat.list # Testcase list
│ ├── run.csh # Test runner script
│ └── report.csh # Coverage report generator
└── README.md
| Tool | Version | Purpose |
|---|---|---|
| QuestaSim | 10.7c | Verilog simulation & coverage |
| GNU Make | - | Build automation |
| Bash/C-shell | - | Scripting |
This project provides foundational knowledge in Verilog simulation and testing:
- Verilog Testbench Basics: Writing stimulus files, module instantiation, and test verification
- QuestaSim Fundamentals: Compilation, simulation, and waveform analysis workflows
- Code Coverage Concepts: Understanding coverage metrics (blocks, conditions, statements) and measurement techniques
- Test Automation: Automating multi-testcase execution using Make and shell scripts
- Coverage Analysis: Generating and interpreting coverage reports to identify untested code
- Test Organization: Structuring testcases, logs, and reports for systematic verification
Note: This is a basic, educational framework designed to teach core simulation concepts. Production environments may require more advanced features (formal verification, protocol compliance, performance analysis, etc.).
make all # Build + Run simulation
make all_cov # Build + Run with coverage
make build # Compile design
make build_cov # Compile with coverage instrumentation
make run # Run simulation
make run_cov # Run with coverage tracking
make gen_cov # Generate text coverage report
make clean # Clean all generated files./run.csh # Run all testcases with coverage
./run.csh no-cov # Run without coverage (faster)
./report.csh # Generate test summary reportTestbench achieves 100% code coverage by testing all input combinations:
| Test | Inputs | Expected | Status |
|---|---|---|---|
| Test 1 | a=0, b=0 | z=0 | PASS |
| Test 2 | a=0, b=1 | z=1 | PASS |
| Test 3 | a=1, b=0 | z=1 | PASS |
| Test 4 | a=1, b=1 | z=0 | PASS |
(Example: XOR gate. Customize test scenarios for your design.)
log/- Simulation logs for each testcasecoverage/- Coverage reports (text format)rep.log- Test summary reportcovhtmlreport/- HTML coverage visualization (optional)
- Create test file in
testcases/mytest.v - Add to
pat.list: echo "mytest" >> sim/pat.list - Run:
./run.csh
See SETUP.md
Last Updated: May 2026