whitequark[cis] changed the topic of #amaranth-lang to: Amaranth hardware definition language · weekly meetings: Amaranth each Mon 1700 UTC, Amaranth SoC each Fri 1700 UTC · play https://amaranth-lang.org/play/ · code https://github.com/amaranth-lang · logs https://libera.irclog.whitequark.org/amaranth-lang · Matrix #amaranth-lang:matrix.org
helle has quit [Read error: Connection reset by peer]
Degi has quit [Ping timeout: 245 seconds]
Degi has joined #amaranth-lang
<cr1901> I added a pipelined BCD converter... latency 4, throughput 1. With hard IP or PipelinedMul, this is a building block for a decimal multiplier on FPGA with throughput of 1: https://github.com/cr1901/smolarith/blob/next/src/smolarith/base10.py#L394-L464
<cr1901> Unfortunately, I have a few problems generalizing it beyond 6 digits (the paper I took it from goes up to 10 digits/34 bits), and don't feel like tackling those right now. So I think I'll take a break.
<cr1901> Ya know how like some software libraries will _automatically_ switch between different "strategies" to implement an algorithm depending on the size of the input? Is there precedence for this in Amaranth? Is it even a good idea without giving the user an option to override (which I'm not sure what such an option should look like)?
<whitequark[cis]> lib.io basically does that
<whitequark[cis]> but I don't understand why this is needed for this particular problem
<cr1901> Naive BCD conversion is N^2 LUT usage (purely combinational), and a pipelined alternate algorithm starts giving better LUT usage (approaches 50% fewer resources) after about 15 bits.
<whitequark[cis]> is the area or the delay the limiting factor?
<cr1901> It's delay; for a 10-bit delay, e.g. the 3rd bcd digit depends on 8 shift-add-3 units in series
<cr1901> I ran nextpnr-ice40 without pcfs for the purely combinational BCD converters: 10 bits- 20ns, 20 bits- 46.0ns, 30 bits- 75.5ns, 40 bits- 107.5ns, 4 bits (smallest)- 4.2ns
<cr1901> (No out-of-context mode for ice40 AFAIK, this is the best I can do)
<whitequark[cis]> put registers before/after
<cr1901> 4: 305.90 MHz 10: 55.20 MHz 20: 24.70 MHz 30: 14.30 MHz
<cr1901> Should I even try 40?
<cr1901> Actually, even 10 is really bad, compared to the paper, so guess I should fix that first
<cr1901> (Paper got 200MHz on some old Virtex for 20 digits, with suitably pipelined classic shift-add-3 BCD converter)
<cr1901> And 40: FAIL at 12.00 MHz (10.62 MHz)
notgull has joined #amaranth-lang
notgull has quit [Ping timeout: 245 seconds]
notgull has joined #amaranth-lang
notgull has quit [Ping timeout: 240 seconds]
mindw0rk has quit [Read error: Connection reset by peer]
mindw0rk has joined #amaranth-lang
mindw0rk_ has joined #amaranth-lang
mindw0rk has quit [Read error: Connection reset by peer]
mindw0rk_ is now known as mindw0rk
Stary has quit [Quit: ZNC - http://znc.in]
Stary has joined #amaranth-lang
jfng[m] has quit [Quit: Idle timeout reached: 172800s]
ktemkin has quit [Quit: Connection closed for inactivity]
Raito_Bezarius has quit [Read error: Connection reset by peer]
Raito_Bezarius has joined #amaranth-lang
Raito_Bezarius has quit [Max SendQ exceeded]
Raito_Bezarius has joined #amaranth-lang
GenTooMan has quit [Quit: Leaving]
cybernaut has joined #amaranth-lang
cybernaut has quit [Read error: Connection reset by peer]
notgull has joined #amaranth-lang
notgull has quit [Ping timeout: 268 seconds]
polysci_00232[m] has quit [Quit: Idle timeout reached: 172800s]
notgull has joined #amaranth-lang
notgull has quit [Ping timeout: 245 seconds]
GenTooMan has joined #amaranth-lang
dyniec has quit [Quit: WeeChat 3.8]
dyniec has joined #amaranth-lang
lf has quit [Ping timeout: 256 seconds]
lf_ has joined #amaranth-lang