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: cb02a452e9c8
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: b404d603fb94
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jul 7, 2019

  1. vendor.xilinx_spartan_3_6: Add Spartan3A family support.

    cr1901 authored and whitequark committed Jul 7, 2019
    Copy the full SHA
    b404d60 View commit details
Showing with 34 additions and 3 deletions.
  1. +34 −3 nmigen/vendor/{xilinx_spartan6.py → xilinx_spartan_3_6.py}
Original file line number Diff line number Diff line change
@@ -6,10 +6,14 @@
from ..build import *


__all__ = ["XilinxSpartan6Platform"]
__all__ = ["XilinxSpartan3APlatform", "XilinxSpartan6Platform"]

# The interface to Spartan 3 and 6 are substantially the same. Handle
# differences internally using one class and expose user-aliases for
# convenience.

class XilinxSpartan6Platform(TemplatedPlatform):

class XilinxSpartan3Or6Platform(TemplatedPlatform):
"""
Required tools:
* ISE toolchain:
@@ -45,7 +49,8 @@ class XilinxSpartan6Platform(TemplatedPlatform):
* ``{{name}}_par.ncd``: place and routed netlist.
* ``{{name}}.drc``: DRC report.
* ``{{name}}.bgn``: BitGen log.
* ``{{name}}.bit``: binary bitstream.
* ``{{name}}.bit``: binary bitstream with metadata.
* ``{{name}}.bin``: raw binary bitstream.
"""

toolchain = "ISE"
@@ -76,6 +81,10 @@ class XilinxSpartan6Platform(TemplatedPlatform):
-ifn {{name}}.prj
-ofn {{name}}.ngc
-top {{name}}
{% if platform.family in ["3", "3E", "3A"] %}
-use_new_parser yes
{% endif %}
-register_balancing yes
-p {{platform.device}}{{platform.package}}-{{platform.speed}}
{{get_override("script_after_run")|default("# (script_after_run placeholder)")}}
""",
@@ -127,11 +136,29 @@ class XilinxSpartan6Platform(TemplatedPlatform):
r"""
{{get_tool("bitgen")}}
{{get_override("bitgen_opts")|default(["-w"])|options}}
-g Binary:Yes
{{name}}_par.ncd
{{name}}.bit
"""
]

@property
def family(self):
device = self.device.upper()
if device.startswith("XC3S"):
if device.endswith("A"):
return "3A"
elif device.endswith("E"):
raise NotImplementedError("""Spartan 3E family is not supported
as a nMigen platform.""")
else:
raise NotImplementedError("""Spartan 3 family is not supported
as a nMigen platform.""")
elif device.startswith("XC6S"):
return "6"
else:
assert False

def _get_xdr_buffer(self, m, pin, i_invert=None, o_invert=None):
def get_dff(clk, d, q):
# SDR I/O is performed by packing a flip-flop into the pad IOB.
@@ -353,3 +380,7 @@ def get_diff_input_output(self, pin, p_port, n_port, attrs, invert):
io_IO=p_port[bit], io_IOB=n_port[bit]
)
return m


XilinxSpartan3APlatform = XilinxSpartan3Or6Platform
XilinxSpartan6Platform = XilinxSpartan3Or6Platform