ChanServ changed the topic of #nmigen to: nMigen hardware description language · code at https://github.com/nmigen · logs at https://freenode.irclog.whitequark.org/nmigen · IRC meetings each Monday at 1800 UTC · next meeting TBD
lf_ has quit [Ping timeout: 260 seconds]
lf has joined #nmigen
proteusguy has quit [Ping timeout: 264 seconds]
proteusguy has joined #nmigen
<_whitenotifier> [YoWASP/yosys] whitequark pushed 1 commit to develop [+0/-0/±1] https://git.io/Jtfy5
<_whitenotifier> [YoWASP/yosys] whitequark 918dbe1 - Update dependencies.
modwizcode has quit [Quit: Later]
futarisIRCcloud has joined #nmigen
electronic_eel_ has joined #nmigen
electronic_eel has quit [Ping timeout: 264 seconds]
PyroPeter_ has joined #nmigen
Degi_ has joined #nmigen
Degi has quit [Ping timeout: 256 seconds]
Degi_ is now known as Degi
PyroPeter has quit [Ping timeout: 265 seconds]
PyroPeter_ is now known as PyroPeter
Bertl_oO is now known as Bertl_zZ
electronic_eel_ has quit [Remote host closed the connection]
electronic_eel has joined #nmigen
futarisIRCcloud has quit [Quit: Connection closed for inactivity]
<_whitenotifier> [nmigen] hansfbaier opened pull request #576: #572: add option to suppress generated verilog attributes - https://git.io/JtfbF
electronic_eel_ has joined #nmigen
electronic_eel has quit [Ping timeout: 272 seconds]
<_whitenotifier> [nmigen] codecov[bot] commented on pull request #576: #572: add option to suppress generated verilog attributes - https://git.io/JtfbA
<_whitenotifier> [nmigen] codecov[bot] edited a comment on pull request #576: #572: add option to suppress generated verilog attributes - https://git.io/JtfbA
<_whitenotifier> [nmigen] codecov[bot] edited a comment on pull request #576: #572: add option to suppress generated verilog attributes - https://git.io/JtfbA
emeb_mac has quit [Quit: Leaving.]
electronic_eel_ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
electronic_eel has joined #nmigen
<d1b2> <OmniTechnoMancer> is yowasp-yosys expected to be able to successfully read verilog/rtlil files?
<d1b2> <OmniTechnoMancer> I seem to receive no error but it doesn't actually read anything in
<d1b2> <OmniTechnoMancer> it appears to read an empty file :/
chipmuenk has joined #nmigen
<whitequark[m]> yes it is expected
<d1b2> <OmniTechnoMancer> well the expectation seems unsatisfied in my case :/
<whitequark> then you should file a bug
phiren has quit [Quit: ZNC - http://znc.in]
phire has joined #nmigen
<Sarayan> Hey whitequark, welcome back :-)
<whitequark> agg: if you could update that comment it would be nice
<agg> wilco
<agg> shall I just delete it, or would you rather it specifically say they're packed now?
<_whitenotifier> [nmigen] adamgreig opened pull request #577: Remove outdated comment in ECP5 platform - https://git.io/JtJYM
<_whitenotifier> [nmigen] codecov[bot] commented on pull request #577: Remove outdated comment in ECP5 platform - https://git.io/JtJYp
<_whitenotifier> [nmigen] codecov[bot] edited a comment on pull request #577: Remove outdated comment in ECP5 platform - https://git.io/JtJYp
<_whitenotifier> [nmigen] codecov[bot] edited a comment on pull request #577: Remove outdated comment in ECP5 platform - https://git.io/JtJYp
<_whitenotifier> [nmigen] whitequark closed pull request #577: Remove outdated comment in ECP5 platform - https://git.io/JtJYM
<_whitenotifier> [nmigen/nmigen] whitequark pushed 1 commit to master [+0/-0/±1] https://git.io/JtJOv
<_whitenotifier> [nmigen/nmigen] adamgreig 3a4b61c - vendor.lattice_ecp5: remove outdated comment in ECP5 platform.
<_whitenotifier> [nmigen] whitequark commented on pull request #577: Remove outdated comment in ECP5 platform - https://git.io/JtJOf
<_whitenotifier> [nmigen/nmigen] github-actions[bot] pushed 1 commit to gh-pages [+0/-0/±13] https://git.io/JtJOG
<_whitenotifier> [nmigen/nmigen] whitequark b2d52aa - Deploying to gh-pages from @ 3a4b61c16e3dbafbfdeb02485bb59d431298cd21 🚀
Bertl_zZ is now known as Bertl
jeanthom has joined #nmigen
<Sarayan> whitequark: what's the current recommended syntax in C++ to set data lines and toggle clk in cxxrtl?
<_whitenotifier> [nmigen] adamgreig opened pull request #578: ECP5: Replicate OE FF for each output bit - https://git.io/JtJci
<agg> definitely in the weeds today, this always seems to happen when i worry too much about ecp5 i/o
<agg> can't wait to get to the ecp5 dsp soon :p
<_whitenotifier> [nmigen] codecov[bot] commented on pull request #578: ECP5: Replicate OE FF for each output bit - https://git.io/JtJc7
<_whitenotifier> [nmigen] codecov[bot] edited a comment on pull request #578: ECP5: Replicate OE FF for each output bit - https://git.io/JtJc7
<_whitenotifier> [nmigen] codecov[bot] edited a comment on pull request #578: ECP5: Replicate OE FF for each output bit - https://git.io/JtJc7
<_whitenotifier> [nmigen] codecov[bot] edited a comment on pull request #578: ECP5: Replicate OE FF for each output bit - https://git.io/JtJc7
chipmuenk1 has joined #nmigen
chipmuenk has quit [Ping timeout: 244 seconds]
chipmuenk1 has quit [Ping timeout: 260 seconds]
jeanthom has quit [Ping timeout: 272 seconds]
<whitequark> Sarayan: .get<T>(), .set<T>(val)
<Sarayan> on the debug_item?
<Sarayan> nope, not on th debug item
<Sarayan> on p_x: then I guess
<Sarayan> ok, it compiles, still not working, but no worse than before
<Sarayan> I have one pos-edge clock. How should I handle it and step() w.r.t all other signals (including the two phase ones) ?
<Sarayan> oh "nice", the cxxrtl source is completely wrong
<Sarayan> time to try to understand where the fuckup is then
jeanthom has joined #nmigen
<Sarayan> oh, write_cxxrtl is asserting now, funky
emeb has joined #nmigen
modwizcode has joined #nmigen
<modwizcode> Sarayan: You have to drive/read signals in C++ land before the posedge even happens. Otherwise you get race conditions.
<Sarayan> right now I do "setup signals including phi, step, clk=1, step, phi=0 && slk=0, step"
<modwizcode> uhh
<modwizcode> That seems
<modwizcode> Weird can you post some code?
<Sarayan> I'm writing an issue for the assert, it may be pointing to the actual problem
<Sarayan> the c++ code is broken in the first place, there's been a lot of assigns droppped on the floor
<Sarayan> I must have done a clean I shouldn't have
<modwizcode> Like clean in yosys?
<Sarayan> yeah
<modwizcode> Yeah so wq mentioned to me at some point that clean is somehow broken, but I didn't dig into it, been crazy busy.
<Sarayan> Now I'm not doing anything... and it asserts :-)
<Sarayan> Yeah, this start of year is kinda insane at times
<modwizcode> Let me pull up some code real quick
<Sarayan> and it's only the second week
<modwizcode> I've just been trying to cram all my job stuff in right before classes truly start and I've not had much energy/time for much else.
<modwizcode> Sarayan: I need a micromem.rom?
<modwizcode> looks like I can stub it out
<Sarayan> Sorry, added
<modwizcode> thanks
<Sarayan> idn't realize it was still using it after the sv2v, but it's logical
peeps[zen] has joined #nmigen
peepsalot has quit [Ping timeout: 240 seconds]
Bertl is now known as Bertl_oO
bvernoux has joined #nmigen
<modwizcode> Solved it lol.
<Sarayan> oh? cool
<modwizcode> Sarayan: use -g3 with write_cxxrtl until it's fixed.
<modwizcode> I submitted a PR tho
<Sarayan> really? fun
<modwizcode> It'll not have debug info for all public wires tho
<Sarayan> I'll apply the patch instead :-)
<modwizcode> fair enough :)
<Sarayan> I mean, it's not really a massive one :-)
<Sarayan> damn, the output is still... problematic
<Sarayan> maybe you'll have an idea. Look for eCntr (it's a 4-bit lfsr counter that is used to generate a /10 clock)
<Sarayan> the conversion result in m68k.v seems reasonable
<Sarayan> but the .cc only has one line that reads it and nothing that writes to it
<Sarayan> same for p_E, the resulting divided clock, read once, nothing writes it
<Sarayan> am I misreading the verilog and they're broken, or did the optimization just broke it?
<modwizcode> Hmm
<modwizcode> I'll look a bit further. I didn't check that the optimization pass was fully without errors, I tracked down the reason this was happening to that. Let me try and figure out what's going on.
<Sarayan> I'm trying different O levels now to check
<modwizcode> If you run with g0 (no debug anything) the wire is still generated but it's never assigned
<Sarayan> I'm trying -O0, clang++ is still compiling
<Sarayan> ...and E is not workin
<Sarayan> working
<modwizcode> E?
<modwizcode> oh
<Sarayan> og.kervella.org/main.cc for the main code
<Sarayan> how course my main.cc may be bad too, there's no reason to have only one bug :-)
<modwizcode> Even at O0 that eCntr isn't updated ever in the cxxrtl output
<Sarayan> yeah
<modwizcode> Uh
<modwizcode> Hmm
<modwizcode> It might have something to do with how it's being assigned
<modwizcode> I've never worked with verilog that uses posedge on a vector of clocks that's... unique to me
<modwizcode> I'm going to look at the rtlil to see what yosys made of it after proc pass
<modwizcode> The rtlil looks good
<modwizcode> I think you should post another issue on yosys for this
<Sarayan> You think? Ok then
<modwizcode> I think I might see the issue
<modwizcode> but I'm not sure I thought cxxrtl acts conservatively and handles this anyway
<modwizcode> but it might not be handling the fact that the clocks are slices
<modwizcode> it definitely is supposed to handle that, but it might not be handling that correctly
<modwizcode> It works if I assign it to a wire first and use the wire in the @posedge instead
<Sarayan> Issue #2542. Wife is hungry, need to take care of that
<modwizcode> hah
<Sarayan> pasta is cooking :-)
<Sarayan> thanks for tracking these bugs btw
<Sarayan> in the original sv code it's a 5-logic struct
<Sarayan> // Clocks, phases and resets
<Sarayan> logic clk;
<Sarayan> logic pwrUp; // Asserted together with reset on emulated system coldstart
<Sarayan> typedef struct {
<Sarayan> logic extReset; // External sync reset on emulated system
<Sarayan> logic enPhi1, enPhi2; // Clock enables. Next cycle is PHI1 or PHI2
<Sarayan> } s_clks;
<modwizcode> Ah that... almost kind of makes sense
<modwizcode> I've never written system verilog before. I still don't know how I feel about clocks being in a struct.
<modwizcode> Especially considering how the enables aren't actually clocks. Converting it to an array/vector makes sense in light of that form though.
<Sarayan> yeah
<Sarayan> it's becoming a stylistic issue, not pure insanity :-)
<modwizcode> I have to use const_cast to make it so I can log things during debugging because some stuff isn't const safe (most of that should probably be fixed but it's deep enough in yosys that it's like it's own issue)
<d1b2> <DX-MON> that definitely should be fixed as use of const_cast to erase const-ness is UB and so always a bug
<d1b2> <DX-MON> (the cast exists to make such code smelly for an easier review)
emeb_mac has joined #nmigen
<modwizcode> The const cast is for me to debug without solving the issue, it needs to be fixed for real at some point.
<d1b2> <DX-MON> aye - hence only a mention in agreement that it should indeed be an issue raised to be fixed later 🙂
<modwizcode> yep.
<modwizcode> I always forget what const_cast is actually for lol
<d1b2> <DX-MON> its only purpose in life is as a code smell for casting away const
<d1b2> <DX-MON> there is no way to cast away const that is defined by the standard - it is always UB
<modwizcode> I think I remember
<modwizcode> hmm actually nevermind
<modwizcode> I thought it was safe as long as the object wasn't like originally defined const. But like that doesn't sound safe at all so I doubt that's right.
<d1b2> <DX-MON> the standard only takes into consideration object-constness in the scope the cast is being performed
<d1b2> <DX-MON> and for it to be necessary, it has to be to cast const away which is UB
<modwizcode> Leave it to c++ to define something that's only use is UB
<modwizcode> I see where this issue is happening now, I don't know enough about yosys to understand if this is actually an issue with the definition of "is_wire" on sigspec. it only returns true if there's only 1 chunk and that chunk has the same size as the wire it's connected to. Which means that a smaller portion of a signal (like a sigspec that's a single bit of the wire) will not.
<d1b2> <DX-MON> ahahahaha, yeah.. technically more than one something as most uses of reinterpret_cast<>() are also UB
<modwizcode> Yeah I wish they had just defined that one to do the right thing (or added a seperate cast as I've seen elsewhere)
<modwizcode> The only "safe" way to express easily that you want to do a non-byte read of a byte area is to use memcpy into like an int and assume it's optimized, and even that is questionably defined by the spec I think.
<modwizcode> but it's such a common thing and useful ability that it should be defined somehow.
<d1b2> <DX-MON> that is the correct way to do it, and it is defined by the spec (they're working on solidifying that actually.. which is why std::byte was introduced)
<d1b2> <DX-MON> and also, on all reasonably modern (within the last decade..) compilers, memcpy() is an intrinsic first before the CRT call so it is agressively optimised out
<modwizcode> I thought if you read the spec it's kinda wishy washy about if that's safe or just unspecified rather than undefined. But it's been awhile since I wasted a day trying to nail that down.
<d1b2> <DX-MON> *aggressively
<d1b2> <DX-MON> I'm going on my own reading of the spec combined with the advise and wisdom from committee members who presented on this exact topic at CppCon 🙂
<modwizcode> Oh for sure. I personally just feel like it's pretty unclear compared to a defined way like a specific cast. Iirc the proposed standard would add a specific cast for this I think?
<d1b2> <DX-MON> yeah, there is a byte cast (byte_cast<>() even I think) being proposed
<d1b2> <DX-MON> hopefully for inclusion in C++23
<modwizcode> Nice
<d1b2> <DX-MON> because the question had come up of "how does one define memcpy() in pure C++ then?".. and they realised the standard doesn't exactly give a way to do it..
<d1b2> <DX-MON> hence std::byte and now also the cast
<modwizcode> I wonder if rust has a defined way to do that kind of thing too, it seems somewhat unrust-like to alias data in any way but it's a necessary thing. Maybe they just rely on llvm to be really good about recognizing the operations that encode it?
<d1b2> <DX-MON> which well.. broke the idea that "C++ can and should be self-contained without any external dependencies to make it functional".. when clearly "use memcpy()! (but you can't write it in C++)" violates that by forcing an unwanted dep on C
<modwizcode> Yeah
<modwizcode> But like I don't think it's defined in C either lol
<modwizcode> but I think C has less rules anyway so it matters less
<d1b2> <DX-MON> uh.. it wierdly is actually thanks to the same reason you can have a union of int and float and assign to the float then access the int
<d1b2> <DX-MON> it's nasty and C++ closed that loophole with the strict aliasing rules along with only reads from the active member of the union being defined
<modwizcode> That's defined for C?
<modwizcode> I didn't realize that.
<d1b2> <DX-MON> yeah, that's defined for C
bvernoux has quit [Quit: Leaving]
<modwizcode> Getting access to the C spec is more annoying. Technically both specs are annoying but the C++ spec is basically viewable via cppreference.com
<d1b2> <DX-MON> you can get the final drafts for both sets of specs.. which are the same thing as the ISO document, but without the ISO copyright
<d1b2> <DX-MON> but yeah.. agreed that it's unpleasant
<modwizcode> One day maybe C and C++ will both define enough of the details that you can actually use the spec to design an OS without relying on compiler specifics.
<d1b2> <DX-MON> https://eel.is/c++draft/ is also a complete reference of the C++ standard in its current draft form
<modwizcode> Also parsing through the standard itself is a pain, I'm glad that website exists bc otherwise figuring out specifics is like an hour long affair
<d1b2> <DX-MON> yeah, that's very fair
<d1b2> <DX-MON> https://github.com/cplusplus/draft is the official repo the committee uses for the standard too fwiw
<d1b2> <DX-MON> agreed that cppreference is one of the best resources for this stuff out there.. the write-up on reinterpret_cast<>() for example is phenomenal for understanding the subtitles of the cast and why most of the time it's UB except in some very particular cases when it's not
<modwizcode> Yeah it's very detailed
<modwizcode> although sometimes now I feel like it's too detailed to the point of obscuring the useful information.
<d1b2> <DX-MON> yeah, that's fair
<modwizcode> Oh there's some weird const casting happening in yosys already
<modwizcode> uh wtf
<modwizcode> oh well not my problem
<modwizcode> I've never seen someone take a const class method and then cast this to a non-const pointer.
<d1b2> <DX-MON> for the more advanced topics it's definitely "awesome writeup, but.. uh.. could I please have a summary version of the key points for those less able to handle standardese, or in a hurry please?"
<d1b2> <DX-MON> that sounds like the pointer should be const return_t (*)(params_t...), while I bet it was written as return_t (*)(params_t...)
<d1b2> <DX-MON> well.. I've been wanting to contrib more to the FOSS FPGA tool community for a while so it sounds like the kind of improvement/patchset which I excel at and might and up taking on as a "my first yosys contrib"
<d1b2> <DX-MON> (that's not to say nobody else touch it.. far from that.. just that if nobody else does, I might well turn my eye to it)
chipmuenk has joined #nmigen
chipmuenk has quit [Client Quit]
lambda has quit [Ping timeout: 260 seconds]
ianloic_ has quit [Ping timeout: 260 seconds]
GenTooMan has quit [Ping timeout: 260 seconds]
ianloic_ has joined #nmigen
lambda has joined #nmigen
GenTooMan has joined #nmigen
<d1b2> <DX-MON> that strongly suggests the empty() function on w/e type bits_ is.. is incorrectly non-const
<d1b2> <DX-MON> that'd be the only reason you'd want to do that
<modwizcode> There's other lines like that
<d1b2> <DX-MON> "love" that C-style cast though which.. may.. but also may not.. it depends (IB) translate into const_cast<>()'ing
<daveshah> this looks a bit dodgy too
<modwizcode> But like the issue seems to be that sometimes you can have values that are "packed" and before you can read data you have to unpack them. But the read methods are const safe. The whole thing seems like a mess because I'm positive that C style cast is equivilent to the const_cast which is UB
<d1b2> <DX-MON> it will most probably be being compiled as a const_cast<>() but C style casts are strongly discouraged in C++ specifically because there are no guarantees of that
<d1b2> <DX-MON> and yeah.. unpacking etc seems like something that should be completely doable in a const-marked function so.. some annotation needs doing to allow that code to be clenaed
jeanthom has quit [Ping timeout: 256 seconds]
<modwizcode> Sarayan: Should be fixed now :)
emeb has quit [Quit: Leaving.]