Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusted examples to Amaranth 0.4.0+ #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

littlelailo
Copy link

In Amaranth 0.4.0 the Pin instance can no longer simply be cast to a Value,
instead you have to specify the input/output direction when accessing it.

I changed the examples in two commits to work on newer version of Amaranth (tested against 0.5.3).
The first commit updates blink and uart, which I both flashed and tested (well it blinks and loopback is working).
The second commit fixes the remaining examples.
There I was only able to test flashing them but not if they work as I don't have the accessories.

The pdm_fade_gamma example unfortunately doesn't build for me at all so I was unable to fix that:

/<censored>/icebreaker-amaranth-examples/icebreaker/pdm_fade_gamma/gamma_pdm.py:112: DeprecationWarning: `amaranth.hdl.Memory` is deprecated, use `amaranth.lib.memory.Memory` instead
  self.gamma_table = Memory(width=out_width, depth=2**in_width, init=gamma_init)
ERROR: Found error in internal cell \top.cnt.$13 ($memrd_v2) at kernel/rtlil.cc:1579:
  attribute \src "/<censored>/icebreaker-amaranth-examples/icebreaker/pdm_fade_gamma/gamma_pdm.py:122"
  cell $memrd_v2 $13
    parameter \CLK_POLARITY 1
    parameter \CLK_ENABLE 1
    parameter \CE_OVER_SRST 0
    parameter \INIT_VALUE 16'xxxxxxxxxxxxxxxx
    parameter \SRST_VALUE 16'xxxxxxxxxxxxxxxx
    parameter \ARST_VALUE 16'xxxxxxxxxxxxxxxx
    parameter \COLLISION_X_MASK 0'
    parameter \TRANSPARENCY_MASK 0'
    parameter \WIDTH 16
    parameter \ABITS 8
    parameter \MEMID "\\gamma_rd_p"
    connect \CLK \clk
    connect \EN 1'1
    connect \SRST 1'0
    connect \ARST 1'0
    connect \DATA \pdm_level_gamma_n
    connect \ADDR $4 [7:0]
  end
Traceback (most recent call last):
  File "/<censored>/icebreaker-amaranth-examples/icebreaker/pdm_fade_gamma/gamma_pdm.py", line 189, in <module>
    plat.build(Top(gamma=args.g), do_program=True)
  File "/opt/homebrew/lib/python3.11/site-packages/amaranth/build/plat.py", line 103, in build
    products = plan.execute_local(build_dir)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/amaranth/build/run.py", line 118, in execute_local
    subprocess.check_call(["sh", f"{self.script}.sh"],
  File "/opt/homebrew/Cellar/[email protected]/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 1.

In Amaranth 0.4.0 the Pin instance can no longer simply be cast to a
Value, instead you have to specify the input/output direction when
accessing it. This commit makes these changes for the blink and uart
example of the icebreaker. Changes were not made to the other examples
as I can't test them here.
In Amaranth 0.4.0 the Pin instance can no longer simply be cast to a
Value, instead you have to specify the input/output direction when
accessing it. This commit makes these changes for the remaining
examples of the icebreaker. The changes were flashed to the icebreaker
but I'm unable to test them as I don't have the accessories. The
pdm_fade_gamma example unfortunately doesn't build for me at all so I
didn't fix that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant