<daveshah>
btw, ad full adders - probably be better doing what the FPGA flows do; which is `synth -run :fine; techmap -map +/techmap.v -map <custom adder rules.v>; opt`, followed by abc
<daveshah>
rather than trying to extract them after doing synthesis to gates
<ZirconiumX>
Yeah, I figured I'd need to do something like that
<ZirconiumX>
I'm wondering what other MSI chips I could add; the 74xx series has synchronous counters, for example,
<ZirconiumX>
But I'm not sure what kinds of things Verilog usually emits
<daveshah>
I believe Yosys has some support for mapping counters, it's used in the Greenpak4 pass
<ZirconiumX>
I guess the best way of testing the impact of this kind of thing is a large Verilog library that Yosys can synthesize
<ZirconiumX>
I'm getting a lot of `ERROR: syntax error, unexpected TOK_ELAB_TASK` while trying to parse the ethernet benchmark though
<daveshah>
I think this is a recent regression, Yosys used to ignore them in this context (as is correct for a synthesis tool), but now tokenises them and then fails to ignore them in the parser (because it supports them in `generate` contexts now)
<ZirconiumX>
Guess we'll have to wait for Clifford to get round to reviewing it
<daveshah>
I've added a comment to try and speed that up...
rohitksingh has quit [Ping timeout: 248 seconds]
proteusguy has joined #yosys
maikmerten has joined #yosys
dys has quit [Ping timeout: 248 seconds]
dys has joined #yosys
proteusguy has quit [Remote host closed the connection]
proteusguy has joined #yosys
vidbina has quit [Ping timeout: 246 seconds]
sammylin has joined #yosys
<ZirconiumX>
daveshah: So, I've been reading the techmap documentation, and the example techmap implementations. If I want to insert a full adder, do I use (* techmap_celltype = "$add" *}
<ZirconiumX>
?
Laksen has quit [Quit: Leaving]
<daveshah>
ZirconiumX: Yes, however, you'll have to make sure you run techmap before alumacc in that case
<daveshah>
alumacc converts arithmetic to more flexible, but more complicated `$macc` amd `$alu` cells (which are probably better suited to mapping things like FPGA carries than discrete chips)
<ZirconiumX>
Is a $macc a multiply-accumulate unit?
emeb has quit [Quit: Leaving.]
<daveshah>
I think so, although I've never worked out it's exact semantics
emeb_mac has joined #yosys
<ZirconiumX>
daveshah: Is it worth having an early and late techmap pass? It seems useful to early-convert $add (74283) and $eq/$ne (7485/7485 with inverter), but late-convert things like counters etc?
<daveshah>
Yes, definitely
<ZirconiumX>
"early" and "late" being "before synth" and "after synth"
<ZirconiumX>
Can techmap synthesize a $ne out of a $eq?
<ZirconiumX>
(assuming they are what I think they are)
<daveshah>
You might need to play around a bit, but I think that should be possible
<daveshah>
Best route might be to take advantage of techmapping being recursive
<daveshah>
So you write one rule that maps $ne to $eq, and another that maps $eq to logic
<daveshah>
*to chips
<ZirconiumX>
The 7485 is actually quite versatile; you can use it as a comparator too
<ZirconiumX>
Presumably you'd need to infer that though
<ZirconiumX>
daveshah: So to get this to work, I should build a model of the 7485 and then use a _TECHMAP_REPLACE_ for it?
<ZirconiumX>
My verilog skills feel quite weak at the moment
emeb_mac has quit [Ping timeout: 245 seconds]
<daveshah>
No, with techmapping you don't build a model of the thing you want to map to - instead you describe how to go from a Yosys cell type to the cell type you want to map to
<ZirconiumX>
So I'm allowed to pretend that a 74283 exists, even when I don't define it?
<ZirconiumX>
Or whatever
<daveshah>
You should probably have at least a "black box" - an empty model just specifying what pins are are inputs and what are outputs
<ZirconiumX>
daveshah: So I just need my transformations to match the API of the equivalent simlib cell?
<daveshah>
Yes
<daveshah>
You don't have to handle all cases though, if you set a wire named _TECHMAP_FAIL_ to 1 then Yosys will fall back to its default implementation
<ZirconiumX>
And using techmap on it infinite loops
<ZirconiumX>
Though I realise there's obvious bugs
<ZirconiumX>
I'm not sure how to pad the input and output buffers though
<ZirconiumX>
Ah, a buffer
<ZirconiumX>
I think
fsasm_ has quit [Ping timeout: 245 seconds]
<daveshah>
ZirconiumX: you need to add `(* blackbox *)` to the 74283 model
<daveshah>
Otherwise Yosys looks inside it, which you don't want in this context (because it will recursively techmap the add inside it)
<ZirconiumX>
That makes sense
<daveshah>
Normally, the idiom is to put all the sim models in a separate Verilog file to the techmap rules, and read that file in Yosys with read_verilog -lib
<daveshah>
That implies blackbox on all the sim models
<daveshah>
I'm also not sure if _TECHMAP_REPLACE_ will work here
<daveshah>
It's intended for 1:1 techmapping, might cause problems when you map to more than one cell
<daveshah>
I'd name the instance something else meaningful like adder_i
<daveshah>
Right now nothing in that script is actually mapping memory to logic
<daveshah>
*`opt -full`, no space between - and full in either case
<ZirconiumX>
No more leaking $mem cells
<ZirconiumX>
But one of the example benchmarks doesn't synthesize
<ZirconiumX>
Looks like I messed up the adder?
<ZirconiumX>
ERROR: Output port smartbextdep.$techmap\smartbextdep_direct_inst.decoder.pps_core.$add$../benchmarks/smartbextdep.v:245$1677.slice[0].adder_i.CO (\74283_1x1ADD4) is connected to constants: 1'x
<daveshah>
ZirconiumX: Make C `WIDTH:0` rather than `Y_WIDTH:0`
<daveshah>
in the techmap rule
<ZirconiumX>
Yep, that fixes it, thank you once again
<ZirconiumX>
5,051 ICs for the benchmark here
<ZirconiumX>
But all of the benches build at least
<ZirconiumX>
And we're still doing better than before
<ZirconiumX>
Have I thanked you enough, daveshah? I'm not sure I have.
vidbina has quit [Ping timeout: 268 seconds]
gnufan_home has joined #yosys
s_frit has quit [Remote host closed the connection]