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
mikolajw has quit [Quit: WeeChat 3.2]
GenTooMan has quit [Ping timeout: 250 seconds]
GenTooMan has joined #yosys
chipb has quit [*.net *.split]
chipb_ has joined #yosys
agg has quit [*.net *.split]
sauce has joined #yosys
anuejn has joined #yosys
TD--Linux has joined #yosys
agg has joined #yosys
agg is now known as Guest6056
kbeckmann has joined #yosys
peepsalot has quit [Read error: Connection reset by peer]
peepsalot has joined #yosys
FabM has joined #yosys
FabM has joined #yosys
emeb_mac has quit [Quit: Leaving.]
Guest6056 has quit [Quit: WeeChat 1.8]
adamgreig has joined #yosys
adamgreig is now known as agg
vidbina has joined #yosys
vidbina has quit [Ping timeout: 240 seconds]
GenTooMan has quit [Quit: Leaving]
GenTooMan has joined #yosys
vidbina has joined #yosys
FabM has quit [Quit: Leaving]
gsmecher has joined #yosys
emeb has joined #yosys
emeb_mac has joined #yosys
vidbina has quit [Ping timeout: 248 seconds]
vidbina has joined #yosys
gsmecher has quit [Ping timeout: 250 seconds]
GenTooMan has quit [Ping timeout: 240 seconds]
GenTooMan has joined #yosys
emeb_mac has quit [Ping timeout: 240 seconds]
emeb has quit [Ping timeout: 240 seconds]
emeb has joined #yosys
emeb_mac has joined #yosys
GenTooMan has quit [Ping timeout: 250 seconds]
gsmecher has joined #yosys
GenTooMan has joined #yosys
<tnt> Is there an attribute I can set on a signal to tell yosys to actually generate and _use_ that signal as-is in logic whenever I use it and not try to optimize by looking at where that signal come frome etc ... ?
<tnt> Like I have wire x = ~y; and then I use `x` in some expressions later, and I want it to not try to fold the inverter in there.
<tnt> I tried 'keep' but that's not enough apparently :/
vidbina has quit [Quit: vidbina]
<corecode> tnt: what would be the use case for this?
<tnt> Guide yosys into doing "the right thing".
<tnt> I want to do this: val_cur <= do_load ? val_load : (val_cur - 1);
<killjoy> Yeah I don't understand why you would want to do that in this case. The synthesizer could very well fold your inverter downstream, or upstream, and what do you care as long as it's equivalent?
<tnt> But for it to pack correctly, I have to write: val_cur <= do_load ? val_load : (val_cur + {N{do_load}});
<tnt> Err, wait, when simplifying my example, I inverted thing.
<tnt> val_cur <= do_dec ? (val_cur - 1) : val_load;
<tnt> val_cur <= do_dec ? (val_cur + {N{do_dec}}) : val_load;
<corecode> oh otherwise it packs less compactly?
<tnt> That only packs properly (1 LUT per bit) if do_dec is `1` when doing the decrement and `0` when doing the load due to the hardcoded carry chain.
<tnt> And so if instead of using `do_dec` _exactly_ as I wrote it as a logic expression, yosys tries to optimize or unfold an inverter or something ... packing is screwed up.
<killjoy> How wide is val_cur? and do_load is your 1 bit wire, right?
<tnt> do_load is 1 bit. val_cur is 16 bit.
<tnt> But that submodule ends up instanciated 32 times in a UP5k ... so wasting like 10% of the whole FPGA if packing for this is not done as it should.
<corecode> good that you found a workaround
<tnt> I didn't ...
<killjoy> So, are you making an assignment or comparison with "val_cur <= do_dec"?
<tnt> huh ? No.
<killjoy> Are you wanting "if val_cur is less than or equal to do_dec?"
<tnt> no.
<tnt> it either loads a value or decrement by 1.
<killjoy> I would be a lot more explicit in my code than this.
<killjoy> You don't get points for being terse.
<killjoy> You're trying to say "if do_dec is 1 decrement val_cur and assign it back, else give it val_load?"
<tnt> That's the only way to write it so it packs properly ....
emeb has quit [Ping timeout: 240 seconds]
emeb_mac has quit [Ping timeout: 240 seconds]
<tnt> Feel free to try and find another way : https://pastebin.com/Rbedy7J7
<tpb> Title: // yosys -p 'synth_ice40' t.vmodule top( input wire [31:0] ld_value, - Pastebin.com (at pastebin.com)
<corecode> so you did find a workaround?
<tnt> No.
<corecode> ok i'm confused :) you said it packs correctly if you do this
<corecode> what about instantiating the LUT manually?
<tnt> As a separate module it works, but when the 'do_dec' signal doesn't come from outside, but from some internal logic, yosys tries to optimize it and merge it with the adder and screws things up.
<corecode> ah!
emeb_mac has joined #yosys
<corecode> is the LUT the issue or the carry chain?
<tnt> Which is why I want a way to 'fence' it. Tell yosys : "Ok, use 'do_dec' as is, don't touch it"
<corecode> i don't think i can help at all, but I can learn :)
<killjoy> This doesn't make sense to me.
<killjoy> It shouldn't need to pack anything, you're just decrementing a 32 bit integer.
<killjoy> Based on some signal.
emeb has joined #yosys
<killjoy> I thought maybe your use of the ternary operator was confusing the synthesizer.
<killjoy> But you're saying the lower code doesn't work right?
<corecode> i'm assuming it prepares the LSB in one LUT and then does the carry chain separately
<killjoy> Oh wait.
<tnt> It "works" as in the logic is "correct" but it uses twices as many LCs at the top one.
<killjoy> *sigh* let me attempt to dig into brain cells from 10 years ago.
<killjoy> I think it's because you're implying latches, but let me try to remember.
<tnt> I can assure you it's not.
<corecode> so what do the two LUTs do?
<corecode> one for the mux, the other for ~do_dec being inverted again?
<tnt> two LUTs ?
<corecode> you said it allocates two LC
<tnt> per bit.
<corecode> is that LUT + carry element?
<tnt> No, it will use 1 LC per bit to implement the decrement and then another LC to do the mux.
<killjoy> Yeah ok it's not that.
<corecode> huh ok
<tnt> while in reality you can do both theses functions in the same LC.
emeb_mac has quit [Ping timeout: 240 seconds]
<corecode> does it use the carry chain of the LC?
<tnt> yes
<corecode> or does it do a plain LUT ripple
emeb has quit [Ping timeout: 240 seconds]
<corecode> aha, so it fails to merge carry chain and mux LUT
<corecode> surprising
<tnt> well the ice40 has a very rigid carry structure.
<tnt> and it's only mergeable when the 'control' signal has value '1' when doing the decrement and value '0' when doing the load.
<tnt> (you'd have to go dig up the ice40 internal structure to understand why ... a bit late here for me to explain all the details ... )
<corecode> ok
<corecode> i'll have a look out of curiosity
<corecode> so even if you'd instantiate a SB_CARRY and a SB_LUT4, it might not get merged
<corecode> i mean, co-located
<tnt> well ... yeah, if I instanciate primitives manually I'm sure it'd work ...
<tnt> but that's a major pain.
<corecode> or not...
<corecode> or does nextpnr do the co-locating?
<corecode> the tech library docs are not very good in this regard
<tnt> nextpnr does the colocating.
<tnt> if the SB_CARRY in/out connect to the righ tports of the SB_LUT4 for it to go there.
emeb_mac has joined #yosys
emeb has joined #yosys
<killjoy> Eh, it's been too long for me, and I never did an FPGA project, just ASICs.
shoragan has quit [Ping timeout: 255 seconds]
shoragan has joined #yosys
emeb has left #yosys [#yosys]
peepsalot has quit [Read error: Connection reset by peer]
peepsalot has joined #yosys