soc/integration/soc_core: improve error message for missing csrs
This commit is contained in:
parent
c02b127ef9
commit
2a50a8021a
|
@ -258,15 +258,12 @@ class SoCCore(Module):
|
||||||
try:
|
try:
|
||||||
return self.csr_map[name]
|
return self.csr_map[name]
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
raise RuntimeError("""\
|
msg = "Undefined \"{}\" CSR.\n".format(name)
|
||||||
Unable to find {} in your SoC's csr address map.
|
msg += "Avalaible CSRs in {} ({}):\n".format(
|
||||||
|
self.__class__.__name__, inspect.getfile(self.__class__))
|
||||||
Check {}.csr_map in {}
|
for k in sorted(self.csr_map.keys()):
|
||||||
|
msg += "- {}\n".format(k)
|
||||||
Found {} in the csr_map""".format(
|
raise RuntimeError(msg)
|
||||||
name, self.__class__.__name__, inspect.getfile(self.__class__),
|
|
||||||
", ".join(self.csr_map.keys()))
|
|
||||||
) from e
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue