Commit graph

910 commits

Author SHA1 Message Date
whitequark 72ef4303a9 hdl.ast: clarify docs for Value.rotate_{left,right}.
"Rotate modulo 2**len(self)" is redundant because that's just how
rotates work.
2020-05-19 23:43:25 +00:00
whitequark 404b2e07e4 hdl.dsl: check for unique domain name.
Fixes #385.
2020-05-19 23:40:49 +00:00
whitequark fbf9e1f339 back.rtlil: handle signed and large Instance parameters correctly.
Fixes #388.
2020-05-19 23:33:14 +00:00
whitequark 393c27ac8e tracer: fix get_var_name() to work on toplevel attributes.
E.g. this now works:

    >>> class dummy: pass
    >>> self = dummy()
    >>> self.foo = Signal()
    >>> self.foo.name
    'foo'
2020-05-17 19:51:58 +00:00
Gwenhael Goavec-Merou e301798cee
vendor.lattice_machxo2: generate binary bitstreams. 2020-05-08 04:42:21 +00:00
whitequark 6cee280407 plat, vendor: systematically escape net and file names in Tcl.
Before this commit, there was only occasional quoting of some names
used in any Tcl files. (I'm not sure what I was thinking.)

After this commit, any substs that may include Tcl special characters
are escaped. This does not include build names (which are explicitly
restricted to ASCII to avoid this problem), or attribute names (which
are chosen from a predefined set). Ideally we'd use a more principled
approach but Jinja2 does not support custom escaping mechanisms.

Note that Vivado restricts clock names to a more restrictive set that
forbids using Tcl special characters even when escaped.

Fixes #375.
2020-05-02 10:41:18 +00:00
whitequark 6e29fbcc61 back.rtlil: fix incorrect escaping of signed parameters.
Also, improve escaping code in general.
2020-04-28 02:18:45 +00:00
whitequark 35f3f7d630 hdl.ast: use SignalSet, not ValueSet, for _[lr]hs_signals().
The implementation of these functions likely predates support for
{Clock,Reset}Signal() in SignalKey.
2020-04-27 18:43:36 +00:00
whitequark da76ffa781 lib.cdc: add missing documentation for AsyncFFSynchronizer. NFC. 2020-04-27 02:20:29 +00:00
awygle ba79b0cdc6
lib.fifo: add r_rst output for AsyncFIFO{,Buffered}.
Fixes #181.
2020-04-24 22:27:04 +00:00
awygle f2b4584b34
hdl.ir: typecheck convert(ports=) more carefully.
The `ports` argument to the `convert` functions is a frequent hotspot of
beginner issues. Check to make sure it is either a list or a tuple, and
give an appropriately helpful error message if not.

Fixes #362.
2020-04-24 21:15:00 +00:00
whitequark fd7f69f7a5 README: link directly to Yosys build instructions. 2020-04-24 21:09:58 +00:00
Teguh Hofstee ed0f508e8a
back.verilog: add workaround for evaluation Verific behavior.
The evaluation version of Verific prints its license information to stdout,
and since it is against the EULA to change that in any way, this behavior
is not possible to fix in Yosys. Add a workaround in nMigen instead.
2020-04-23 21:46:10 +00:00
Teguh Hofstee 875579ea50
back.verilog: make Yosys version check compatible with Verific. 2020-04-22 12:23:14 +00:00
Kate Temkin 0e18429fb7 vendor: use nextpnr -12k for -12F devices; remove theoretical devices
nextpnr now supports -12k; which replaces the use of -25k and --idcode
together to build bitstreams compatible with -12F devices. Use this.

This also removes the LFEUM-12K and its 5G counterpart; as per Dave Shah
they're currently only theoretical FPGAs.
2020-04-21 01:25:28 +00:00
anuejn ff6c0327a7
hdl.rec: make Record inherit from UserValue.
Closes #354.
2020-04-16 16:46:55 +00:00
whitequark b4af217ed0 back.rtlil: translate enum decoders to Yosys enum attributes.
Fixes #254.
2020-04-15 14:45:59 +00:00
whitequark 3346f2c505 buil.plat: enable strict undefined behavior in Jinja2.
By default, if an operation produces an undefined value (a Jinja2
concept that corresponds to Python's KeyError, AttributeError, etc)
then this value may be printed in a template, which is a nop. This
behavior can hide bugs.

This commit changes the Jinja2 behavior to raise an error instead of
producing an undefined value in all cases. (We produce undefined
values deliberately in a few places. Those are unaffected; it is OK
to use several kinds of undefined values in one Jinja2 environment.)

Fixes #337.
2020-04-14 06:17:16 +00:00
whitequark ee73d39b8d back.rtlil: don't emit connections to zero width ports.
Fixes #335.
2020-04-13 17:04:13 +00:00
whitequark 792f35ac8f back.rtlil: refuse to create extremely large wires.
Such wires are likely to trigger pathological behavior in Yosys and,
if applicable, other toolchains that consume Verilog converted from
RTLIL.

Fixes #341.
2020-04-13 16:38:36 +00:00
whitequark 814ffde6fb back.rtlil: fix expansion of Part() for partial dummy writes.
Before this commit, selecting a part that was fully out of bounds of
a value was correctly implemented as a write to a dummy wire, but
selecting a part that was only partially out of bounds resulted in
a crash.

Fixes #351.
2020-04-13 15:56:39 +00:00
whitequark edd2bb2c49 back.rtlil: fix legalization of Part() with stride.
Also known as word_select().
2020-04-13 14:43:43 +00:00
whitequark b44870e779 Clarify a few comments. NFC. 2020-04-13 13:55:23 +00:00
Dan Ravensloft 06c45c9ff0
hdl.ast: add Value.{rotate_left,rotate_right}. 2020-04-13 13:40:39 +00:00
whitequark 8b137438d0 Travis: require tests to pass on pypy3.
Fixes #147.
2020-04-13 11:04:25 +00:00
whitequark 7ba362a8d8 Travis: upgrade to bionic. 2020-04-13 09:40:00 +00:00
whitequark 91d6e4b22a build.run: fix BuildProducts.extract to work with subdirectories.
Fixes #353.
2020-04-12 04:56:15 +00:00
whitequark 7a08901117 hdl.rec: improve repr() for Layout.
Fixes #326.
2020-04-12 04:47:40 +00:00
whitequark e9c75f7ca1 hdl.ast: improve repr() for Shape.
The default __repr__() from typing.NamedTuple does not include
the module name, so the replacement (which uses the preferred syntax
for specifying these shapes) doesn't either.
2020-04-12 03:59:56 +00:00
whitequark 9055090f65 build.plat: don't check for toolchain presence if do_build=False. 2020-04-12 03:28:29 +00:00
Stuart Olsen 0e40dc0a2d back.pysim: Clear pending updates after they are effected 2020-04-08 14:08:35 +00:00
Stuart Olsen 1e744097ab back.pysim: Eliminate duplicate dict lookup in VCD update 2020-04-07 09:23:24 +00:00
Stuart Olsen 2398b7922e back.pysim: Reuse clock simulation commands 2020-04-07 09:23:17 +00:00
whitequark bb1bbcc51a hdl.mem: fix source location of ReadPort.en. 2020-04-05 02:00:06 +00:00
whitequark ec8386a797 back.pysim: fix emission of undriven traces to VCD files.
This has been originally implemented in commit d3775eed (which fixed
`write_vcd(traces=)` to do something at all), but had a flaw where
undriven traces would not be correctly placed in hierarchy. This
used to produce incorrect results on pyvcd 0.1, but started causing
assertion failures on pyvcd 0.2.

Fixes #345.
2020-04-03 05:20:42 +00:00
whitequark c79caead33 setup: bump pyvcd to ~=0.2.
We don't use any of the deprecated functionality, and the added
requirement of Python 3.6+ matches ours.

Having a requirement for pyvcd ~=0.1.4 was actually the cause of
the error I tried to fix in commit 6e1145e2. It had nothing to do
with Jinja2 (though it is definitely still good to have the tighter
requirement on Jinja2); the cause of the error was that pip would
install Jinja2, schedule installing markupsafe, install pyvcd 0.2.0
and then choke on the pyvcd 0.1.4 requirement, which would prevent
it from installing markupsafe &c. Why it does that is beyond me.
2020-04-02 11:23:49 +00:00
Jacob Lifshay 995f3a147b Add support for using non-compat Elaboratable instances with compat.fhdl.verilog.convert and compat.run_simulation
Fixes #344
2020-04-02 02:46:44 +00:00
whitequark 6e1145e2e7 setup: tighten version constraint on Jinja2.
I remember thinking that not constraining it properly might bite us
someday, but assumed that Jinja2 will always stay version 2. Now it
looks like Jinja2 3.0.0a1 got released, pip picks it by default, and
it's currently broken (something about markupsafe missing).

Do what needed to be done in the first place.
2020-04-02 01:35:39 +00:00
whitequark 2d1e12d00c hdl.ast: implement abs() on values. 2020-03-22 20:50:10 +00:00
WRansohoff a0d279850e
vendor.lattice_ice40: add support for SB_[LH]FOSC as default_clk.
These oscillators are only available on iCE40 UltraPlus devices.
2020-03-20 08:10:48 +00:00
Nicolas Robin 28f5eba9fb vendor: fix typo async_ff_sync 2020-03-15 11:34:52 +00:00
Stuart Olsen 7b9c8b440f
back.pysim: implement modulus operator. 2020-03-15 05:22:03 +00:00
awygle 4601dd0a69
Correctly handle resets in AsyncFIFO.
This commit improves handling of resets in AsyncFIFO in two ways:
  * First, resets no longer violate Gray counter CDC invariants.
  * Second, write domain reset now empties the entire FIFO.
2020-03-14 23:26:07 +00:00
whitequark 12c79025f3 vendor: fix a few issues in commit 2f8669ca. 2020-03-12 20:29:17 +00:00
awygle 2f8669cad6
lib.cdc: extract AsyncFFSynchronizer.
In some cases, it is necessary to synchronize a reset-like signal but
a new clock domain is not desirable. To address these cases, extract
the implementation of ResetSynchronizer into AsyncFFSynchronizer,
and replace ResetSynchronizer with a thin wrapper around it.
2020-03-08 21:37:40 +00:00
whitequark a14a5723c1 hdl.ast: fix off-by-1 in Initial.__init__(). 2020-02-19 01:28:14 +00:00
whitequark ec7aee62ea back.pysim: fix RHS codegen for Cat() and Repl(..., 0).
Fixes #325.
2020-02-19 01:21:00 +00:00
whitequark 377f2d987d back.pysim: optionally allow introspecting generated code. 2020-02-19 01:01:24 +00:00
awygle 5ae87916ec
nmigen.compat.genlib.cdc: add PulseSynchronizer. 2020-02-16 07:01:44 +00:00
awygle fcbabfeefc
nmigen.lib.cdc: port PulseSynchronizer.
Co-authored-by: Luke Wren <wren6991@gmail.com>
2020-02-16 06:51:53 +00:00