Commit graph

839 commits

Author SHA1 Message Date
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
whitequark 71d9eea4a0 Travis: prune dependencies.
bitarray is not required since commit 7df70059.
2020-02-14 06:34:28 +00:00
whitequark 3fd7fe7880 Travis: test on Python 3.8. 2020-02-14 06:33:08 +00:00
whitequark 57b08dbc2c cli: update use of deprecated code. 2020-02-12 14:42:24 +00:00
whitequark 8947096eea back.pysim: accept write_vcd(vcd_file=None).
Because write_vcd() is a context manager, this is useful if the VCD
file should be sometimes not written, since it avoids awkward
conditionals with duplicated code. It's not very elegant though.

Fixes #319.
2020-02-12 14:42:06 +00:00
whitequark 38aa9fb671 setup: update project URLs. 2020-02-09 17:03:06 +00:00
whitequark 4f17cb1ac7 doc: remove outdated files and references to them. 2020-02-09 14:16:00 +00:00
whitequark 66f4510c44 README: link to IRC channel. 2020-02-08 11:00:08 +00:00
whitequark 36f498e358 README: consolidate requirements in the Installation section. 2020-02-08 10:54:01 +00:00
whitequark 3b6727152e test_build_res: fix after commit 3e2ecdf2. 2020-02-07 00:07:19 +00:00
whitequark 3e2ecdf2fb build.res,vendor: place clock constraint on port, not net, if possible.
For most toolchains, these are functionally identical, although ports
tend to work a bit better, being the common case. For Vivado, though,
it is necessary to place them on the port because its timing analyzer
considers input buffer delay.

Fixes #301.
2020-02-06 23:37:15 +00:00
whitequark 5888f29c1f xilinx_{7series,ultrascale}: run report_methodology.
This can expose important timing issues, such as #301.
2020-02-06 19:38:21 +00:00
whitequark 27b47faf16 hdl.ast: add Value.{as_signed,as_unsigned}.
Before this commit, there was no way to do so besides creating and
assigning an intermediate signal, which could not be extracted into
a helper function due to Module statefulness.

Fixes #292.
2020-02-06 18:27:55 +00:00
whitequark 9301e31b69 test_lib_fifo: define all referenced FSM states.
Broken in commit a1c58633.
2020-02-06 18:10:15 +00:00
whitequark a1c58633e6 hdl.dsl: make referencing undefined FSM states an error.
Before this commit, doing something like:

    with m.FSM():
        with m.State("FOO"):
            m.next = "bAR"
        with m.State("BAR"):
            m.next = "FOO"

would silently create an empty state `bAR` and get stuck in it until
the module is reset. This was done intentionally (in Migen, this code
would in fact miscompile), but in retrospect was clearly a bad idea;
it turns typos into bugs, while in the rare case that branching to
a completely empty state is desired, it is trivial to define one.

Fixes #315.
2020-02-06 17:47:46 +00:00
whitequark 97cc78a3db hdl.ir: type check ports.
Fixes #290.
2020-02-06 17:33:41 +00:00
whitequark 882fddfa96 back.pysim: emit toplevel inputs in VCD files as well.
Before this commit, only signals driven from fragments (in practice,
everything except toplevel inputs) would get written to a VCD file.
Not having toplevel inputs in the dump made debugging ~impossible.

After this commit, all signals the fragment refers to get written to
a VCD file. (More specifically, all signals the compiler assigns
an index to, i.e. signals the generated code reads or writes.)

Fixes #280.
2020-02-06 17:19:47 +00:00
whitequark d3775eedd7 back.pysim: make write_vcd(traces=) actually use those traces.
Reported in #280.
2020-02-06 17:07:48 +00:00
whitequark 3df429703c hdl.dsl: reject name mismatch in m.domains.<name> +=.
This would violate invariants later in the elaboration process.

Fixes #282.
2020-02-06 16:13:59 +00:00
whitequark 86b57fe6b6 hdl.dsl: type check when adding to m.domains. 2020-02-06 15:19:16 +00:00
whitequark 31cd72c0b6 hdl.mem: add synthesis attribute support.
Fixes #291.
2020-02-06 14:53:16 +00:00
whitequark f7abe368a9 hdl.mem: document Memory. 2020-02-06 13:47:13 +00:00