From 63d399b6adbd3feb410127f48a15d9195fcac396 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 11 Feb 2013 18:34:01 +0100 Subject: [PATCH] fhdl/autofragment: from_attributes --- migen/fhdl/autofragment.py | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- 2.30.2