projects
/
lambdasoc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
95a97de
)
Throw exception if two CSR have the same name
author
Jean THOMAS
<git0@pub.jeanthomas.me>
Mon, 8 Jun 2020 11:23:48 +0000
(13:23 +0200)
committer
Jean THOMAS
<git0@pub.jeanthomas.me>
Mon, 8 Jun 2020 11:23:48 +0000
(13:23 +0200)
lambdasoc/periph/base.py
patch
|
blob
|
history
diff --git
a/lambdasoc/periph/base.py
b/lambdasoc/periph/base.py
index 8789ee3146bb3e246ff4fdf407b4aeda4890db95..84c3452c4f597dca6968a103b3921bea0280959c 100644
(file)
--- a/
lambdasoc/periph/base.py
+++ b/
lambdasoc/periph/base.py
@@
-253,6
+253,8
@@
class CSRBank:
name = name or tracer.get_var_name(depth=2 + src_loc_at).lstrip("_")
elem_name = "{}_{}".format(self._name_prefix, name)
+ if any(elem.name == elem_name for (elem, _, _) in self._csr_regs):
+ raise Exception("CSR \"{}\" has already been defined".format(elem_name))
elem = csr.Element(width, access, name=elem_name)
self._csr_regs.append((elem, addr, alignment))
return elem