From 4408dad9d27a5170daf04719d65ff9c9c1339a33 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Wed, 30 Oct 2019 19:32:20 -0700 Subject: [PATCH] Improve the error message on memory region conflict. Before; ``` ValueError: Memory region conflict between rom and main_ram ``` After; ``` ValueError: Memory region conflict between rom () and main_ram () ``` Fixes #296. --- litex/soc/integration/common.py | 5 +++++ litex/soc/integration/soc_core.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/litex/soc/integration/common.py b/litex/soc/integration/common.py index 3a56ffa7e..695e56090 100644 --- a/litex/soc/integration/common.py +++ b/litex/soc/integration/common.py @@ -83,6 +83,11 @@ class SoCMemRegion: self.length = length self.type = type + def __str__(self): + return "".format( + self.origin, self.length, self.type) + + class SoCCSRRegion: def __init__(self, origin, busword, obj): self.origin = origin diff --git a/litex/soc/integration/soc_core.py b/litex/soc/integration/soc_core.py index b9e7b7bc8..346175f0c 100644 --- a/litex/soc/integration/soc_core.py +++ b/litex/soc/integration/soc_core.py @@ -401,7 +401,11 @@ class SoCCore(Module): self.mem_regions[name] = SoCMemRegion(origin, length, type) overlap = self.check_regions_overlap(self.mem_regions) if overlap is not None: - raise ValueError("Memory region conflict between {} and {}".format(overlap[0], overlap[1])) + o0, o1 = overlap[0], overlap[1] + raise ValueError("Memory region conflict between {} ({}) and {} ({})".format( + o0, self.mem_regions[o0], + o1, self.mem_regions[o1], + )) def register_mem(self, name, address, interface, size=0x10000000): self.add_wb_slave(address, interface, size)