UVM Back-door Access for Protected Memories

Back-door Access for Protected Memories

Memory content can be safeguarded using various protection schemes, ranging from simple error correction codes (ECC) to full encryption. When writing to memory using back-door access, it’s essential to apply the correct protection to avoid issues when the physical interface later reads these locations.

Sometimes, direct access to the protected data (e.g., the encoded bits) is required because these bits are managed entirely within the design and are accessible only through back-door access. The back-door is also the only way to verify protected values or inject protection errors.

To handle this, the uvm_mem_backdoor_cbs class provides two key callback methods:

  1. encode():
    This method applies protection (like encryption or ECC) to data when it is written to memory through the back-door.
  2. decode():
    This method removes the protection when reading data back through the back-door.

One unique aspect of these callbacks is that decoding happens in the reverse order of how the callbacks were registered. This allows for multiple layers of protection to be applied or removed in sequence, with each layer modeled as a separate callback extension.

For example, ECC (Error Correction Code) bits are stored in extra memory bits alongside the data they protect. These bits must be generated and stored during write operations and must be checked and masked during read operations.