whitequark changed the topic of #amaranth-lang to: Amaranth hardware definition language ยท weekly meetings on Mondays at 1700 UTC ยท code https://github.com/amaranth-lang ยท logs https://libera.irclog.whitequark.org/amaranth-lang
kivikakk1 has quit [Ping timeout: 268 seconds]
lf has quit [Ping timeout: 248 seconds]
lf has joined #amaranth-lang
jess has quit [Quit: Lost terminal]
jesopo has joined #amaranth-lang
jesopo is now known as jess
bl0x has joined #amaranth-lang
bl0x_ has quit [Ping timeout: 248 seconds]
Degi_ has joined #amaranth-lang
Degi has quit [Ping timeout: 255 seconds]
Degi_ is now known as Degi
<d1b2> <Nate> ok, probably a dumb question, but what am I doing wrong here: >>> from amaranth import * >>> from icebreaker import * >>> p = ICEBreakerPlatform() >>> p.request("pmod", 0) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/nates/.local/lib/python3.10/site-packages/amaranth/build/res.py", line 62, in requ est resource = self.lookup(name, number) File
<d1b2> "/home/nates/.local/lib/python3.10/site-packages/amaranth/build/res.py", line 57, in look up raise ResourceError("Resource {}#{} does not exist" amaranth.build.res.ResourceError: Resource pmod#0 does not exist
<d1b2> <Nate> icebreaker.py: connectors = [ Connector("pmod", 0, " 4 2 47 45 - - 3 48 46 44 - -"), # PMOD1A Connector("pmod", 1, "43 38 34 31 - - 42 36 32 28 - -"), # PMOD1B Connector("pmod", 2, "27 25 21 19 - - 26 23 20 18 - -"), # PMOD2 ]
<d1b2> <Nate> or should I access it with p.connectors[("pmod", 0)] ?
<d1b2> <Nate> I'd be happy to try to reflect whatever I learn here into the language guide
<d1b2> <tnt> I don't think you can request connectors as resources. See https://github.com/no2fpga/no2amaranth/blob/master/examples/amaranth_icebreaker_muacm.py#L84 for declaring a resource connected to a connector.
<whitequark> the build system isn't a part of the language (it's its own thing)
<d1b2> <Nate> Ah, I should have noticed other resources were using Resource(..., Pins(..., conn="pmod", 2))). --Seems https://amaranth-lang.org/docs/amaranth/latest/intro.html#development-board-definitions could benefit from including e.g. the icebreaker board definition / platform file and a short explanation / note like: "Resources defined in plat.resources generally come native with the platform [see line 6 of icebreaker.py]. For example, gpio leading
<d1b2> to a button would be specified as ButtonResource(). However, connectors (and gpio?) can each potentially have multiple different resources (e.g. an external daughter board with a Button or an LED could connect to a particular pin on a pmod). Ergo, it's recommended to define a use case specific list of resources (separate from plat.resources) [see line 35 of icebreaker.py], and subsequently call plat.add_resource(plat.breakoff_pmod)."
<whitequark> yeah, I'll do that once I'm done with the more urgent tasks
<whitequark> such as "finding housing"
<d1b2> <Nate> Would be happy to take any feedback on above blurb for a PR if it's not too far from what you had in mind. Would totally understand if you wanted the docs to be written a certain way though
<whitequark> I think right now the problem is more that I don't have any review bandwidth
<whitequark> I'll probably reschedule the next meeting too since I won't be well enough to conduct it
<d1b2> <Nate> ๐Ÿ˜ฃ
<whitequark> in general -boards has not had enough attention allocated to it and it is in part because of structural issues
<whitequark> i.e. there being absolutely no standards or acceptance criteria for new boards as the result of which they do not scale
<whitequark> i have a plan to tackle this, but, see above
* FireFly wishes best of luck in the apartmenthunting etc
<whitequark> thanks
kivikakk has quit [Ping timeout: 255 seconds]
kivikakk has joined #amaranth-lang
<d1b2> <Olivier Galibert> @whitequark once you've made the appropriate decisions I can take care of upgrading de10-nano/mister and add c5g. In the meantime, do take care of yourself ๐Ÿ™‚
<josuah> I am exploring the source in my journey through Amaranth. Here is what I understood from the "with ...If()" dance:
<josuah> It uses decorator like @_guardedcontextmanager("If") to allow it to work with a try/catch/finally,
<josuah> while in the process overloading the __bool__() so that "if xxx" fails early instead of being accepted but do the wrong thing
<josuah> to avoid common mistakes
<josuah> what the actual wrapper does then, with the "with" keyword: increment the current "depth" field of the signal (to tell "hey, we are in a nested signal, here is the new signal you will need to refer as 'current context' now")
<josuah> then try to hook the logics on that new depth
<josuah> then decrease the depth (while gotten out of the "with" keyword) to resume to the parent context
<josuah> that means it only track the current depth... that would then fail in case amaranth elaboration gets mixed with async?
<josuah> it would be a horrible thing to do though, why would we want concurrency *while elaboration/("compilation") happens*! that does not make sense...
<josuah> just asking to make sure I understood it.
<josuah> I hope it is fine to ask these questions once in a while. Otherwise let me know I'd reduce my chatter...
<whitequark> I'll respond when I'm on a train in a sec
<josuah> [^] nothing important, take your time
<josuah> references:
<whitequark> josuah: "It uses decorator like @_guardedcontextmanager("If") to allow it to work with a try/catch/finally" that doesn't have to do with try/catch/finally; the context manager itself is there solely so that the `with` syntactic form is accepted, and for the `__bool__` override
<whitequark> "increment the current "depth" field of the signal" signals don't have a depth field; the `m.d.<domain>` proxy object does, but this is once again to keep track of some syntactic features (see `_pop_ctrl` for the place where depth is actually used)
<whitequark> "that would then fail in case amaranth elaboration gets mixed with async?" I... honestly can't imagine why you would ever want that; it's not supported
<whitequark> elaborate() can't be an async function anyway, Fragment.get will fail in that case
<josuah> > can't imagine why you would ever want that
<josuah> I really do not want.
<josuah> It was me trying to understand the behavior, observing some kind of global state within the "with" keyword that permitted to keep track of things
<whitequark> right, yeah
<josuah> thank you a lot for taking the time to decipher my questions!
<whitequark> np
<josuah> it feels like Amaranth is fully exposing the working of hardware rather than disguising it into being "some C-like language for hardware"... enjoyable :)
<whitequark> yeah, that's the idea
<Sarayan> yeah, love that about amaranth too, it's verilog/vhdl level, only way nicer
<Sarayan> way way wayyyyyyyyyyyyyyy nicer
crzwdjk has joined #amaranth-lang
<bl0x> Sarayan: there are cases where verilog code looks very clean and equivalent amaranth code is a bit noisy with 'Mux(...), Repl(...)' and 'with m.If()' syntax.
<bl0x> but in general, I agree.
<whitequark> Amaranth syntax isn't particularly clean, in my view
<whitequark> it's clean in the sense that it's relatively free of overloads of normal Python syntax (compared to something like MyHDL, Amaranth is almost plain Python), but it's visually cluttered
<bl0x> I agreed to it being nicer (to use). Syntax is cleaner than VHDL, especially less verbose / repetitive.
<whitequark> it's the semantics where Amaranth is a clear improvement over Verilog
<bl0x> I was about to ask for a while: Signals can be aliased/assigned (?) to a new variable name, e.g.: "a = b & c" In that case one can't inspect the value of 'a' in simulation. Instead, when 'a' is a proper signal and one does: "self.a = Signal() \n m.comb += self.a.eq(b & c)", then 'a' shows up in the simulation. Is there another way to achieve this without having 'a' as a proper signal? And is there a penalty associated with turning 'a' into
<bl0x> a signal?
<whitequark> there is no other way and I don't think there will be
<whitequark> as for a penalty, other than the immediate consequences (introducing a new name in e.g. Verilog, having this signal be captured in VCD files, etc) there isn't
peepsalot has quit [Quit: Connection reset by peep]
<bl0x> good! Synthesis will take care of optimising the wires, I assume. Even if I (for no reason at all) connect 5 Signals with different names in a row.
<d1b2> <Olivier Galibert> @whitequark I wanted to ask, is there a way with cxxrtl to get all the signals? When signals are equivalent (e.g. through assign in verilog) you only get one of the names, pretty much at random
<d1b2> <Olivier Galibert> in debug_items that it
peepsalot has joined #amaranth-lang
<whitequark> you should be getting all of the names
<whitequark> in debug_items
<whitequark> if you're not, file an MCVE against Yosys
crzwdjk has quit [Quit: Client closed]
<d1b2> <Olivier Galibert> MCVE, is that an issue?
<d1b2> <zx64> "minimal, complete and verifiable example"
<d1b2> <Olivier Galibert> it may not be minimal but it's rather small and makes the problem very visible
<whitequark> please include the complete steps to reproduce the problem in the issue, including your Yosys script
<whitequark> it's not complete or verifiable as it is
<whitequark> I guess the new name is "minimal reproducible example", which is a lot better
<d1b2> <Olivier Galibert> ah sorry
<d1b2> <Olivier Galibert> it could indeed be a problem in the script
<d1b2> <Olivier Galibert> I've been cargo-culting it for a while
<d1b2> <Olivier Galibert> added
<whitequark> thanks
<whitequark> it's clean -purge that's doing that
<d1b2> <Olivier Galibert> in fact, should I just remove everything but read, hierarchy and write?
<d1b2> <Olivier Galibert> I guess it dates from way earlier in your development of cxxrtl
<whitequark> it could still be needed in some cases depending on how weird the Verilog is
<whitequark> cxxrtl2 will not have that issue, I think
<whitequark> (cxxrtl2 will be available sometime after the NHS stops being useless)
<d1b2> <Olivier Galibert> ouch, seen from afar the NHS seems to have been deliberatly put in a very bad state
<d1b2> <Olivier Galibert> not sure whether it can recover
<whitequark> well yes, but also private care is not something that will be useful for my condition because of various bureaucratic hurdles
<d1b2> <Olivier Galibert> in any case I hope you can recover from your health problems
<whitequark> you don't recover from fibromyalgia
<d1b2> <Olivier Galibert> ouch indeed not, I'm sorry for you. Hopefully it can be managed
<whitequark> if you're lucky you can get treatment that lets you live in a significantly more impaired state than someone who doesn't have it, but at least you can do things
<whitequark> fortunately, there is treatment that works for me. unfortunately, actually accessing it requires NHS to not be useless
<d1b2> <Olivier Galibert> how nice
<whitequark> as it is usual, doctors stand more in the way of care than as providers of it
<whitequark> it's normal
<whitequark> if you've ever wondered why I occasionally get quite angry at the healthcare system: well, it's things like this. and medical abuse. but let's not talk about that
<d1b2> <Olivier Galibert> well, in that case I suspect it's more the politicians that want to privatize healthcare and start by starving the public healthcare to justify it than the doctors
<d1b2> <Olivier Galibert> it is very clearly deliberate sabotage in the NHS case
<whitequark> I agree, but mainly because NHS staff is striking
<whitequark> I fully support that industrial action and frankly I would be happy if the strikes were more widespread despite it being directly in the way of me getting care
<whitequark> but also, I've had a private consultant attempt to bullshit me, probably because he thinks women's pain doesn't matter, and \_that\_ is what I mean by "doctors stand more in the way of care"
<d1b2> <Olivier Galibert> yeah, what is this fucking problem with doctors, pain and women? I mean, I never got to witness it directly, obviously, but I hear it all the time
<whitequark> I got him to actually do something by telling him "a year ago I broke six ribs, and I was thankful for that respite from chronic pain. if you walked up to me and broke a rib right now, I would accept that as treatment", and by "something" I mean "write a referral letter"
<whitequark> he also basically told me to never come back again lmao
<d1b2> <Olivier Galibert> huhuhu
<whitequark> as for what it is with doctors? well, it's misogyny and huge egos
<whitequark> I've heard of women pretending to be trans men to get pain meds, on multiple occasions. I've actually considered doing it myself
<d1b2> <Olivier Galibert> any port in a storm
<whitequark> it would admittedly be incredibly funny to do that, in a depressing way
<d1b2> <Olivier Galibert> "I'm in tech, of course I'm trans"
<whitequark> the thing is, despite really rather extreme levels of pain, I'm generally fine, like I've known people whose pain drove them to suicidality and I'm not like that. I just can't maintain all the shit that I wrote over the years because the level of pain in and of itself, ignoring any downstream effects, causes cognitive impairment on the same level as being quite drunk
<whitequark> I can ignore the pain, but I can't ignore the cognitive impairment, like how you can't really compensate for having the BAC of 0.15%
<whitequark> I can't write documentation when I stammer through a basic sentence about some everyday event and only manage to put it together in a coherent way the third time
<whitequark> with no specific measures taken, I get something like 15-30 minutes of usable time for work per day? and that includes things like "read incomplete bug reports" and "figuring out why virtualenv broke again or something"
<whitequark> there's various things that can be done, but they generally require things such as "the government not attempting to do a genocide towards you", "the healthcare system prescribing things that work", or at least "having a housemate you can ask for help with basic tasks". this might be a low bar but it is a bar that is difficult to clear in practice
<d1b2> <Olivier Galibert> the first two are not that low, and the last when you just arrived in a new country? Not that low either
<jn> low bars in a "not surprised but disappointed" way
<whitequark> yes
<d1b2> <VA3TEC-Mikek-14362> Sorry for chiming in here, But I am just curious, would Mary J help? see for example in Canada it's now legal and can get doctor's notes for it. But not sure for the Cognitive part! ๐Ÿ˜ (hahah joke) But seriously some people swear by it. I personally don't do it. My Employer would not approve.. ๐Ÿ˜
<whitequark> taking THC would exchange one problem for another that isn't particularly better, from past experience
<whitequark> I've never tried CBD (ironically I've been in places where you can easily get THC but not CBD) but it's on my list of things to try
<whitequark> the most promising option that I haven't yet tried is LDN (low dose naltrexone), there's an actual proposed mechanism and some people report very good results. it's a bit counterintuitive since you'd expect naltrexone to make pain worse and not better, but the theory is that it affects inflammatory processes
<whitequark> that still needs to go through NHS sadly
<d1b2> <j4cbo> the way the medical system handles pain is an absolute mess everywhere, as far as I can tell
<d1b2> <VA3TEC-Mikek-14362> Sorry What is NHS? I am assuming National Health System, for the USA? Again, assuming this.
<whitequark> for the UK
<d1b2> <VA3TEC-Mikek-14362> ah ok... So does the UK have a universal health care plan, provider similar to Canada? I completely understand your frustration! We are having similar problems with our daughter. She has a brain tumor. it's been treated, but we just had a major relapse, she recovered from that, now are are just waiting on more tests for the Big one! They want to do a complete tumor removal, We as best that they can. Your not alone... ๐Ÿฅฐ
<d1b2> <Olivier Galibert> @VA3TEC-Mikek-14362 the NHS has the problem that the people love it but the government for the last BIGNUM years would like to turn it into something private akin to the US system because it makes more money to the Right People[tm]. So since the first step to destroy a public system is to starve it of resources so that it doesn't work anymore. So they've been doing that for a very long while.
lambda has quit [Quit: WeeChat 3.8]
lambda has joined #amaranth-lang
<d1b2> <VA3TEC-Mikek-14362> Yup totally agree, but very very recently Justine (Our PM) just made a deal with the provinces (Who takes care of the health care system) a new funding deal, But I see the points on either side, there can be HUGE efficiencies applied to our HC system. But I do agree, going to the private model would skew the system toward the people with money.
<whitequark> i wish it would be skewed towards people with money, because then i could actually get care
<whitequark> as far as i can tell it's just fucked now.
<d1b2> <VA3TEC-Mikek-14362> you can go the US and get care... That what a lot of the politicians do here! ๐Ÿ™‚ Jump the wait times. I even heard of People going to Mexico for surgeries with Doctors from the US! The doctor gets a 1 week paid trip to the resort, the client has the operation and EVERYONE is happy! Apparently so for the facilities in the South rival the ones in the Canada and US. ๐Ÿ˜บ
<d1b2> <j4cbo> last year I broke my leg and spent 5 days in the hospital (in the US). Iโ€™m glad I had good insurance because the total bill was $110,000
<d1b2> <VA3TEC-Mikek-14362> Yep! I just imagine my daughter 16 Hour Brain surgery would have Cost! 1 Million!?!?!? OH on that note! Apparently they have taken samples of her tissue and did a complete MRNA makeup of her tumor! have a complete genetic drug solution for her. At 20K a MONTH!!! Yup, nope! I like to eat!
<d1b2> <VA3TEC-Mikek-14362> But it's amazing the technology now! Might need that in the future!
<whitequark> US prescriptions aren't valid in the UK
<whitequark> I do wish people were less flippant about something that is a serious issue for me
<d1b2> <VA3TEC-Mikek-14362> I didn't mean it in any way, I was trying to offer possible solutions to the problem. And to offer my condolences as I can relate and to comfort you in saying that you are not alone. I am very sorry If I have offended you in ANY way...
<d1b2> <VA3TEC-Mikek-14362> Please accept my apologies...
<whitequark> accepted
<whitequark> I'm considering all available options but this one is one of the most impractical ones...
<d1b2> <Olivier Galibert> hat, you mean being filthy rich is not a practical option? You really make no effort
<d1b2> <Olivier Galibert> +W
<josuah> I wish you can get the best of what can be done with these sort of sorrow
pbsds3 has joined #amaranth-lang
pbsds has quit [Ping timeout: 252 seconds]
pbsds3 is now known as pbsds
<whitequark> thank you
<d1b2> <VA3TEC-Mikek-14362> Likewise, I only wish the best for you and hope that you are able to find the solution moving forward.
<josuah> somehow, that did not prevent you to write an actual HDL front-end language that kicks arses! :]
<josuah> I am still on my way through groking it.
<josuah> On today's episode, that nice ressources and pinout declaration I'm discovering now.
<josuah> I was stuck at getting anything pushed in/out of PMODs, but thanks to debug_verilog=True (I should get used to peek at top.il instead... the verilog export acts as a Rosetta stone for me)
<josuah> I could notice this: assign pmod_gpio_0__oe = 1'h0;
<josuah> my problem was just that I did not think about setting _oe to 1
* josuah goes on further
crzwdjk has joined #amaranth-lang
<_whitenotifier-9> [amaranth-boards] josuah commented on pull request #204: Test module that configure a given pin of a connector as output, and makes it blink -plug a LED on it- - https://github.com/amaranth-lang/amaranth-boards/pull/204#issuecomment-1464632578
<_whitenotifier-9> [amaranth-boards] josuah commented on pull request #204: Test module that configure a given pin of a connector as output, and makes it blink -plug a LED on it- - https://github.com/amaranth-lang/amaranth-boards/pull/204#issuecomment-1464635492
<_whitenotifier-9> [amaranth-boards] josuah opened issue #219: How to handle dual-row PMODs? - https://github.com/amaranth-lang/amaranth-boards/issues/219