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: cea92e95314e
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: 4dbb5352ad52
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 3, 2019

  1. build.plat: add default_clk{,_constraint,_frequency}.

    This is the equivalent of oMigen's default_clk and default_clk_period
    except the period is taken from the resource.
    whitequark committed Aug 3, 2019
    Copy the full SHA
    4dbb535 View commit details
Showing with 18 additions and 2 deletions.
  1. +18 −2 nmigen/build/plat.py
20 changes: 18 additions & 2 deletions nmigen/build/plat.py
Original file line number Diff line number Diff line change
@@ -18,8 +18,9 @@


class Platform(ResourceManager, metaclass=ABCMeta):
resources = abstractproperty()
connectors = abstractproperty()
resources = abstractproperty()
connectors = abstractproperty()
default_clk = None

def __init__(self):
super().__init__(self.resources, self.connectors)
@@ -28,6 +29,21 @@ def __init__(self):

self._prepared = False

@property
def default_clk_constraint(self):
if self.default_clk is None:
raise AttributeError("Platform '{}' does not define a default clock"
.format(self.__class__.__name__))
return self.lookup(self.default_clk).clock

@property
def default_clk_frequency(self):
constraint = self.default_clk_constraint
if constraint is None:
raise AttributeError("Platform '{}' does not constrain its default clock"
.format(self.__class__.__name__))
return constraint.frequency

def add_file(self, filename, content):
if not isinstance(filename, str):
raise TypeError("File name must be a string")