Skip to content

Commit 3523b0e

Browse files
Deploying to main from @ amaranth-lang/amaranth@5a6ceec 🚀
1 parent d955ae8 commit 3523b0e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+514
-271
lines changed

docs/amaranth/latest/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 8a742aa9ed59343fa8ddfc65bff03707
3+
config: 9d1ff2d69a43f21ccdef9ee0509e3140
44
tags: 645f666f9bcd5a90fca523b33c5a78b7
3.32 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

docs/amaranth/latest/_sources/changes.rst.txt

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Changelog
22
#########
33

4-
This document describes changes to the public interfaces in the Amaranth language and standard library. It does not include most bug fixes or implementation changes.
4+
This document describes changes to the public interfaces in the Amaranth language and standard library. It does not include most bug fixes or implementation changes; versions which do not include notable changes are not listed here.
55

66

77
Documentation for past releases
@@ -19,8 +19,8 @@ Documentation for past releases of the Amaranth language and toolchain is availa
1919
* `Amaranth 0.3 <https://amaranth-lang.org/docs/amaranth/v0.3/>`_
2020

2121

22-
Version 0.6 (unreleased)
23-
========================
22+
Version 0.6.0 (unreleased)
23+
==========================
2424

2525

2626
Language changes
@@ -30,12 +30,12 @@ Language changes
3030

3131
* Changed: overriding :meth:`ValueCastable.from_bits` is now mandatory. (`RFC 51`_)
3232
* Deprecated: the :py:`local=` argument to :class:`ClockDomain`. (`RFC 59`_)
33-
* Removed: (deprecated in 0.4) :class:`Record`.
34-
* Removed: (deprecated in 0.5) :class:`Memory` (`RFC 45`_)
35-
* Removed: (deprecated in 0.5) public submodules of :mod:`amaranth.hdl`.
36-
* Removed: (deprecated in 0.5) :meth:`Value.implies`.
37-
* Removed: (deprecated in 0.5) :meth:`Const.width`, :meth:`Const.signed`, :meth:`Signal.width`, :meth:`Signal.signed`.
38-
* Removed: (deprecated in 0.5) upwards propagation of clock domains. (`RFC 59`_)
33+
* Removed: (deprecated in 0.4.0) :class:`Record`.
34+
* Removed: (deprecated in 0.5.0) :class:`Memory` (`RFC 45`_)
35+
* Removed: (deprecated in 0.5.0) public submodules of :mod:`amaranth.hdl`.
36+
* Removed: (deprecated in 0.5.0) :meth:`Value.implies`.
37+
* Removed: (deprecated in 0.5.0) :meth:`Const.width`, :meth:`Const.signed`, :meth:`Signal.width`, :meth:`Signal.signed`.
38+
* Removed: (deprecated in 0.5.0) upwards propagation of clock domains. (`RFC 59`_)
3939

4040

4141
Standard library changes
@@ -44,13 +44,22 @@ Standard library changes
4444
.. currentmodule:: amaranth.lib
4545

4646
* Added: :py:`payload_init=` argument in :class:`amaranth.lib.stream.Signature`.
47-
* Removed: (deprecated in 0.5) :mod:`amaranth.lib.coding`. (`RFC 63`_)
47+
* Changed: (deprecated in 0.5.1) providing :meth:`io.PortLike.__add__` is now mandatory. (`RFC 69`_)
48+
* Removed: (deprecated in 0.5.0) :mod:`amaranth.lib.coding`. (`RFC 63`_)
4849

4950

5051
Version 0.5.1
5152
=============
5253

5354

55+
Implemented RFCs
56+
----------------
57+
58+
.. _RFC 69: https://amaranth-lang.org/rfcs/0069-simulation-port.html
59+
60+
* `RFC 69`_: Add a ``lib.io.PortLike`` object usable in simulation
61+
62+
5463
Standard library changes
5564
------------------------
5665

@@ -59,10 +68,11 @@ Standard library changes
5968
* Added: views of :class:`amaranth.lib.data.ArrayLayout` can be indexed with negative integers or slices.
6069
* Added: :py:`len()` works on views of :class:`amaranth.lib.data.ArrayLayout`.
6170
* Added: views of :class:`amaranth.lib.data.ArrayLayout` are iterable.
71+
* Added: :class:`io.SimulationPort`. (`RFC 69`_)
6272

6373

64-
Version 0.5
65-
===========
74+
Version 0.5.0
75+
=============
6676

6777
The Migen compatibility layer has been removed.
6878

@@ -161,9 +171,9 @@ Language changes
161171
* Deprecated: :class:`amaranth.hdl.Memory`. (`RFC 45`_)
162172
* Deprecated: upwards propagation of clock domains. (`RFC 59`_)
163173
* Deprecated: :meth:`Value.implies`.
164-
* Removed: (deprecated in 0.4) :meth:`Const.normalize`. (`RFC 5`_)
165-
* Removed: (deprecated in 0.4) :class:`Repl`. (`RFC 10`_)
166-
* Removed: (deprecated in 0.4) :class:`ast.Sample`, :class:`ast.Past`, :class:`ast.Stable`, :class:`ast.Rose`, :class:`ast.Fell`.
174+
* Removed: (deprecated in 0.4.0) :meth:`Const.normalize`. (`RFC 5`_)
175+
* Removed: (deprecated in 0.4.0) :class:`Repl`. (`RFC 10`_)
176+
* Removed: (deprecated in 0.4.0) :class:`ast.Sample`, :class:`ast.Past`, :class:`ast.Stable`, :class:`ast.Rose`, :class:`ast.Fell`.
167177
* Removed: assertion names in :class:`Assert`, :class:`Assume` and :class:`Cover`. (`RFC 50`_)
168178
* Removed: accepting non-subclasses of :class:`Elaboratable` as elaboratables.
169179

@@ -182,9 +192,9 @@ Standard library changes
182192
* Added: :mod:`amaranth.lib.meta`, :class:`amaranth.lib.wiring.ComponentMetadata`. (`RFC 30`_)
183193
* Added: :mod:`amaranth.lib.stream`. (`RFC 61`_)
184194
* Deprecated: :mod:`amaranth.lib.coding`. (`RFC 63`_)
185-
* Removed: (deprecated in 0.4) :mod:`amaranth.lib.scheduler`. (`RFC 19`_)
186-
* Removed: (deprecated in 0.4) :class:`amaranth.lib.fifo.FIFOInterface` with :py:`fwft=False`. (`RFC 20`_)
187-
* Removed: (deprecated in 0.4) :class:`amaranth.lib.fifo.SyncFIFO` with :py:`fwft=False`. (`RFC 20`_)
195+
* Removed: (deprecated in 0.4.0) :mod:`amaranth.lib.scheduler`. (`RFC 19`_)
196+
* Removed: (deprecated in 0.4.0) :class:`amaranth.lib.fifo.FIFOInterface` with :py:`fwft=False`. (`RFC 20`_)
197+
* Removed: (deprecated in 0.4.0) :class:`amaranth.lib.fifo.SyncFIFO` with :py:`fwft=False`. (`RFC 20`_)
188198

189199

190200
Toolchain changes
@@ -199,7 +209,7 @@ Toolchain changes
199209
* Deprecated: :py:`Simulator.add_sync_process`. (`RFC 27`_)
200210
* Deprecated: generator-based simulation processes and testbenches. (`RFC 36`_)
201211
* Deprecated: the :py:`run_passive` argument to :meth:`Simulator.run_until <amaranth.sim.Simulator.run_until>` has been deprecated, and does nothing.
202-
* Removed: (deprecated in 0.4) use of mixed-case toolchain environment variable names, such as ``NMIGEN_ENV_Diamond`` or ``AMARANTH_ENV_Diamond``; use upper-case environment variable names, such as ``AMARANTH_ENV_DIAMOND``.
212+
* Removed: (deprecated in 0.4.0) use of mixed-case toolchain environment variable names, such as ``NMIGEN_ENV_Diamond`` or ``AMARANTH_ENV_Diamond``; use upper-case environment variable names, such as ``AMARANTH_ENV_DIAMOND``.
203213

204214

205215
Platform integration changes
@@ -212,11 +222,11 @@ Platform integration changes
212222
* Added: ``build.sh`` begins with ``#!/bin/sh``.
213223
* Changed: ``IntelPlatform`` renamed to ``AlteraPlatform``.
214224
* Deprecated: argument :py:`run_script=` in :meth:`BuildPlan.execute_local`.
215-
* Removed: (deprecated in 0.4) :mod:`vendor.intel`, :mod:`vendor.lattice_ecp5`, :mod:`vendor.lattice_ice40`, :mod:`vendor.lattice_machxo2_3l`, :mod:`vendor.quicklogic`, :mod:`vendor.xilinx`. (`RFC 18`_)
225+
* Removed: (deprecated in 0.4.0) :mod:`vendor.intel`, :mod:`vendor.lattice_ecp5`, :mod:`vendor.lattice_ice40`, :mod:`vendor.lattice_machxo2_3l`, :mod:`vendor.quicklogic`, :mod:`vendor.xilinx`. (`RFC 18`_)
216226

217227

218-
Version 0.4
219-
===========
228+
Version 0.4.0
229+
=============
220230

221231
Support has been added for a new and improved way of defining data structures in :mod:`amaranth.lib.data` and component interfaces in :mod:`amaranth.lib.wiring`, as defined in `RFC 1`_ and `RFC 2`_. :class:`Record` has been deprecated. In a departure from the usual policy, to give designers additional time to migrate, :class:`Record` will be removed in Amaranth 0.6 (one release later than normal).
222232

docs/amaranth/latest/_sources/stdlib/io.rst.txt

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ All of the following examples assume that one of the built-in FPGA platforms is
6060

6161
.. testcode::
6262

63-
from amaranth.lib import io, wiring
63+
from amaranth.sim import Simulator
64+
from amaranth.lib import io, wiring, stream
6465
from amaranth.lib.wiring import In, Out
6566

6667

@@ -191,6 +192,74 @@ In this example of a `source-synchronous interface <https://en.wikipedia.org/wik
191192
This component transmits :py:`dout` on each cycle as two halves: the low 8 bits on the rising edge of the data clock, and the high 8 bits on the falling edge of the data clock. The transmission is *edge-aligned*, meaning that the data edges exactly coincide with the clock edges.
192193

193194

195+
Simulation
196+
----------
197+
198+
The Amaranth simulator, :mod:`amaranth.sim`, cannot simulate :ref:`core I/O values <lang-iovalues>` or :ref:`I/O buffer instances <lang-iobufferinstance>` as it only operates on unidirectionally driven two-state wires. This module provides a simulation-only library I/O port, :class:`SimulationPort`, so that components that use library I/O buffers can be tested.
199+
200+
A component that is designed for testing should accept the library I/O ports it will drive as constructor parameters rather than requesting them from the platform directly. Synthesizable designs will instantiate the component with a :class:`SingleEndedPort`, :class:`DifferentialPort`, or a platform-specific library I/O port, while tests will instantiate the component with a :class:`SimulationPort`. Tests are able to inject inputs into the component using :py:`sim_port.i`, capture the outputs of the component via :py:`sim_port.o`, and ensure that the component is driving the outputs at the appropriate times using :py:`sim_port.oe`.
201+
202+
For example, consider a simple serializer that accepts a stream of multi-bit data words and outputs them bit by bit. It can be tested as follows:
203+
204+
.. testcode::
205+
206+
class OutputSerializer(wiring.Component):
207+
data: In(stream.Signature(8))
208+
209+
def __init__(self, dclk_port, dout_port):
210+
self.dclk_port = dclk_port
211+
self.dout_port = dout_port
212+
213+
super().__init__()
214+
215+
def elaborate(self, platform):
216+
m = Module()
217+
218+
m.submodules.dclk = dclk = io.Buffer("o", self.dclk_port)
219+
m.submodules.dout = dout = io.Buffer("o", self.dout_port)
220+
221+
index = Signal(range(8))
222+
m.d.comb += dout.o.eq(self.data.payload.bit_select(index, 1))
223+
224+
with m.If(self.data.valid):
225+
m.d.sync += dclk.o.eq(~dclk.o)
226+
with m.If(dclk.o):
227+
m.d.sync += index.eq(index + 1)
228+
with m.If(index == 7):
229+
m.d.comb += self.data.ready.eq(1)
230+
231+
return m
232+
233+
def test_output_serializer():
234+
dclk_port = io.SimulationPort("o", 1)
235+
dout_port = io.SimulationPort("o", 1)
236+
237+
dut = OutputSerializer(dclk_port, dout_port)
238+
239+
async def testbench_write_data(ctx):
240+
ctx.set(dut.data.payload, 0xA1)
241+
ctx.set(dut.data.valid, 1)
242+
await ctx.tick().until(dut.data.ready)
243+
ctx.set(dut.data.valid, 0)
244+
245+
async def testbench_sample_output(ctx):
246+
for bit in [1,0,0,0,0,1,0,1]:
247+
_, dout_value = await ctx.posedge(dut.dclk_port.o).sample(dut.dout_port.o)
248+
assert ctx.get(dut.dout_port.oe) == 1, "DUT is not driving the data output"
249+
assert dout_value == bit, "DUT drives the wrong value on data output"
250+
251+
sim = Simulator(dut)
252+
sim.add_clock(1e-6)
253+
sim.add_testbench(testbench_write_data)
254+
sim.add_testbench(testbench_sample_output)
255+
sim.run()
256+
257+
.. testcode::
258+
:hide:
259+
260+
test_output_serializer()
261+
262+
194263
Ports
195264
-----
196265

@@ -199,6 +268,7 @@ Ports
199268
.. autoclass:: PortLike
200269
.. autoclass:: SingleEndedPort
201270
.. autoclass:: DifferentialPort
271+
.. autoclass:: SimulationPort
202272

203273

204274
Buffers

docs/amaranth/latest/_static/documentation_options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var DOCUMENTATION_OPTIONS = {
22
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
3-
VERSION: '0.6.0.dev30',
3+
VERSION: '0.6.0.dev32',
44
LANGUAGE: 'en',
55
COLLAPSE_INDEX: false,
66
BUILDER: 'html',

0 commit comments

Comments
 (0)