I tried to run the sample code found in the getting start part of the documentation.
from amaranth import *
from amaranth.back import verilog
class UpCounter(Elaboratable):
"""
A 16-bit up counter with a fixed limit.
Parameters
----------
limit : int
The value at which the counter overflows.
Attributes
----------
en : Signal, in
The counter is incremented if ``en`` is asserted, and retains
its value otherwise.
ovf : Signal, out
``ovf`` is asserted when the counter reaches its limit.
"""
def __init__(self, limit):
self.limit = limit
# Ports
self.en = Signal()
self.ovf = Signal()
# State
self.count = Signal(16)
def elaborate(self, platform):
m = Module()
m.d.comb += self.ovf.eq(self.count == self.limit)
with m.If(self.en):
with m.If(self.ovf):
m.d.sync += self.count.eq(0)
with m.Else():
m.d.sync += self.count.eq(self.count + 1)
return m
top = UpCounter(25)
with open("up_counter.v", "w") as f:
f.write(verilog.convert(top, ports=[top.en, top.ovf]))
As you can see, the ports in the generated verilog have garbage name:
I tried to run the sample code found in the getting start part of the documentation.
As you can see, the ports in the generated verilog have garbage name:
Based on what I see in the documentation, I expected the ports to have real names:
I have installed amaranth with pip:
pip install -U amaranth[builtin-yosys]
.