-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding subsection on Full_Access_Only aspect #1170
base: master
Are you sure you want to change the base?
Adding subsection on Full_Access_Only aspect #1170
Conversation
Parts of the code examples are inspired by the Ada Drivers Library (https://github.com/AdaCore Ada_Drivers_Library).
We need the `-gnat2022` switch to run this example.
:ref:`volatile type <Adv_Ada_Shared_Variable_Control_Volatile>` or an | ||
:ref:`atomic type <Adv_Ada_Shared_Variable_Control_Atomic>`. (In other words, | ||
if a type is neither volatile nor atomic, it cannot be a full access type.) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a reminder that any atomic type is automatically also volatile?
|
||
As we already know, the value of a volatile object may be constantly changing, | ||
so the compiler generates code in such a way that the process must read the | ||
value of the volatile object from memory for each access. (In other words, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider simplifying this:
"so the compiler generates code in such a way that the process must read the
value of the volatile object from memory for each access"
to be instead something like this:
"so the compiler generates code to read the
value of the volatile object from memory for each access"
type, these assignments are performed for the complete 32-bit register, even | ||
though we're updating just a single component of the record object. (Note that | ||
if :ada:`Window_Register` wasn't a *full-access* object, an assignment such as | ||
:ada:`WR.Horizontal_Cnt := 800` could be performed with a 16-bit operation.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding "could be performed with a 16-bit operation": This is in an admonition, but it is central to the concept because it is what the compiler would want to do otherwise, because that is more efficient than manipulating the entire object.
end Show_Registers; | ||
|
||
A delta assignment using an aggregate such as :ada:`(WR with delta ...)` | ||
includes reading the value of complete 32-bit :ada:`WR` object from memory, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should "value of complete" be "value of the complete"?
atomic reads and updates, which |mdash| as a whole |mdash| are indivisible, | ||
i.e. they must be done in a single instruction, so that no other instruction | ||
could execute on that same object before the read or update completes. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a reminder that atomic implies volatile should go here (instead of above)?
|
||
.. admonition:: For further reading... | ||
|
||
By running on an PC, we can compare the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"on an PC" should be "on a PC"
Rework of #1146