projects
/
lambdasoc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cab1efc
)
soc.base: add socproperty(weak=True) for optional properties.
author
Jean-François Nguyen
<jf@lambdaconcept.com>
Mon, 28 Jun 2021 17:49:27 +0000
(19:49 +0200)
committer
Jean-François Nguyen
<jf@lambdaconcept.com>
Mon, 28 Jun 2021 17:49:30 +0000
(19:49 +0200)
lambdasoc/soc/base.py
patch
|
blob
|
history
diff --git
a/lambdasoc/soc/base.py
b/lambdasoc/soc/base.py
index 79cb6c2a03ab3bdd65cb05df0cdfebc2998d5a69..ceb3663c021c6a5e2365f6470f0983282cbecbc8 100644
(file)
--- a/
lambdasoc/soc/base.py
+++ b/
lambdasoc/soc/base.py
@@
-14,14
+14,14
@@
from ..periph import Peripheral
__all__ = ["socproperty", "SoC", "ConfigBuilder"]
-def socproperty(cls, src_loc_at=0):
+def socproperty(cls,
*, weak=False,
src_loc_at=0):
name = tracer.get_var_name(depth=2 + src_loc_at)
__name = "__{}".format(name)
def getter(self):
assert isinstance(self, SoC)
attr = getattr(self, __name, None)
- if attr is None:
+ if attr is None
and not weak
:
raise NotImplementedError("SoC {!r} does not have a {}"
.format(self, name))
return attr