Commit graph

61 commits

Author SHA1 Message Date
Wanda
890e099ec3 Implement RFC 45: Move hdl.Memory to lib.Memory. 2024-02-19 22:24:58 +00:00
Wanda
24a392887a Implement RFC 43: Rename reset= to init=. 2024-02-15 22:52:24 +00:00
Wanda
4014f6429c Implement RFC 27 amendment: deprecate add_sync_process, not add_process. 2024-02-12 18:26:48 +00:00
Wanda
2fecd1c78b examples.basic.pmux: Fix for RFC 39. 2024-01-16 12:14:43 +00:00
Catherine
e6ec0be889 examples,docs: ensure amaranth-boards is available as a dev dependency. 2023-09-25 14:15:11 +00:00
Ben Newhouse
55756e9568
examples/uart: acknowledging RX data should deassert RX ready. 2021-12-16 13:31:32 +00:00
whitequark
909a3b8be7 Rename nMigen to Amaranth HDL. 2021-12-10 10:34:13 +00:00
Robin Ole Heinemann
25caf4045b *: remove unused imports 2021-05-18 20:18:55 +00:00
whitequark
6e7dbe004e examples: clean up oudated code. 2020-11-06 01:54:30 +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
d048f069f8 hdl.ast: actually remove simulator commands.
These were supposed to be removed in 7df70059, but I forgot.
2019-12-02 02:24:24 +00:00
whitequark
7df70059d1 back.pysim: redesign the simulator.
The redesign introduces no fundamental incompatibilities, but it does
involve minor breaking changes:
  * The simulator commands were moved from hdl.ast to back.pysim
    (instead of only being reexported from back.pysim).
  * back.pysim.DeadlineError was removed.

Summary of changes:
  * The new simulator compiles HDL to Python code and is >6x faster.
    (The old one compiled HDL to lots of Python lambdas.)
  * The new simulator is a straightforward, rigorous implementation
    of the Synchronous Reactive Programming paradigm, instead of
    a pile of ad-hoc code with no particular design driving it.
  * The new simulator never raises DeadlineError, and there is no
    limit on the amount of delta cycles.
  * The new simulator robustly handles multiclock designs.
  * The new simulator can be reset, such that the compiled design
    can be reused, which can save significant runtime with large
    designs.
  * Generators can no longer be added as processes, since that would
    break reset(); only generator functions may be. If necessary,
    they may be added by wrapping them into a generator function;
    a deprecated fallback does just that. This workaround will raise
    an exception if the simulator is reset and restarted.
  * The new simulator does not depend on Python extensions.
    (The old one required bitarray, which did not provide wheels.)

Fixes #28.
Fixes #34.
Fixes #160.
Fixes #161.
Fixes #215.
Fixes #242.
Fixes #262.
2019-11-28 21:05:34 +00:00
whitequark
ffd10e3042 back.rtlil: fix lowering of Part() on LHS to account for stride. 2019-10-26 01:52:34 +00:00
whitequark
706bfaf5e1 hdl.ast: deprecate Signal.{range,enum}.
Although constructor methods can improve clarity, there are many
contexts in which it is useful to use range() as a shape: notably
Layout, but also Const and AnyConst/AnyValue. Instead of duplicating
these constructor methods everywhere (which is not even easily
possible for Layout), use casting to Shape, introduced in 6aabdc0a.

Fixes #225.
2019-10-11 13:07:42 +00:00
whitequark
7dfd7fb12a examples: update blinky, add some explanatory text about domains. 2019-10-09 23:19:28 +00:00
whitequark
8deb13cea3 lib.cdc: MultiReg→FFSynchronizer.
Fixes #229.
2019-09-23 14:18:45 +00:00
whitequark
eb04a2509e hdl.mem,lib,examples: use Signal.range(). 2019-09-08 12:19:13 +00:00
whitequark
5e9587bbbd Remove nmigen.lib from prelude.
Currently it's just MultiReg, and there's no particularly good reason
to privilege this specific CDC primitive so much.
2019-09-06 06:53:06 +00:00
Reto Kramer
b0ef53e095 examples/basic/uart: document divisor parameter. 2019-08-22 19:28:40 +00:00
whitequark
fa0fa056ba hdl.xfrm: CEInserter→EnableInserter.
Fixes #166.
2019-08-12 13:39:26 +00:00
whitequark
5c63177fc2 test: generate examples to verilog as part of unit tests.
This is to make sure 806a62c2 doesn't happen again.
2019-07-08 10:12:26 +00:00
whitequark
c14d074fcc examples/basic/ctr_ce: fix outdated syntax. 2019-07-08 10:12:26 +00:00
whitequark
2b92f12016 examples: add concise UART example.
This example uses shift registers and counters instead of an explicit
FSM, which makes it very compact in terms of generated logic, and
more concise too.
2019-06-27 04:51:45 +00:00
whitequark
1b54eb80da vendor.board: split off into nmigen-boards package.
The iCE40 programmers are also moved, since they're board-specific.
(It looks like iceprog isn't, but it only works with Lattice
evaluation kits.)

Fixes #80.
2019-06-04 09:52:33 +00:00
whitequark
3d04122d55 examples: reorganize into examples/basic and examples/board. 2019-06-03 16:17:37 +00:00
whitequark
0fa45b5e14 vendor.board: extract package. 2019-06-03 16:14:59 +00:00
whitequark
f417725b10 build.res: if not specified, request resource #0.
This markedly differs from oMigen system, which would request
consecutive resources. The difference is deliberate; most resources
are singular, so it does not matter for them, and for resources where
it does matter, which pins are requested should not depend on order
of execution of `platform.request`.
2019-06-03 02:54:17 +00:00
whitequark
ba0fcddb2c vendor.ice40_hx1k_blink_evn: implement. 2019-06-01 16:48:07 +00:00
whitequark
aed2062101 Remove examples/tbuf.py.
This example predates the plans for nmigen.build, and indeed
get_tristate and TSTriple no longer exist.
2019-04-21 08:53:37 +00:00
whitequark
44711b7d08 hdl.ir: detect elaboratables that are created but not used.
Requres every elaboratable to inherit from Elaboratable, but still
accepts ones that do not, with a warning.

Fixes #3.
2019-04-21 08:52:57 +00:00
Alain Péteut
d69a4e29a8 examples.por: fix typo 2019-03-12 02:14:21 +00:00
whitequark
7acea8f3ce examples: update for newer API. 2019-01-26 16:25:05 +00:00
whitequark
4948162f33 hdl.ir: rename .get_fragment() to .elaborate().
Closes #9.
2019-01-26 02:31:12 +00:00
whitequark
6f66885c09 lib.io: lower to platform-independent tristate buffer. 2019-01-14 16:50:04 +00:00
whitequark
011bf2258e hdl: make ClockSignal and ResetSignal usable on LHS.
Fixes #8.
2019-01-14 15:38:16 +00:00
whitequark
92a96e1644 hdl.rec: add basic record support. 2018-12-28 13:22:10 +00:00
whitequark
470d66934f hdl.dsl: add support for fsm.ongoing(). 2018-12-27 16:19:01 +00:00
whitequark
597d778cf6 examples: add an FSM usage example (UART receiver). 2018-12-26 10:10:27 +00:00
whitequark
cf79738744 cli: new module, for basic design generaton/simulation. 2018-12-23 00:06:58 +00:00
whitequark
a061bfaa6c hdl.mem: tie rdport.en high for asynchronous or transparent ports. 2018-12-21 04:22:16 +00:00
whitequark
2b4a8510ca back.rtlil: implement memories. 2018-12-21 01:55:59 +00:00
whitequark
f7fec804ec ir: allow non-Signals in Instance ports. 2018-12-20 23:40:40 +00:00
whitequark
c7f9386eab fhdl.ir: add black-box fragments, fragment parameters, and Instance. 2018-12-17 22:55:39 +00:00
whitequark
850674637a back.rtlil: implement Array. 2018-12-17 01:15:23 +00:00
whitequark
1adf58f561 examples: rename clkdiv/ctrl to ctr/ctr_ce. 2018-12-15 20:42:52 +00:00
whitequark
b5a1efa0c8 Move star imports to make from nmigen import * usable. 2018-12-15 14:20:10 +00:00
whitequark
9307a31678 back.pysim: Simulator({gtkw_signals→traces}=). 2018-12-14 15:23:22 +00:00
whitequark
dd00b5e2d6 back.pysim: more general clean-up. 2018-12-14 12:46:04 +00:00
whitequark
a10791e160 back.pysim: if requested, write a gtkw file with a useful preset. 2018-12-14 08:04:29 +00:00
whitequark
3bb7a87e0f back.pysim: implement "sync processes", like migen.sim generators. 2018-12-14 05:13:58 +00:00