Tuesday, 2019-09-10

*** tpb has joined #litex00:00
*** CarlFK has quit IRC00:04
John_Krunning into a bit of trouble trying to use litedram with DDR2 on Spartan6, are there any good examples to follow? I can't seem to find any. (caveat: I haven't done DDR memory things before)00:43
John_Kthings seem to be stalling out during Phase 3 of Routing00:57
John_Knon-DDR2 builds of the same SoC take ~10min for everything, this has been stalled out for 20min at Routing Phase 300:58
*** CarlFK has joined #litex01:07
*** freemint has quit IRC01:27
*** freemint has joined #litex01:28
*** freemint has quit IRC01:34
*** freemint has joined #litex01:34
*** freemint has quit IRC01:39
*** rohitksingh has joined #litex02:18
John_Kchanged the clock generation by adapting PPL config from DDR3 on S6, but I must not be doing it right as I'm getting Unroutable messages02:30
John_K"Unroutable      signal: GLOBAL_LOGIC0   pin:  OSERDES2_1/IOCE" for OSERDES2_1 through OSERDES2_1002:30
John_Khttps://github.com/John-K/litex-boards/blob/PanoLogicG2_DDR2/litex_boards/community/targets/panologicg2.py#L74 is where I'm at right now, '__init0__' was my previous attempt02:43
tpbTitle: litex-boards/panologicg2.py at PanoLogicG2_DDR2 · John-K/litex-boards · GitHub (at github.com)02:43
*** CarlFK has quit IRC03:16
mithroWe should add rocket at https://github.com/enjoy-digital/litex/wiki/Soft-CPU04:03
tpbTitle: Soft CPU · enjoy-digital/litex Wiki · GitHub (at github.com)04:03
mithrosomlo: Any chance you could do that?04:03
John_Kmithro: inching closer to linux-on-litex-vexriscv for PanoLogicG2 - DDR is giving me issues right now, but have the core running at 100MHz with UART - going to work on Ethernet tomorrow04:39
_florent_John_K: i'll try to implement your design to see if i understand what is going wrong05:07
John_Kthanks _florent_, the litedram and litex-board changes are on my github linked above05:07
*** rohitksingh has quit IRC05:38
xobsHi all, I'm trying to solve the issue of how to document register sets.  I've come up with this, which I'd like to start using.  Does anyone have any feedback? https://gist.github.com/xobs/9bda0fb09b2cb3e5316592b96d4d408706:05
tpbTitle: dreg sample · GitHub (at gist.github.com)06:05
xobsThe idea is that each bit of the CSR is now documented, and it will create signals that can be easily manipulated (e.g. `self.status.pend` is the correct thing).06:06
xobsThis should be enough to make full register sets, including wavedrom `reg` graphs.06:08
*** CarlFK has joined #litex06:21
_florent_xobs: that's a good idea to add something on top of CSR to help describing  registers, have you already implemented RegStorage/RegStatus? i'd like to have a look if so06:43
xobs_florent_: I'm mostly done implementing it, I'm just trying to figure out how to fix the CSR naming.  I'm getting registers named things like `usb_address_address`.06:46
xobsLet me put together something really quick.  One moment.06:47
xobs_florent_: https://github.com/xobs/dreg/blob/master/dreg.py06:49
tpbTitle: dreg/dreg.py at master · xobs/dreg · GitHub (at github.com)06:49
_florent_regarding the naming,  for more consistency, maybe you could call things: DReg/DRegStorage/DRegStatus/DRegField06:55
_florent_(naming of the classes, not naming of the generated registers)06:56
_florent_this could also be DCSR/DCSRStorage/DCSRStatus/DCSRField : Documented Control Status Register06:59
_florent_since it would also be useful for others purposes, would you ok to have it integrated directly in LiteX?07:01
xobsSure, I can do that.  Naming things in computer science is hard.  I'll change the class names to match that.07:01
xobsSure!  That was one of the goals.  Then have the build process generate a reference manual as part of the output.07:01
_florent_would you/would you be07:01
_florent_ok good07:02
_florent_that's indeed something that is missing both for designing and documenting, so i really like the idea07:03
xobsI've been putting documentation at the top: https://github.com/xobs/valentyusb/blob/tri-fifo/valentyusb/usbcore/cpu/eptri.py#L6407:06
tpbTitle: valentyusb/eptri.py at tri-fifo · xobs/valentyusb · GitHub (at github.com)07:06
xobsBut I realized why that feels so clunky.07:07
xobsIt's because that kind of documentation is for Python users, not for end-SoC users.07:07
xobsSo it'd be good to put how to use the python class there (e.g. what `iobuf` and `debug` mean), but it's not the place to put register-level documentation.07:07
xobsHence the push to defined DReg.07:07
xobs*DCSR07:08
_florent_indeed, even for using the register internally it would be easier, instead of doing self.status.[4].eq(X) you just do self.status.data.eq(X)07:10
mithroWhy DReg?07:12
xobsmithro: It's a Documented Register.07:13
xobsAnd I wanted to avoid any namespace collisions in case florent wanted to do his own approach.07:13
mithroxobs: I would say that the documentation is more of a side-effect of the way you are structuring the code?07:14
_florent_i'm fine doing a common thing07:14
mithroxobs: Does feel very argparse like....07:14
xobsmithro: How do you mean?07:14
mithroxobs: https://docs.python.org/3/library/argparse.html07:15
tpbTitle: argparse — Parser for command-line options, arguments and sub-commands Python 3.7.4 documentation (at docs.python.org)07:15
xobsmithro: How do you mean it's a side-effect?07:15
_florent_We could also call it ECSR: Enhanced CSR, Control and Status Registers with field and documentation support07:16
mithroxobs: Well, even if you left the description field off all that example above, I feel like this structure kind of still has some advantages07:16
mithro_florent_: This kind of feels like Records a bit too?07:17
_florent_yes but records don't have descriptions07:17
mithrohttps://github.com/enjoy-digital/litex/blob/8634401b33ff1101987b1dfda8a781716835a7ec/litex/tools/remote/etherbone.py#L14-L2407:17
tpbTitle: litex/etherbone.py at 8634401b33ff1101987b1dfda8a781716835a7ec · enjoy-digital/litex · GitHub (at github.com)07:17
mithro_florent_: Maybe they should? :-P07:17
mithro_florent_: The fact that every field in that record has a comment after it, kind of makes my argument :-P07:18
xobsmithro: I still don't know what a Record is, and the documentation of it isn't very helpful... https://github.com/m-labs/migen/blob/master/migen/genlib/record.py07:19
tpbTitle: migen/record.py at master · m-labs/migen · GitHub (at github.com)07:19
mithroI think it is basically a "`struct` for Signal objects"?07:20
mithroFor example, https://github.com/enjoy-digital/litex/blob/2638393b53a6ae77e4bfcbaed9d15ca434ce3c6f/litex/soc/integration/soc_zynq.py#L16-L24 could really use some description strings :-)07:21
tpbTitle: litex/soc_zynq.py at 2638393b53a6ae77e4bfcbaed9d15ca434ce3c6f · enjoy-digital/litex · GitHub (at github.com)07:21
_florent_i was also thinking about adding layout/record support to existing CSR when first saw xobs work, but this also complicate CSR code, so for now i dont' know what is best: building something on top of CSR (as xobs is doing), or improving actual CSR.07:21
mithroxobs: Agreed that record.py should have more docs...07:22
mithro_florent_: The fact that record takes a bare tuple rather than something like a Field object has always kind of bothered me...07:25
mithrohttps://github.com/enjoy-digital/litex/blob/ccc2cbd9d4a82c8599bca1d9b6de901c0f24ef67/litex/soc/interconnect/axi.py#L22-L34 <- another example where every field in a record has a comment...07:25
tpbTitle: litex/axi.py at ccc2cbd9d4a82c8599bca1d9b6de901c0f24ef67 · enjoy-digital/litex · GitHub (at github.com)07:25
mithroWould pretty simple create a `class RecordField(namedtuple):` which also supports setting a description?07:27
mithrops - I should be in bed asleep right now :-P07:28
xobsmithro: Being able to document individual bits is nice, with the values[] parameter.07:28
xobsAlso, having "pulse" values and offsets is a nice feature I use to make various disparate CSRs have their fields line up.07:29
mithroWhat does the "pulse" value mean?07:29
mithroxobs: I would also recommend chatting with whitequark about this topic07:30
xobsIt means the Field value is only valid if the `.re` signal is also valid.07:31
xobs(Which reminds me -- I should `Replicate()` the `.re` signal...)07:31
mithroxobs: You should probably use a Python enum in those "values()" case? https://docs.python.org/3/library/enum.html07:32
tpbTitle: enum — Support for enumerations Python 3.7.4 documentation (at docs.python.org)07:32
xobsmithro: what would that look like?07:33
mithroxobs: whitequark had an example (in nmigen but should be pretty easily backported)07:35
xobsxobs: the goal with that information is to be able to generate tables like this:07:37
* xobs uploaded an image: image.png (76KB) < https://matrix.org/_matrix/media/v1/download/matrix.org/JlyYodqFpLsWQJKOlNCxSftJ >07:37
mithroxobs: Yeah - whitequark is doing a lot of stuff like that for boneless IIRC07:37
mithrohttps://github.com/whitequark/Boneless-CPU/blob/master/boneless/gateware/decoder.py07:37
tpbTitle: Boneless-CPU/decoder.py at master · whitequark/Boneless-CPU · GitHub (at github.com)07:37
mithrohttps://github.com/whitequark/Boneless-CPU/blob/master/boneless/arch/opcode.py07:37
tpbTitle: Boneless-CPU/opcode.py at master · whitequark/Boneless-CPU · GitHub (at github.com)07:37
xobsmithro: How would the enum work?  And how would it work for ranges?07:39
mithrohttps://github.com/whitequark/Boneless-CPU/blob/master/doc/manual/manual.pdf07:40
tpbTitle: Boneless-CPU/manual.pdf at master · whitequark/Boneless-CPU · GitHub (at github.com)07:40
mithroxobs: I don't quite remember how it all ties together...07:41
mithroxobs: whitequark is in Hong Kong, so good timezone for you to chat with07:41
*** _whitelogger has joined #litex07:49
xobsflorent: Do you have any recommendations on how I can avoid double-naming?  Should I have DCSR inherit from CSRStatus and CSRStorage?  Or is there some way I can inhibit the name of the instantiated CSR?07:50
_florent_xobs: i wanted to play a bit with your code to figure that out, i'm just finishing something and will look at that07:52
_florent_xobs: the way you did it, it's difficult to improve the naming. You have a common Reg Module, but then switch inside it if it's readable/writable08:54
xobs_florent_: I was mimicking how CSR does it.  Is there a way you'd suggest doing it instead?08:55
_florent_xobs: i think you should have some helpers functions outside of Reg to do the common processing on the fields08:55
_florent_then maybe just have RegStorage be RegStorage(CSRStorage)08:55
_florent_and do the processing of the field before the CSRStorage.__init__(self, ...)08:56
_florent_and the reset logic insertion after08:56
xobsOkay, I'll change my approach and do that then.  Thanks for the advice!08:56
_florent_and the same for RegStatus08:56
_florent_this is just what i think, but this way, the naming will be similar to using regular CSRStatus/CSRStorage08:57
_florent_and you will avoid having the:08:57
_florent_https://www.irccloud.com/pastebin/A1l1SLrf/08:57
tpbTitle: Snippet | IRCCloud (at www.irccloud.com)08:57
_florent_since it will be directly accessible08:58
xobsWell, one thing I want to avoid is namespace collisions.  For example, what if you want a field called "status"?  Or "re"?  That's one of the reasons behind the requirement that fields not begin with "_".08:58
_florent_ok i see, maybe you could also do it with a specific __getattr__ (of otherwise prohibit the use of "status", "storage", "re", "we" in the fields as we are doing on streams: https://github.com/enjoy-digital/litex/blob/master/litex/soc/interconnect/stream.py#L3309:03
tpbTitle: litex/stream.py at master · enjoy-digital/litex · GitHub (at github.com)09:03
*** freemint has joined #litex09:06
xobsI see you're right, florent, it really doesn't want to work that way.  That's unfortunate.10:30
xobsFor example, the global `csrprefix` def appears to assume that all CSRs have a `.name` property, which means I can't do a `DCSR` with a `name` Field on it.  Not unless I add it to a sub-property.10:32
*** vup has joined #litex10:51
somlomithro: I'll take a look (as soon as finish waking up :)11:02
*** guan has joined #litex11:19
*** freemint has quit IRC12:35
*** freemint has joined #litex13:37
*** freemint has quit IRC15:54
*** davidc__ has joined #litex15:55
*** freemint has joined #litex15:57
*** john_k[m] has joined #litex16:05
*** freeemint has joined #litex17:04
*** freemint has quit IRC17:06
_florent_John_K: i don't have the right license right now so can't test the implementation, but i adapted your code to be closer to what is used on Numato Opsis:17:29
_florent_https://hastebin.com/yitexeheto.m17:30
_florent_You can find the opsis here: https://github.com/timvideos/litex-buildenv/blob/master/targets/opsis/base.py17:30
tpbTitle: litex-buildenv/base.py at master · timvideos/litex-buildenv · GitHub (at github.com)17:30
_florent_in a first time, i would recommend using the exact same frequency we are using on opsis: 50MHz17:31
_florent_you can find the ddram constraints of the opsis here: https://github.com/timvideos/litex-buildenv/blob/master/platforms/opsis.py#L184-L20917:32
tpbTitle: litex-buildenv/opsis.py at master · timvideos/litex-buildenv · GitHub (at github.com)17:32
mithro_florent_: is https://github.com/ikwzm/udmabuf have any potential use with LiteX?17:46
tpbTitle: GitHub - ikwzm/udmabuf: User space mappable dma buffer device driver for Linux. (at github.com)17:46
john_k[m]thanks _florent_ I'll look into it. For the toolchain, you need the "Windows 10" version of ISE 14.7 (Xilinx are really bad at versioning)17:46
john_k[m]I'mI'm going to write up instructions for how to get the "Windows 10" version to work under Linux (at mithro's prodding) - it adds support for S6 LX100/LX150 devices and comes with a permanent license17:47
mithrojohn_k[m]: that would be awesome!17:48
john_k[m]:) it takes a lot of tools, going to see if I can optimize it a bit and and a shell script to transform it into something usable17:49
john_k[m]florent18:06
john_k[m] * florent it's close, https://hastebin.com/raw/orayudutom18:06
CarlFKjohn_k: have you seen https://github.com/timvideos/litex-buildenv/wiki/Bash-On-Windows18:19
tpbTitle: Bash On Windows · timvideos/litex-buildenv Wiki · GitHub (at github.com)18:19
john_k[m]I haven't, but I prefer to use Linux for FPGA development. Plus the "Windows 10" version of ISE is a Linux VM that runs on Windows anyway18:20
somlo_florent_, mithro: PTAL @ https://github.com/enjoy-digital/litex/wiki/Soft-CPU and let me know if the rocket stuff looks about right, or if you think I missed anything18:44
tpbTitle: Soft CPU · enjoy-digital/litex Wiki · GitHub (at github.com)18:44
john_k[m]that reads well somlo, was surpised that the FPU isn't enabled in the Linux config19:09
_florent_john_k[m]: l55, you have p = 8, it should work with p=1619:18
_florent_mithro: i'll look at udmabuf and compare to what we are doing in litepcie19:19
john_k[m]_florent_: aha, trying that now (was attempting to change CPU back to 100MHz to see if that would fix it)19:20
john_k[m]at some point, would like to pick your brain about the different styles of instantiating PLLs19:21
_florent_john_k[m]: i would say the style you started implemented things is now recommended (using S6PLL)19:24
_florent_but the thing is that getting DRAM working is already complicated on Spartan6, so that's better just using the code that is known to work on the Opsis for now19:25
john_k[m]it does seem a bit neater, will have to play around with it a bit after we get this working19:25
john_k[m]makes sense19:25
_florent_once working, it will be easier to try the S6PLL with DDR319:25
john_k[m]DDR3?19:26
john_k[m](I presume you mean on a different board?)19:26
_florent_isn't the panologic using a ddr3 memory?19:26
john_k[m]DDR219:29
john_k[m]MT47H32M16HR-25E:G https://www.micron.com/~/media/Documents/Products/Data%20Sheet/DRAM/DDR2/512MbDDR2.pdf19:29
somlojohn_k[m]: the FPU burns a lot of LUTs, and currently will not fit on an ecp5 45k FPGA (the versa-5g board from lattice)19:31
John_Ksomlo: that makes sense19:32
_florent_ah, then it's probably better to use the Atlys as a reference instead of the Opsis: https://github.com/timvideos/litex-buildenv/blob/master/targets/atlys/base.py19:32
tpbTitle: litex-buildenv/base.py at master · timvideos/litex-buildenv · GitHub (at github.com)19:32
somloso I decided that the 'linux' variant will have the MMU only, and do floating point via software traps in the BBL19:33
John_K_florent_: ah, hrm19:33
_florent_John_K: you should be able to almost copy/paste the CRG19:33
_florent_you don't need the peripheral clock / encoder clock part19:34
somloI built a 'full' variant on the nexys4ddr (with Vivado) and it fits, and beats the pants off of the emulated variant in linpack :)19:34
_florent_then also copy the sdram instance19:34
john_k[m]_florent_: ok will try that if p=16 doesn't work19:34
_florent_be sure that you have 1:2 in the sdram module, not 1:419:35
john_k[m]in general, is HalfRate or QuarterRate preferred? I'd want to think that QuarterRate would give more BW?19:35
_florent_john_k[m]: sorry the code i adapted before won't work, i was thinking it was a DDR319:35
john_k[m]oh19:35
_florent_ok Spartan6 it's pretty limited, we only validated DDR2 with HalfRate and DDR3 with QuarterRate19:36
_florent_ok/on19:36
_florent_john_k[m]: sorry i have to go, if it's not working, you can post your results here, i'll have a look later19:38
John_Ksounds good, thanks for all of your help _florent_19:38

Generated by irclog2html.py 2.13.1 by Marius Gedminas - find it at mg.pov.lt!