_catircservices has quit [Quit: Bridge terminating on SIGTERM]
jfng[m] has quit [Quit: Bridge terminating on SIGTERM]
galibert[m] has quit [Quit: Bridge terminating on SIGTERM]
whitequark[cis] has quit [Quit: Bridge terminating on SIGTERM]
_catircservices has joined #amaranth-lang
smkz has joined #amaranth-lang
<cr1901>
Is there an algorithm for the following problem: "Given a multiply by a rational number, spit out a minimal sequence of L/R shifts and adds to multiply by the numerator and divide by the denominator"?
<cr1901>
I guess I could derive the naive algorithm by doing some in my head- e.g. "n" times 9/5 is "shift n left by 3, add n, shift right by 2, sub n"
whitequark[cis] has joined #amaranth-lang
<whitequark[cis]>
what's this for?
<cr1901>
Convert Celsius to Fahrenheit from a temp sensor (1.8*t + 32). I think I have code for that somewhere already.
<whitequark[cis]>
do it in fixed point?
<cr1901>
Hmmm lemme try that
peeps[zen] has quit [Read error: Connection reset by peer]
<cr1901>
I feel like this is a lot, but I did have to extend the precision to get close to 1.8 (not exactly representable in base 2)
<whitequark[cis]>
that is really not a lot imo
<whitequark[cis]>
for 1-cycle
<cr1901>
Well, at least I have decimal places after the ones now :P. And yea I was just curious about 1-cycle LUT usage. God help me if I start seriously playing with fixed point types in Amaranth.
notgull has quit [Ping timeout: 248 seconds]
notgull has joined #amaranth-lang
<cr1901>
Updated to final version. With an intermediate precision of Q8.3 input, Q9.18 intermedia (27 bits), and Q10.3 output. 23 SB_CARRY and SB_LUT4 170.
<cr1901>
But the model is adjustable, so I can get a feel for how fixed-point precision affects resource usage
<cr1901>
s/intermediate// (first one)
Bluefoxicy_ has joined #amaranth-lang
Bluefoxicy has quit [Ping timeout: 245 seconds]
Bluefoxicy_ is now known as Bluefoxicy
mithro has quit [Server closed connection]
mithro has joined #amaranth-lang
galibert[m] has joined #amaranth-lang
<galibert[m]>
how do you count the usage?
mindw0rk has quit [Ping timeout: 255 seconds]
mindw0rk has joined #amaranth-lang
feldim2425 has quit [Ping timeout: 246 seconds]
feldim2425 has joined #amaranth-lang
sporniket has joined #amaranth-lang
<sporniket>
Hello, I defined a clock domain with e.g. myDomain = ClockDomain("foo", local=True) and setup the clk signal, and then I use it. Then amaranth complains, saying "amaranth.hdl.cd.DomainError: Domain 'foo' is used but not defined". Actual code :
<galibert[m]>
or, in fact, what do I need to try to run your code?
<galibert[m]>
(I don't see anything obvious so I'd like to try)
<sporniket>
oh there is a "redeploy" script that will try to build and program the ECP5 (that is what I am doing with my colorlight board plugged on my computer). The "amaranth-stuff" is there if you want to see the code of those other modules like sequencer, dvitmdsencoder, etc https://github.com/sporniket/amaranth-stuff/tree/main/src/amaranth_stuff/modules
<sporniket>
(the redeploy script just launch the redeployer.py in the project)
<galibert[m]>
getting fun errors like "no module named black"
<galibert[m]>
missing a bunch of dependencies anyway, like Colorlight_I9_V7_2_Platform
<galibert[m]>
anyway, can I have the exact error message?
<galibert[m]>
(fixing some stuff in the deps, but whatever)
<sporniket>
this what I get at the end of running "redeploy" :
<sporniket>
========================[ START OF Deployment ]============================
<sporniket>
Traceback (most recent call last):
<sporniket>
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
<sporniket>
(real life is calling, I have to go out, if you have other questions I will answer them as soon as I am back)
<sporniket>
charlottia ok, got it
<sporniket>
galibert[m] I believe that to run the code, only those 2 lines (the first is to self install) http://paste.debian.net/1292480/
<galibert[m]>
yeah, I'm missing some stuff like nextpnr-ecp5
<galibert[m]>
Hmm, I've done impolite things to the code to try to make it compile without a platform, but then I'm getting no errors
<galibert[m]>
guess I need to fake ecp5 instead
<charlottia>
do you need nextpnr-ecp5 to get to that point? It's still elaborating; it hasn't gotten to calling the toolchain yet.
<galibert[m]>
I don't actually need it, I just had to remove it from required_tools()
<charlottia>
ahhh, nice.
<galibert[m]>
Yes, got the error now
<galibert[m]>
amaranth.hdl.cd.DomainError: Domain 'pixel' is used but not defined
<galibert[m]>
I bet it has just been missed in one place but a better error message is hell to generate without the new ir
<galibert[m]>
or maybe it's an order issue
cr1901 has quit [Remote host closed the connection]
cr1901 has joined #amaranth-lang
<charlottia>
galibert: if it's convenient for you, try adding e.g. `print(self)` around line 332 of your `amaranth/hdl/ir.py` temporarily.
<charlottia>
Then you'll see which Fragment didn't have the domain defined on it.
<galibert[m]>
oh good idea
<galibert[m]>
<amaranth.hdl.ir.Fragment object at 0x7f8b22bcc810>
<galibert[m]>
friggin' python
<charlottia>
Hah :3
<charlottia>
You could try printing self.__dict__. It'll be noisy!
<charlottia>
Going by that traceback, though, it looks like the toplevel Elaboratable maybe?
<charlottia>
Hey, um, where's the m.domains += ...?
<charlottia>
I think that'll be it :3
<galibert[m]>
DUH
<galibert[m]>
of course
<galibert[m]>
I had forgotten about that
<galibert[m]>
sporniket: what she says, you need a m.domains += [the domains you created]
<galibert[m]>
* sporniket: what she says, you need a `m.domains += \[the domains you created\]`
<galibert[m]>
* need a `m.domains +=, * you created]`
<sporniket>
I'm back, on it now
<sporniket>
ok no more errors :)
<charlottia>
Yay!
<sporniket>
thanks
<charlottia>
Thanks galibert!
<sporniket>
when I will get something on screen, I'll will tell you (now I have nothing, so I will have to check various things), see you later :)
<galibert[m]>
Have fun
sporniket has quit [Quit: Client closed]
<cr1901>
galibert[m]: To count usage, I do (requires an amaranth PR not merged yet): python fixed.py > fixed.v; yosys -p 'synth_ice40' fixed.v. I have python code to invoke yosys and run a script, but wish to rework it