54
4.3
Operation
A 16-bit uniform random number can be generated by the following steps:
•
Write 1 to the GE bit.
•
Read RNRR while the GE bit is 1.
Figure 4.1 shows the procedure for writing the required length of a random number to the RAM.
Start
Write 1 to GE
RRDY = 1 ?
Read RNRR in word size
and write the data to RAM
RRDY = 0
NO
NO
YES
YES
Required length of data ?
Write 0 to GE
End
Figure 4.1 Random Data Writing Procedure Using RNG
To generate a random number, first write 1 to the GE bit to start the RNG. When a random
number is generated, the 16-bit random number is written to RNRR and the RRDY bit is set to 1.
Reading the random number from RNRR in this state clears the RRDY bit to 0, and a new 16-bit
random number is generated and written to RNRR. Repeat these steps until the required length of
random number is obtained. In this procedure, check whether RNRR holds a valid data by
referring to the RRDY bit status each time before reading RNRR.