# uvm_simple_lock_dap

Provides a ‘Simple Lock’ Data Access Policy.

The ‘Simple Lock’ Data Access Policy allows for any number of ‘sets’, so long as the value is not ‘locked’. The value can be retrieved using ‘get’ at any time.

The UVM uses this policy to protect the file name value in the uvm_text_tr_database.

Summary

uvm_simple_lock_dap
Provides a ‘Simple Lock’ Data Access Policy.
Class Hierarchy
uvm_set_get_dap_base#(T)
uvm_simple_lock_dap
Class Declaration
> class uvm_simple_lock_dap#(
> | type | T | = | int
> ) extends uvm_set_get_dap_base#(T)
new | Constructor
Set/ Get Interface |
set | Updates the value stored within the DAP.
try_set | Attempts to update the value stored within the DAP.
get | Returns the current value stored within the DAP
try_get | Retrieves the current value stored within the DAP
Locking |
lock | Locks the data value
unlock | Unlocks the data value
is_locked | Returns the state of the lock.
Introspection | The uvm_simple_lock_dap cannot support the standard UVM instrumentation methods (copy, clone, pack and unpack), due to the fact that they would potentially violate the access policy.

### new

> function new(
> | string | name | = | "unnamed-uvm_simple_lock_dap#(T)"
> )

Constructor

### Set/ Get Interface

### set

> virtual function void set(
> | T | value
> )

Updates the value stored within the DAP.

set will result in an error if the DAP has been locked.

### try_set

> virtual function bit try_set(
> | T | value
> )

Attempts to update the value stored within the DAP.

try_set will return a 1 if the value was successfully updated, or a 0 if the value can not be updated due to the DAP being locked. No errors will be reported if try_set fails.

### get

> virtual function T get()

Returns the current value stored within the DAP

### try_get

> virtual function bit try_get(
> | output | T | value
> )

Retrieves the current value stored within the DAP

try_get will always return 1.

### Locking

### lock

> function void lock()

Locks the data value

The data value cannot be updated via set or try_set while locked.

### unlock

> function void unlock()

Unlocks the data value

### is_locked

> function bit is_locked()

Returns the state of the lock.

#### Returns

1 | The value is locked
0 | The value is unlocked

### Introspection

The uvm_simple_lock_dap cannot support the standard UVM instrumentation methods (copy, clone, pack and unpack), due to the fact that they would potentially violate the access policy.

A call to any of these methods will result in an error.

> class uvm_simple_lock_dap#(
> | type | T | = | int
> ) extends uvm_set_get_dap_base#(T)

Provides a ‘Simple Lock’ Data Access Policy.

> function new(
> | string | name | = | "unnamed-uvm_simple_lock_dap#(T)"
> )

Constructor

> virtual function void set(
> | T | value
> )

Updates the value stored within the DAP.

> virtual function bit try_set(
> | T | value
> )

Attempts to update the value stored within the DAP.

> virtual function T get()

Returns the current value stored within the DAP

> virtual function bit try_get(
> | output | T | value
> )

Retrieves the current value stored within the DAP

> function void lock()

Locks the data value

> function void unlock()

Unlocks the data value

> function bit is_locked()

Returns the state of the lock.

> class uvm_text_tr_database extends uvm_tr_database

The uvm_text_tr_database is the default implementation for the uvm_tr_database.