From: Sebastien Bourdeauducq Date: Mon, 11 Feb 2013 17:34:01 +0000 (+0100) Subject: fhdl/autofragment: from_attributes X-Git-Tag: 24jan2021_ls180~2099^2~698 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=63d399b6adbd3feb410127f48a15d9195fcac396;p=litex.git fhdl/autofragment: from_attributes --- diff --git a/migen/fhdl/autofragment.py b/migen/fhdl/autofragment.py index 554db1a8..50e7bc37 100644 --- a/migen/fhdl/autofragment.py +++ b/migen/fhdl/autofragment.py @@ -11,3 +11,10 @@ def from_local(): if hasattr(obj, "get_fragment"): f += obj.get_fragment() return f + +def from_attributes(obj): + f = Fragment() + for x in obj.__dict__.values(): + if hasattr(x, "get_fragment"): + f += x.get_fragment() + return f