-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
104 additions
and
5 deletions.
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
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
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
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,19 @@ | ||
property a_map_p { type = string; component = addrmap | regfile; }; | ||
property some_bool_p { type = boolean; component = field; default = false; }; | ||
property some_ref_p { type = ref; component = all; }; | ||
property some_num_p { type = number; default = 0x10; component = field | reg | regfile; }; | ||
|
||
addrmap foo { | ||
reg{ | ||
field { some_bool_p; } field1; // Attach some_bool_p to the field | ||
// with a value of false; | ||
|
||
field { some_bool_p = true; some_num_p; } field2; | ||
// Attach some_bool_p to the field with a value of true; | ||
field1->some_ref_p = field2; // create a reference | ||
some_num_p = 0x20; // Assign this property to the reg and give it value | ||
} bar; | ||
|
||
a_map_p; // The property has been bound to the map but it has not been | ||
// assigned a value so its value is undefined | ||
}; |
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,16 @@ | ||
enum myEncoding { | ||
alpha = 1'b0; | ||
beta = 1'b1; | ||
}; | ||
|
||
property my_enc_prop { | ||
type = myEncoding; | ||
component = field; | ||
default = myEncoding::beta; | ||
}; | ||
|
||
addrmap top { | ||
reg { | ||
field { my_enc_prop = myEncoding::alpha ; } f ; | ||
} regA ; | ||
} ; |
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,43 @@ | ||
|
||
from .unittest_utils import RDLSourceTestCase | ||
|
||
class TestUDP(RDLSourceTestCase): | ||
|
||
def test_15_2_2_ex1(self): | ||
root = self.compile( | ||
["rdl_testcases/udp_15.2.2_ex1.rdl"], | ||
"foo" | ||
) | ||
|
||
foo = root.find_by_path("foo") | ||
bar = root.find_by_path("foo.bar") | ||
field1 = root.find_by_path("foo.bar.field1") | ||
field2 = root.find_by_path("foo.bar.field2") | ||
|
||
with self.subTest("foo"): | ||
self.assertIs(foo.get_property("some_ref_p"), None) | ||
self.assertIs(foo.get_property("a_map_p"), None) | ||
|
||
with self.subTest("bar"): | ||
self.assertIs(bar.get_property("some_ref_p"), None) | ||
self.assertEqual(bar.get_property("some_num_p"), 0x20) | ||
|
||
with self.subTest("field1"): | ||
self.assertEqual(field1.get_property("some_ref_p"), field2) | ||
self.assertEqual(field1.get_property("some_bool_p"), False) | ||
self.assertIs(field1.get_property("some_num_p"), None) | ||
|
||
with self.subTest("field2"): | ||
self.assertIs(field2.get_property("some_ref_p"), None) | ||
self.assertEqual(field2.get_property("some_bool_p"), True) | ||
self.assertIs(field2.get_property("some_num_p"), 0x10) | ||
|
||
def test_15_2_2_ex2(self): | ||
root = self.compile( | ||
["rdl_testcases/udp_15.2.2_ex2.rdl"], | ||
"top" | ||
) | ||
|
||
f = root.find_by_path("top.regA.f") | ||
self.assertEqual(f.get_property("my_enc_prop").value, 0) | ||
self.assertEqual(f.get_property("my_enc_prop").name, "alpha") |