- ๐ฏ Overview
- โจ Features
- ๐๏ธ BMU Architecture
- ๐งช Verification Environment
- ๐ Directory Structure
- ๐ Quick Start
- ๐ Verified Instruction Set
- ๐ Coverage Model
- ๐ ๏ธ Usage
- ๐ Results
The Bit Manipulation Unit (BMU) is a synthesizable RTL block that implements bit manipulation functionality compliant with the RISC-V BitManip extension. This verification environment provides comprehensive testing for all supported instruction subsets and ensures robust functionality across various operational scenarios.
| Extension | Instructions | Status | Description |
|---|---|---|---|
| Zbb | CLZ, CPOP, MIN, SEXT.H, AND/ANDN, XOR/XORN | โ Verified | Basic bit manipulation operations |
| Zbs | BEXT | โ Verified | Single bit operations |
| Zbp | ROL, PACKU, GORC | โ Verified | Bit permutation operations |
| Zba | SH3ADD | โ Verified | Address generation operations |
| Basic | ADD, SLL, SRA, SLT/SLTU | โ Verified | Core arithmetic and logical operations |
| Instruction | Extension | Control Signals |
|---|---|---|
| ADD | Basic | ap.add |
| CLZ | Zbb | ap.clz |
| CPOP | Zbb | ap.cpop |
| MIN | Zbb | ap.min + ap.sub |
| SEXT.H | Zbb | ap.siext_h |
| AND | Basic | ap.land |
| ANDN | Zbb | ap.land + ap.zbb |
| XOR | Basic | ap.lxor |
| XORN | Zbb | ap.lxor + ap.zbb |
| SLL | Basic | ap.sll |
| SRA | Basic | ap.sra |
| SLT | Basic | ap.slt + ap.sub |
| SLTU | Basic | ap.slt + ap.sub + ap.unsign |
| BEXT | Zbs | ap.bext |
| ROL | Zbp | ap.rol |
| PACKU | Zbp | ap.packu |
| GORC | Zbp | ap.gorc |
| SH3ADD | Zba | ap.sh3add + ap.zba |
| Port Name | Direction | Width | Description |
|---|---|---|---|
clk |
Input | 1 bit | System clock |
rst_l |
Input | 1 bit | Active-low synchronous reset |
scan_mode |
Input | 1 bit | Scan test mode control |
valid_in |
Input | 1 bit | Instruction valid flag |
ap |
Input | Struct | Decoded instruction control signals |
csr_ren_in |
Input | 1 bit | CSR read-enable |
csr_rddata_in |
Input | 32 bits | CSR read data |
a_in, b_in |
Input | 32 bits | Input operands A and B |
result_ff |
Output | 32 bits | Final computed result |
error |
Output | 1 bit | Error indicator |
- โ Arithmetic Unit: ADD, SUB, SHxADD operations
- ๐ Shift Logic: SLL, SRL, SRA, ROL, ROR operations
- ๐ข Count Logic: CLZ, CTZ, CPOP implementations
- ๐ Extension Logic: SEXT.B, SEXT.H sign extension
- โ๏ธ Compare Logic: MIN, MAX signed/unsigned comparison
- ๐ Pack Logic: PACK, PACKU, PACKH data combination
- ๐ญ Bit Logic: BSET, BCLR, BINV, BEXT operations
This comprehensive UVM-based verification environment ensures thorough validation of the BMU design through:
- ๐ฅ๏ธ Environment: Complete UVM environment with all necessary components
- ๐ค Agent: Modular agent architecture for stimulus generation and monitoring
- ๐ Driver: Intelligent driver for transaction execution
- ๐ Monitor: Comprehensive monitoring and protocol checking
- ๐ Scoreboard: Advanced result checking and comparison
- ๐ Sequences: Targeted and random test sequences
- โ Tests: Comprehensive test suite covering all scenarios
- ๐ง Instruction-Specific Tests: Individual instruction validation
- ๐ฒ Random Tests: Pseudo-random stimulus generation
โ ๏ธ Error Tests: Error condition validation- ๐ Regression Tests: Complete test suite execution
BMU-Verification/
โโโ ๐ README.md # This comprehensive documentation
โโโ ๐ง Makefile # Build and simulation scripts
โโโ ๐ .gitignore # Git ignore patterns
โ
โโโ ๐งฉ components/ # Core verification components
โ โโโ bmu_interface.sv # BMU interface definition
โ โโโ bmu_pkg.sv # UVM package declarations
โ โโโ bmu_sequence_item.sv # Transaction/sequence item
โ โโโ bmu_tb.sv # Top-level testbench
โ โโโ BMU.sv # BMU design wrapper
โ โโโ env/ # UVM Environment Components
โ โโโ bmu_agent.sv # UVM agent for BMU interface
โ โโโ bmu_driver.sv # Driver for stimulus generation
โ โโโ bmu_environment.sv # Top-level UVM environment
โ โโโ bmu_monitor.sv # Monitor for signal observation
โ โโโ bmu_scoreboard.sv # Result checking and comparison
โ โโโ bmu_sequencer.sv # Sequence coordination
โ โโโ bmu_subscriber.sv # Coverage and analysis subscriber
โ
โโโ ๐ฏ dut_rm/ # Design Under Test Reference Model
โ โโโ bmu_reference_model.sv # Golden reference implementation
โ
โโโ ๐๏ธ rtl/ # RTL Design Files
โ โโโ Bit_Manibulation_Unit.sv # Main BMU RTL implementation
โ โโโ bmu_design.sv # Design wrapper
โ โโโ rtl_def.sv # RTL definitions
โ โโโ rtl_defines.sv # RTL macros and defines
โ โโโ rtl_lib.sv # RTL library components
โ โโโ rtl_param.vh # RTL parameters
โ โโโ rtl_pdef.sv # RTL package definitions
โ
โโโ ๐ช sequences/ # UVM Test Sequences
โ โโโ bmu_add_sequence.sv # Addition operation sequence
โ โโโ bmu_and_sequence.sv # Logical AND sequence
โ โโโ bmu_bext_sequence.sv # Bit extract sequence
โ โโโ bmu_clz_sequence.sv # Count leading zeros sequence
โ โโโ bmu_cpop_sequence.sv # Population count sequence
โ โโโ bmu_csr_write_sequence.sv # CSR write sequence
โ โโโ bmu_errors_sequence.sv # Error condition sequence
โ โโโ bmu_gorc_sequence.sv # Generalized OR-combine sequence
โ โโโ bmu_min_sequence.sv # Minimum operation sequence
โ โโโ bmu_packu_sequence.sv # Pack upper sequence
โ โโโ bmu_reset_sequence.sv # Reset sequence
โ โโโ bmu_rol_sequence.sv # Rotate left sequence
โ โโโ bmu_sh3add_sequence.sv # Shift-add sequence
โ โโโ bmu_siext_h_sequence.sv # Sign extend halfword sequence
โ โโโ bmu_sll_sequence.sv # Shift left logical sequence
โ โโโ bmu_slt_sequence.sv # Set less than sequence
โ โโโ bmu_sra_sequence.sv # Shift right arithmetic sequence
โ โโโ bmu_valid_in_sequence.sv # Valid input sequence
โ โโโ bmu_xor_sequence.sv # Logical XOR sequence
โ
โโโ โ
tests/ # UVM Test Cases
โโโ bmu_add_test.sv # Addition operation test
โโโ bmu_and_test.sv # Logical AND test
โโโ bmu_bext_test.sv # Bit extract test
โโโ bmu_clz_test.sv # Count leading zeros test
โโโ bmu_cpop_test.sv # Population count test
โโโ bmu_csr_write_test.sv # CSR write test
โโโ bmu_errors_test.sv # Error condition test
โโโ bmu_gorc_test.sv # Generalized OR-combine test
โโโ bmu_min_test.sv # Minimum operation test
โโโ bmu_packu_test.sv # Pack upper test
โโโ bmu_regression_test.sv # Complete regression test
โโโ bmu_rol_test.sv # Rotate left test
โโโ bmu_sh3add_test.sv # Shift-add test
โโโ bmu_siext_h_test.sv # Sign extend halfword test
โโโ bmu_sll_test.sv # Shift left logical test
โโโ bmu_slt_test.sv # Set less than test
โโโ bmu_sra_test.sv # Shift right arithmetic test
โโโ bmu_valid_in_test.sv # Valid input test
โโโ bmu_xor_test.sv # Logical XOR test
- Cadence Xcelium or compatible SystemVerilog simulator
- UVM 1.2 or later
- Make utility for build automation
-
Clone the repository
git clone <repository-url> cd BMU-Verification
-
Run regression test (Recommended for first-time users)
make all
-
Run specific test
make TEST_NAME=bmu_add_test run_sim
-
Run with different verbosity
make TEST_NAME=bmu_clz_test VERBOSITY=UVM_HIGH run_sim
-
Clean build artifacts
make clean
| Target | Description |
|---|---|
all |
Clean and run regression test |
run_sim |
Run simulation with specified test |
test |
Run default test from testbench |
wave |
Open Verisium GUI |
imc |
Open IMC GUI |
clean |
Remove simulation artifacts |
| Instruction | Status | Description | Test Coverage |
|---|---|---|---|
| CLZ | โ Verified | Count Leading Zeros - counts zeros from MSB before first '1' | Complete |
| CPOP | โ Verified | Count Population - counts total number of '1' bits | Complete |
| MIN | โ Verified | Minimum - returns smaller of two signed integers | Complete |
| SEXT.H | โ Verified | Sign Extend Halfword - extends sign bit from bit 15 | Complete |
| ANDN | โ Verified | AND with Negation - performs a & (~b) |
Complete |
| XORN | โ Verified | Exclusive NOR - performs (a ^ ~b) |
Complete |
| Instruction | Status | Description | Test Coverage |
|---|---|---|---|
| BEXT | โ Verified | Bit Extract - copies specific bit to LSB, clears others | Complete |
| Instruction | Status | Description | Test Coverage |
|---|---|---|---|
| ROL | โ Verified | Rotate Left - rotates bits left, MSB wraps to LSB | Complete |
| PACKU | โ Verified | Pack Upper Halves - combines upper halves from two registers | Complete |
| GORC | โ Verified | Generalized OR-Combine - sets all bits in byte to '1' if any bit was '1' | Complete |
| Instruction | Status | Description | Test Coverage |
|---|---|---|---|
| SH3ADD | โ Verified | Shift-Add 3 - performs (a << 3) + b |
Complete |
| Instruction | Status | Description | Test Coverage |
|---|---|---|---|
| ADD | โ Verified | Addition - performs a + b |
Complete |
| AND | โ Verified | Logical AND - performs a & b |
Complete |
| XOR | โ Verified | Logical XOR - performs a ^ b |
Complete |
| SLL | โ Verified | Shift Left Logical - shifts left by specified amount | Complete |
| SRA | โ Verified | Shift Right Arithmetic - arithmetic right shift | Complete |
| SLT | โ Verified | Set Less Than - signed comparison a < b |
Complete |
| SLTU | โ Verified | Set Less Than Unsigned - unsigned comparison a < b |
Complete |
- Zbb Extension: 6 instructions (CLZ, CPOP, MIN, SEXT.H, ANDN, XNOR)
- Zbs Extension: 1 instruction (BEXT)
- Zbp Extension: 3 instructions (ROL, PACKU, GORC)
- Zba Extension: 1 instruction (SH3ADD)
- Basic Operations: 5 instructions (ADD, AND, XOR, SLL, SRA, SLT, SLTU)
- โ Instruction Coverage: All supported instructions exercised
- ๐ Operand Coverage: Various operand combinations and edge cases
- ๐ State Coverage: All internal FSM states and transitions
โ ๏ธ Error Coverage: All error conditions and recovery scenarios- ๐ช Cross Coverage: Instruction ร operand ร state combinations
Each instruction has dedicated test sequences and test cases:
# Test Zbb Extension Instructions
make TEST_NAME=bmu_clz_test run_sim # Count leading zeros
make TEST_NAME=bmu_cpop_test run_sim # Population count
make TEST_NAME=bmu_min_test run_sim # Minimum operation
make TEST_NAME=bmu_siext_h_test run_sim # Sign extend halfword
make TEST_NAME=bmu_and_test run_sim # AND/ANDN operations
make TEST_NAME=bmu_xor_test run_sim # XOR/XNOR operations
# Test Zbs Extension Instructions
make TEST_NAME=bmu_bext_test run_sim # Bit extract
# Test Zbp Extension Instructions
make TEST_NAME=bmu_rol_test run_sim # Rotate left
make TEST_NAME=bmu_packu_test run_sim # Pack upper halves
make TEST_NAME=bmu_gorc_test run_sim # Generalized OR-combine
# Test Zba Extension Instructions
make TEST_NAME=bmu_sh3add_test run_sim # Shift-add-3
# Test Basic Operations
make TEST_NAME=bmu_add_test run_sim # Addition
make TEST_NAME=bmu_sll_test run_sim # Shift left logical
make TEST_NAME=bmu_sra_test run_sim # Shift right arithmetic
make TEST_NAME=bmu_slt_test run_sim # Set less thanTo execute the complete regression suite covering all instructions and scenarios:
make allComing soon: Detailed coverage reports and performance metrics.
- Additional Zbb instructions (CTZ, MAX, SEXT.B, ORN)
- Remaining Zbs instructions (BSET, BCLR, BINV)
- Additional Zbp instructions (ROR, PACK, PACKH, GREV)
- Additional Zba instructions (SH1ADD, SH2ADD)