Ensure loop does not go forever in RNG#461
Open
pat-rogers wants to merge 1 commit intoAdaCore:masterfrom
Open
Conversation
f43a9aa to
6b194b3
Compare
6b194b3 to
e16e942
Compare
jklmnn
reviewed
Apr 14, 2026
Comment on lines
+62
to
+65
| Max_Attempts : constant := 1000; | ||
| -- The above is arbitrary. It needs to be long enough that normal | ||
| -- behavior will not be flagged. Longer than that is fine. The point | ||
| -- is to not hang forever. |
Member
There was a problem hiding this comment.
According to the documentation the RNG is guaranteed to be filled every 40 RNG clock cycles. Do we have an idea of how many iterations we could do within these 40 clock cycles?
Contributor
Author
|
On 14-Apr-26 6:06 AM, JK wrote:
***@***.**** commented on this pull request.
------------------------------------------------------------------------
In arch/ARM/STM32/drivers/stm32-rng-polling.adb <https://github.com/
AdaCore/Ada_Drivers_Library#461#discussion_r3078978323>:
> + Max_Attempts : constant := 1000;
+ -- The above is arbitrary. It needs to be long enough that normal
+ -- behavior will not be flagged. Longer than that is fine. The point
+ -- is to not hang forever.
According to the documentation the RNG is guaranteed to be filled every
40 RNG clock cycles. Do we have an idea of how many iterations we could
do within these 40 clock cycles?
No, I don't. I chose 1000 on the assumption that it should be much more
than enough.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the loop that checks for data ready is otherwise potentially infinite. not seen in practice, but no need to allow it.