From a6b3aa3c621294040e1fd062ca4674c7407b71c8 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 9 Oct 2019 10:47:19 +0200 Subject: [PATCH] soc_core: improve check_io_region error message --- litex/soc/integration/soc_core.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/litex/soc/integration/soc_core.py b/litex/soc/integration/soc_core.py index 94aa037b..a340e2db 100644 --- a/litex/soc/integration/soc_core.py +++ b/litex/soc/integration/soc_core.py @@ -356,11 +356,15 @@ class SoCCore(Module): for region_origin, region_length in self.soc_io_regions.items(): if (origin >= region_origin) & ((origin + length) < (region_origin + region_length)): return - msg = "{} region: 0x{:08x}-0x{:x} not located in an IO region.\n".format( + msg = "{} region (0x{:08x}-0x{:08x}) is not located in an IO region.\n".format( name, origin, origin + length - 1) - msg += "Avalaible IO regions:\n" - for region_origin, region_length in self.soc_io_regions.items(): - msg += "- 0x{:08x}-0x{:x}\n".format(region_origin, region_origin + region_length - 1) + msg += "Available IO regions: " + if not bool(self.soc_io_regions): + msg += "None\n" + else: + msg += "\n" + for region_origin, region_length in self.soc_io_regions.items(): + msg += "- 0x{:08x}-0x{:08x}\n".format(region_origin, region_origin + region_length - 1) raise ValueError(msg) def add_memory_region(self, name, origin, length, io_region=False): -- 2.30.2