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: 3d62dac1cbc3
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: ee1ad2daf183
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Sep 22, 2019

  1. build.plat: restrict design names to alphanumeric to avoid quoting is…

    …sues.
    whitequark committed Sep 22, 2019
    Copy the full SHA
    ee1ad2d View commit details
Showing with 11 additions and 0 deletions.
  1. +11 −0 nmigen/build/plat.py
11 changes: 11 additions & 0 deletions nmigen/build/plat.py
Original file line number Diff line number Diff line change
@@ -257,6 +257,17 @@ class TemplatedPlatform(Platform):
}

def toolchain_prepare(self, fragment, name, **kwargs):
# Restrict the name of the design to a strict alphanumeric character set. Platforms will
# interpolate the name of the design in many different contexts: filesystem paths, Python
# scripts, Tcl scripts, ad-hoc constraint files, and so on. It is not practical to add
# escaping code that handles every one of their edge cases, so make sure we never hit them
# in the first place.
invalid_char = re.match(r"[^A-Za-z0-9_]", name)
if invalid_char:
raise ValueError("Design name {!r} contains invalid character {!r}; only alphanumeric "
"characters are valid in design names"
.format(name, invalid_char.group(0)))

# This notice serves a dual purpose: to explain that the file is autogenerated,
# and to incorporate the nMigen version into generated code.
autogenerated = "Automatically generated by nMigen {}. Do not edit.".format(__version__)