Saturday, 2022-05-07

*** tpb <[email protected]> has joined #litex00:00
*** Degi_ <[email protected]> has joined #litex00:13
*** Degi <[email protected]> has quit IRC (Ping timeout: 260 seconds)00:14
*** Degi_ is now known as Degi00:14
*** Emantor <[email protected]> has quit IRC (Quit: ZNC - http://znc.in)01:20
*** Emantor <[email protected]> has joined #litex01:20
swetlandI think I've missed _florent_ but maybe somebody else knows -- what's the mechanism to fix the litex CSR base addresses?04:36
tntswetland: csr_map https://github.com/litex-hub/zephyr-on-litex-vexriscv/blob/master/soc_zephyr.py#L4705:30
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 ...)05:31
tntyou basicaly just put a csr_map = { } variable in your  SocBase that contains the base address for the modules05:31
swetlandyay!  I am really lousy at deciphering all the piles of python. thanks05:35
swetlandit probably says something (worrisome) about me that I find qemu's elaborate C object system less puzzling ^^05:35
swetlandI am saved from having to inflict devicetree or some other dynamic hw enumeration thing on a bunch of beginner/hobbyist os hackers ^^05:37
swetlandalso I finally found a linux diagram tool that's not hateful. what a great day: https://twitter.com/dnaltews/status/152257853330164531305:38
swetlandhuh. I can't make it work, with or without the **soc_class.csr_map, **{ business05:54
swetlandit ignores my map and just puts the csrs whereever it wants05:55
swetlandoh wait, operator error05:55
swetland(stuck it inside the __init__ method05:57
_florent_swetland: you can do it like this at the top:06:57
_florent_https://github.com/litex-hub/linux-on-litex-vexriscv/commit/dec4cb399db6cf3e1f53433f6969946dd224f41906:57
_florent_or directly in your code like this:06:57
_florent_https://github.com/enjoy-digital/litex/blob/master/litex/soc/cores/cpu/naxriscv/core.py#L280-L28106:57
_florent_by default, LiteX automatically collect/assign the CSR base address, this allows you to force/reserve them06:58
swetlandthanks!  what's the **{ business about? overriding a csr_map in the superclass?06:58
swetlandI've now got qemu, ULX3S and IceSugarPro in agreement about peripheral bases and interrupt numbers, which is very nice06:59
swetlandI 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/workshop07:08
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! 12:54
*** shoragan <shoragan!~shoragan@user/shoragan> has quit IRC (Excess Flood)13:14
*** shoragan <shoragan!~shoragan@user/shoragan> has joined #litex13:14
*** shoragan[m] <shoragan[m]!~shoraganm@2001:470:69fc:105::39> has quit IRC (*.net *.split)14:56
*** Melkhior <Melkhior!~Melkhior@2a01:e0a:1b7:12a0:225:90ff:fefb:e717> has quit IRC (*.net *.split)14:56
*** gatecat <[email protected]> has quit IRC (*.net *.split)14:57
*** joseng <[email protected]> has quit IRC (*.net *.split)14:57
*** shoragan[m] <shoragan[m]!~shoraganm@2001:470:69fc:105::39> has joined #litex14:57
*** Melkhior <Melkhior!~Melkhior@2a01:e0a:1b7:12a0:225:90ff:fefb:e717> has joined #litex14:57
*** gatecat <[email protected]> has joined #litex14:57
swetlandxobs: I tried renode but most of the litex peripherals did not operate like they did in litex on the fpga15:28
swetlandat that point, already invested in qemu, I just kept going there.  I do want to revisit renode at some point, it seems very slick.15:29
swetlandqemu 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.15:30
*** TMM_ <[email protected]> has quit IRC (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)16:35
*** TMM_ <[email protected]> has joined #litex16:36
swetlandokay 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/litex17:43
mithro_florent_: FYI - https://docs.google.com/document/d/1jyodwCNK-9mokDAe6X1AMhEDPW-qPeqPTHI-z9aUGVg/edit# 17:54
tpbTitle: Carl's Arty CI for Tim - Pictures and Links - Google Docs (at docs.google.com)17:54
mithroswetland: I think I mentioned that the lack of config file support in QEMU was what ended up stopping my QEMU work17:55
mithroswetland: I did investigate the idea of using devicetree to configure QEMU and others had proposed that idea too17:55
mithroswetland: Did you generate a Renode configuration for your LiteX gateware?18:32
swetlandmithro: I did.  the framebuffer crashed. turns out the registers are the multiple 8bit slices (some old litex model), and this impacts other peripherals as well18:41
swetlandmy takeaway was that a number of the peripherals would need work before I could get anything working18:41
swetlandsee the conversation on this issue: https://github.com/renode/renode/issues/32418:42
swetlandI 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.18:45
swetlandthough 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 is18:46
mithroswetland: you might find some useful info at https://docs.google.com/spreadsheets/d/1XTHfdYXuvwoYdPXm4M6qDA0D2fZCPy220-9q6qZpTw4/edit?usp=drivesdk18:47
tpbTitle: LiteX Soft-CPU, FPGA and Firmware Support - Google Tabellen (at docs.google.com)18:47
swetlandnice18:47
mithroswetland: 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. 18:48
swetlandthough 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 vary18:48
mithroswetland: do you have an Google account so you could update the QEMU model?18:49
mithroS/model/spreadsheet column/18:49
swetlandbecause I assume you don't want to start breaking the upstream linux, zephyr, etc drivers needless as qemu evolves18:49
swetlandI do. I haven't looked into how involved getting stuff upstream into qemu is yet18:50
mithroBTW qmeu is so entrenched with Linux kernel developers at the moment that even if Renode is a better solution, QEMU support could still be useful18:50
swetlandI 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 ^^18:52
mithroswetland: 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 18:53
mithroswetland: BTW you can write peripherals for Renode without needing to recompile all of Renode - see xobs precursor stuff for example18:54
mithroswetland: I would not say the QEMU command line generation script was better the "terrible, horrible, hack" either :-)18:55
swetlandthat's nice.  does that include updating/replacing the existing ones?   there's definitely a lot of interesting stuff in renode18:55
mithroswetland: you can subclass / extend an existing one18:55
swetlandyeah I think a solid argument could be made that qemu would benefit from a configuration language18:55
swetlandrequested edit access to your spreadsheet if you want me to info on my patches18:56
mithroswetland: there have been multiple attempts at getting a config language into QEMU with resulting multiple flame wars and people quoting.18:56
swetlandoh joy18:57
mithroS/quoting/quiting/18:57
mithroswetland: should have access now18:57
mithroswetland: dunno if you are a rust person or not https://antmicro.com/blog/2021/07/rust-peripheral-support-in-renode/18:58
tpbTitle: Antmicro · Rust peripheral support in Renode (at antmicro.com)18:58
mithroswetland: Renode can even co-similate with a peripheral being emulated by verilog code in Renode 18:58
swetlandI 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 system18:59
swetlandnow *that's* a useful feature18:59
mithrohttps://renode.readthedocs.io/en/latest/tutorials/verilator-cosimulation.html18:59
tpbTitle: Co-simulating HDL models — Renode - documentation (at renode.readthedocs.io)18:59
swetlandco-simulation is super hand18:59
swetlandhandy18:59
mithroAt some point, I would like to enable LiteX to export just a peripheral into verilog which is then embedded into Renode via verilator all automagically19:00
mithroswetland: take a look at https://renode.readthedocs.io/en/latest/advanced/writing-peripherals.html some time19:01
tpbTitle: Peripheral modeling guide — Renode - documentation (at renode.readthedocs.io)19:01
mithroswetland: xobs is probably the most advanced Renode user outside of paying Antmicro customers19:02
swetlandso spreadsheet doesn'19:02
swetlandt have entries for the timer, interrupt controller (maybe that counts as vexriscv support) 19:03
swetlandshould I just add them?19:03
mithroYeah 19:04
mithroswetland: 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 19:05
tpbTitle: Antmicro · Boosting Machine Learning with tailored accelerators: Custom Function Units in Renode (at antmicro.com)19:05
mithroSometimes it is really hard to stop talking about Renode as there is just *so* many cool features it has 19:09
swetlandit certainly looks promising19:10
mithroswetland: 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 hardware19:10
swetlandslick19:11
mithrohttps://docs.google.com/drawings/d/13bRFtmgb7Og6hmWEYqxPrfbshxPwuIRDJ0NzPKeBoZs/edit?usp=drivesdk19:11
tpbTitle: LiteX Wishbone Bridge Infrastructure - Google Zeichnungen (at docs.google.com)19:11
mithrohttp://bit.ly/litex-bridge-proto19:12
tpbTitle: LiteX Bridge Protocol - Google Docs (at bit.ly)19:12
mithroI'm sure I had some better diagrams somewhere19:12
mithrohttps://docs.google.com/drawings/d/1tfDZcxK3Ui8EaOnEDisxe8_LyromUIGIFkmcP76gBdc/edit?usp=drivesdk19:13
tpbTitle: Renode Wishbone Bridge Infrastructure - Google Zeichnungen (at docs.google.com)19:13
mithroA lot of this is demonstrated in the Fomu workshop 19:16
mithroBeing able to poke/peek and single step the soft CPU via USB is pretty magical19:16
mithroAnyway, lunch time for me19:17
swetlandlater!19:18
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.19:50
jevinskie[m]The DECA would be so wonderful with native litedram support! :)19:51
swetlandwow the video framebuffer has some serious impact on memory bandwidth ^^20:28
swetlandI get 20.4MB/s memset with video dma off, 3.1MB/s memset with it on20:29
swetland16bit 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 so20:44
_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 20:57
_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 :)20:57
_florent_jevinskie[m]: I'm interested to help if you have troubles (and also have the DECA)20:58
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 logic21:31
mithroswetland: 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. 22:29
mithroswetland: If you need a Fomu so you can do the Fomu workshop, I would be happy to send you one22:29
mithroThe paper at https://www.researchgate.net/profile/Sergiu-Mosanu/publication/360226899_PiMulator_a_Fast_and_Flexible_Processing-in-Memory_Emulation_Platform/links/6269a750d99ac24cc46e4339/PiMulator-a-Fast-and-Flexible-Processing-in-Memory-Emulation-Platform.pdf seems to be doing stuff with LiteX22:50
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.22:51

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!