+ def test_add_window_wrong_overlap(self):
+ memory_map = MemoryMap(addr_width=16, data_width=8)
+ memory_map.add_window(MemoryMap(addr_width=10, data_width=8))
+ with self.assertRaisesRegex(ValueError,
+ r"Address range 0x200\.\.0x600 overlaps with window "
+ r"<nmigen_soc\.memory\.MemoryMap object at .+?> at 0x0\.\.0x400"):
+ memory_map.add_window(MemoryMap(addr_width=10, data_width=8), addr=0x200)
+
+ def test_add_window_wrong_twice(self):
+ memory_map = MemoryMap(addr_width=16, data_width=8)
+ window = MemoryMap(addr_width=10, data_width=8)
+ memory_map.add_window(window)
+ with self.assertRaisesRegex(ValueError,
+ r"Window <nmigen_soc\.memory\.MemoryMap object at .+?> is already added "
+ r"at address range 0x0\.\.0x400"):
+ memory_map.add_window(window)
+