|
31 | 31 | from ..lib import RegAsyncReadOnly, RegAsyncReadWrite, RegAsyncWriteOnly |
32 | 32 | from ..lib import AddressMap, AsyncAddressMap |
33 | 33 | from ..lib import RegFile, AsyncRegFile |
| 34 | +from ..lib.memory import BaseMemory |
34 | 35 | from ..lib import MemoryReadOnly, MemoryReadOnlyLegacy |
35 | 36 | from ..lib import MemoryWriteOnly, MemoryWriteOnlyLegacy |
36 | 37 | from ..lib import MemoryReadWrite, MemoryReadWriteLegacy |
@@ -95,6 +96,13 @@ def simulator_instance(self) -> BaseSimulator: |
95 | 96 | Simulator configured for the DUT |
96 | 97 | """ |
97 | 98 |
|
| 99 | + @property |
| 100 | + @abstractmethod |
| 101 | + def legacy_block_access(self) -> bool: |
| 102 | + """ |
| 103 | + Whether the register model has been configured for legacy block access or not |
| 104 | + """ |
| 105 | + |
98 | 106 | # pylint:disable-next=too-many-arguments |
99 | 107 | def _single_field_property_test(self, *, |
100 | 108 | fut: Union[FieldReadWrite, |
@@ -160,6 +168,26 @@ def _single_register_property_test(self, *, |
160 | 168 | else: |
161 | 169 | self.assertEqual(rut.accesswidth, width) |
162 | 170 |
|
| 171 | + # pylint:disable-next=too-many-arguments |
| 172 | + def _single_memory_property_test(self, *, |
| 173 | + mut: BaseMemory, |
| 174 | + address: int, |
| 175 | + width: int, |
| 176 | + entries: int, |
| 177 | + accesswidth: Optional[int], |
| 178 | + array_typecode: Optional[str]) -> None: |
| 179 | + self.assertEqual(mut.address, address) |
| 180 | + self.assertEqual(mut.width, width) |
| 181 | + self.assertEqual(mut.entries, entries) |
| 182 | + if accesswidth is not None: |
| 183 | + self.assertEqual(mut.accesswidth, accesswidth) |
| 184 | + else: |
| 185 | + self.assertEqual(mut.accesswidth, width) |
| 186 | + if self.legacy_block_access: |
| 187 | + self.assertEqual(mut.array_typecode, array_typecode) |
| 188 | + else: |
| 189 | + self.assertIsNone(array_typecode) |
| 190 | + |
163 | 191 | def _single_node_rdl_name_and_desc_test(self, |
164 | 192 | dut: Base, |
165 | 193 | rdl_name: Optional[str], |
@@ -190,11 +218,11 @@ def _test_node_inst_name(self, |
190 | 218 |
|
191 | 219 | def _test_field_iterators(self, *, |
192 | 220 | rut: Union[RegReadOnly, |
193 | | - RegReadWrite, |
194 | | - RegWriteOnly, |
195 | | - RegAsyncReadOnly, |
196 | | - RegAsyncReadWrite, |
197 | | - RegAsyncWriteOnly], |
| 221 | + RegReadWrite, |
| 222 | + RegWriteOnly, |
| 223 | + RegAsyncReadOnly, |
| 224 | + RegAsyncReadWrite, |
| 225 | + RegAsyncWriteOnly], |
198 | 226 | has_sw_readable: bool, |
199 | 227 | has_sw_writable: bool, |
200 | 228 | readable_fields: set[str], |
|
0 commit comments