_florent_ changed the topic of #litex to: LiteX FPGA SoC builder and Cores / Github : https://github.com/enjoy-digital, https://github.com/litex-hub / Logs: https://libera.irclog.whitequark.org/litex
tpb has quit [Remote host closed the connection]
tpb has joined #litex
Degi_ has joined #litex
Degi has quit [Ping timeout: 260 seconds]
Degi_ is now known as Degi
Emantor has quit [Quit: ZNC - http://znc.in]
Emantor has joined #litex
<swetland> I think I've missed _florent_ but maybe somebody else knows -- what's the mechanism to fix the litex CSR base addresses?
<tnt> (ok, this example is more complex than needed because they use a class generator for some reason but couldn't google for an online example ...)
<tnt> you basicaly just put a csr_map = { } variable in your SocBase that contains the base address for the modules
<swetland> yay! I am really lousy at deciphering all the piles of python. thanks
<swetland> it probably says something (worrisome) about me that I find qemu's elaborate C object system less puzzling ^^
<swetland> I am saved from having to inflict devicetree or some other dynamic hw enumeration thing on a bunch of beginner/hobbyist os hackers ^^
<swetland> also I finally found a linux diagram tool that's not hateful. what a great day: https://twitter.com/dnaltews/status/1522578533301645313
<swetland> huh. I can't make it work, with or without the **soc_class.csr_map, **{ business
<swetland> it ignores my map and just puts the csrs whereever it wants
<swetland> oh wait, operator error
<swetland> (stuck it inside the __init__ method
<_florent_> swetland: you can do it like this at the top:
<_florent_> or directly in your code like this:
<_florent_> by default, LiteX automatically collect/assign the CSR base address, this allows you to force/reserve them
<swetland> thanks! what's the **{ business about? overriding a csr_map in the superclass?
<swetland> I've now got qemu, ULX3S and IceSugarPro in agreement about peripheral bases and interrupt numbers, which is very nice
<swetland> I know mithro doesn't have a ton of interest in qemu, but if others do, I'm assembling some patches to provide compatible peripherals in this repo: https://github.com/swetland/qemu/commits/workshop
<xobs[m]> I tend to do all of my sim work in Renode, just because it's a lot easier to implement peripherals, and it works cross-platform. It's really nice to see more examples of how to add peripherals to qemu, though!
shoragan has quit [Excess Flood]
shoragan has joined #litex
shoragan[m] has quit [*.net *.split]
Melkhior has quit [*.net *.split]
gatecat has quit [*.net *.split]
joseng has quit [*.net *.split]
gatecat has joined #litex
shoragan[m] has joined #litex
Melkhior has joined #litex
<swetland> xobs: I tried renode but most of the litex peripherals did not operate like they did in litex on the fpga
<swetland> at that point, already invested in qemu, I just kept going there. I do want to revisit renode at some point, it seems very slick.
<swetland> qemu suffers from the same problems the linux kernel does: enormous codebase, fast moving, documentation on development is rather thin, lots of examples but they use different APIs, styles, etc and it's sometimes hard to figure out what's the modern vs old fashioned way of doing something.
TMM_ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
TMM_ has joined #litex
<swetland> okay this patch stack is tidied up, includes the litex-timer, and uart and timer are both happily working in irq mode now: https://github.com/swetland/qemu/commits/litex
<tpb> Title: Carl's Arty CI for Tim - Pictures and Links - Google Docs (at docs.google.com)
<mithro> swetland: I think I mentioned that the lack of config file support in QEMU was what ended up stopping my QEMU work
<mithro> swetland: I did investigate the idea of using devicetree to configure QEMU and others had proposed that idea too
<mithro> swetland: Did you generate a Renode configuration for your LiteX gateware?
<swetland> mithro: I did. the framebuffer crashed. turns out the registers are the multiple 8bit slices (some old litex model), and this impacts other peripherals as well
<swetland> my takeaway was that a number of the peripherals would need work before I could get anything working
<swetland> see the conversation on this issue: https://github.com/renode/renode/issues/324
<swetland> I will again suggest that device tree is maybe not the optimal answer and that while reinventing the wheel is not always great, not every existing solution is a good solution just because it exists.
<swetland> though as far as device tree goes, the point would be to indicate where the peripherals are right? instead of pushing DT *into* qemu why not have qemu generate DT for the machine it's emulating (which many machines in qemu already do) and have the litex build/bios generate DT, then in both cases whatever you're running would look at the DT for where everything is
<tpb> Title: LiteX Soft-CPU, FPGA and Firmware Support - Google Tabellen (at docs.google.com)
<swetland> nice
<mithro> swetland: agreed that it seems like the most logical solution would be for QEMU to have a config file format and then generate the device tree for the machine it was emulating.
<swetland> though looking at this it drives home the fact that I think litex really needs a vehicle to ensure registers/fields are stable even if the base addresses and irq maps may vary
<mithro> swetland: do you have an Google account so you could update the QEMU model?
<mithro> S/model/spreadsheet column/
<swetland> because I assume you don't want to start breaking the upstream linux, zephyr, etc drivers needless as qemu evolves
<swetland> I do. I haven't looked into how involved getting stuff upstream into qemu is yet
<mithro> BTW qmeu is so entrenched with Linux kernel developers at the moment that even if Renode is a better solution, QEMU support could still be useful
<swetland> I haven't looked at building renode from source, etc yet, so not sure how involved working on it is. qemu I just need a c compiler ^^
<mithro> swetland: I had a script here https://github.com/timvideos/litex-buildenv/blob/master/scripts/build-qemu.sh that generated a QEMU command line with a set of peripherals found in LiteX gateware
<mithro> swetland: BTW you can write peripherals for Renode without needing to recompile all of Renode - see xobs precursor stuff for example
<mithro> swetland: I would not say the QEMU command line generation script was better the "terrible, horrible, hack" either :-)
<swetland> that's nice. does that include updating/replacing the existing ones? there's definitely a lot of interesting stuff in renode
<mithro> swetland: you can subclass / extend an existing one
<swetland> yeah I think a solid argument could be made that qemu would benefit from a configuration language
<swetland> requested edit access to your spreadsheet if you want me to info on my patches
<mithro> swetland: there have been multiple attempts at getting a config language into QEMU with resulting multiple flame wars and people quoting.
<swetland> oh joy
<mithro> S/quoting/quiting/
<mithro> swetland: should have access now
<mithro> swetland: dunno if you are a rust person or not https://antmicro.com/blog/2021/07/rust-peripheral-support-in-renode/
<tpb> Title: Antmicro · Rust peripheral support in Renode (at antmicro.com)
<mithro> swetland: Renode can even co-similate with a peripheral being emulated by verilog code in Renode
<swetland> I have not had enough time to work with rust. I like a lot of the ideas. in practice it seems a bit fiddly. not a fan of the hyper-opinionated build system and package system
<swetland> now *that's* a useful feature
<tpb> Title: Co-simulating HDL models — Renode - documentation (at renode.readthedocs.io)
<swetland> co-simulation is super hand
<swetland> handy
<mithro> At some point, I would like to enable LiteX to export just a peripheral into verilog which is then embedded into Renode via verilator all automagically
<tpb> Title: Peripheral modeling guide — Renode - documentation (at renode.readthedocs.io)
<mithro> swetland: xobs is probably the most advanced Renode user outside of paying Antmicro customers
<swetland> so spreadsheet doesn'
<swetland> t have entries for the timer, interrupt controller (maybe that counts as vexriscv support)
<swetland> should I just add them?
<mithro> Yeah
<mithro> swetland: https://antmicro.com/blog/2021/09/cfu-support-in-renode/ is pretty cool, it is extending the simulated CPU with specific custom opcodes deligated to simulation in verilator
<tpb> Title: Antmicro · Boosting Machine Learning with tailored accelerators: Custom Function Units in Renode (at antmicro.com)
<mithro> Sometimes it is really hard to stop talking about Renode as there is just *so* many cool features it has
<swetland> it certainly looks promising
<mithro> swetland: oh, the functionality that Renode uses to bridge to verilator is the same Etherbone stuff that LiteX uses which allows you to also bridge between emulated CPUs and peripherals running on real hardware
<swetland> slick
<tpb> Title: LiteX Wishbone Bridge Infrastructure - Google Zeichnungen (at docs.google.com)
<tpb> Title: LiteX Bridge Protocol - Google Docs (at bit.ly)
<mithro> I'm sure I had some better diagrams somewhere
<tpb> Title: Renode Wishbone Bridge Infrastructure - Google Zeichnungen (at docs.google.com)
<mithro> A lot of this is demonstrated in the Fomu workshop
<mithro> Being able to poke/peek and single step the soft CPU via USB is pretty magical
<mithro> Anyway, lunch time for me
<swetland> later!
<jevinskie[m]> Does anybody have advice about adding a new PHY (max10 using altera gpio_lite primitives) to litedram? Are there specific test cases I can use? I’ve never done ddr3 bringup before but I figure building on litedram would be my best bet.
<jevinskie[m]> The DECA would be so wonderful with native litedram support! :)
<swetland> wow the video framebuffer has some serious impact on memory bandwidth ^^
<swetland> I get 20.4MB/s memset with video dma off, 3.1MB/s memset with it on
<swetland> 16bit fb gets me 7.7MB/s write bandwidth. I think I may add rgb233 or idx8 formats to get that up to 15MB/s or so
<_florent_> jevinskie[m]: I would recommend studying the S7DDRPHY and understand how serialization/deserialization/output delays/input delays/bitslip work. Then studying the Altera primitives and compare them to 7-Series (serialization ratios, latencies, etc..). This will allow you to create the skeleton of the PHY. Then you can use a model from Micron and do initial simulations (but not sure Verilator will work, you'll maybe have to use a
<_florent_> non open source simulator or the one provided by Quartus). Once things start to work correctly in simulation, start testing on hardware and debug :)
<_florent_> jevinskie[m]: I'm interested to help if you have troubles (and also have the DECA)
<jevinskie[m]> Thanks for the pointers! Yeah I’ve used the micron models before with modelsim. I’ll take a look at the 7 series. For the max10 I’ll definitely have to do the bitslip in logic
<mithro> swetland: I would double check what you expect the values to be and see if they match what you are seeing -- they should hopefully match within 20% to rough calculations.
<mithro> swetland: If you need a Fomu so you can do the Fomu workshop, I would be happy to send you one
<mithro> > G. Integration with LiteX - We wrap the top PiMulator System Verilog module in LiteX [14] and interface it with the LiteDRAM memory controller and VexRiscV processor system by defining a target script.