Wednesday, 2020-05-13

*** tpb has joined #litex00:00
*** HoloIRCUser has joined #litex00:37
*** HoloIRCUser2 has joined #litex00:37
*** HoloIRCUser1 has quit IRC00:40
*** HoloIRCUser has quit IRC00:41
*** Skip has joined #litex01:09
*** HoloIRCUser2 has quit IRC01:58
benh_florent_: not quite working yet :-) See emails02:04
*** darren099 has quit IRC02:10
*** futarisIRCcloud has quit IRC02:18
*** futarisIRCcloud has joined #litex03:03
*** Degi has quit IRC03:29
*** Degi has joined #litex03:30
*** Skip has quit IRC03:38
*** HoloIRCUser has joined #litex03:43
*** rohitksingh has joined #litex05:34
*** futarisIRCcloud has quit IRC05:43
*** HoloIRCUser has quit IRC06:20
*** futarisIRCcloud has joined #litex06:25
benh_florent_: so your latest change is triggering its own slew of problems10:06
benh_florent_: as I wrote in my response, the values in csr.h are wrong ... I tried using my own CSR accessors via CSR_ACCESSORS_DEFINED10:07
benh_florent_: but that's broken by all the "new" accessors in common.h10:07
benhthings like csr_rd_buf_uint810:07
benhthere is no extern definition of them in csr.h10:07
benhand they are not defined at all by common.h when CSR_ACCESSORS_DEFINED is set10:08
benhso essentially, whatever CSR_ACCESSORS_DEFINED might have once been intended for, it's broken10:08
*** CarlFK has quit IRC10:09
benhthat said, those "new" accessors are also broken in different ways (my earlier discussion on this a few days ago) since they don't do memory barriers or similar10:09
benhit's particularly broken in that the new accessors will always do 64-bit accesses10:10
benhon a 64-bit platform10:10
benhso they will always 2 consecutive accesses to a 32-bit downconverted wb/csr bus10:11
benhwhich is not ideal, or even broken if you don't also set csr_alignment to 64-bit10:11
benhtrying to fix that stuff but I'll need help testing the changes10:27
benhsomlo: ping10:35
benhsomlo: is it me mis-reading the code or are the "new" CSR accessors such as _csr_rd assume that CSRs are spaced "unsigned long" appart ?10:37
benhsomlo: ie, 64-bit appart on a 64-bit system, and 32-bit appart on a 32-bit system10:37
benhsomlo: due to how you just index a unsigned long* to increment addresses10:37
*** Dolu has joined #litex10:38
benhsomlo: shouldn't it instead be incremented by CONFIG_CSR_ALIGNMENT/8 bytes ?10:38
benhsomlo: for example on microwatt I can have a setup such that CSRs are 32-bit appart on a 64-bit system10:38
benh(I don't have to ... but I can :-)10:38
benhalso you can have processors that can run either 32-bit or 64-bit code...10:39
benhsomlo: _florent_ : If you have a chance, can you take aa peek at https://pastebin.com/jZNstq5810:50
tpbTitle: [C] --- a/litex/soc/software/include/hw/common.h +++ b/litex/soc/software/include/h - Pastebin.com (at pastebin.com)10:50
benhmostly untested (other than my sdram init builds :-)10:50
benhbut this allows to override csr_{read,write}_simple and have everything else built on top of them10:50
benhit shoudl also fix cases where CONFIG_CSR_ALIGNMENT/8 != sizeof(unsigned long)10:51
*** CarlFK has joined #litex10:54
somlobenh: CONFIG_CSR_ALIGNMENT/8 should always equal sizeof(unsigned long)10:57
benhsomlo: who says ?10:59
benhie, why ? :-)10:59
somlohttps://github.com/enjoy-digital/litex/blob/master/litex/soc/software/include/hw/common.h#L3010:59
tpbTitle: litex/common.h at master · enjoy-digital/litex · GitHub (at github.com)10:59
benhanyways, see the patch I posted, tell me what you think10:59
benh_florent_: this change of yours looks broken in litedram:         if cpu_type is None:10:59
benh            wb_bus = wishbone.Interface(self.bus.address_width)10:59
benhie, you removed adr_width= so it's now setting the *data* width11:00
somlobenh: because it's always been 32 until the first 64bit CPU was added to litex (rocket), and I had to make it 64 on 64 to get it to work properly :)11:01
benhsomlo: well, that's my whole point :-)11:01
benhsomlo: I don't like how you wrote that code11:01
benhand it's a mistake to make that assumption that CSRs are unsigned long spaced11:01
benhand it's a bigger mistake to dereference an unsigned long to access them for a number of reasons11:02
benhone big one being that you can't just "access" IOs like that on most CPU architectures, you need things like memory barriers etc..11:02
somlobut right now they *are* -- not opposed to expressing that better, or fixing the underlying hardware so they don't *have* to be, but right now them's the breaks :)11:02
benhbut you can have a 32-bit wishbone bridged11:02
benhon your 64-bit main bus11:02
benhwhich means now each of your CSR access turns into *2* accesses... pointlessly11:03
benhsomlo: well, my point is that code is broken :-) Anyway, see the pastebin link I pasted above11:03
benhit's a quick attempt at fixing this and re-viving the ability to provide custom accessors with CSR_ACCESSORS_DEFINED which all those new things broke11:03
somloI remember something about the CSR bus lacking a byte select signal, and adjacent registers being inadvertently "touched" without the software meaning to, on 64bit11:04
benhit's mostly untested for now as I'm working through other changes but please provide feedback11:04
benhsomlo: well, if they are 64-bit appart, that hopefully won't happen but you might end up still doing weird things11:04
benhlike writing the same reg twice11:04
benhagain, *hopefully* my changes should fix all that11:05
benhthe basic idea is that all the new fangled accessors are expressed on *top* of csr_{read,write}_simple and don't do poitner magic, but instead calculate the proper offset between registers11:05
benhand the csr_{read,write}_simple implementation is responsible for using the right access size11:05
benhI haven't fixed the latter in the general case yet11:06
benhonly for me as I provide custom  ones (with the proper memory barrier)11:06
benhbut I'll do that next11:06
somloI'm ok with rewriting a[i] as csr_*_simple(a) if that's the question :)11:06
benhand taking out the pointer arithmetic11:06
benhnext (which I haven't done yet) is I'll make the default implementation of csr_*_simple use a csr_type * where csr_type is defined to the right uint64_t/uint32_t/uint8_t11:07
benhhowever, anything with an out of order memory model will probably need to provide its own implementation using appropriate IO accessors11:07
benhI'll look into that next, it will be needed for powerpc at least11:08
benh_florent_: I'm having some trouble figuring out how the CSR address decoding is done :-) It looks like the generated verilogg checks address bits 0 and 1 on 32-bit CSRs with 64-bit aliggnment11:13
benh_florent_: so I have to pass it something padded with "000" on the right11:13
benhsomlo: generally LiteX needs proper IO accessors11:30
benhprovided by the CPU implementation/wrapper11:36
somlobenh: if by that you mean `csr_[read|write]_simple()`, I agree. But I'd rather keep the higher-level (compound) register code common11:48
benhsomlo: agreed, which is why I would like to build it on top of the simple ones11:51
benhsomlo: https://github.com/ozbenh/litex/commits/csr-access-rework11:54
tpbTitle: Commits · ozbenh/litex · GitHub (at github.com)11:54
benhsomlo: let me know what you think please :-)11:54
benhsomlo: I'll try to test it a bit in the meantime11:54
somlobenh: tbh, I used a[i] mostly because it helped me keep track of what's going on. But now that it's moe or less debugged and seems to work, I'm totally ok with factoring out the simple accesses as standalone functions11:58
somlode002fe does that, as far as I can tell11:58
somloI can try to test it later today, too, see what happens11:59
benhsomlo: cool, thanks !12:01
benhsomlo: if you're happy with it I'll send _florent_ a PR12:03
somlowell, I tried building it, but there's syntax errors (token "=" is not valid in preprocessor expressions) :)12:03
somloyou wanna fix it and I can try again, or should I switch that to "==" locally ?12:03
benhsomlo: ah I have my own CSR defs .. so I might have mangled that12:03
benhsomlo: either, fixing it now12:04
benhthat's the doom of constantly switching between programmingg languages :-)12:04
benhpushed12:05
somlobuilding now (for the trellisboard, with gateware and all, so it'll be 20-30 minutes)12:06
benhsomlo: ok, thanks !12:07
benhat some point I'll try to figure out how to add a cpu.h include that's provided by the cpu definition12:07
benhwe''ll need things like proper IO accessors and memory barriers for DMA etc...12:07
benhthat is then included by hw/common.h12:08
benhthat will esp. matter when Dolu has SMP going as memory barriers, locks etc... are going to be a must have12:08
benhand those are at least architecture specific12:08
benhunless we entirely rely on the new fangled C primitives but ...12:09
somlolike the equivalent of `[read|write][l|q]()` in linux12:09
benhyup12:10
benhand memcpy_to/from_IO for ethernet12:10
benhand smp_mb/rmb/wmb, spinlocks, etc...12:10
benhfor SMP VexRiscV12:11
benhetc...12:11
somloRocket could also be SMP, on larger FPGAs (I can barely fit a single core on ecp5, so it's never been a direct concern :)12:12
benhyeah a lot of these things aren't a concern ... yet :)12:13
benhbut we fix microwatt in an Arty 35T today.. we could fit 2 in a 100T ;)12:14
Dolubenh: 2 SMP linux ready cores in 100T ?12:18
Dolubenh: about the smp stuff hw/common.h, you talk about its integration into the litex bios ?12:42
_florent_benh: sorry, i wasn't on irc12:47
somlobenh: c9fb9cd `Reviewed-by: Gabriel Somlo <[email protected]>` fwiw (no mailing list to do this over) :)12:54
zypsomlo, fit on a -85, or smaller?12:55
somlozyp: a linux-capable (though FPU-less) 64bit rocket + litex SoC utilizes cca. 60% of the -85 on a trellisboard, at the moment12:56
somloa FPU-enabled single-core 64bit rocket will *not* fit on the -8512:57
zypI see12:57
zyphow does the ecp5 size figures compare to the artix-7 ones? is there a rough factor for comparisons?12:59
somlozyp: the fpu-less single-core 64bit rocket *sometimes* fits on a -45 (on the ecp5 versa 5g). Utilization dances around the 100% logic block mark, and sometimes, when the stars align, you get 99% fromthe placer and routing can proceed12:59
somlozyp: I think that's more of a daveshah question; I know I can do a fpu-enabled single-core rocket on the nexys4ddr (artix-7-100)13:00
somlo(with vivado, so not exactly apples-to-apples)13:01
zypalso, how far are we from being able to do a full artix-7 flow with open tools?13:02
zyp(somebody stop me if I'm asking too many stupid and/or offtopic questions)13:03
daveshahnextpnr for xilinx is probably a year away from being something I would actually recommend end users to use13:04
daveshahidk about vpr13:04
zypwhat's the current state of nextpnr for xilinx? working but for a subset of features?13:06
benhsomlo: thanks13:07
benhsomlo: I'll send a PR13:07
benhDolu: among others yes13:07
soreargiven that riscv32 is probably never going to be well supported by binary distros, a more resource-efficient riscv64 is something I would like to see13:07
daveshahzyp: yes, roughly13:08
zypdaveshah, does a full nextpnr flow rely on any non-free bits at the moment, or is it possible to go all the way from verilog to a bitstream?13:11
daveshahYou can go all the way to a bitstream with prjxray13:12
zypnice13:14
*** Skip has joined #litex13:29
Dolubenh: So, basicaly, the integration which was done for VexRiscv SMP into litex bios is the following : https://github.com/enjoy-digital/litex_vexriscv_smp/tree/master/vexriscv_smp13:42
tpbTitle: litex_vexriscv_smp/vexriscv_smp at master · enjoy-digital/litex_vexriscv_smp · GitHub (at github.com)13:42
DoluOnly hart 0 get through crt0 to the bios code, the others will wait, and only be unlocked at the last moment before jumping into the payload (opensbi / linux)13:43
DoluSo, nearly nothing SMP at the litex bios level13:44
benhDolu: ok, so yes, system.h isn't a bad place for that I suppose though it should probably be cpu.h13:46
benhfor core specific bits13:46
benhDolu: we would want a way to put MMIO accessors in there as well... I can propose something later, it's past bed time here :)13:46
benh_florent_: btw, microwatt will probably break on/off with LiteX ... I'll fix things up soon. The way we feed interrupts to the core for example is probably due to change13:49
Dolubenh: Ahh right, MMIO accessors should be added13:56
Dolusorear: unfortunatly :(, i have no good idea how much RV64 would inflate VexRiscv13:57
benhmicrowatt with MMU takes about half an Arty 35T13:58
benhno FPU and no SIMD13:58
benhbut it boots a hacked up linux13:58
benhit also could use bigger caches/TLBs and generally be faster, it still somewhat sucks ;-)13:59
benhVexRiscV starts with a much slimmer base line, it should be possible to keep it below that, again without FP and SIMD13:59
sorearpossibly interesting experiment: add FP registers and loads/stores so that setjmp/longjmp and context switches don't trap, how much that makes things faster at what cost14:01
benhsorear: pretty much waht Paul is doing right now :-)14:14
benhadd the basic regs and load/stores and SW emulate the rest14:15
benhmaybe with a handful of "assist" instructions14:15
sorear(Paul?)14:15
benhthe load/stores do require a bit of fiddling for single/double conversion etc.14:15
benhPaul Mackerras14:15
benh(on Microwatt that is)14:15
sorearah14:15
sorearriscv is easier, there's no single/double conversion :)14:16
benhhehe14:16
benhI am not familiar with riscv FPU... double only ?14:16
sorearthis is my one contribution to the riscv base spec14:16
benhon powerpc, it's always stored as a double in the register, so load/store single have to convert14:16
sorearthe registers are double-sized, loading a single value and then storing it as double pads it on the left with 32 1s14:16
benhok14:17
sorearso it becomes a DP NaN14:17
benhso the actual arithmetic ops operate on what ?14:18
sorearthe actual arithmetic ops are all tagged with a size and there's an explicit "double/single conversion with register src and dest" instruction14:18
sorearmixing sizes on a register without conversion will not do anything useful14:19
benhI see.. doesn't that make the FPU more complex ?14:19
sorearit's supported exactly to the extent to allow registers containing single to be saved and restored by generic code14:19
benhpowerpc always has doubles in the registers and all arith. ops are double14:19
benhsingle is only an artifact of load/store conv.14:19
benhI suppose it's just a few more muxes in the FPU to select how many bits of mantissa and exponent you use based on the tag14:21
sorearugh, FLT_EVAL_METHOD makes me sad14:21
benhbut that adds to the critical timing path, doesn't it ?14:21
sorearI forget exactly what we put where, but Rocket uses an internal 65-bit float format with no subnormals and all of the annoying timing stuff happens on loads/stores only14:23
soreardoing single math in real single precision is important, it means fp behavior doesn't silently change between -O0 and -O114:24
soreari686 gets this catestrophically wrong (all operations are *long double* unless spilled to memory), it sounds like ppc at least does double ops in intended precision14:25
benhyup14:26
benhallright, I do need to call it a day, it's already tomorrow here :-)14:27
*** st-gourichon-f has joined #litex14:28
*** st-gourichon-fid has quit IRC14:29
*** tmbinc1 is now known as tmbinc15:14
*** scanakci has quit IRC15:26
CarlFKxobs: bunnie: netv2 in a pc's pci slot - do I need to give it 12v on the barrel connector?19:26
*** robert2 has joined #litex19:32
*** Dolu has quit IRC19:47
kgugalaCarlFK: you can power it via pcie connector19:55
CarlFKkgugala: good.  installing vivado now..  I need that right ?20:03
kgugalayep20:04
kgugalaCarlFK: do you have a100t or a50t version of netv2?20:05
CarlFKboth20:05
*** kgugala_ has joined #litex20:13
CarlFK Vivado HLx 2019.2: All OS installer Single-File Download         (TAR/GZIP - 26.55 GB)       *surprised face*20:15
*** kgugala has quit IRC20:15
*** kgugala_ is now known as kgugala20:16
*** scanakci has joined #litex20:21
*** kgugala has quit IRC20:26
*** kgugala has joined #litex20:30
CarlFKINFO : Installation completed successfully.20:36
CarlFKthat' wasn't too bad.20:36
CarlFKkgugala: juser@cnt4:~/tv/netv2$ make gateware/target20:38
CarlFKmake: *** No rule to make target 'gateware/target'.  Stop.20:38
CarlFKkgugala: "4. Go back to netv2 directory and build the bitstream:"20:40
kgugalaCarlFK you need to select the target e.g gateware/build or gateware/load (or clean)20:40
*** Skip has quit IRC20:41
kgugalaor simply run make build - this should build all20:41
CarlFKthere's no makefile 'here'20:41
CarlFKand i have a feeling there is some other netv2 dir I should be in20:42
CarlFKkgugala: nothing told  me to git clone https://github.com/antmicro/netv220:44
tpbTitle: GitHub - antmicro/netv2: NeTV2 SoC based on LiteX (at github.com)20:44
CarlFKI bet that's the netv2 dir I'm spozed to be in20:44
kgugalayep20:44
kgugalathe repo where the readme is20:45
CarlFKkgugala:   guessing I need to apt install something?   OSError: Unable to find any of the cross compilation toolchains: - riscv64-unknown-elf ...21:04
kgugalayes you need RISC-V toolchain to build Litex bios21:05
*** simeonm has quit IRC21:05
*** simeonm has joined #litex21:05
kgugalayou can grab it from https://www.sifive.com/boards21:06
tpbTitle: Boards & Software - SiFive (at www.sifive.com)21:06
kgugalaPrebuilt RISC‑V21:07
kgugalaGCC Toolchain21:07
kgugalasection21:07
CarlFKkgugala: why does it say "unknown" in riscv64-unknown-elf ?21:31
CarlFKI'm guessing an env var needs to be set21:31
tumbleweednaah, that's just a standard gnu triplet21:58
*** peeps[zen] has quit IRC22:03
*** peeps has joined #litex22:04
CarlFKtumbleweed: wut?22:04
CarlFKhttp://paste.ubuntu.com/p/2QQSxq66xK/  make build  ... OSError: Unable to find any of the cross compilation toolchains: - riscv64-unknown-elf22:05
tpbTitle: Ubuntu Pastebin (at paste.ubuntu.com)22:05
tumbleweedCarlFK: I mean the unknown there doesn't sonud too worrying22:06
tumbleweedthe problem is that it can't find riscv64-unknown-elf22:07
*** tmichalak has quit IRC22:07
*** tmichalak has joined #litex22:07
*** darren099 has joined #litex22:10
CarlFKtumbleweed: know if it is packaged?22:16
CarlFK https://github.com/riscv/riscv-gnu-toolchain#installation-linux22:16
tpbTitle: GitHub - riscv/riscv-gnu-toolchain: GNU toolchain for RISC-V, including GCC (at github.com)22:16
CarlFKim compiling a compiler..it gving me gentoo flashbacks22:17
daveshahYou can download it from https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz22:19
daveshahYou don't need to build it from scratch22:20
daveshah(despite the ubuntu14 it seems to run fine on any linux)22:20
CarlFKapplication-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory22:35
CarlFKbut it is stil doing something22:35
CarlFKmaybe not. cpus are all idle22:35
*** robert2 has quit IRC22:40
tumbleweedCarlFK: install libtinfo523:04
tumbleweed(or go back to compiling compilers23:04
tumbleweedor install gcc-riscv64-unknown-elf - yes we do have a packaged cross-compiler23:05
*** ambro718 has joined #litex23:15
*** ambro718 has quit IRC23:29

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