-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add method to generate a globally scoped type name. #187
- Loading branch information
Showing
5 changed files
with
133 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,15 @@ | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
version: 2 | ||
|
||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.11" | ||
|
||
sphinx: | ||
configuration: docs/conf.py | ||
|
||
python: | ||
install: | ||
- requirements: docs/requirements.txt |
This file contains 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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "1.26.1" | ||
__version__ = "1.27.0" |
This file contains 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 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,25 @@ | ||
reg r_global { | ||
field {} f1[4]; | ||
|
||
field myfield {}; | ||
myfield f2; | ||
myfield f3[4]; | ||
field myfield2 {fieldwidth = 4;}; | ||
myfield2 f4; | ||
}; | ||
|
||
regfile rf_global #( | ||
longint unsigned NUM = 4 | ||
){ | ||
reg r_local { | ||
field {} f_param[NUM]; | ||
field myfield {}; | ||
myfield f_param2[NUM]; | ||
} r1; | ||
r_global r2; | ||
}; | ||
|
||
addrmap top { | ||
rf_global rf1; | ||
rf_global #(.NUM (8)) rf2; | ||
}; |
This file contains 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,30 @@ | ||
from unittest_utils import RDLSourceTestCase | ||
|
||
class TestGlobalTypeNames(RDLSourceTestCase): | ||
|
||
def test_global_type_names(self): | ||
root = self.compile( | ||
["rdl_src/global_type_names.rdl"], | ||
"top" | ||
) | ||
top = root.top | ||
|
||
self.assertEqual(top.find_by_path("rf1").get_global_type_name("|"), "rf_global") | ||
self.assertEqual(top.find_by_path("rf1.r1").get_global_type_name("|"), "rf_global|r_local") | ||
self.assertEqual(top.find_by_path("rf1.r1.f_param").get_global_type_name("|"), "rf_global|r_local|f_param") | ||
self.assertEqual(top.find_by_path("rf1.r1.f_param2").get_global_type_name("|"), "rf_global|r_local|myfield_w4") | ||
self.assertEqual(top.find_by_path("rf1.r2").get_global_type_name("|"), "r_global") | ||
self.assertEqual(top.find_by_path("rf1.r2.f1").get_global_type_name("|"), "r_global|f1") | ||
self.assertEqual(top.find_by_path("rf1.r2.f2").get_global_type_name("|"), "r_global|myfield") | ||
self.assertEqual(top.find_by_path("rf1.r2.f3").get_global_type_name("|"), "r_global|myfield_w4") | ||
self.assertEqual(top.find_by_path("rf1.r2.f4").get_global_type_name("|"), "r_global|myfield2") | ||
|
||
self.assertEqual(top.find_by_path("rf2").get_global_type_name("|"), "rf_global_NUM_8") | ||
self.assertEqual(top.find_by_path("rf2.r1").get_global_type_name("|"), "rf_global_NUM_8|r_local") | ||
self.assertEqual(top.find_by_path("rf2.r1.f_param").get_global_type_name("|"), "rf_global_NUM_8|r_local|f_param") | ||
self.assertEqual(top.find_by_path("rf2.r1.f_param2").get_global_type_name("|"), "rf_global_NUM_8|r_local|myfield_w8") | ||
self.assertEqual(top.find_by_path("rf2.r2").get_global_type_name("|"), "r_global") | ||
self.assertEqual(top.find_by_path("rf2.r2.f1").get_global_type_name("|"), "r_global|f1") | ||
self.assertEqual(top.find_by_path("rf2.r2.f2").get_global_type_name("|"), "r_global|myfield") | ||
self.assertEqual(top.find_by_path("rf2.r2.f3").get_global_type_name("|"), "r_global|myfield_w4") | ||
self.assertEqual(top.find_by_path("rf2.r2.f4").get_global_type_name("|"), "r_global|myfield2") |