-
Notifications
You must be signed in to change notification settings - Fork 12
Modular subtype #221
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
Merged
Merged
Modular subtype #221
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
deb4871
New types for bounded mod types
117bb16
Implement the introduction of modular integer subtypes
petr-bauch 53905f1
Update the py script to remove the extra info
petr-bauch dcd1005
Regression test
petr-bauch 2fe20c6
Modular subtype indication is unsigned
petr-bauch 708484e
Update golden results
petr-bauch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"parent": "bitvector_type", | ||
"id": "bounded_mod_type", | ||
"namedSub": { | ||
"lower_bound": {"type": "integer"}, | ||
"upper_bound": {"type": "integer"}, | ||
"ada_mod_max": {"type": "string"} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"parent": "bitvector_type", | ||
"namedSub": { | ||
"lower_bound": {"type": "integer"}, | ||
"upper_bound": {"type": "integer"} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
procedure Test is | ||
type Unsigned_16 is mod 2 ** 4; | ||
RAM_Start : constant Unsigned_16 := 5; | ||
RAM_End : constant Unsigned_16 := 12; | ||
Sum : Unsigned_16 := 0; | ||
|
||
Test_Passed : Boolean := True; | ||
|
||
subtype Sub16 is Unsigned_16 range RAM_Start .. RAM_End; | ||
SubVar : Sub16 := RAM_Start; | ||
|
||
function Address_OK | ||
(Address : in Unsigned_16) return Boolean; | ||
function Address_OK | ||
(Address : in Unsigned_16) | ||
return Boolean | ||
is | ||
begin | ||
Sum := Sum + 1; | ||
return Test_Passed; | ||
end Address_OK; | ||
begin | ||
SubVar := SubVar + 1; -- invokes range check | ||
for I in Unsigned_16 range RAM_Start .. RAM_End loop | ||
if Address_OK (Address => I) | ||
then | ||
Test_Passed := False; | ||
end if; | ||
|
||
end loop; | ||
pragma Assert (Sum = RAM_End - RAM_Start + 1); | ||
|
||
end Test; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[assertion.1] Range Check: SUCCESS | ||
[1] file test.adb line 31 assertion: SUCCESS | ||
VERIFICATION SUCCESSFUL |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from test_support import * | ||
|
||
prove() |
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.
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.
might be worth asserting that
followed_mod_type
is actually anunsigned
ormod_type