Skip to content

Commit

Permalink
Replace | dict operator with .update()
Browse files Browse the repository at this point in the history
This improves compatibility with Python 3.8

Internal-tag: [#53526]
Signed-off-by: Krzysztof Obłonczek <[email protected]>
  • Loading branch information
koblonczek committed Jan 9, 2024
1 parent 5e40dfd commit e4b4a62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions fpga_topwrap/elaboratable_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ def get_ports_hier(self) -> SignalMapping:
"""Maps elaboratable's Signature to a nested dictionary of WrapperPorts.
See _gather_signature_ports for more details.
"""
return self._gather_signature_ports(self.elaboratable.signature) | {
"clk": self.clk,
"rst": self.rst,
}
ports = self._gather_signature_ports(self.elaboratable.signature)
ports.update(
{
"clk": self.clk,
"rst": self.rst,
}
)
return ports

@lru_cache(maxsize=None)
def _cached_wrapper(
Expand Down
3 changes: 2 additions & 1 deletion tests/tests_build/test_elaboratable_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ def test_get_ports_hier(
clock_domain_signals: SignalMapping,
) -> None:
hier_ports = elaboratable_wrapper.get_ports_hier()
assert signal_mapping_eq(hier_ports, nested_signature_mapping | clock_domain_signals)
nested_signature_mapping.update(clock_domain_signals)
assert signal_mapping_eq(hier_ports, nested_signature_mapping)

def test_get_ports(
self,
Expand Down

0 comments on commit e4b4a62

Please sign in to comment.