Changing and Reading the Values of a Write-only Register

Question: How do I change and read the values of a Write-only register?



The value in a write-only register may be changed by simply writing to it.  Once you write to it however, you are unable to read it.  It therefore may be advantageous to create a shadow variable in RAM which stores the value you want to write to the write-only register.  The shadow variable now enables the user to read the value and modify it later if so desired.  Another circumstance is in a dynamic configuration situation where a write-only register or port may be used by two different user modules or components in a design.  In this case the memory of register is preserved in each instance and therefore the use of the register may be switched back and forth without losing any data.  Using a shadow register facilitates efficient, robust and powerful designs.