ChanServ changed the topic of #yosys to: Yosys Open SYnthesis Suite: https://github.com/YosysHQ/yosys/ | Channel logs: https://libera.irclog.whitequark.org/yosys/
tpb has quit [Remote host closed the connection]
tpb has joined #yosys
emeb_mac has quit [Ping timeout: 272 seconds]
emeb_mac has joined #yosys
emeb_mac has quit [Ping timeout: 256 seconds]
emeb_mac has joined #yosys
emeb_mac has quit [*.net *.split]
kristianpaul has quit [*.net *.split]
cr1901 has quit [*.net *.split]
lambda has quit [*.net *.split]
cr1901 has joined #yosys
lambda has joined #yosys
jryans has joined #yosys
jevinskie[m] has joined #yosys
emeb_mac has joined #yosys
Raito_Bezarius has joined #yosys
cyrozap has joined #yosys
kristianpaul has joined #yosys
Raito_Bezarius has quit [Max SendQ exceeded]
Raito_Bezarius has joined #yosys
stefanct__ has joined #yosys
stefanct__ is now known as stefanct
agg has joined #yosys
Xark has joined #yosys
agg is now known as Guest9521
jevinskie[m] has quit [Ping timeout: 272 seconds]
jryans has quit [Ping timeout: 272 seconds]
trabucay1e has joined #yosys
mewt_ has joined #yosys
mwk_ has joined #yosys
oldtopman has joined #yosys
Niklas[m]1 has quit [Ping timeout: 252 seconds]
srk has joined #yosys
Ekho has joined #yosys
FabM has joined #yosys
FabM has quit [Changing host]
FabM has joined #yosys
emeb_mac has quit [Ping timeout: 272 seconds]
emeb_mac has joined #yosys
jeanthom has joined #yosys
diadatp has joined #yosys
xiretza[m] has joined #yosys
kaji has joined #yosys
promach[m] has joined #yosys
whitequark has joined #yosys
Niklas[m]1 has joined #yosys
CarlosEDP has joined #yosys
jeanthom has quit [Ping timeout: 272 seconds]
emilazy has joined #yosys
jevinskie[m] has joined #yosys
jryans has joined #yosys
GenTooMan has quit [Ping timeout: 240 seconds]
GenTooMan has joined #yosys
emeb_mac has quit [Quit: Leaving.]
<whitequark> that's the closest thing I have to having it written down
<whitequark> let's have a meeting on that topic and then I could prepare something more Yosys-oriented, maybe a few slides and a small proposal?
Guest9521 is now known as agg
mwk_ is now known as mwk
dormito has joined #yosys
<dormito> out of curiosity: anyone know if there's a technical reason (like mandatory encrypted bitstreams) that polarfire support can't be added(to yosys & nextpnr)?
<mwk> *shrug* it's an FPGA, it should be doable
<mwk> but making a nextpnr target takes a *lot* of work, especially with uncooperative vendor that needs reverse engineering (which is all of them)
<dormito> lol, yeah. though I've no motivation to mess with porting to new targets.
<sorear> Not sure I understood the question correctly but I believe polarfire does have mandatory encrypted bitstreams
<cr1901> nextpnr can emit something that a downstream tool can encrypt
<mwk> encrypted *with what* is the question
<mwk> if this is a Xilinx-like arrangement where the user chooses the key and burns it to the fuses / uploads to eeprom — not a problem, we can do the encryption in nextpnr
<mwk> (or whatever hypothetical downstream tool ends up being written for bitstream assembly purposes)
<dormito> I spoke badly
<dormito> I should have said "mandatory microsemi signinng" or similar. that is the bitstream needs a license(which I guess could come with a microsemi signed key) to be usable. I'm sure there are other ways as well to completely block a libre toolchain from existing
<mwk> if it's some sort of static vendor encryption key used for all bitstreams that the user does not know... wellll then it has to be *somewhere* in the vendor binary and, while extracting it may ruffle a few feathers, it's perfectly doable
<dormito> anyhow. I was just curious, since I couldn't fine anything about a project for it (even though xillinx and intel have projets for their fpga). maybe polarfires just aren't as popular
<mwk> dormito: there are two big potential threats to any given libre tool's existence
<mwk> one is lack of people willing to do it, the other is lawyers
<mwk> technical limitations are secondary
<dormito> lol, I think some lawyers are a threat to everything
<mwk> the question is: is the vendor willing to spend the time on lawyers to fuck up whatever open source project springs up
<sorear> i've seen some interest in pfsoc because of the riscv angle
<mwk> in many cases this cannot be answered without trying
<sorear> note that even with a libre toolchain the polarfire platform is much worse for tinkering because it's only rated for 50 programs
<mwk> "rated"?
<mwk> ... oh wait, it's NVM?
<sorear> it's NVM
<dormito> yeah. I have a hifive unlead+expansion board. fooling around with the polarfire fpga would be kind of need... but I'm not going to use a non-floss toolchain to do it.
<dormito> *hifive unleashed
<sorear> it's NVM with flash cells in the actual fabric, which gives you much faster startup but cannot tolerate *any* worn-out bit cells
<dormito> someone recently linked me the icicle key, which seems to be the evolution of that, it looks pretty neat
<dormito> interesting about the write endurance. I didn't know that at all
<dormito> sounds pretty terrible for designing a system :/
<cr1901> >the bitstream needs a license
<cr1901> Why does Microchip keep doing this shit? I want to like their products, even PIC. But they make it so damn hard.
<mwk> cr1901: I think that was a hypothetical that was asked about
<mwk> not something that was actually asserted
<cr1901> Ahhh
<dormito> cr1901: yeah I was just hypothizing on technical reasons that could prevent a floss implementation (I have no technical knowledge of how microsemi's polarfire toolchain works)
<cr1901> If Microchip/Microsemi did something like that... I would not be surprised. They do some crappy things to encourage lock in
<cr1901> like refusing to upstream their LLVM changes (which ticks me off considering that reg/stack-starved PIC isn't a good fit for LLVM in the first place and yet they made it work)
<sorear> those were two unrelated companies at the time
emeb has joined #yosys
<whitequark> cr1901: if the changes required to make LLVM work with PICs are too invasive it's possible they're not worth attempting to upstream anyway
<cr1901> upstream isn't the right word... their changes aren't open source period
<whitequark> ah, that's different
GenTooMan has quit [Ping timeout: 256 seconds]
GenTooMan has joined #yosys
GenTooMan has quit [Excess Flood]
GenTooMan has joined #yosys
trabucay1e is now known as trabucayre
GenTooMan has quit [Ping timeout: 272 seconds]
GenTooMan has joined #yosys
GenTooMan has quit [Ping timeout: 256 seconds]
GenTooMan has joined #yosys
emeb_mac has joined #yosys
emeb has quit [Ping timeout: 272 seconds]
emeb has joined #yosys
gsmecher has joined #yosys
FabM has quit [Quit: Leaving]
jeanthom has joined #yosys
jeanthom has quit [Ping timeout: 248 seconds]
jeanthom has joined #yosys
<xiretza[m]> well, that's what permissive licenses are for
jeanthom has quit [Remote host closed the connection]
tlwoerner_ is now known as tlwoerner
<mwk> whitequark: wrt your undefinedness proposal: having (Undefined & 0) === Undefined, but (0 ? Undefined : 0) === 0 kind of worries me because it disallows the A ? B : 0 -> A & B transformation (at least without adding freezes)
<mwk> but then I guess I shouldn't criticize an incomplete proposal in the first place
GenTooMan has quit [Ping timeout: 258 seconds]
<whitequark> mwk: oh, that comment has an important typo
<whitequark> should be Uninitialized, not Undefined, because it's not intended for transformations
<whitequark> it's only for approximating nondeterminism in simulations
<mwk> ... so we'd have overeager Uninitialized in sim, that deterministically turns into 0 in synth here?
<mwk> that's... kind of weird, but not unsound
<whitequark> Uninitialized is "a specific value, either 0 or 1, but you don't know which"
<whitequark> specific in the sense that you can sample it as many times as you want and it's always the same
<mwk> I mean, it turns into 0 because of the "& 0"
<whitequark> oh, sorry, I misread
<whitequark> there's no Uninitialized in synthesis, well, not directly
<whitequark> reset_less registers and memories are Uninitialized in sim
<mwk> is it like LLVM "freeze poison"?
<whitequark> in synthesis they just... don't have an init value
<whitequark> you can think of Uninitialized as Verilog's X constrained to this one specific and very limited case of nondeterminism
<whitequark> constrained so hard that it no longer propagates
<mwk> that does sound like `freeze poison`
<whitequark> kind of
<whitequark> okay, "no longer propagates" is inaccurate
<whitequark> what I mean is that you're not allowed to take two signals assigned from the same Uninitialized value and assume they have different values
<mwk> hm
<mwk> now about the hypothetical $freeze cell
<mwk> I just had a realization
<mwk> it has to be a synchronous cell that applies to a given domain, right?
<whitequark> has it?
<mwk> like what is $freeze(1'bX)?
<mwk> is it a constant signal?
<mwk> or, if used within sync domain, can it chance every clock cycle, or is it stable within the clock cycle?
<whitequark> hmm
<whitequark> the one constraint here is that if you do `wire x = $freeze(1'bX); wire a = x; wire b = x;`, then always `a === b`
<mwk> always?
<mwk> what does it mean?
<jix> IMO it can help to specify undef/x/etc. by a mapping between abstract states (that can contain such values) and sets of corresponding concrete states represented by that... instead of trying to specify it for every operation or via allowed transformations
<mwk> you cannot assume (a & b) === (a & b) when synthesis is involved, unless you only sample the === at clock edges
<whitequark> hmm
<mwk> because these two gates won't come up with the result at the same time, necessarily
<whitequark> I'm thinking of netlist-level equivalence here
<whitequark> the idea behind the freeze cell is that it stops X-propagation in the optimizer itself
<mwk> I'm still strongly in favor of having some kind of concrete model of what the freeze cell returns in terms of 1/0/x/... values
<mwk> it may be that we need to tie all cells, combinatorial or not, to a clock domain and think in terms of that
<mwk> then $freeze does its work on every cycle
<mwk> kind of like LLVM on every execution
<whitequark> I think I see what you mean
<mwk> and if you have loose asynchronous combinatorial cells... well that's danger territory and we may want to inhibit optimizations here
<mwk> (yosys does not handle that well atm, by the way)
<whitequark> if 'x means "you can replace any instances of 'x with any circuit you have around", then $freeze('x) means "you can replace all instances of this specific $freeze cell with any single circuit you have around"
GenTooMan has joined #yosys
<mwk> ... but that produces a non-'x value
<mwk> (as in, the circuit needs to produce a non-'x value)
<whitequark> that's the interesting part
<whitequark> during synthesis, you cannot know whether a certain wire produces a non-x value, right?
<mwk> hmm
<whitequark> you know which wires are definitely 'x, but any inputs can be potentially 'x
<mwk> well, given some freezes, you can
<mwk> but absent a freeze, any non-constant can potentially be 'x, right
<whitequark> the only definitely non-'x values around are constants, yeah
<whitequark> now, you could certainly freeze all inputs to the module being synthesized
<mwk> right
<whitequark> and that was the original intended application: insert freezes at module boundaries, so that a stray 'x in one part of your massive SoC doesn't break something in a completely unrelated IP core from another vendor
<mwk> heh
<mwk> yeah, reasonable
GenTooMan has quit [Ping timeout: 248 seconds]
<mwk> (I mean you can still get hit by metastability given shitty enough IP, but other than that, yes)
<whitequark> one major toolchain design issue at a time, mwk!
<whitequark> ... not that i have a right to complain (looks at the HDL she maintains)
<mwk> I kind of see them as related
<mwk> I mean, freeze can only do its job properly if it has no metastability on input
<whitequark> soooort of
<mwk> so while the optimizer on the shit module is allowed to do any kinds of logic shenanigans, it's not allowed to just optimize away a synchronizer and connect a signal from an async clock domain
<whitequark> this all ties back to 'x meaning three completely unrelated things in Verilog
<whitequark> if we had separate 'u(ninitialized), 'm(etastable), and 'd(ontcare), then $freeze would turn 'u and 'd into "some constant", and pass through 'm
<mwk> mhm
<killjoy> <comment without reading backscroll> Unless that syncronizer doesn't have an effect on the output of the shit module.
<whitequark> this would be really useful in simulations with timing data
<mwk> and we'd need a different mechanism for avoiding 'm, got it
<whitequark> yes
<mwk> which would involve guarantees in optimizer to only make a 'm for actual metastability problems and never for just an 'x
<mwk> reasonable
<mwk> and you could statically prove there can never be 'm by showing that every CDC involves synchronizers
<whitequark> well
GenTooMan has joined #yosys
<whitequark> there's plenty of CDC that doesn't need synchronizers
<whitequark> where you cross between related clocks
<mwk> right, that
<mwk> but related domains also cannot result in 'm
<mwk> (at least the right kind of related)
<whitequark> (I've spent a lot of time thinking about that for CXXRTL; it's a really tricky problem!!)
<mwk> oh it sure is
<whitequark> which neither Verilog nor VHDL actually solve in any meaningful way, so it's -also- novel research
<mwk> ... I consider special-casing "same clock signal" vs "different clock signals" in my memory inference code like the biggest wart in it
<mwk> because there are meaningfully different inference options between truly async domains and related domains
<whitequark> "are these clocks the same" currently makes a lot of possible CXXRTL outputs unsound
<whitequark> yes
<mwk> but there's no way I can learn this information given our current netlist format
<mwk> (it may even differ between instances of a given module)
<whitequark> anything hierarchical in CXXRTL, even with a single clock domain, currently produces unsound simulation code
<whitequark> which normally doesn't come up because of flatten, but... blackboxes
<whitequark> I've considered adding clock tree analysis as a core pass just for this
<whitequark> to sidestep the problem a bit, at least
<whitequark> it's kind of a nightmare
<mwk> I feel at some point we need a discussion about coming up with a language / set of attributs / whatever to describe interface properties of modules, blackboxes in particular
<whitequark> yes please
<mwk> ... and yes, that
<whitequark> CXXRTL has a poor approximation of it, the cxxrtl_comb and cxxrtl_sync attributes
<mwk> arguably Verilog's specify could be this kind of language, but... I'm wary of it
<whitequark> there's no domain attached to cxxrtl_sync so it has limited usefulness
<mwk> (and it still cannot know about "this clk is twice the frequency of that and phase aligned")
<whitequark> ... it's so frustrating trying to write a decent simulator for once and then finding out you have to design entire aspects of core semantics
<whitequark> which as far as i know no one tried to systematically address in a production compiler before
<mwk> ... see also my rant about EDA tools in general
<mwk> yes
<mwk> and the ugly part is that there's a pull in the other direction, too
<mwk> of the "just make it work with this output of that other shitty EDA tool that uses blackboxes with completely unknown semantics" kind
<whitequark> yep
<mwk> ... I mean, yosys even supports using undefined cells
<mwk> and I'm pretty sure a lot of people would yell at me if I disallowed that
<whitequark> there's nothing wrong with it, is there?
<whitequark> it's morally equivalent to having toplevel inputs and outputs
<whitequark> a blackbox and a toplevel IO are duals
<mwk> it's morally equivalent to having toplevel inouts
<whitequark> * a blackbox and a few toplevel IOs are duals
<whitequark> ohh, sorry
<whitequark> yes, that's cursed
<whitequark> and i'm pretty sure it doesn't actually work as it should a lot of the time?
<mwk> we regularly get bug reports about it, yes
<mwk> also to actually disallow them I'd have to fix yosys itself to not rely on it first
<whitequark> i remember that bug with inouts i fixed in flatten
<mwk> eg. the way memory_bram works is that for a short moment you have a $__XILINX_RAMB36 temporary cell that is never defined even as a blackbox, which is then techmapped
<whitequark> that was really bad
<whitequark> inouts are cursed in general
<whitequark> I feel like maybe they shouldn't survive past the frontend
<mwk> well
<mwk> there is the issue of toplevel inouts which have to exist
<mwk> anyway, I have a proposal for them in the wednesday slides
<whitequark> alright
<mwk> I am still not sure whether I actually want this proposal to happen or to disallow them outright
<whitequark> the way I'd do it is by making it a constraint violation to connect a toplevel inout to anything other than an inout cell port
<whitequark> in general, make it legal to connect inout ports only to other inout ports
<whitequark> exactly once
<mwk> ... that breaks synthesis for FPGAs where tristate OBUF and IBUF are separate primitives and you have to instantiate both for IO port
<whitequark> okay, scratch the "exactly once" part
<mwk> and IBUF input is not an inout
<whitequark> if the synthesizer never tries to interpret wires connected to inout ports it still works out fine
<mwk> well
<whitequark> hm
<whitequark> okay, I hate it
<whitequark> we all know what inout is supposed to mean, which is more or less an analog connection
<mwk> my proposal is to basically have multi-driver/tristate nets as second-class citizens in the IR
<whitequark> but it's weirdly integrated with the rest of semantics
<whitequark> yeah
<mwk> and while all other wires would have LLVM-like SSA behavior (wire and the cell driving it are one and the same), this kind of wires would be explicitely cursed by design and avoided by all the optimization passes
<whitequark> making it a net property rather than a port property is more reasonable in light of IBUF/OBUF
<whitequark> I like that approach a lot
<mwk> also connectable only to special cells that have special port type
<whitequark> that still screws IBUF, no?
<mwk> not necessarily
<mwk> my plan involves adapters in both directions
<mwk> a "wire observer" that gives you a SSA value out of a cursed wire
<mwk> which you then connect to IBUF
<mwk> and, if directly driven by non-cursed logic, you insert a "wire driver" cell
<mwk> (which is a TBUF that may or may not have output enable tied to 1)
<whitequark> this is a really contrived way to do it but I see why you're going for it
<mwk> also the cell port type does not need to be the same as Verilog input/inout/output
<mwk> consider a TBUF cell; it may have an output port type, but it's pretty obvious it's a different kind of output than an AND cell
<mwk> and we'd want them as separate kinds in the IR
<whitequark> reasonable
<mwk> and yes, this requires having that information in the cell library
<mwk> we might reuse (* iopad_external_pin *) for that
<whitequark> I wanted to say "if you annotate cells you might as well switch buffers to use inouts" but an attribute like that is less invasive and, yeah, the kind is different anyhow
<mwk> the thing is, there are 4 kinds of ports really
<mwk> input, inout, output that may be 'z, output that cannot be 'z
<mwk> anyway... yeah, lots of things to design in the IR
<mwk> now I'm wondering if we need first-class clock domain support in that
<mwk> there's a good argument for "YES PLEASE", and also the counter-argument of "but what to do with non-annotated blackboxes"
<mwk> (at the very least I believe our IR needs to have a definite "THIS IS A SYNCHRONIZER DON'T TOUCH" marking for FFs)
<killjoy> I would second that. You always need stuff like that.
<mwk> well
<mwk> ... I guess I'll need to make more slides
<whitequark> yes, definitely need the ability to mark synchronizers
<whitequark> you need it anyway if you do retiming
<mwk> we already need it
<mwk> right now a synchronizer FF can end up merged into a memory or a DSP
<mwk> nothing prevents that
<killjoy> That's bad, m'kay.
dormito has quit [Ping timeout: 272 seconds]
<mwk> well I'll gladly fix it as soon as we have an IR where the concept of a synchronizer is actually defined
<cr1901> I'm kinda OOTL... is the above discussion for a new yosys IR or new additions to the existing IR?
<mwk> the synchronizer part should go in ASAP; other than that, we're thinking of having a new IR, but this is not something we're actually commited to any time soon
dormito has joined #yosys
peeps[zen] has quit [Read error: Connection reset by peer]
peepsalot has joined #yosys
killjoy has quit [Ping timeout: 258 seconds]
emeb has quit [Quit: Leaving.]
killjoy has joined #yosys
killjoy has joined #yosys
killjoy has quit [Changing host]