clifford changed the topic of #yosys to: Yosys Open SYnthesis Suite: http://www.clifford.at/yosys/ -- Channel Logs: https://irclog.whitequark.org/yosys
tpb has quit [Remote host closed the connection]
tpb has joined #yosys
vidbina_ has quit [Ping timeout: 240 seconds]
Degi_ has joined #yosys
Degi has quit [Ping timeout: 240 seconds]
Degi_ is now known as Degi
X-Scale has quit [Ping timeout: 256 seconds]
[X-Scale] has joined #yosys
[X-Scale] is now known as X-Scale
futarisIRCcloud has joined #yosys
citypw has joined #yosys
Cerpin has quit [Ping timeout: 265 seconds]
Cerpin has joined #yosys
az0re has joined #yosys
_whitelogger has joined #yosys
elfGamal has quit [Quit: ZNC 1.7.5 - https://znc.in]
elGamal has joined #yosys
rohitksingh has quit [Ping timeout: 260 seconds]
emeb_mac has quit [Quit: Leaving.]
Vinalon has quit [Ping timeout: 240 seconds]
npe has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dys has joined #yosys
jakobwenzel has joined #yosys
anuejn_ is now known as anuejn
jakobwenzel1 has joined #yosys
jakobwenzel has quit [Read error: Connection reset by peer]
jakobwenzel1 is now known as jakobwenzel
hexagon5un has quit [Ping timeout: 258 seconds]
hexagon5un has joined #yosys
rohitksingh has joined #yosys
az0re has quit [Remote host closed the connection]
vidbina_ has joined #yosys
<ZirconiumX> I've been going through a MiSTer core and trying to fix the various bits of SystemVerilog that have creeped into the codebase
<ZirconiumX> But there's a Yosys error that confuses me
<tpb> Title: Minimig-AGA_MiSTer/hps_io.v at MiSTer · MiSTer-devel/Minimig-AGA_MiSTer · GitHub (at github.com)
<ZirconiumX> (pretend the always block has a name like it should in Verilog-2005)
<ZirconiumX> sys/hps_io.v:600: ERROR: Failed to detect width for identifier \clk_sys.cmd!
<daveshah> This is a terrible error
<ZirconiumX> But the width is defined within the block (`reg [15:0] cmd`)
<daveshah> but in non-system Verilog signals can only be declared in named blocks
<daveshah> try begin: foo here
<tpb> Title: Minimig-AGA_MiSTer/hps_io.v at MiSTer · MiSTer-devel/Minimig-AGA_MiSTer · GitHub (at github.com)
<ZirconiumX> <ZirconiumX> (pretend the always block has a name like it should in Verilog-2005)
<ZirconiumX> I gave it the name `clk_sys`
<daveshah> Oh, I didn't see that
<ZirconiumX> Which appears in the error
<daveshah> Then this is a bug
<daveshah> at a guess it is because of nesting of begin/end blocks
<ZirconiumX> Well, using *just* that always block as a minimal testcase parses fine
<ZirconiumX> Ugh
<ZirconiumX> :q
<ZirconiumX> ...
<ZirconiumX> I really hate how difficult it is to see if a window is in focus sometimes
<ZirconiumX> Oh, I see where the bug is
<ZirconiumX> daveshah: I have two always blocks named the same thing and they contain a register which is named the same thing
<daveshah> ah
<ZirconiumX> So I'm wondering if Yosys isn't properly resolving the names
<daveshah> Yes, although maybe that should be an error?
<ZirconiumX> I don't know what the LRM thinks here.
<daveshah> idk if two always blocks named the same are allowed
<ZirconiumX> Verilator rejects it
<ZirconiumX> As does Icarus
<ZirconiumX> So I guess it's technically invalid.
<tpb> Title: Poor error message with two always blocks named the same · Issue #1940 · YosysHQ/yosys · GitHub (at github.com)
<ZirconiumX> While I'm here, the code uses register initialisation inside always blocks
<ZirconiumX> e.g. reg [3:0] state = 0;
<ZirconiumX> How should I replace that?
ebb has quit [Remote host closed the connection]
ebb has joined #yosys
Ultrasauce has quit [Quit: No Ping reply in 180 seconds.]
Ultrasauce has joined #yosys
kuldeep has quit [Read error: Connection reset by peer]
kuldeep has joined #yosys
kuldeep has quit [Remote host closed the connection]
kuldeep has joined #yosys
<ZirconiumX> daveshah: Could you send me a firmware.hex for attosoc? I want to try using attosoc with synth_intel_alm and Quartus and see how far I get
<tpb> Title: Snippet | IRCCloud (at www.irccloud.com)
<ZirconiumX> Thank you
<ZirconiumX> I still think the most cursed code I've ever seen has to be the Altera mif2hex.v, which does all its parsing in Verilog
<ZirconiumX> I'm sure mwk would love to read it
FFY00 has quit [Remote host closed the connection]
FFY00 has joined #yosys
FFY00 has quit [Remote host closed the connection]
FFY00 has joined #yosys
<ZirconiumX> Holy fucking shit
<ZirconiumX> synth_intel_alm works on real hardware with only minor changes
<daveshah> nice!
<ZirconiumX> Yeah, attosoc boots
<ZirconiumX> And I think that's a pretty good example of a fairly complex program
<daveshah> Well, complex gateware but a simple program
<ZirconiumX> A good enough tech demo, though, right?
<daveshah> Definitely
<daveshah> It's found the vast majority of problems with simple logic, ime
<daveshah> May or may not use any BRAM depending on how it is implemented
<ZirconiumX> It does use BRAM for the register file, but not for the firmware ROM
<ZirconiumX> (because I don't currently have initialisable BRAM)
<daveshah> Meanwhile, I'm trying to get the MiST SNES core working with GHDL and cxxrtl (then ECP5)
<daveshah> It's proving an interesting test, found a few ghdl bugs but all fixed by tristan very quickly
* ZirconiumX points to MiSTer being even worse
<daveshah> Now deep in 65C816 assembly trying to figure out some subtle bug somewhere
<daveshah> FPGA dev really can be interesting
<ZirconiumX> You know how people write "portable code" that only actually compiles with GCC?
<ZirconiumX> MiSTer is that but with Quartus
<ZirconiumX> Because all the "Verilog" files are actually SystemVerilog with extensions Yosys can't handle
<ZirconiumX> And the dev seems to think that's a Yosys problem
<mwk> what exactly is missing?
<mwk> oh wait, extensions *to* SystemVerilog
<mwk> ugh
<ZirconiumX> mwk: The main things that come to mind are declarations in anonymous always blocks, and initialisations inside always blocks
<ZirconiumX> With those, I think Yosys will be able to build the Minimig MiSTer core (with the help of ghdlsynth)
<ZirconiumX> mwk: not "extensions to SystemVerilog" but "SystemVerilog extensions to Verilog"
<mwk> ah, then it is a yosys problem
<ZirconiumX> mwk: depends if you count .v files as systemverilog or not
jfcaron has joined #yosys
vidbina_ has quit [Ping timeout: 260 seconds]
dys has quit [Ping timeout: 256 seconds]
emeb has joined #yosys
<Sarayan> ZX: I'm working on integrating slang into yosys
<ZirconiumX> That ought to work :P
<Sarayan> It's not a trivial endeavour though, in large part because I don't talk verilog
<Sarayan> oh, btw, is there a good rtlil documentation, or is all there is to it is in the yosys manual?
<ZirconiumX> whitequark would probably know more there
<Sarayan> Yeah, hopefully she'll answer the question when she's around
<whitequark> i'm here
<whitequark> everything i know about rtlil is in the manual
<whitequark> (either i learned it from the manual, or i put it into the manual)
<Sarayan> Hmm damn
<Sarayan> okay then
<whitequark> you can also ask here
<Sarayan> I guess I shall. Can rtlil do 01XZ?
<whitequark> yes
<whitequark> and only those, in fact
<ZirconiumX> S0/S1/Sx/Sz right?
<whitequark> ok, not quite
<ZirconiumX> And I think Sa/Sm
<whitequark> there's also -, but not in values
<Sarayan> I mean opposite to 0/1
<whitequark> m should never appear in RTLIL you see anywhere
<ZirconiumX> But it *is* there, and should be mentioned for that
<whitequark> Sarayan: yep, it is 4-valued
<whitequark> ZirconiumX: fair enough
<mwk> - is used in the $fsm cells, I think
<Sarayan> slang classifies values are 2-state or 4-state, so I guess rtlil doesn't have explicit 2-state?
<Sarayan> s/are/as/
* ZirconiumX wonders how the heck ghdlsynth lowers VHDL's 9-state logic
<mwk> nope, no 2-state
<Sarayan> 'kay
<whitequark> Sarayan: in RTLIL you can put any of its 5 (6 if you count m) states in any position where a constant is valid
<whitequark> in some of those places, only 0/1 are in fact valid
<whitequark> actually, now that I think about it, what happens if you feed a $add cell 'z?
<Sarayan> wq: A black hole opens and swallows the computer?
<mwk> 'x happens on the output
<whitequark> ah, makes sense
<Sarayan> mwk: I liked my version more
<ZirconiumX> That sounds like a bash.org quote
emeb has quit [Ping timeout: 260 seconds]
vidbina_ has joined #yosys
<daveshah> making progress with ghdl and cxxrtl!
<daveshah> all a horrible hack but at least it is doing something
emeb has joined #yosys
Vinalon has joined #yosys
<gtw> haha nice choice of screenshot daveshah :)
<daveshah> it's the MiST SNES core
<whitequark> daveshah: whoa nice
<whitequark> how's the performance like?
<daveshah> It took about 20 minutes to get to that point
<whitequark> flattened design?
<daveshah> But it's a big and messy core
<daveshah> No
<whitequark> oh
<whitequark> yeah that would do it
<whitequark> non-flattened designs run orders of magnitude slower
<gtw> Is this an appropriate place to ask prjtrellis questions, or is there somewhere better? I am wondering about adding a bunch more SVF options to ecppack...
<daveshah> gtw: sure
<mwk> gtw: it's ok, though there's also ##openfpga
<gtw> daveshah: sure it's appropriate, or sure add more SVF?
<whitequark> daveshah: if you don't flatten then two things happen
<gtw> mwk: ok thanks :)
<whitequark> first, there is no splitnets
<daveshah> gtw: both
<whitequark> second, you have comb dependencies between submodules
<Sarayan> How do you add a port to a RTLIL::Module?
<whitequark> both of which mean you probably have hundreds of delta cycles
<whitequark> (I'm curious how many)
<daveshah> ack
<daveshah> how do I know?
<whitequark> .step() returns that
<gtw> daveshah: OK I will send a pull request once I get a round tuit :)
<daveshah> gtw: thanks!
npe has joined #yosys
<Sarayan> (adding a wire and setting its port_id blows up because it's not in the ports array)
<daveshah> whitequark: looks like up to 62 delta cycles, but that is during startup so maybe more once more parts start running
<whitequark> daveshah: i would expect at least a 10x speedup if you flatten
<whitequark> quite possibly mre
<Sarayan> oh, looks like I have to class fixup_ports() at some mysterious point
<whitequark> daveshah: oh and if you do -b 'cxxrtl -header' you can rebuild your bench code without rebuilding the generated code
<daveshah> whitequark: thanks, absolutely flying with flatten as expected
<whitequark> daveshah: curious what the speedup is
<Sarayan> ok, I have the ports and internal variables translating, weee
<daveshah> whitequark: took about 2 minutes to get to the point it took noflatten about 20 minutes
<daveshah> so about 10x as expected
<whitequark> nice
<whitequark> how many delta cycles is it now?
<whitequark> (both on posedge and negedge)
<whitequark> also, does the flattened design have any feedback arcs, per the backend output?
<daveshah> up to about 5 delta cycles
<daveshah> i'll see what the backend output is
<whitequark> 5 delta cycles is reasonable
<daveshah> I think there is even a generated clock deep inside
<whitequark> ah, then my next suggestion wouldn't work
<whitequark> (stop toggling the clock and instead set posedge_p_clk = true; directly, which lets you skip negedge cycles)
<daveshah> Yes, one feedback arc around the PPU
<whitequark> ok, yes, won't work then
<daveshah> there is definitely stuff happening on the negede too
<whitequark> ahh
<whitequark> this is really nice to hear that cxxrtl actually handles that well
<whitequark> i've only really built it for fully synchronous single-clock nmigen designs
<whitequark> well
<whitequark> that was my task. i built it to handle literally any imaginable rtlil because why not
<daveshah> Almost everything is on the same clock tbf
<daveshah> But it still seems to do very well
<whitequark> daveshah: how do you grab the images btw?
<daveshah> whitequark: writing a csv file and processing it with PIL
<daveshah> just using hsync falling edge = start new line and vsync falling edge = start new file
<whitequark> oh, so you're basically sampling it at each pixel clock?
<daveshah> Yeah, every other system clock which I think is one pixel clock
<whitequark> do you think blackboxes would help you here?
<daveshah> The video output is top level at the moment anyway, so it wouldn't make a big difference
<whitequark> ah ok
<ZirconiumX> I think it'd be at least a little more fun to see it render in SDL or whatever
<whitequark> yeah but you don't necessarily need blackboxes for that
<daveshah> ZipCPU did something like that with Verilator
<whitequark> ZirconiumX: my idea for nmigen-soc is that it would come with peripherals you could drop into your design and they'd have simulation versions hooked up to the host system
<whitequark> one of them could very well be SDL output
<daveshah> That's a really nice idea
<daveshah> Being able to do that for the CPU should give a good speedup too
<whitequark> yes, lambdaconcept suggested it, based on the concept pioneered by litex
<whitequark> we are actually quite close to it working
<whitequark> two yosys PRs away from having all the knobs I need in nmigen for turnkey integration
<whitequark> and i already have a working design for the first one
<ZirconiumX> https://gist.github.com/ZirconiumX/dcf5f76675658f2d10937f176adc4a6e <-- if people are curious, here's how Yosys attosoc synthesis compares to Quartus attosoc synthesis
<tpb> Title: quartus_v_yosys.txt · GitHub (at gist.github.com)
<whitequark> there's some... quite unfortunate C++ code involved
<whitequark> but so can be said about the rest of cxxrtl
<whitequark> it's reliable and relatively simple, i just hate it
strongsaxophone has joined #yosys
<lambda> ZirconiumX: is that still with LUT ROM?
<gtw> ZirconiumX: nice :)
<ZirconiumX> lambda: No, flop ROM, AFAICT; I don't yet have BRAM initialisation
<whitequark> ZirconiumX: nice!
<whitequark> about 30% more area, is it?
<ZirconiumX> 60% more :P
<whitequark> oh, right
<lambda> ZirconiumX: ah, interesting, wouldn't have expected flops to be anywhere near as cheap as LUTs
<ZirconiumX> lambda: It's possible Yosys is lowering them to constant drivers
<ZirconiumX> Since the flops are used for ROM
<whitequark> daveshah: if you ever feel like making cxxrtl faster, there's something i don't quite understand
<whitequark> i think there is a bug in a scheduler somewhere that prevents designs without feedback arcs from taking only 2 delta cycles
<whitequark> i haven't looked into it yet because... well, it's just slightly slower this way, yet still reliable
<whitequark> (a curious advantage of a design with delta cycles is that bugs in scheduler only result in slowdown, never correctness issues)
<ZirconiumX> I don't foresee adding 7-input functions because they're too specific for scavenging them from ABC9 output to produce meaningful results
<ZirconiumX> DSP inference is going to be awkward, because naturally it's not documented anywhere
<ZirconiumX> And BRAM inference requires directly instantiating the target cell
<ZirconiumX> Which is apparently like five layers of unsupported
<ZirconiumX> *BRAM initialisation
<ZirconiumX> whitequark: It surprises me how often I go back to the DE10-Nano support I added to nmigen-boards to remember the pin numberings
<whitequark> heh :)
citypw has quit [Ping timeout: 240 seconds]
jakobwenzel has quit [Quit: jakobwenzel]
<daveshah> welp, not quite a title screen yet, this is probably something wrong with my attempt to remove altera ram primitives though
<ZirconiumX> altsyncram, right?
* ZirconiumX has been wondering about trying to instantiate $mem or something from it
<whitequark> daveshah: ooh, send it to @mcclure111!
<ZirconiumX> FPGA glitch art :P
<mwk> ZirconiumX: like, making sim models for block RAMs?
<mwk> I tried and failed
<daveshah> ZirconiumX: no the dpram, spram, dpram_dif, etc IPs
<ZirconiumX> mwk: No, turning a user altsyncram into something memory_bram can operate on
<ZirconiumX> daveshah: oh lord
<daveshah> I don't really blame them
<daveshah> We all know BRAM inference is screwy and they only care about building with Quartus
<ZirconiumX> This attitude seems to persist with MiSTer...
<whitequark> to be fair, supporting multiple toolchains with verilog is hard
<daveshah> Indeed
<ZirconiumX> https://gist.github.com/ZirconiumX/dcf5f76675658f2d10937f176adc4a6e <-- my chess move generator (using post-fit stats and Fmax)
<tpb> Title: qvy_chess.txt · GitHub (at gist.github.com)
<daveshah> Some parts of memory inference is even more cursed in VHDL than Verilog
<ZirconiumX> It's *way* closer here
<whitequark> daveshah: you represent the memory as one gigantic register and then read chunks of it, right?
<daveshah> No, you can have arrays
<daveshah> It's true dual port that gets weird as you start to get into shared variables, which were significantly changed in VHDL 08 so one pattern stopped working
<ZirconiumX> 10MHz less Fmax, 2 LABs more area. That's not too shabby.
<lambda> ZirconiumX: wow, nice
<ZirconiumX> On the other hand I'm very consciously giving it workloads without things like RAM or multipliers
<daveshah> Hmm, that's very impressive
<daveshah> Particularly in terms of area which Yosys/ABC usually do quite badly on
<whitequark> nice
<ZirconiumX> My hunch is that it's the LUT4s that ABC is producing
<lambda> daveshah: from what I can tell shared variables were never a very good pattern, but somehow very common anyway. The "one process, two clock edges" approach should've always worked and is cleaner in a few ways
<ZirconiumX> Because an ALM can fit two independent LUT4s and two LUT5s that share only two terms
<ZirconiumX> I don't think it's that ABC is doing particularly well here, rather that Quartus can pack the result efficiently
<whitequark> what if you mark the LUTs as keep?
<ZirconiumX> I don't have e.g. WYSIWYG primitive resynthesis enabled, so it should be treated as keep
dys has joined #yosys
<ZirconiumX> wq: Yeah, no difference to the Yosys results
<whitequark> I see
az0re has joined #yosys
<ZirconiumX> I can try enabling resynthesis, if you're curious
<whitequark> i am
<ZirconiumX> ADV_NETLIST_OPT_SYNTH_WYSIWYG_REMAP
<ZirconiumX> Memorable, ain't it?
vidbina_ has quit [Ping timeout: 258 seconds]
N2TOH_US has quit [Ping timeout: 256 seconds]
<ZirconiumX> wq: slightly decreased area, slightly decreased Fmax.
<ZirconiumX> (stats on same link)
<whitequark> interesting
<ZirconiumX> Reduced flops, though
<ZirconiumX> Which is probably some level of sequential synthesis
dys has quit [Ping timeout: 240 seconds]
<daveshah> Yay, was a typo between vram1 and vram2
strongsaxophone has quit [Quit: Lost terminal]
<lambda> daveshah: awesome :D
<gtw> Very cool!
<cr1901_modern> nice... I forgot there was a free SNES HDL core
az0re has quit [Ping timeout: 240 seconds]
<ZirconiumX> Remind me again what BRAM transparency means?
<daveshah> Transparent means that when you read from a address that is being written to in the same cycle as the read address arrived, the new rather than old data appears
<ZirconiumX> If it's configurable, should I pick it or not?
<daveshah> It can be configurable in Yosys too
<ZirconiumX> Doesn't that then produce a parameter to instantiate?
<daveshah> Yes
<ZirconiumX> Unfortunately memory_bram doesn't tell me what the parameter is called
<whitequark> ZirconiumX: the manual lists the parameter
<ZirconiumX> whitequark: Where? It's not in command-reference-manual.tex
<daveshah> It looks like the parameters for memory_bram created cells are indeed undocumented
<whitequark> hm
<whitequark> did I forget to put them in? apologie
<whitequark> *apologies
strobokopp has joined #yosys
<ZirconiumX> It seems to be the RD_TRANSPARENT parameter?
<daveshah> I think that is for $mem cells
<daveshah> It is called TRANSPn for memory_bram created cells
<daveshah> where n is the port
<daveshah> *not the port, but the number given in the transp section in the config
<ZirconiumX> transp 0 2 <-- this would have a TRANSP2?
<daveshah> Yes
<ZirconiumX> What about if `clocks` is configurable?
<daveshah> clocks isn't configurable
<daveshah> values greater than 1 are just different clock signals
<daveshah> with 0 being unclocked
<ZirconiumX> Yeah, but an MLAB read port can either be sync or async
<daveshah> Then you need two different BRAM entries
<ZirconiumX> Okay
az0re has joined #yosys
Cerpin has quit [Quit: Lost terminal]
Cerpin has joined #yosys
emeb_mac has joined #yosys
npe has quit [Ping timeout: 256 seconds]
<ZirconiumX> Quartus is giving me a headache
<ZirconiumX> It lets you build a 32x2 LUTRAM (as the documentation says) but only sometimes
N2TOH has joined #yosys
jfcaron has quit [Ping timeout: 258 seconds]
<ZirconiumX> daveshah: Having problem mapping the ROM in attosoc; I have an async-read initialisable LUTRAM (that I'm using for testing) but memory_bram is giving up
<daveshah> Yeah, the rom in attosoc doesn't map to bram
<daveshah> It was a horrible pattern because at the time objcopy didn't write more than 8 bit inits
<daveshah> And I cba to write a better was at the time ecp5 bram wasn't even supported
<daveshah> *better way
<ZirconiumX> Ugh; I need a testbench for BRAM init
<daveshah> This newer attosoc variant should
<tpb> Title: nextpnr-xilinx/xilinx/examples/attosoc at xilinx-upstream · daveshah1/nextpnr-xilinx · GitHub (at github.com)
<ZirconiumX> Yep, it does
twnqx has joined #yosys
<twnqx> is there a simple, yosys-friendly way to say "output 0 if the number of set bits is 0 or 1, output 1 else" with four inputs?
<ZirconiumX> twnqx: Write a case, I suppose
<ZirconiumX> Or else a small if/else chain
<twnqx> thought so. ok
<ZirconiumX> daveshah: So, uh, new attosoc doesn't boot under either Quartus or Yosys
<daveshah> Are the LEDs half on by any chance?
<ZirconiumX> No; under Quartus they are fully on, and under Yosys it gets to 2 and then freezes
<daveshah> Oh, that's odd
<ZirconiumX> No, it's even /s
<daveshah> That is a simulation test I realise so it has no delay loop
<daveshah> Try this firmware with it
<tpb> Title: nextpnr-xilinx/firmware.hex at xilinx-upstream · daveshah1/nextpnr-xilinx · GitHub (at github.com)
<daveshah> Note that one only uses 4 LEDs
<ZirconiumX> That works
strobokopp has quit [Ping timeout: 240 seconds]
<ZirconiumX> Now I have the fun question of trying to figure out why RAM init is failing
<ZirconiumX> Which is fairly tricky when there are encrypted simulation models
<ZirconiumX> daveshah: How do I convert an integer into a hex string in Verilog?
<daveshah> Some for loop monstrosity probably
<ZirconiumX> The reason I ask is this hint: parameter mem_init0 = "";
N2TOH has quit [Read error: Connection reset by peer]
N2TOH_ has joined #yosys
X-Scale` has joined #yosys
X-Scale has quit [Ping timeout: 240 seconds]
X-Scale` is now known as X-Scale
twnqx has quit [Ping timeout: 272 seconds]
develonepi3 has joined #yosys
develonepi3 has left #yosys ["Leaving"]
dxld has quit [Ping timeout: 265 seconds]
dxld has joined #yosys