Monday, 2020-06-15

*** tpb has joined #litex00:00
*** Degi has quit IRC02:21
*** Degi has joined #litex02:22
*** midnight has joined #litex03:38
*** _whitelogger has quit IRC04:18
*** _whitelogger has joined #litex04:20
*** CarlFK has quit IRC04:45
*** CarlFK has joined #litex04:52
*** st-gourichon-fid has joined #litex05:14
_florent_thanks for looking at this somlo, zyp. That's also a bit out of my confort zone, but could try to help. We could use the simulation with verilator to reproduce the issue and fix it correctly on at least one CPU first (running a simulation with SERV or Vexriscv is just a few seconds) and i could apply the change to the others CPU.05:26
*** _whitelogger has quit IRC06:42
zypsomlo, how did it go?06:44
*** _whitelogger has joined #litex06:44
*** tcal has quit IRC07:02
zypI fixed the CRC code as well and am building for vexriscv now07:18
zypfun, that broke everything because apparently the BIOS for vexriscv adds a .got section07:47
zypI've got a solution that appears to work on vexriscv now, I'll spend some time looking at the other cpus as well and then submit a PR08:52
zypbut I've got some errands to run before that, so it might be a while08:52
benhright I noticed our .lds might need to be enriched to support more sections08:54
benh.got comes to mind08:55
benhthe kernel is a good example of how messy it can get :)08:55
benhsome archs might have a .toc or .opd08:57
somlozyp: commenting out the crc function allowed the bios to proceed, but then it went on to print out a bunch of garbage and eventually crash09:36
somloprintf says content (at least first 16 bytes) starting at 0x10008600 are not the same as content starting at 0x1100000009:37
somlogotta be afk for a few hours, bbl09:37
zypI tried --cpu-type rocket, but litex is failing with this: https://paste.jvnv.net/view/dsI8G11:17
tpbTitle: JVnV Pastebin View paste – Untitled (at paste.jvnv.net)11:17
zypapparently it wants to connect a 64-bit cpu port to a 128-bit memory port, and upconversion is not supported11:18
zypokay, --cpu-variant linuxd solves that11:34
*** futarisIRCcloud has quit IRC11:51
zypappears to work perfectly here on both vexriscv and rocket now: https://paste.jvnv.net/view/WFsom12:15
tpbTitle: JVnV Pastebin View paste – Untitled (at paste.jvnv.net)12:15
benhMemspeed Writes: 1047Mbps Reads: 1051Mbps12:49
benh:-)12:49
benhMicrowatt's getting there ... (standalone MW with a full 64-bit pipelined wishbone and my L2 cache)12:49
benhhopefully we'll get that in LiteX soon12:49
*** Skip has joined #litex12:55
*** somlo has quit IRC13:23
*** somlo has joined #litex13:25
somlozyp: mind posting a patch (or sending a PR, and linking issue #566)?13:27
zypI'll do a PR, but I'm looking at having a go at all the other cpus as well13:29
zypbenh, as far as I can tell, microwatt/crt0.S doesn't even set up .bss, is that correct?13:46
keesjwhat is microwatt?14:09
keesjhttps://github.com/enjoy-digital/litex/blob/master/litex/soc/cores/cpu/microwatt/core.py14:09
tpbTitle: litex/core.py at master · enjoy-digital/litex · GitHub (at github.com)14:09
keesjwow.. it is vhdl code14:10
keesj(just had a 4 days advanced security training using FPGA / verilog) https://advancedsecurity.training/training/live-fpga-hacking . I became better a verilog but.well..14:13
keesjI also tried to do the assignments with litex (parts of them) but I was kinda lacking a UART RX/TX block that is simple enough to mess arround with (not one to access via wishbone or .. to complicated)14:14
keesjand the second "problem" I had (that I solved) was when using additional pins bit is just a little bit cumbersome if you are trying to prove "litex is much better"14:15
zypsomlo, https://github.com/enjoy-digital/litex/pull/56714:41
tpbTitle: bios/linker: Place .data in sram with initial copy in rom. by zyp · Pull Request #567 · enjoy-digital/litex · GitHub (at github.com)14:41
*** tcal has joined #litex15:08
somlozyp: thanks! I tried, it, but it's printing garbage to the terminal for me (starting with the sdram initialization output), then eventually hangs16:19
somlowell, if I don't try to boot from sdcard it works (boots from ethernet)16:20
somloso I think we're on the right track, just not 100% there yet16:21
*** Skip has quit IRC16:36
*** Dolu has joined #litex17:01
DolufutarisIRCcloud, about the DMIPS in linux. One big issue is currently that the strcmp used for userspace is a stupid loop which check one byte at the time, instead of the word based one which is used in barmetal/newlib17:03
DoluSo, in barmetal, the CPU configuration used is about 1.1 or 1.2 DMIPS/Mhz17:06
Dolu(baremetal => not the same libc => optimized strcmp)17:07
DoluNot sure if that was strcmp or strlen XD, but one of those function was realy dumply implemented in the linux libc17:08
DoluThen about the memory speed, in addition of what florent said, there is also the fact that the i$ bus is 128 bits wide / d$ bus is 64 bits wide on the SMP cluster. On the single core version they are both only 32 bits wide, which result into high cache miss penality (transfer time)17:13
zypsomlo, I wonder if the problem is that putting .data in sram leaves less room for the stack, so stack grows into .bss17:22
zypsomlo, any chance you could try simply increasing sram size?17:22
zypworst case we rule out that as an issue17:23
somlozyp: trying now (it's only 4k by default, trying 32k). If that works, I'll have to also try this whole thing on an 85k ecp5 board, there might be less wiggle room there...17:35
*** Skip has joined #litex17:44
*** Dolu has quit IRC17:56
*** kgugala_ has joined #litex18:01
*** kgugala has quit IRC18:05
zypif 4k is too little, it's probably enough to increase by one block or so, as far as I can tell .data itself tends to be less than 1k18:06
*** Dolu has joined #litex18:07
zypit was 776B in the bios.elf you sent me yesterday18:07
DoluThere is a past bin with the two version of memcmp : https://pastebin.com/QL9CSuF6 . Quite some difference. I'm now mesuring in a simulation the drhystone run, to be sure there is not something else hidden.18:08
tpbTitle: [M68000 Assembler] linux libc : 0007764c : 7764c: 00150513 add - Pastebin.com (at pastebin.com)18:08
*** kgugala has joined #litex18:26
*** kgugala_ has quit IRC18:29
somlozyp: works like a charm with 8x the default :)18:32
somlowe should come up with a reasonable number for the new default, maybe incorporate that into the PR with a note in the commit blurb18:33
somloprobably doubling it to 8k will work, I can try it now that my knee-jerk "make it BIG" thing has panned out :)18:34
zypif it worked at 4k before, I'm confident it'd work at 6k now, unless it actually had a collision before as well that just didn't show any symptoms18:35
zypbut yeah, 8k is a rounder number18:35
zyp.data and .bss are easy to find the requirements for, since you can just read those right from the elf header, but stack usage is harder18:37
zypI did some experiments many years ago extracting function stack frame and call tree information from gcc to find the maximum stack usage, but as soon as you have any indirect calls, building a complete call tree gets pretty hard18:40
somlothe default setting is pretty self-contained, here: https://github.com/enjoy-digital/litex/blob/master/litex/soc/integration/soc_core.py#L78 and here: https://github.com/enjoy-digital/litex/blob/master/litex/soc/integration/soc_core.py#L26718:40
tpbTitle: litex/soc_core.py at master · enjoy-digital/litex · GitHub (at github.com)18:40
*** tcal has quit IRC19:03
somlozyp: doubling sram works (is sufficient). Would you mind pushing an additional commit to PR #567 to modify the default in soc_core.py?19:15
zypsure, only need to change those two places?19:15
*** tcal has joined #litex19:16
somlothat's where the default comes from on every target's command line, as far as I can tell19:17
zypdone19:18
somlozyp: cool beans, I changed my hacky workaround for the global variable to let it remain in .data :)19:36
zypgreat, now we just need the two last cpus fixed as well19:39
*** FFY00 has quit IRC19:56
*** FFY00 has joined #litex19:57
*** st-gourichon-fid has quit IRC21:43
DolufutarisIRCcloud: I investigated more about the dhrystone package in buildroot and how that's compiled. And basicaly that's shity. It's compiled in -Os instead of -O3, and i can't spot any -fno-inline. Most of the time, the CPU has to run into strcpy and strcmp which are pretty bad compared to the bar metal version.21:49
Doluwith the SoC in baremetal, you should get about 1.08 DMIPS/Mhz, i turned off quite some feature while i was trying to boost the cluster frequancy (should be able to go up to 125 Mhz with some margin)21:58
zyp-Os doesn't tend to be too bad though, it's -O2 with a few speed for size tradeoffs22:12
Doluzyp: In that specific case, that's prety bad, basicaly, the strcpy of the benchmark is using 200 instructions per benchmark loop, instead of 20. On bar metal, one benchmark loop is 322 instructions.22:27
zypfair enough22:28
*** tpearson-mobile has joined #litex23:27
tpearson-mobileSo I'm trying to use the SpiFlash peripheral in MMIO mode with a Micron SPI part23:27
tpearson-mobilewhen I try to do a dump of the MMIO space, all I get is 0xa0000000  00 00 00 00 44 44 44 44 88 88 88 88 cc cc cc cc23:27
tpearson-mobile0xa0000010  00 00 00 00 44 44 44 44 88 88 88 88 cc cc cc cc  ....DDDD........23:27
tpearson-mobileetc.23:27
tpearson-mobileobviously I'm missing something, any hints? :)23:28
tpearson-mobileis this what the peripheral does when it can't talk to an external SPI (it does the same thing with the SPI pins completely disconnected, FWIW) or is this a more fundamental problem with the SoC configuration?23:29
*** Dolu has quit IRC23:36
awordnottpearson-mobile: which flash part are you using? Looking at the SpiFlash peripherals' code it seems like they only support spi mode 3 so the part will need to support that23:49
tpearson-mobileyeah it supports mode 323:50
tpearson-mobileN25Q51223:50
tpearson-mobilenearly identical to the N25Q128 that's already on the Versa board23:50
awordnotand you're sure you're looking at the right MMIO address range?23:51
tpearson-mobileshould be, yeah23:51
tpearson-mobile    mem_map = {        "hostspiflash": 0xa0000000,    }23:51
tpearson-mobileand "mr 0xa0000000 32"23:51
tpearson-mobileI was honestly expecting tis to "just work"23:52
awordnothmm, well I don't see anything in the code that would artificially generate that pattern you're seeing (unless I'm missing it)23:52
awordnotwhich is strange23:53
tpearson-mobilehere's the tie in: https://paste.ee/p/lZ9Yw23:53
tpbTitle: Paste.ee - View paste lZ9Yw (at paste.ee)23:53
tpearson-mobileand yeah, I'm puzzled23:53
awordnotwhen you run the soc builder, does your 'hostspiflash' memory region get printed out?23:55
tpearson-mobileINFO:SoCBusHandler:hostspiflash Region added at Origin: 0xa0000000, Size: 0x04000000, Mode: RW, Cached: True Linker: False.INFO:SoCBusHandler:hostspiflash added as Bus Slave.INFO:SoCCSRHandler:hostspiflash CSR allocated at Location 7.23:56
awordnothmm yeah everything looks good in terms of the SpiFlash instantiation. I guess the next thing to check would be the pinout23:59

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