<darkling>
Neophyte question: Is there any good documentation on how to actually use yosys? The docs aren't exactly brimming with information, and I've found one "tutorial" that doesn't explain anything, just gives a couple of commands ex cathedra.
<lofty>
darkling: have you read the manual and/or the command reference?
<darkling>
I've read the manual. It gives one example of a script. The command reference is just that... reference, not tutorial.
<lofty>
what are you trying to do? use it to synthesise for an FPGA?
<darkling>
I'd like to simulate first, and then synthesise.
<lofty>
for simulation, consider something like icarus verilog or verilator
<darkling>
So I can't use yosys as a single all-in-one solution?
<lofty>
there technically is `sim`, but I've never used it or seen anybody directly use it
<lofty>
and there's also write_cxxrtl, which builds a C++ simulation of your HDL
<lofty>
but whitequark would be the person to ask about that.
<darkling>
OK. Nevertheless, the yosys docs are distinctly impenetrable. It's landed straight in the usual failure mode of "here's all the things in alphabetical order", without explaining what the different types of things are, what the expected operational structures are, or how to fit them together in common use cases.
<lofty>
Okay.
<lofty>
So, the manual talks about script-based synthesis flows, which is how Yosys is typically used
<lofty>
at its core, Yosys represents the netlist as RTLIL
<lofty>
and all the commands are passed to operate or transform that RTLIL
<darkling>
I got the overall idea -- that you're passing netlists from one stage to the next.
<lofty>
There are no explicit stages.
<darkling>
Other than the one example script, there's nothing about how you should put things together, what steps you might want to take for different situations, what order they'd be useful to run in...
<lofty>
have you looked at something like synth_ecp5?
<darkling>
Not relevant for me -- I don't have that hardware. (I've got an Ice40, and a Xilinx6 in a SpecNext -- and I need to track down the docs on that latter one to work out how it's put together)
<lofty>
but as an example of how you should put things together, it is absolutely relevant to you
<lofty>
Hell; I wrote synth_intel_alm, and I can directly answer every question you have about what that script does
<darkling>
I still don't understand why the individual pieces of that are put together like that.
<lofty>
would you like me to walk you through how it works?
<darkling>
Or, if I don't need to know that, then what are the higher-level elements such as synth_ecp5 that I should be looking at?
<lofty>
the user-facing scripts are the `synth_xxx` passes
<darkling>
It seems that there's a bunch of low-level things (used in the ecp5 synth), but then those are combined into high-level things (like ecp5).
<lofty>
yes.
<darkling>
Those are thrown together in the docs without highlighting which pieces are which.
<darkling>
So, again, we come back to: what should someone be using, and how?
bjorkintosh has quit [Quit: Leaving]
<darkling>
Even "<lofty> the user-facing scripts are the `synth_xxx` passes" is an important piece of information that I didn't see in the docs.
<darkling>
I know I'm being grumpy about this, and I'm sorry, but it's a general problem in docs that I see frequently, and it's been annoying me for at lesat 20 years. :)
<lofty>
for ice40, use `yosys -p "synth_ice40 -top <your top-level modules> -json filename.json" <your verilog files>`, for xilinx use `synth_xilinx -flatten -top <your top level module> -json filename.json` instead of `synth_ice40`
<darkling>
Why is there -flatten in the xilinx one, but not in the ice40?
<lofty>
because for maintainer-related reasons, xilinx does not flatten the module hierarchy when everybody else does
<lofty>
(by default, I mean)
<lofty>
and nobody seems to use synth_xilinx enough to complain about that annoyance
<darkling>
OK. :)
<lofty>
actually, I should be more specific
<lofty>
you also need `-family xc6s` to instruct the pass to synthesise for spartan 6
<darkling>
I'm a long way off being anywhere near needing to target the SpecNext. I'm still at the stage of two buttons, and AND gate, and an LED. :)
<darkling>
But I'll keep that in mind.
<lofty>
(I think the distinction between xc7 and xc6s from a synthesis point of view is the DSPs, but don't quote me on that)
<lofty>
I would be genuinely happy to explain how the synthesis scripts work, if you're interested
<darkling>
The "tutorial" I've found is https://eecs.blog/lattice-ice40-fpga-icestorm-tutorial/, and that uses arachne for place-and-route, and some chip-specific tooling for generating and uploading the bitstream. Is that normal procedure?
<lofty>
arachne-pnr is horrendously obsolete; you should use nextpnr-ice40 instead
<lofty>
but uploading generally has some kind of chip-specific tooling in some way
<darkling>
Not unexpected, but good to have confirmation.
<darkling>
Oh, and thanks for the offer on explanation of the synthesis scripts, but it's probably a step too far for me right now.
<darkling>
I'm sure I'll be back with those questions at some point, but right now if I can get two buttons and an LED working, it'll be a major advance for me.