From 6d5878a0ee8125aa346a15a12df7039e14d39181 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 12 Dec 2018 10:00:00 +0000 Subject: [PATCH] fhdl.dsl: allow f.sync["dom"] as a synonym of f.sync.dom. --- nmigen/fhdl/dsl.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nmigen/fhdl/dsl.py b/nmigen/fhdl/dsl.py index b193e12..2b14541 100644 --- a/nmigen/fhdl/dsl.py +++ b/nmigen/fhdl/dsl.py @@ -38,11 +38,17 @@ class _ModuleBuilderSync(_ModuleBuilderProxy): def __getattr__(self, name): return _ModuleBuilderSyncCD(self._builder, self._depth, name) + def __getitem__(self, name): + return self.__getattr__(name) + def __setattr__(self, name, value): if not isinstance(value, _ModuleBuilderSyncCD): raise AttributeError("Cannot assign sync.{} attribute - use += instead" .format(name)) + def __setitem__(self, name, value): + return self.__setattr__(name, value) + class _ModuleBuilderRoot: def __init__(self, builder, depth): -- 2.30.2