Tuesday, 2020-05-05

*** tpb has joined #litex00:00
shuffle2daveshah: fwiw seems the syn_preserve is injected because of FX681 :...|Initial value on register arp_table_request_timer_count[23:0] is non-zero which can prevent the register from being packed into a block RAM or DSP. (occurs for a few other registers in ip/mac stack as well)00:14
shuffle2seems migen emits the initial value as an initial assignment in addition to putting it in the reset block, is it worthwhile to avoid that?00:15
shuffle2i had left the udp_loopback example in with my own logic, and the loopback path is what was causing timing failures (mostly because of this deoptimization, i'm thinking)00:17
*** CarlFK has quit IRC00:21
*** Skip has quit IRC00:32
*** CarlFK has joined #litex00:33
shuffle2eh, is there any good way to do it? after some trial/error, seems like any nonzero value assigned in initial _or_ reset will cause synplify to warn/inject syn_preserve :(00:44
shuffle2strange ive never seen it on the rather sizable amount of other (native) verilog im pushing through synplify00:44
*** futarisIRCcloud has quit IRC01:01
benhwhat would it take to make litex add a default_nettype wire to generated files ?01:10
benhserv is setting it to none, and litedram breaks01:10
benh(depending on order files are built by vivado, as it incorrectly carries the default from file to file)01:11
benhthat or make litex use explicit wire in the module generated01:11
*** futarisIRCcloud has joined #litex02:19
*** HoloIRCUser has joined #litex02:53
*** HoloIRCUser2 has joined #litex02:54
*** HoloIRCUser1 has quit IRC02:55
*** HoloIRCUser has quit IRC02:57
*** Degi has quit IRC03:44
*** Degi has joined #litex03:44
shuffle2changing liteeth\examples\targets\udp_loopback\versa_ecp5.py to target ecp5um (instead of ecp5um5g) causes the timing issue on the plain example, as well. suppose that's why no one has noticed it until now06:21
shuffle2same size/speed otherwise, kinda curious :s06:37
*** HoloIRCUser has joined #litex06:53
*** HoloIRCUser2 has quit IRC06:57
*** zyp_ has joined #litex07:06
*** zyp has quit IRC07:09
*** captain_morgan has quit IRC07:09
*** palmer has quit IRC07:09
*** goran-mahovlic_ has quit IRC07:09
*** kbeckmann has quit IRC07:09
*** captain_morgan has joined #litex07:16
*** palmer has joined #litex07:16
*** goran-mahovlic_ has joined #litex07:16
*** kbeckmann has joined #litex07:16
_florent_benh: you could probably do some tests by modifying https://github.com/enjoy-digital/litex/blob/master/litex/gen/fhdl/verilog.py07:21
tpbTitle: litex/verilog.py at master · enjoy-digital/litex · GitHub (at github.com)07:21
_florent_shuffle2: we indeed have to optimize the timings of the LiteEth hardware stack on ECP5, it has been developed mostly for 7-series but hasn't been optimized yet for slower devices.07:27
*** HoloIRCUser1 has joined #litex07:44
*** HoloIRCUser has quit IRC07:46
benhHrm ... standalone litedram with serv instead of vexriscv is smaller ... but also doesn't quite work :-)08:00
benhanything special to do other than including all the serv rtl verilog files in the project ? It builds, I get the banner but ..08:01
benhah wait.. it comes up eventually but extremely slowly08:01
benh BIOS built on May  5 2020 11:15:2108:01
benhit stops after that for a long time]08:01
benhthen08:01
benh BIOS CRC failed (expected 000000000000000000, got 000000000000000000)08:01
benh The system will continue, but expect problems.08:01
benhand the RAM init seems to fail08:02
_florent_benh: yes, since SERV is a lot slower, that's possible we need to modify the BIOS a bit to speedup the initialization08:02
_florent_benh: are you sure all the BIOS files have been recompiled for SERV (and you are not using old VexRiscv ones?)08:03
_florent_benh: be sure to remove the software build directory when switching CPU08:04
benh_florent_: I think so, but I'll dbl check. I'm using fusesoc so it should be clean but ...08:04
benhI'll try to build a LiteX one to compare, this is microwatt + standalone litedram with built-in serv for inits (works fine with VexRiscV mini)08:04
_florent_benh: ok, at least i remember having this issue in simulation when testing lxsim --cpu-type=vexriscv and then lxsim --cpu-type=serv without removing the build directory08:15
*** HoloIRCUser2 has joined #litex08:23
*** HoloIRCUser1 has quit IRC08:26
benh_florent_: ok, let me just build a standard LiteX SoC from scratch with serv see what happens...08:34
benhERROR: [Synth 8-6735] net type must be explicitly specified for 'serial_rx' when default_nettype is none [/home/benh/hackplace/litex/litex-boards/litex_boards/targets/soc_basesoc_arty/gateware/top.v:6]08:35
benh:-)08:35
benhYou need to fix the problem I mentioned above :)08:35
benhit's a Vivado bug but you know how long it takes Xilinx to fix anything ...08:35
benhfusesoc sets the default_nettype to none at the top of each .v file, vivado "carries" it over to the next file, and thus applies it to the litex generated ones who then fail to build08:36
daveshahThat's the Verilog standard afaik08:36
benhso you can have either litex use explicit "wire" in module defs08:36
daveshahNothing to do with Vivado08:36
benhdaveshah: to carry it over to subsequent .v files ?08:36
daveshahYes08:36
benhOdd ... I've read otherwise but maybe I'm wrong, I haven't read the standard08:37
benhit sounds very bogus to have a compiler carry such definitions to another compile unit08:37
daveshahThere is an ambiguity as to whether default_nettype requires wire in "input wire" but I'm pretty sure the conclusion was it is08:37
benhso the fix here is either to make litex slaps a default_nettype back to wire on top of every generated .v file08:37
benhor use explicit "wire" in module definitions08:38
benhfor now I'm just hacking serv to reset the nettype to wire at the end of each file as a temporary workaround08:38
benh_florent_: ok with the workaround above, serv based SoC comes up, inits RAM fine, not entirely sure what's wrong, I'll dig a bit more08:42
_florent_benh: for the default_nettype, can you create an issue on LiteX repo with a minimal example to reproduce it?08:45
*** futarisIRCcloud has quit IRC08:49
benh_florent_: well, just checkout litex, try ./arty.py --cpu-type=serv :-)08:52
benhwith Vivado 2019.208:52
benhbut yes, I can08:52
benhodd... serv is working now08:52
benhthough its bus is so slow, the memory test is taking minutes08:52
benhthe init per se is quick, the memory test is useless08:52
benhit's somewhat odd actually...08:53
benhMemtest OK08:54
benhMemspeed Writes: 10Mbps Reads: 16Mbps08:54
benh_florent_: what's the licence on LiteX generated .v files & binaries ?08:55
benh_florent_: for standalone litedram, the generator I did is too awkward for most users, they would have to install litex, it breaks when you change thinggs etrc... I'd like to ship pre-generated .v files and BIOS images with microwatt along with the scripts to re-generate08:55
*** zyp_ is now known as zyp09:08
_florent_benh: that's the aim of the generators: allow users to easily reuse pre-generated cores without having to install/understand LiteX. The license is similar to LiteX (BSD-2)09:14
benh_florent_: thanks, that's perfect. I'll include some pre-generated stuff with microwatt then. I'll try to get you patches to fix LiteX tonight or tomorrow09:16
benh_florent_: serv  does save a few % LUT usage but with the memory test taking minutes, it's not very useful :)09:17
benh_florent_: so I'll stick to built-in VexRiscV "Min" for now ...09:18
_florent_benh: the idea is to reduce the memtest size or do something more clever to speed up init with SERV09:18
_florent_benh: what difference do you have in resource usage between VexRiscV Min and SERV?09:19
benh_florent_: with the whole of microwatt I go from about 51% slice LUT down to 48% from memory09:34
benh_florent_: and a couple % down on registers as well09:34
benhI'd have to rebuild later if you want precise numbers, that's what I remember from earlier09:35
benhit's not huge at this point (on the Arty 35)09:35
benh_florent_: the standalone sdram init seem to hang with VexRiscV_Mini compared to VexRiscV09:49
benh_florent_: not sure what's up at this point... I did clean up build cache etc...09:49
benhsame as before with serv, I get the banner and it stops after "BIOS built xxxx"09:50
benhit's odd ... I would swear it worked yesterday... ugh09:54
zyphow fast are you running serv? I assume it'll have on the order of 1/32th the performance per clock compared to vexriscv09:54
_florent_benh: i also remember having some hang with VexRiscv mini but haven't intestigated it09:55
_florent_investigated09:55
benhI wonder if I'm building the BIOS with the wrong options...09:56
sorearsomeone has found an actual use case for serv?09:56
benhsorear: it would be nice for initializing litedram "standalone" just bcs it's small ...09:56
benhyup !09:57
benh-march=rv32im09:57
benhlitedram_gen doesn't pass the variant down so core.py assumes a full vexriscv09:58
benhunless I can specify it in the yaml, I need to dig09:58
zypsorear, I figure it could be nice for running the software part of a usb stack in applications that otherwise wouldn't need a cpu09:59
zypwithout having to handle control requests in gateware10:00
benh_florent_: ah ! litedram gen.py need to collect cpu_variant from the yaml10:02
benhand pass it down10:02
benhlet me work around and see if that helps10:03
benhI10:14
benhI'll send you a patch if it  does10:14
benh_florent_: works now. However, it takes several seconds to do the memory test which is a bit nasty10:18
*** lambda has quit IRC10:30
benh_florent_: so ppc64 needs custom CSR access functions... where should i put them ?10:31
benh_florent_: I'd rather not add special ifdef's in hw/commmon.h... I could define CSR_ACCESSORS_DEFINED10:32
benh_florent_: is there an include file in cpu/ that's force-included before anything else ?10:32
*** lambda has joined #litex10:34
benhoh my ... csr accessors in common.h are ghastly10:35
_florent_benh: i just tried to avoid any CPU specific code in the BIOS, so if possible, the custom functions should be put in the CPU directory. If this is not possible with the current structure, we could think about that10:37
benh_florent_: right, we might need cpu specific include that goes before anything else10:40
benh_florent_: also I really really really don't like how we access CSRs today :)10:41
benhdoing unsigned long* accesses regardless of the size of the CSR for example10:41
benhand the csr_rd_* etc... casting integers into pointers etc... it's all rather gross10:42
benhfinally _csr_rd always doing a 64-bit access is somewhat of a nonsense10:42
benhon 32-bit cpus with 8 bit CSR bus that means 2x32-bit bus accesses per byte of the CSR !10:43
_florent_benh: the one you are looking at are probably the one in common.h that are purposed to be the most generic, the bios is generating specialized CSR access functions in csr.h10:43
benh_florent_: anyways, sent you 2 patches to get microwatt going for now10:43
benh_florent_: yup10:44
benh_florent_: though the generic ones should be written more nicely too :) but before hacking that to death10:44
_florent_benh: thanks for the patch, i already integrated your suggestions /findings yesterday for MicroWatt: https://github.com/enjoy-digital/litex/commit/9bef218ad6616d4d8b958e34de1f6e87b7cbdd9910:44
tpbTitle: cpu/microwatt: fix integration/crt0.S (thanks Benjamin Herrenschmidt). · enjoy-digital/litex@9bef218 · GitHub (at github.com)10:44
benh_florent_: I suppose we should first decide whether to ditch 8-bit CSR busses10:44
benhand stick to 32-bit and no funny games of CSR sizes10:44
benhbcs that would simplify things quite a bit10:44
benh_florent_: oh, oops, I didn't re-pull today :)10:45
benh_florent_: I also sent you a patch to litedram gen.py to grab the cpu variant10:45
benh_florent_: so MW will still break once we take out the hack to treat c******* as cache-inhibited and start requiring the use of the special instructions (or the MMU)10:45
benh_florent_: that's what we need to fix CSR accesses for10:45
benhso there's a bit of time, the hack can stay for a while10:46
benhso I'd rather you guys decide what to do with CSRs long run and whether to ditch those funky variable sizes things alltogether or not before I start hackign through it :)10:46
*** CarlFK has quit IRC10:49
_florent_benh: what we could do is switching to 32-bit CSR as default and see if we need to keep 8-bit CSR for retro-compatibility or just remove it. Even if 8-bit is still supported, we could still add some restrictions for it it to simplify things (ie would not be supported by Linux SoCs for example)10:50
benh_florent_: hrm... I would still like to gget rid of the mess in hw/common.h but ok :)10:51
benh_florent_: at least we should probably make the generic _csr_rd/wr use the _simple ones and have only those latter be in ifdef CSR_ACCESSORS_DEFINED10:52
benh_florent_: so things like microwatt only need to redefine the simple read/write10:52
benhthe generated csr.h is already just using csr_simple_read/write10:53
benhso that's fine10:53
_florent_benh: yes, we can try to have a simple solution for that. A few months ago, not all design were able to work with 32-bit CSR, for example being able to do the DRAM calibration with 32-bit CSR is a few months old10:54
zypeven more of a reason to standardize on one CSR size10:56
_florent_benh: so for you it seems to be a mess now, but it's because there is some history and because we worked hard to make 32-bit CSR possible and work on all designs10:57
benh_florent_: of course, I apologise if I come accross a bit more rude that I intend ...10:58
benhI've written my share of mess over time :)10:58
_florent_benh: no problem, but it's just that supporting both is probably temporary and now that all designs can use 32-bit CSR and since it also seem to be ok on resource usage, we can now discuss to see if we should keep 8-bit support10:59
benhtbh my main nitpick for the general case (not specifically linux) is the structure of the helpers in common.h ... the fancy _csr_rd/wr ones should be built on top of the "basic" ones and there should thus be only one pair of "basic" ones that do the actual HW access with the right size10:59
benhand which can then be easily overriden if a CPU needs extra nits such as memory barriers or special IO instructions10:59
benhand thus CSR_ACCESSORS_DEFINED would allow to re-define just those two (ie csr_simple_*) and the rest would just build on top... not hard, I could give it a go myself but not tonight11:00
benhok11:00
_florent_benh: we are open to suggestions/ideas and if using 32-bit CSR work for all projects and simplify things, that's probably what we'll do11:03
*** CarlFK has joined #litex11:05
benh_florent_: yup11:08
benhall good11:09
benhbtw, I need the litedram patch I sent you merged for microwatt generator to work with vexriscv_min11:09
benh(to specify cpu_variant)11:09
benhI haven't yet figured out how to fix litedram gen for cpu type "None", that's for another day, it seems more intricate11:10
benhsso for now microwatt+litedram will use vex11:10
_florent_ok, i'll going to apply your patch11:12
_florent_i'm11:12
benhthanks !11:13
shuffle2_florent_: seems you're the main author of the ecp5 pll code in litex? https://gist.github.com/shuffle2/f102897f100ab4b5995720c9214bda32 see anything concerning in the diff between litex/clarity?11:43
tpbTitle: pll.v · GitHub (at gist.github.com)11:43
somlobenh: as the person to blame for the common.h "ghastliness", using [] indexing on an `unsigned long *` in `_csr_[rd|wr]` felt more expressive than `MMPTR(a)` or calling `csr_[read|write]_simple()`. Besides, those were (re)added for backward compatibility with externally written bios code by downstream. And they had to support multiple (8/16/32) subregister data widths, all of which were aligned at either 32 or 64 bits, depending on the CPU. And try to11:45
somloglue them back into 8, 32, 64, 128, etc. bit wide "compound" registers :)11:45
somloso if you want to apply some additional awesomeness to that ghastly mess, I'm super excited to learn how one would do it better!11:45
benhheh11:58
benhsomlo: it's hard to write that sort of stuff without ending up with a mess ;-) Look at the MMIO accessors in Linux ...11:58
_florent_somlo: you are the one we should thanks for allowing 32-bit CSRs to be used in all designs :) Most of the mess probably comes from the various configurations that need to be supported which make things complicated, as discussed just before, if limiting the configurations can help simplifying things, we should probably go in this direction11:59
benhsomlo: I'll do some suggestions when I'm not about to fall asleep. The key thing though  is that you really want to isolate the functions that do the actual HW access and have as few of these as possible11:59
benhsomlo: and build the other "fancier" stuff on top of these. The reasons come from a number of factors such as the need for CPU specific memory barriers or even special instructions to do that type of MMIO access12:00
benhsomlo: for example ARM and powerpc in theory need memeory barriers. I suppose none of the CPUs supported by LiteX today really re-order accesses but that's not an impossibility :)12:00
benhsomlo: or you could end up with x86 style split IO bus with inb/outb style instructions (yuck ,.. but heh, they do exist)12:01
benhsomlo: also I would strongly suggest keeping the address argument as a pointer all along12:01
benhanyway, off to bed !12:01
somlobenh: good night, sleep tight -- talk again tomorrow :)12:03
somlo_florent_: of course, if we *do* get rid of 8/16 bit csr data widths and go with 32 exclusively, we can totally simplify that crazy setup in common.h (but that almost feels like cheating now after all the hardship) :D :D12:04
somlo(not that I'm against simplifying things in any way, and 32-bit-only csr-data-width is probably the right thing to do)12:04
_florent_shuffle2: i wrote the ECP5 PLL code yes (mostly reading the docs and testing on hardware) but haven't really compared it to clarity results, so if you find obvious improvements, we could integrate them12:07
_florent_somlo: i think for now what we can do is: default to 32-bit, only support 32-bit on Linux SoC (if that can simplify upstreaming the Linux patches) and keep support for the other CSR data-width until we are sure that 32-bit work fine for all configurations and that keeping others configuations is not useful. So i will change the default to 32-bit and see if we have complains :)12:12
*** futarisIRCcloud has joined #litex12:14
*** gregdavill has joined #litex13:06
gregdavillbenh: fyi, serv doesn't have a hardware multiplier. So you need to compile with -march=rv32i.13:07
gregdavillAlso this is the same reason memory tests are slow. For standard tests the "random" generator is multiplying some numbers. Which needs to be emulated in sw.13:09
gregdavillWhich on a serial CPU where everything is *32 clocks, will be slower than Vex.13:09
zypshuffle2, looks to be 100 / 1 * 5 / 4, vs 100 / 4 * 5 / 1, end result is the same, difference is just in whether the division happens before or after the VCO13:11
zypalthough, according to the ECP5 datasheet, the config from clarity falls outside the f_VCO range specced in the datasheet (400-800 MHz)13:12
shuffle2the ui actually says the vco is 625mhz13:13
zypoh, my bad13:14
zyphmm, no, that doesn't add up13:15
*** gregdavill has quit IRC13:15
zypah, yes it does, the clarity config is 100 / 4 * 5 * 5 for the VCO and / 5 for the output13:18
shuffle2ah13:19
zypI'm still unused to this pll structure, I forgot that the feedback path runs through both the CLKOx_DIV and CLKFB_DIV, so you get a 25x multiplication, not 5x13:20
zypanyway, both configs are within the legal ranges then13:21
zyp100 / 1 * 5 / 4 vs 100 / 4 * 25 / 513:22
zyp_florent_, I also found the answer now to the question we were discussing some weeks ago on CLKI range13:23
zypf_PFD is the frequency after the CLKI_DIV, has a specified range of 10-400 MHz, so the 10MHz minimum is indeed after dividing13:24
zypalthough the datasheet also mentiones that «For f_PFD < 10 MHz, the jitter numbers may not be met in certain conditions.»13:25
zypwhich sounds to me like «you can go lower, but we can't give guarantees about jitter then»13:26
_florent_zyp: thanks, in your case allowing a lower frequency was enabling you to generate the 48MHz with a single PLL right?13:39
zypyes, it's been working fine so far13:40
_florent_zyp: ok so that could be interesting to keep this, or at least allow it and create a warning if CLKI is bellow the specified range13:43
*** Skip has joined #litex14:58
*** spacekookie has quit IRC15:17
*** spacekookie has joined #litex15:18
somlo_florent_: after b0578580 (litex) and da61aab (litex-boards) if I try to build a rocket+litex design (on either nexys4ddr or trellisboard), it just stops after building the bios and never goes into vivado (or, respectively, yosys/nextpnr)16:26
somlono error, just declares victory once the bios is compiled :)16:26
_florent_somlo: indeed, you now have to add --build to build the gateware16:26
somloaaaah16:27
somlook, let me update my bash history :D16:27
somlo(I just up-arrow and hit enter, if things don't work the way I expect then I start asking :D )16:27
somlo_florent_: thanks, I'm back in business now :)16:30
somlo_florent_: does that also apply to litex_sim.py ? I'm actually updating my notes, not just .bash_history :)16:32
_florent_somlo: no, that's only for the targets16:32
somlook, thanks!16:33
_florent_./target.py now generate the software generated files, compile the BIOS and generate the gateware files16:33
_florent_--build build the bitstream16:33
_florent_--load load the bistream16:33
somlooh, so if I had tried to dig around the build folder, I would have found the verilog file there :)16:33
somloit's just running the toolchain that's now an explicit command-line flag16:34
somlogot it!16:34
_florent_i did that for project external to LiteX and found that more convenient16:34
zypnice, I like that change16:34
_florent_this way, if you just want to work on software, you just generate the files but don't build the gateware16:35
_florent_and if you want to load bitstream to the FPGA, you no longer need external script16:35
somloI have to try openocd on nexys4ddr -- so far I've been loading the .bit file to the sdcard, and had the nexys set up to load it from there16:36
somlobut "tethered" mode via usb cable is much better for development16:37
daveshahI can recommend xc3sprog16:37
zypI've been thinking it'd be nice to have some sort of change tracking as well, as in --load would rebuild the gateware only if it changed16:37
daveshahDespite the name it supports a lot of xc7 devices etc16:37
somlozyp: that's something we should at least try to use `make` for, before rolling our own :D16:38
zypsomlo, well, I were thinking instead of reimplementing it from scratch, maybe we could reuse parts of scons16:39
_florent_somlo: which version of GCC are you using to compile https://github.com/litex-hub/linux?16:55
tpbTitle: GitHub - litex-hub/linux: Linux kernel source tree (at github.com)16:55
_florent_(i'm trying to build the Linux-On-LiteX-Vexriscv kernel with the branches from https://github.com/litex-hub/linux)16:56
tpbTitle: GitHub - litex-hub/linux: Linux kernel source tree (at github.com)16:56
*** HoloIRCUser has joined #litex17:36
*** HoloIRCUser2 has quit IRC17:38
*** captain_morgan has quit IRC19:36
*** captain_morgan has joined #litex19:37
*** CarlFK has quit IRC19:38
*** robert2 has joined #litex19:48
*** robert2 is now known as rw1nkler19:48
somlo_florent_: it's `riscv64-unknown-linux-gnu-gcc (GCC) 9.2.0`19:59
john_k[m]anyone know what FPGA is on this card? https://www.ebay.com/itm/ACCOLADE-ANIC-40K-QUAD-PORT-10GBE-10GB-PCI-E-SFP-ETHERNET-FULL-PACKET-CAPTURE/25457484517820:08
tpbTitle: ACCOLADE ANIC-40K QUAD PORT 10GBE 10GB PCI-E SFP+ ETHERNET, FULL PACKET CAPTURE | eBay (at www.ebay.com)20:08
john_k[m]ANIC-40Ku has a Kintex Ultrascale20:09
john_k[m]guessing maybe a Kintex? For $80 I grabbed one20:10
daveshahLooks like it was released in 2011, so Virtex-6 is a possibility too20:19
rw1nklerHello Everyone! Please, could somebody provide me any tips about using the wishbone-tool with LiteX? Do I have to instanciate any special core, or simple serial is enough?20:34
zyprw1nkler, you'll need an instance of UARTWishboneBridge if you wanna use it over serial20:43
scanakcihttps://usercontent.irccloud-cdn.com/file/dNEH9Kdd/BP_LiteX_Linux_Genesys20:46
scanakciI fixed the final bug. BP works on FPGA!20:46
scanakciI tested it on genesys 2 kintex-7 for 100MhZ.20:47
daveshahGreat!20:49
sajattack[m]sweet20:50
Findescanakci: awesome work!!20:50
scanakcithank you daveshah,  sajattack[m], and Finde21:02
*** rjeschmi has quit IRC21:07
benhSo it might make sense to replace that random number generator in the memory test with an lfsr for example...22:10
benhI'll have a look. it's also slow with VexRiscV_Min but of course not nearly as bad as serv22:10
*** CarlFK has joined #litex22:59
*** rw1nkler has quit IRC23:18
*** darren099 has quit IRC23:28
*** gregdavill has joined #litex23:31

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