Closed
Description
Consider the following, snippet:
from nmigen import *
from nmigen_boards.tinyfpga_ax2 import *
from nmigen.build import *
plat = TinyFPGAAX2Platform()
plat.add_resources([Resource("led", Pins("1", dir="o", conn=("gpio", 0)))])
The above errors with:
$ python mk_build.py
Traceback (most recent call last):
File "mk_build.py", line 8, in <module>
plat.add_resources([Resource("led", Pins("gpio:13"))])
File "C:/msys64/home/william/projects/fpga/nmigen/nmigen/nmigen/build/dsl.py", line 200, in __init__
super().__init__(name, *args)
File "C:/msys64/home/william/projects/fpga/nmigen/nmigen/nmigen/build/dsl.py", line 132, in __init__
raise ValueError("Missing I/O constraints")
ValueError: Missing I/O constraints
Strictly-speaking, I don't think this is a missing I/O constraints problem. It's a "I forgot the number
argument to Resource.__init__()
" problem. It took me a few seconds to realize my mistake; I can see this error being frustrating to people who are trying to create resources for the first time. The correct code is: plat.add_resources([Resource("led", 0, Pins("1", dir="o", conn=("gpio", 0)))])
- I didn't add any I/O constraints :).
I'd create a PR, but it's simply easier for me to open an issue right now :(.