The Universal Verification Methodology (UVM) Register Abstraction Layer (RAL) provides a structured way to interact with hardware registers during functional verification. UVM RAL simplifies the process of accessing registers, verifying values, and predicting system behavior.
In this article, we’ll explore various register access methods, including:
- Read and Write
- Peak and Poke
- Set and Get
- Update
- Mirror
- Randomize
- Reset
We’ll also discuss front-door vs. back-door access and when to use each method.
1. Read and Write Methods
The read() and write() methods are the most common ways to access registers in UVM.
Syntax:
reg_handle.write(status, value, path);
reg_handle.read(status, value, path);
Parameters
status→ Captures the transaction status (UVM_IS_OK,UVM_NOT_OK, etc.).value→ The data to be written or the value read from the register.path→ Specifies whether the access is front-door (UVM_FRONTDOOR) or back-door (UVM_BACKDOOR).
Example:
uvm_status_e status;
uvm_reg_data_t read_value;
// Write 0x55 to the register using front-door
my_reg.write(status, 32'h55, UVM_FRONTDOOR);
// Read the register value
my_reg.read(status, read_value, UVM_FRONTDOOR);
$display("Register value: %h", read_value);
Front-Door vs. Back-Door Access
- Front-Door (
UVM_FRONTDOOR) → Accesses registers via the DUT’s bus interface (e.g., AXI, APB, etc.). - Back-Door (
UVM_BACKDOOR) → Directly accesses registers via simulation variables (bypassing the bus).
2. Peak and Poke Methods
These are alternative ways to access register values.
Peak (Read Without Side Effects)
- Similar to
read(), but does not trigger side effects (e.g., status bit clearing). - Always uses back-door access.
uvm_reg_data_t value;
my_reg.peak(value);
$display("Register value using peak: %h", value);
Poke (Write Without Side Effects)
- Similar to
write(), but does not trigger bus transactions. - Used for setting register values in simulation directly.
my_reg.poke(32'hA5A5A5A5);
Use Cases
| Method | When to Use? |
|---|---|
| Peak | Checking register values without affecting hardware behavior. |
| Poke | Initializing registers in simulation without triggering bus transactions. |
3. Set and Get Methods
These methods operate at the register field level.
Set (Write to a Field)
my_reg.my_field.set(8'hFF);
Get (Read a Field Value)
uvm_reg_data_t field_value;
field_value = my_reg.my_field.get();
$display("Field value: %h", field_value);
Use Cases
| Method | Purpose |
|---|---|
| Set | Modifies only a specific field without affecting the whole register. |
| Get | Reads only a field instead of the entire register. |
4. Update Method
The update() method writes the current register value to the DUT.
Example:
my_reg.my_field.set(8'hAA);
my_reg.update(status);
- This ensures the DUT gets the new field value.
- Useful when setting multiple fields before writing them at once.
5. Mirror Method
The mirror() method reads a register value and compares it with the expected value stored in the UVM RAL model.
Example:
my_reg.mirror(status, UVM_CHECK);
- UVM_CHECK → Compares the read value with the expected value in the model.
- UVM_NO_CHECK → Reads the value without comparison.
Use Case
| Mirror Type | Purpose |
|---|---|
| UVM_CHECK | Ensures register values match expected behavior. |
| UVM_NO_CHECK | Reads the register but doesn’t report mismatches. |
7. Reset Method
The reset() method resets registers to their default values as specified in the model.
Example:
my_reg.reset();
Use Case
- Used to ensure registers are in a known state before testing.
- Does not affect DUT registers directly unless written explicitly.
Front-Door vs. Back-Door Access:
| Access Type | How It Works? | Advantages | Disadvantages |
|---|---|---|---|
Front-Door (UVM_FRONTDOOR) | Sends transactions through the bus interface. | Realistic; Verifies actual DUT behavior. | Slow due to bus overhead. |
Back-Door (UVM_BACKDOOR) | Directly accesses simulation variables in memory. | Faster; Bypasses bus delays. | Doesn’t check bus logic. |
Choosing the Right Access Method
| Scenario | Recommended Access Method |
|---|---|
| Checking DUT register behavior via the bus | Front-Door (write, read) |
| Setting register values without bus overhead | Back-Door (poke, peak) |
| Randomizing register values | Randomize |
| Ensuring register consistency | Mirror |
| Writing a specific field | Set + Update |
| Resetting register values | Reset |
Understanding register access methods in UVM RAL is essential for efficient functional verification. Depending on the scenario, you can choose between:
- Front-Door Access for realistic verification.
- Back-Door Access for fast register manipulation.
Each method (read, write, peak, poke, set, get, update, mirror, randomize, and reset) serves a specific purpose, helping verify register interactions effectively.
