Thursday, 2021-09-16

*** ibot <ibot!~supybot@libre-riscv.org> has joined #microwatt17:19
*** ibot is now known as Guest211817:19
lkcli trust that people do not mind, i have introduced an ircbot to #microwatt17:28
lkclhttps://libre-soc.org/irclog-microwatt/index.html17:28
lkcltoshywoshy: ^17:28
lkclthis provides an unofficial informal way to refer to prior discussions17:28
lkclthat's if the cron jobs run successfully :)17:30
lkclmithro: i'd be intrigued to know what the context is for the FP operators for the DSP48E1-FP17:31
lkclis it a way to target the specific resources of the DSP of a particular FPGA?17:32
lkclhttps://github.com/fbrosser/DSP48E1-FP/blob/master/src/FPMult/FPMult.v17:32
lkcllooks pipelined17:32
lkcland hard-wired to IEEE754 FP3217:34
lkclhttps://github.com/fbrosser/DSP48E1-FP/blob/master/src/FPMult/FPMult_ExecuteModule.v17:34
lkcli'm not seeing signs of guard, sticky, or rounding bits17:35
lkclmeaning, it'll fail the majority of IEEE754 FP unit tests17:35
openpowerbot[slack] <Gustavo Romero> hmm got it, interesting, so the code is currently wrong no? `core_stopped` is just use to map it in `stat_reg` but not really to trigger when the debugger will rise `core_stop` to effectively stop the core no? in that case only `terminate` is being usedt to drive `core_stop`  (well `do_step` but that also is not related to `core_stopped`  )17:36
openpowerbot[slack] <Gustavo Romero> hmm got it, interesting, so the code is currently wrong no? `core_stopped` is just used to map it in `stat_reg` but not really to trigger when the debugger will rise `core_stop` to effectively stop the core no? in that case only `terminate` is being usedt to drive `core_stop`  (well `do_step` but that also is not related to `core_stopped`  )17:37
openpowerbot[slack] <Gustavo Romero> hmm got it, interesting, so the code is currently wrong no? `core_stopped` is just used to map it in `stat_reg` but not really used to trigger the core stop when the debugger will rise `core_stop` to effectively stop the core no? in that case only `terminate` is being usedt to drive `core_stop`  (well `do_step` but that also is not related to `core_stopped`  )17:37
openpowerbot[slack] <Gustavo Romero> hmm got it, interesting, so the code is currently wrong no? `core_stopped` is just used to map it in `stat_reg` but not really used to trigger the core stop when the debugger will rise `core_stop` to effectively stop the core no? in that case only `terminate` is being used to drive `core_stop`  (well `do_step` as well but that also is not related to `core_stopped`  )17:38
openpowerbot[slack] <Gustavo Romero> btw, neat getting NFS working on microwatt 🙂17:39
openpowerbot[slack] <Gustavo Romero> ```# mount17:39
openpowerbot[slack] <Gustavo Romero> rootfs on / type rootfs (rw,size=113960k,nr_inodes=28490)17:39
openpowerbot[slack] <Gustavo Romero> devtmpfs on /dev type devtmpfs (rw,relatime,size=113960k,nr_inodes=28490,mode=755)17:39
openpowerbot[slack] <Gustavo Romero> proc on /proc type proc (rw,relatime)17:39
openpowerbot[slack] <Gustavo Romero> devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=666)17:39
openpowerbot[slack] <Gustavo Romero> tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)17:39
openpowerbot[slack] <Gustavo Romero> tmpfs on /tmp type tmpfs (rw,relatime)17:39
openpowerbot[slack] <Gustavo Romero> tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)17:39
openpowerbot[slack] <Gustavo Romero> sysfs on /sys type sysfs (rw,relatime)17:39
openpowerbot[slack] <Gustavo Romero> 192.168.15.100:/rootfs on /nfs type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.15.100,mount)17:39
openpowerbot[slack] <Gustavo Romero> # uname -a17:39
openpowerbot[slack] <Gustavo Romero> thanks ; )17:42
openpowerbot[slack] <Gustavo Romero> @joel @Paul Mackerras @Benjamin Herrenschmidt @Michael Neuling are you ok if I enable by default NFS client  v2 and v3 on microwatt?17:56
openpowerbot[slack] <Gustavo Romero> ```diff --git a/arch/powerpc/configs/microwatt_defconfig b/arch/powerpc/configs/microwatt_defconfig17:56
openpowerbot[slack] <Gustavo Romero> index 9465209b8c5b..89d9bff51294 10064417:56
openpowerbot[slack] <Gustavo Romero> --- a/arch/powerpc/configs/microwatt_defconfig17:56
openpowerbot[slack] <Gustavo Romero> +++ b/arch/powerpc/configs/microwatt_defconfig17:56
openpowerbot[slack] <Gustavo Romero> @@ -77,7 +77,7 @@ CONFIG_SPI_SPIDEV=y17:56
openpowerbot[slack] <Gustavo Romero>  # CONFIG_IOMMU_SUPPORT is not set17:56
openpowerbot[slack] <Gustavo Romero>  # CONFIG_NVMEM is not set17:56
openpowerbot[slack] <Gustavo Romero>  CONFIG_EXT4_FS=y17:56
openpowerbot[slack] <Gustavo Romero> -# CONFIG_FILE_LOCKING is not set17:56
openpowerbot[slack] <Gustavo Romero> +CONFIG_FILE_LOCKING=y17:56
openpowerbot[slack] <Gustavo Romero>  # CONFIG_DNOTIFY is not set17:56
lkclGustavo: that's incorrect, the DMI VHDL (and Libre-SOC's matching implementation) is correct.18:49
lkclthe DMI implementation is purely a "communication gateway" in effect.18:50
lkcl* you send in a request to STOP by writing to bit 0 of the CTRL register18:51
lkcl* the DMI interface **COMMUNICATES THIS DESIRE** to the main core (which could be in the middle of a fetch, could have large numbers of instructions outstanding in pipelines and FSMs)18:52
openpowerbot[slack] <Gustavo Romero> incorrect in microwatt's code in `core_debug.vhdl` do you meant?18:53
openpowerbot[slack] <Gustavo Romero> incorrect in microwatt's code in `core_debug.vhdl` do you mean?18:53
lkcl* the core, **ON COMPLETION OF ALL OUTSTANDING WORK**, will communicate that it has, in fact, completed all of the outstanding work, by raising the "core_stopped" flag18:53
lkcl(no, i said, "your understanding is incorrect.  the *code* is perfectly correct and functions exactly as designed"18:53
lkcl* to ascertain whether the core has in fact now stopped, it is *your* responsibility, as the *USER* of the DMI API, to read the "STAT" register18:54
lkcl* only when the core has raised the "core_stopped" flag can you be absolutely certain that it has, in fact, stopped, AS EARLIER REQUESTED18:54
lkclthe reason for this is that it is completely unreasonable for the core to simply blithely chuck away or terminate work that it is already in the middle of executing18:55
lkclsome of that work is literally impossible to terminate anyway18:55
lkcl(for example, Wishbone LD/STs, once started, you are NOT permitted to terminate them in the middle)18:55
lkclthus, there MUST be a way to REQUEST stopping and WAIT until stoped18:56
lkclnot18:56
lkcl"do what i say right now, this instantaneous clock cycle, and terminate all and any outstanding work"18:56
lkclit is simply not possible to meet the expectations that you have, to terminate, instantly, and "stop".18:57
lkclis that clearer?18:57
openpowerbot[slack] <Gustavo Romero> yep, I think so, thanks for the explanations18:58
lkclthere is one other potential way that the expectation "i raise the "STOP" signal, you (DMI) respond *ONLY* when the core has, in fact "STOPPED""18:58
openpowerbot[slack] <Gustavo Romero> yes that's more on the lines I was thinking of it18:59
openpowerbot[slack] <Gustavo Romero> fact is that step seems here busted currently18:59
lkcland it's for the DMI interface to *ONLY* respond with an ACK signal when the core responds (many many cycles later, in the case where it might be in the middle of an IEEE754 FSM)18:59
openpowerbot[slack] <Gustavo Romero> I can stop and start again the core18:59
openpowerbot[slack] <Gustavo Romero> but I can't stop and step for isntance, currently18:59
lkcl1 sec.. hang on... i explained it already - but let me come back to the DMI "ACK" delay things19:00
lkclif the implementation of the DMI interface were to be implemented as a synchronous "delay" system, it would have two huge detrimental consequences:19:00
lkcl1) the extremely simple DMI interface, which responds IMMEDIATELY (one cycle after a command) would now be completely broken, and/or made far more complex19:01
lkcl2) any down-stream users of that DMI interface - for example JTAG - would likewise be made massively more complex because they would have to take into account the delay in the DMI "ACK"19:02
lkclthe entire DMI interface is designed around the fundamental principle that *at no time* shall there be a delay, period.19:02
lkclclock cycle 1: send request19:02
lkclclock cycle 2: receive ack of request19:02
lkclanything beyond that is far too complex to implement and use19:02
lkclwhat that in turn means is that if you want to know what is "in progress", you *HAVE* to send a *SECOND* DMI command in order to determine that fact.19:03
lkcland, if whatever you are expecting to have been completed has not in fact been completed, then, well, tough, you have to keep looping and polling until it is.19:04
lkclyou *could* in theory stop, then wait say 10 cycles, and *THEN* step19:04
lkclbut what if you issued "STOP" just as the core was running an IEEE754 DIV operation?19:05
lkclwhich takes tens of cycles to complete?19:05
lkclbottom line is, you *must* follow the procedure.19:05
lkcl1) issue STOP19:05
lkcl2) read STAT, check "STOPPED" bit, repeat until set19:05
lkcl3) **ONLY THEN** issue "step"19:05
openpowerbot[slack] <Gustavo Romero> I'm totally ok that the user should loop and poll the state util the core is really stopped19:06
lkcl4) repeat step (2) to make sure that it's actually stopped (again) after running the "stepped" instruction19:06
lkcltake a close look, again, at the sim.py code i sent.19:06
lkclfollow the FSM through, which follows the stop-poll-step-poll procedure19:07
lkclit worked perfectly fine on both Microwatt and Libre-SOC when i wrote it, last year, and was using it to do $Display dumps of all register files after each single-stepped instruction19:07
lkclthat was how i got exact and precise instruction-for-instruction compliance with Microwatt19:08
openpowerbot[slack] <Gustavo Romero> but what I meant is that it seems that `core_stopped` is never ever raised  after a stop is requested or `stopping`signal is never cleared once `core_stopped` is raised19:08
lkclby comparing the 2 debug outputs19:08
lkclafter how many clock cycles did you read the STAT register, and did you put it on a "loop"?19:08
lkclit could be 5 cycles, it could be 50 cycles, it could be 100 cycles19:08
lkclit's been a year since i ran sim.py so i can't tell you exactly how long it will take for core_stopped to be raised19:09
lkclplus, it varies depending on what instruction is being executed, anyway19:10
openpowerbot[slack] <Gustavo Romero> wm_debug  step will read the stat_reg  and check for the stopping bit, if it's set it will say core is not stopped, so if run that comment some seconds apart it should at some point read `stopping` as `0`  . some seconds apart on 100Mhz isn't enough cycles to let the cpu complete its work?19:11
lkclreminder, sim.py with (working) DMI interface interaction: https://git.libre-soc.org/?p=libresoc-litex.git;a=blob;f=sim.py;hb=HEAD19:11
lkclapologies i don't know what wm_debug is19:12
openpowerbot[slack] <Gustavo Romero> ah ok, it's a simple tool in microwatt's script/mw_debug19:12
openpowerbot[slack] <Gustavo Romero> the issue I'm talking about is:19:12
openpowerbot[slack] <Gustavo Romero> ```gromero@gromero2:~/git/microwatt/scripts/mw_debug$ mw stop19:12
openpowerbot[slack] <Gustavo Romero> Connected to libftdi driver.19:12
openpowerbot[slack] <Gustavo Romero> Found device ID: 0x1363109319:12
openpowerbot[slack] <Gustavo Romero> Core: stopping19:12
openpowerbot[slack] <Gustavo Romero>  NIA: c00000000006434819:12
openpowerbot[slack] <Gustavo Romero>  MSR: 900000000000100119:12
openpowerbot[slack] <Gustavo Romero> gromero@gromero2:~/git/microwatt/scripts/mw_debug$ mw step19:12
openpowerbot[slack] <Gustavo Romero> Connected to libftdi driver.19:12
openpowerbot[slack] <Gustavo Romero> Found device ID: 0x1363109319:12
openpowerbot[slack] <Gustavo Romero> Core not stopped !19:12
openpowerbot[slack] <Gustavo Romero> Core: stopping19:12
openpowerbot[slack] <Gustavo Romero>  NIA: 000000000000090019:13
openpowerbot[slack] <Gustavo Romero> the first command sends a stop request via DMI19:13
lkcl1 sec, let me take a look19:13
openpowerbot[slack] <Gustavo Romero> and the second one will only step if the CPU is really stopped as you said19:13
lkclhttps://github.com/antonblanchard/microwatt/blob/master/scripts/mw_debug/mw_debug.c19:14
openpowerbot[slack] <Gustavo Romero> however it checks for stat_reg  bit `stopping`which apparently never gets cleaned , hence the `Core not stopped !`19:14
lkclthen that'll be a bug, if it's being polled correctly19:14
* lkcl looking for where core_status is called19:14
openpowerbot[slack] <Gustavo Romero> I can't see in vhdl `stopping` being cleaned except on reset and when `start` is requested...19:14
openpowerbot[slack] <Gustavo Romero> so I'm wondering if that's right19:15
lkclhmm, core_status is only called at the end of the mw_debug command.  odd19:15
lkclwhere is mw_debug called from?19:15
openpowerbot[slack] <Gustavo Romero> from the command line19:16
lkclonce and only once?19:16
openpowerbot[slack] <Gustavo Romero> it's actually like a tiny debugger using the DMI19:16
openpowerbot[slack] <Gustavo Romero> so you can run it many times19:16
openpowerbot[slack] <Gustavo Romero> to get register status, etc19:17
openpowerbot[slack] <Gustavo Romero> stop cpu19:17
lkclbecause if it's only called once, i would indeed expect the possibility that core_status *might* report "not stopped"19:17
openpowerbot[slack] <Gustavo Romero> and step (which seems to not be working 🙂 )19:17
lkclthere's no polling19:17
lkcli mean, however, if you issue the stop command19:17
lkclthen wait several seconds19:17
lkclthen request a status19:18
lkclthere's no way that the "stopping" should not, by that time, have actually stopped.19:18
openpowerbot[slack] <Gustavo Romero> there is no polling right, but there is check for stopping bit in stat_reg before a step command19:18
lkclmillions of clock cycles would have passed19:18
lkclyeah that's a good idea19:18
lkclissuing "STEP" when the core's not actually stopped is bad19:18
lkclBad (tm) :)19:19
openpowerbot[slack] <Gustavo Romero> if I do `mw_debug stop`  wait let's say 40 s then do `mw_debug step`  and it checks for the bit in question that would have the same result of a polling19:19
lkcllet me just do a quick checkout of the latest microwatt HDL19:19
lkclhttps://github.com/antonblanchard/microwatt/blob/0a415410c9f75e4fd8699c70b43dc26d4114d6ed/core_debug.vhdl#L3219:21
lkclis an input19:21
openpowerbot[slack] <Gustavo Romero> my point is: where in core_debug.vhdl `stopping` bit (which is checked by mw_debug before doing a `step` ) is cleared if not in reset or start state19:21
lkclreported here19:21
lkclhttps://github.com/antonblanchard/microwatt/blob/0a415410c9f75e4fd8699c70b43dc26d4114d6ed/core_debug.vhdl#L12819:21
openpowerbot[slack] <Gustavo Romero> right19:21
openpowerbot[slack] <Gustavo Romero> core_stopped comes from the core19:22
lkclgrep core_stopped *.vhdl ==> ....19:22
lkclhttps://github.com/antonblanchard/microwatt/blob/0a415410c9f75e4fd8699c70b43dc26d4114d6ed/core.vhdl#L48419:22
lkclwhich connects dbg_core_is_stopped19:22
lkclgrep dbg_core_is_stopped *.vhdl ==>19:22
lkclis connected to decode2.vhdl19:23
lkcldecode2.vhdl's stopped_out signal19:23
lkclhttps://github.com/antonblanchard/microwatt/blob/0a415410c9f75e4fd8699c70b43dc26d4114d6ed/decode2.vhdl#L2619:23
lkclwhich is connected to work.control19:24
lkclhttps://github.com/antonblanchard/microwatt/blob/0a415410c9f75e4fd8699c70b43dc26d4114d6ed/decode2.vhdl#L33919:24
lkclgrep stopped_out *.vhdl ==> control.vhdl19:24
lkclwhich leads here19:25
lkclhttps://github.com/antonblanchard/microwatt/blob/0a415410c9f75e4fd8699c70b43dc26d4114d6ed/control.vhdl#L25319:25
lkclstop_mark_in is probably the request (when it was made) via the DMI command "STOP"19:26
lkclv_int.outstanding is probably the Register Hazard system19:27
lkcli.e. "it's a bad idea to tell you we stopped when there's still stuff outstanding to write to the regfile"19:27
lkcl:)19:27
lkclthere's been quite a few changes since i used this19:29
lkclincluding19:29
lkclhttps://github.com/antonblanchard/microwatt/commit/31b55b2a75cd439a00c5eeb3f246e4c2805137ed#diff-e55d140d3f570910e5c7df73af5c77184171361243e42e7460237829f0922d9019:29
lkclwhich changes the way that "outstanding" is written to19:29
lkcli am using a version of microwatt that is around a year old19:29
lkclso it *may* be the case that there have been bugs introduced19:29
lkcli.e. an unintentional side-effect of some of those changes resulted in the stopped_out not being set.19:31
lkcldon't honestly know.19:31
lkclthere's enough to justify raising a bugreport about it (expected behaviour of mw_debug is broken)19:32
lkcland hey! there's an IRC log bot now, so it's possible to provide this URL as context in the bugreport!19:33
lkclhttps://libre-soc.org/irclog-microwatt/%23microwatt.2021-09-16.log.html#t2021-09-16T19:12:4919:33
lkcl:)19:33

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