Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/nmigen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 43102541032f
Choose a base ref
...
head repository: m-labs/nmigen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 39ca0e6fa680
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Jun 4, 2019

  1. compat.fhdl.module: CompatModule should be elaboratable.

    Fixes #83.
    whitequark committed Jun 4, 2019
    Copy the full SHA
    39ca0e6 View commit details
Showing with 14 additions and 2 deletions.
  1. +5 −2 nmigen/compat/fhdl/module.py
  2. +9 −0 nmigen/test/test_compat.py
7 changes: 5 additions & 2 deletions nmigen/compat/fhdl/module.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from collections.abc import Iterable

from ...tools import flatten, deprecated
from ...hdl import dsl
from ...hdl import dsl, ir


__all__ = ["Module", "FinalizeError"]
@@ -94,14 +94,17 @@ def __iadd__(self, other):
return self


class CompatModule:
class CompatModule(ir.Elaboratable):
# Actually returns nmigen.fhdl.Module, not a Fragment.
def get_fragment(self):
assert not self.get_fragment_called
self.get_fragment_called = True
self.finalize()
return self._module

def elaborate(self, platform):
return self.get_fragment()

def __getattr__(self, name):
if name == "comb":
return _CompatModuleComb(self)
9 changes: 9 additions & 0 deletions nmigen/test/test_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from ..hdl.ir import Fragment
from ..compat import *
from .tools import *


class CompatTestCase(FHDLTestCase):
def test_fragment_get(self):
m = Module()
f = Fragment.get(m, platform=None)