Commit graph

1085 commits

Author SHA1 Message Date
whitequark 39ff7203ba hdl.ast: remove dead code. NFC.
See #548.
2020-11-21 17:30:28 +00:00
awygle c1ed90807b
nmigen.hdl.rec: restore Record.shape().
This method was lost in commit abbebf8e.
2020-11-17 19:36:58 +00:00
Marcelina Kościelnicka 44318149e0
sim._pyrtl: mask Mux selection operand.
Otherwise it behaves funny when it's eg. the result of operator ~.
2020-11-14 15:22:34 +00:00
Jan Kowalewski adef3b2e7b vendor.quicklogic: enable SoC clock configuration
Signed-off-by: Jan Kowalewski <jkowalewski@antmicro.com>
2020-11-13 16:27:15 +00:00
whitequark 36bc1d2b4d vendor.quicklogic: write OpenOCD scripts as part of build process.
The OpenOCD scripts for EOS-S3 are roughly equivalent to SVF files
for a more traditional FPGA, which we also produce, for some common
"default" configuration, as a part of the build process.
2020-11-13 05:44:16 +00:00
whitequark d6da4c257b build.plat: TemplatedPlatform.iter_extra_files→Platform.iter_files.
This function was added in commit 20553b14 in the wrong place, with
the wrong name, and without tests. Fix all that.
2020-11-10 05:30:30 +00:00
awygle ea94c9cc45
hdl.rec: proxy operators correctly.
Commit abbebf8e used __getattr__ to proxy Value methods called on 
Record. However, that did not proxy operators like __add__ because
Python looks up the special operator methods directly on the class
and does not run __getattr__ if they are missing.

Instead of using __getattr__, explicitly enumerate and wrap every
Value method that should be proxied. This also ensures backwards
compatibility if more methods are added to Value later.

Fixes #533.
2020-11-09 20:20:25 +00:00
Konrad Beckmann ebbdac9798
vendor.intel: add support for Cyclone V internal oscillator
When using the default clock "cyclonev_oscillator" on Cyclone V devices,
the internal oscillator will be used.
2020-11-06 11:35:18 +00:00
whitequark bde37fe2f2 hdl.ast: deprecate UserValue in favor of ValueCastable.
Closes #527.
2020-11-06 02:21:53 +00:00
whitequark c9fd000103 sim.pysim: avoid redundant VCD updates.
This commit properly addresses a bug introduced in 2efeb05c and then
temporarily fixed in 58f1d4bc.

Fixes #429.
2020-11-06 02:05:35 +00:00
whitequark 6e7dbe004e examples: clean up oudated code. 2020-11-06 01:54:30 +00:00
whitequark bb6a233626 Fix commit 8313d6e7. 2020-11-06 01:54:30 +00:00
whitequark 8313d6e71c cli: update deprecated import. 2020-11-06 01:41:41 +00:00
whitequark db5a981f43 CI: add CPython 3.9 to test matrix. 2020-11-06 01:41:41 +00:00
whitequark 10fd5cff4b CI: run testsuite with -Werror. 2020-11-06 01:38:03 +00:00
whitequark c6150d0586 vendor.lattice_{ice40,ecp5}: clean up $verilog_initial_trigger wires.
These only matter in simulation and after conversion to Verilog.
During synthesis they cause Yosys to produce warnings:

  Warning: Wire $verilog_initial_trigger has an unprocessed 'init' attribute.
2020-11-06 01:31:14 +00:00
awygle abbebf8efe
hdl.rec: migrate Record from UserValue to ValueCastable.
Closes #528.
2020-11-06 01:10:39 +00:00
awygle 06c734992f
hdl.ast: implement ValueCastable.
Closes RFC issue #355.
2020-11-06 00:20:54 +00:00
whitequark 0ef01b1282 vendor.quicklogic: part→package 2020-11-05 07:36:43 +00:00
Norbert Braun 14a5c42a8b vendor.xilinx_7series: byte swap generated bitstream
The Zynq driver in the FPGA Manager framework on Linux expects bitstreams that
are byte swapped with respect to what the Vivado command
`write_bitstream -bin_file` produces. Thus, use the `write_cfgmem` command with
appropriate options to generate the bitstream (.bin file).

Fixes #519.
2020-11-03 09:39:49 +00:00
Jaro Habiger b15f0562a6 lib.fifo: fix {r,w}_level in AsyncFIFOBuffered 2020-11-03 09:34:12 +00:00
Jaro Habiger c7014f84ea lib.fifo: fix level on fifo full 2020-11-03 09:20:30 +00:00
David Lattimore 781a3aa767
vendor.lattice_ice40: zero-pad CLKHF_DIV in SB_HFOSC instance.
Fixes #520.
2020-11-02 06:19:47 +00:00
Jan Kowalewski 8fe319f065 vendor.quicklogic: utilize internal SoC clock in EOS-S3
Signed-off-by: Jan Kowalewski <jkowalewski@antmicro.com>
2020-10-30 18:11:25 +00:00
Jan Kowalewski b88009bd96 vendor.quicklogic: fix toolchain nomenclature
Signed-off-by: Jan Kowalewski <jkowalewski@antmicro.com>
2020-10-30 18:11:25 +00:00
Robin Ole Heinemann 05decc43b2 lib.fifo.AsyncFFSynchronizer: check input and output signal width 2020-10-28 00:08:38 +00:00
Ben Newhouse 765c15c709
setup: link to latest docs if VCS information is not available. 2020-10-27 01:16:25 +00:00
whitequark e3207b74f4 build.dsl: clean up inversion logic.
* Add invert= argument to DiffPairs() constructor, like in Pins().
  * Make PinsN() and DiffPairsN() pass invert= to the corresponding
    construtor instead of mutating.
2020-10-26 19:50:21 +00:00
whitequark 87454b0b6f back.{verilog,rtlil}: adjust $verilog_initial_trigger insertion.
To track upstream changes.
2020-10-25 01:59:46 +00:00
whitequark 5581fdc1e8 CI: disable codecov project status.
Every PR should be covered by tests, and codecov patch statuses are
extremely useful. However, codecov project statuses mostly create
noise because project-wide coverage in nMigen is currently primarily
informational.
2020-10-25 00:13:39 +00:00
anuejn d8273a15c3
lib.fifo.AsyncFIFO: fix incorrect latency of r_level.
Co-authored-by: Andrew Wygle <awygle@gmail.com>
2020-10-24 14:58:23 +00:00
anuejn ca6fa036f6
tests: make spec directory name unique per test method. 2020-10-22 21:38:44 +00:00
whitequark df70aae887 sim._pyrtl: sign extend RHS of assignment.
Fixes #502.
2020-10-22 16:08:38 +00:00
whitequark 9d62cbefa5 hdl.dsl: error on Elif immediately nested in an If.
I.e. on this code, which is currently not only wrongly accepted but
also results in completely unexpected RTL:

    with m.If(...):
        with m.Elif(...):
            ...

Fixes #500.
2020-10-22 13:23:06 +00:00
Jan Kowalewski 2c505deacc vendor.quicklogic: fix syntax
Signed-off-by: Jan Kowalewski <jkowalewski@antmicro.com>
2020-10-19 23:02:47 +00:00
Xiretza 12327aedf8 setup.py: Exclude "tests" package
67b957d moved the tests from nmigen/test/ to tests/, and removed the
exclude= parameter from find_packages() in setup.py. However, even if
the new location is not inside the module tree, it is still found by
find_packages(), resulting in a stray "tests" module on the system.
2020-10-19 22:59:33 +00:00
Xiretza eb152da59b hdl.ir: Update error message for Instance arguments
48d4ee4 added the option to specify attributes using Instance arguments,
but the error message wasn't updated accordingly.
2020-10-18 23:55:46 +00:00
whitequark a6db99b05e README: Quicklogic EOS S3 is now supported. 2020-10-15 18:10:39 +00:00
whitequark 80194e1a7e CI: fix code coverage collection.
This has been broken since commit d71e19e2 (2020-07-22).
2020-10-15 18:09:04 +00:00
Jan Kowalewski 9746138e55
vendor.quicklogic: new platform.
Signed-off-by: Kamil Rakoczy <krakoczy@antmicro.com>
Signed-off-by: Jan Kowalewski <jkowalewski@antmicro.com>

Co-authored-by: Kamil Rakoczy <krakoczy@antmicro.com>
2020-10-15 18:02:25 +00:00
whitequark e58233b441 tests: keep comments up to date. NFC. 2020-10-15 17:02:50 +00:00
whitequark d22b2c5604 build.plat: avoid type confusion in _check_feature.
Before this commit, `_check_feature(valid_xdrs=0)` would mean that
XDR buffers are not supported. Only `_check_feature(valid_xdrs=())`
was intended to be an indicator of that.
2020-10-15 08:56:09 +00:00
Jean-François Nguyen 69ed4918b8 hdl.mem: document ReadPort and WritePort.
Fixes #496.
2020-09-17 15:47:46 +00:00
William D. Jones 47ecc16283
vendor.lattice_{ecp5,machxo_2_3l}: explain how to set up NMIGEN_ENV_Diamond on Windows. 2020-08-29 19:34:57 +00:00
whitequark d12c7827a0 setup: synchronize builtin-yosys dependency. 2020-08-27 13:46:55 +00:00
whitequark 955f3f6dcc back.verilog: use proc -nomux if it is available.
Yosys offers no stability guarantees for individual `proc_*` passes,
though so far it worked out fine. This commit changes the Verilog
backend to use `proc -nomux` instead, which is guaranteed to have
backwards-compatible behavior.

Fixes #479.
2020-08-27 13:03:15 +00:00
whitequark b65e11f38f sim: split into base, core, and engines.
Before this commit, each simulation engine (which is only pysim at
the moment, but also cxxsim soon) was a subclass of SimulatorCore,
and every simulation engine module would essentially duplicate
the complete structure of a simulator, with code partially shared.

This was a really bad idea: it was inconvenient to use, with
downstream code having to branch between e.g. PySettle and CxxSettle;
it had no well-defined external interface; it had multiple virtually
identical entry points; and it had no separation between simulation
algorithms and glue code.

This commit completely rearranges simulation code.
  1. sim._base defines internal simulation interfaces. The clarity of
     these internal interfaces is important because simulation
     engines mix and match components to provide a consistent API
     regardless of the chosen engine.
  2. sim.core defines the external simulation interface: the commands
     and the simulator facade. The facade provides a single entry
     point and, when possible, validates or lowers user input.
     It also imports built-in simulation engines by their symbolic
     name, avoiding eager imports of pyvcd or ctypes.
  3. sim.xxxsim (currently, only sim.pysim) defines the simulator
     implementation: time and state management, process scheduling,
     and waveform dumping.

The new simulator structure has none of the downsides of the old one.

See #324.
2020-08-27 11:52:31 +00:00
whitequark 9bdb7accc8 sim.pysim: in write_vcd(), close files if an exception is raised.
This also avoids leaving the waveform writer list in an inconsistent
state after an exception.
2020-08-27 08:34:18 +00:00
whitequark 9bc42cb8c5 sim._pyclock: new type of process.
The overhead of coroutine processes is fairly high. A clock driver
implemented through a coroutine process is mostly overhead. This was
partially addressed in commit 2398b792 by microoptimizing yielding.

This commit eliminates the coroutine process overhead completely by
introducing dedicated clock processes. It also simplifies the logic
to a simple toggle.

This change improves runtime by about 12% on Minerva SRAM SoC.
2020-08-27 07:56:47 +00:00
whitequark c00219d9f3 sim._pycoro: make src_loc() more robust.
* Guard for finished coroutines.
  * Guard for coroutines yielding from iterators and not generators.
2020-08-27 07:11:14 +00:00