Saturday, 2022-09-03

*** ghostmansd <ghostmansd!> has quit IRC00:02
*** yambo <yambo!~yambo@> has quit IRC04:39
*** yambo <yambo!~yambo@> has joined #libre-soc04:42
*** ghostmansd[m] <ghostmansd[m]!> has quit IRC09:58
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@> has joined #libre-soc09:58
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@> has quit IRC10:07
*** ghostmansd[m] <ghostmansd[m]!> has joined #libre-soc10:08
*** ghostmansd[m] <ghostmansd[m]!> has quit IRC10:21
*** ghostmansd[m] <ghostmansd[m]!> has joined #libre-soc10:43
*** ghostmansd <ghostmansd!> has joined #libre-soc11:16
ghostmansdA quick question, how do we differ LD/ST immediate and LD/ST indexed?11:16
ghostmansdI understand how we differ LD/ST and Normal and Branch; well, I do not quite understand what fits "Normal", but at least I can check Function.LDST and Function.BRANCH.11:17
ghostmansdAh I see, ldst_ra_vec11:18
ghostmansdFuck. ldst_ra_vec goes to in1_isvec. This goes to in1_svdec.isvec...11:28
ghostmansdAgain, in all tables here, it must be obvious _what_ we index11:46
lkclyes it does. ldst_ra_vec is in1_svdec.isvec, from the EXTRA table11:47
lkclLD/ST immediate and LD/ST indexed are from whether the suffix is "ld/st RT,RA,RB" or whether it is "ld/st RT,IMM(RA)" something like that11:48
lkclwhich is challenging... which is why i was suggesting, yesterday, to do two types: SVMode.LDST_IMM and SVMode.LDST_IDX11:49
lkclactually i'll do that now11:50
ghostmansdWe have these two types11:50
lkclno, there's only SVMode.LDST at the moment11:50
ghostmansdCheck inside11:50
ghostmansdnested classes11:50
lkclermermerm ahhh11:51
ghostmansdThese are simply nested11:51
ghostmansdSo from this point of view, the code is ready11:51
lkclwhere the heck is it... ah found it11:52
ghostmansdyou know what? let me just push the wip11:52
ghostmansdcf. recent commit11:52
ghostmansdcf. line 96411:52
lkclhang on there is already LDSTMode in power_enums.py11:52
ghostmansdI can nest it too11:53
ghostmansddon't concentrate on naming11:53
ghostmansdas I confessed11:53
ghostmansdI'm terrible at that11:53
ghostmansdcf line 96411:53
lkclthis isn't a good idea.  it's better to have SVMode right at the top11:53
ghostmansdthere must be some switch which, after that line, goes down to mode.imm/mode.idx11:54
lkclas it's really completely different11:54
ghostmansdbut I'm not sure what to check11:54
lkcli would greatly prefer it be power_enums SVMode11:54
lkclthe operation type11:54
lkcli already answered11:55
lkcl<lkcl> LD/ST immediate and LD/ST indexed are from whether the suffix is "ld/st RT,RA,RB" or whether it is "ld/st RT,IMM(RA)" something like that11:55
lkclbut seriously: this is better done by sv_analysis.py11:56
ghostmansdSo we do have it...11:56
ghostmansdhang on11:56
lkclthat one's LDST_IMM11:57
ghostmansdI don't even see LDST_IDX in our sources11:57
ghostmansdor LDST_IMM11:57
lkclthat's because i haven't added it yet because it was only an idea as of 10 hours ago11:57
ghostmansdyou mean we should do it?11:57
ghostmansdOK then11:57
ghostmansdwell I collect all this info11:58
ghostmansdfrom CSVs11:58
lkclgimme a second11:58
ghostmansdso, if you provide it...11:58'll be simple to grab it11:58
lkclthere's a trick by looking at whether the instruction has "u" or "x" etc. in it11:58
ghostmansdcf. line 28911:58
ghostmansdI grab SVMode11:59
ghostmansdin power_insn.py11:59
* lkcl concentrating on identifying IMM vs IDX ops11:59
ghostmansdso once it's already there with the hint on whether it's idx/imm...11:59
ghostmansdthe trick is done11:59
lkcllwz RT,D(RA) - no "u" or "x" - immediate12:01
ghostmansdI also see we have NORMAL in CSVs12:01
ghostmansdmeanwhile I'll do it, if that's OK12:01
lkcllwzu RT,D(RA) - arse12:01
lkcljust x12:02
* lkcl going to check the table you sent last night12:07
lkclhmm hmm this12:08
lkcl001SVM 1Pack/Unpack mode, SUBVL>112:08
ghostmansdlkcl, I've decoupled LD/ST IMM/IDX modes12:09
ghostmansdno more nesting12:09
*** octavius <octavius!> has joined #libre-soc12:09
lkcltends to suggest an XO-style match (sel) of the *entire* 5-bits12:09
lkclthat one would be "001-1"12:09
lkcl000dz sznormal mode12:09
lkclwould be "000--"12:10
ghostmansd> <ghostmansd> A side note: could we call "normal" at something else?12:10
ghostmansdAlso this12:10
ghostmansdnormal.normal kinda bothers12:10
lkclsiiigh, yeeees, but the issue is, it has to cover both arithmetic and logical12:10
ghostmansdor ALU?12:11
ghostmansdthough, it'd a bit conflict with the fact there are FP operations here...12:11
ghostmansdaren't they?12:11
lkclpronounced "AHH-log"12:12
lkclneeds to be quick to say12:12
lkclfrickin 'ell that's a frickin lot of changes, sigh12:12
ghostmansdperhaps we can approach it from different angle12:13
ghostmansdhang on12:13
ghostmansdhow about changing the second normal?12:13
ghostmansdthis is present in all LDSTImm, LDSTIdx and Normal12:13
lkclthat would be better because otherwise i actually have to move pages around12:14
lkclyes. ok.12:14
ghostmansdMine impression too12:14
ghostmansdyeah default is good12:14
ghostmansdor simple12:14
ghostmansdsimple is better12:14
ghostmansddefault kinda might put a bone in a throat in C12:15
lkclon it12:15
lkclha :)12:15
ghostmansd(unlikely, but still)12:15
ghostmansdOK if you're OK with simple I'll rename the subfields12:15
lkclyes go for it12:16
lkclam doing the wiki / spec12:16
lkcl page done12:17
lkcl done12:17
lkcl done12:18
lkclbranch done too12:19
lkclok all good12:19
lkclRM.mode.normal.ffrc1.sel (19, 20) i'd suggest dropping all of these in favour of using "NN-N-" matching against the *entire* 5 bits12:20
ghostmansdI'm not sure what you mean12:22
ghostmansdhere I just choose the appropriate class12:22
lkclyou have a "sel" embedded at several levels12:23
ghostmansdAh yes, this is a quirk12:23
lkclin many cases it is not enough bits12:23
lkclah ok12:23
lkclRM.mode.normal.puzz.zz (22,)12:23 and are missing12:23
ghostmansdCaused by the fact that I need to explicitly keep any mode as 5-bit12:23
ghostmansdand, well, the simplest option is to inherit12:23
ghostmansdand it brings the parent class (Mode) fields12:24
lkclthen sel should be 5-bit12:24
lkclnot 2-bit12:24
ghostmansdthe sel is something that always 2-bit12:24
ghostmansdall modes always have 2 bits dedicated12:24
lkclso you can do "if sel matches 001-1" --> SVM Pack/Unpack mode12:24
ghostmansdto perform an initial matching12:24
lkclit's more complicated than that.  2-bits is not enough.12:24
lkclit really does have to be a... ah :)12:25
ghostmansdthen of course other fields come to play12:25
ghostmansde.g. Rc, other mode bits...12:25
ghostmansdbut ideally I'd like to switch later to generating these12:25
ghostmansdthere's just way too many code12:25
lkclhonestly i think you'll find it's easier just to do a straight (flat) mask-match against the entire 5 bits12:25
ghostmansdyes, but this would cover one specific case12:25
lkcllike in the CSV files with the pattern-match12:25
lkclindeed - and i think you'll find that they're all unique "one specific case(s)"12:26
lkclanyway - RM.mode.normal.puzz.zz (22,)  - dz and sz are missing12:27
* lkcl afk - need to get up, walk about12:28
*** ghostmansd <ghostmansd!> has quit IRC12:30
ghostmansd[m]lkcl, ack12:37
*** octavius <octavius!> has quit IRC13:05
ghostmansd[m]lkcl, are you OK if I teach LDST_IMM/LDST_IDX?13:09
ghostmansd[m]We'll also have to come up with some way to determine vector registers... We already have custom DynamicOperandGPR/DynamicOperandFPR classes, capable of disassembly.13:11
lkclghostmansd[m], already done13:12
ghostmansd[m]Also, I've been thinking, we should have some verbose mode, which dumps all bits13:12
ghostmansd[m]Wow, amazing, star13:12
lkclit's real simple13:13
lkcl-                mode = 'LDST'13:13
lkcl+                if 'x' in insn_name: # Indexed detection13:13
lkcl+                    mode = 'LDST_IDX'13:13
lkcl+                else:13:13
lkcl+                    mode = 'LDST_IMM'13:13
*** ghostmansd[m] <ghostmansd[m]!> has quit IRC13:28
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@> has joined #libre-soc13:29
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@> has quit IRC13:33
*** ghostmansd[m] <ghostmansd[m]!> has joined #libre-soc13:42
*** ghostmansd <ghostmansd!> has joined #libre-soc13:53
ghostmansdlkcl, a question on normal submodes14:10
ghostmansdsmr (scalar mapreduce), pmr (parallel mapreduce), svmr (subvector mapreduce) and pu (pack/unpack)14:11
ghostmansd(I suggest to give these some names in the column, too)14:11
ghostmansd00     1     0 RG     scalar reduce mode (mapreduce), SUBVL=114:11
ghostmansd00     1     1 /     parallel reduce mode (mapreduce), SUBVL=114:11
ghostmansd00     1     SVM 0     subvector reduce mode, SUBVL>114:11
ghostmansd00     1     SVM 1     Pack/Unpack mode, SUBVL>114:11
ghostmansdCannot be there a conflict, depending on particular RG and SVM values?14:12
ghostmansdthat is, with RG=0, we have it the same as SVM=014:12
ghostmansdOr we perhaps should check PU bit?14:13
ghostmansdIs there some kind of situation like FF/PR check for Rc?14:14
ghostmansd you wrote that PU is dropped, I'm removing it14:15
ghostmansdAh-ha, it depends on SUBVL...14:23
ghostmansdand SUBVL == RM.subvl, and SUBVL=1 is RM.subvl == 0b00...14:25
ghostmansdOK then, I'm using this, please correct me if this crime isn't solved yet14:25
*** ghostmansd <ghostmansd!> has quit IRC14:32
*** lx0 <lx0!~lxo@gateway/tor-sasl/lxo> has quit IRC14:47
*** ghostmansd <ghostmansd!> has joined #libre-soc14:52
*** lxo <lxo!~lxo@gateway/tor-sasl/lxo> has joined #libre-soc15:00
lkclghostmansd, note.... ah yes, you noticed it needs SUBVL>115:04
ghostmansdyeah, sorry, that was false alarm :-)15:05
ghostmansdI'm almost done w/ this decoding15:05
lkclnote that *EXTRA* PU modes are removed15:05
ghostmansdthis is actually nice15:05
lkcland that they are now a sub-mode of ldst normal etc. etc.15:05
ghostmansdthe more I get into it the more I like it15:05
lkclyes, a hell of a lot better than before15:05
lkclwith it being part of EXTRA it sacrificed space there15:05
ghostmansdthat said, the whole scheme is really complicated, thanks to PPC legacy15:06
lkclwhich actually compromised those operations quite a lot15:06
lkclwell, you should see other 3D GPU and Scalable Vector ISAs :)15:06
ghostmansdOK, point taken :-)15:06
lkcland remember ARM SVE/2 is... ~7,000 instructions because it's critically dependent on NEON?15:07
ghostmansdOK I decided we really need the verbose mode to pysvp64dis sooner than later15:10
ghostmansdbecause, well, it'd be damn good to have exact prints for modes, dynamic operands, static operands, and so on15:14
ghostmansdthis really gives the better impression than "go count the bits you fucker"15:15
lkclbtw can you add svshape2 to binutils?15:22
ghostmansdyep, sure15:24
ghostmansdI also need to update one of the tests there15:24
ghostmansdso I need to return here15:24
ghostmansdas for other patches upstream... I've been thinking that I'd like to update it with new fields15:24
ghostmansdfirst, because they really deprecate this idiotic struct svp64_ctx, really eliminate it, and we can update svp64_insn immediately15:25
ghostmansdsecond... anybody will ask, "of this huge file with 3000+ lines, with all these shiny getters and setters, what do you use, exactly?"15:26
ghostmansdand the truth is, when I started writing that code, we had none of this, and I did everything directly (pysvp64asm-style)15:26
ghostmansdbut, anyway, svshape2 is outside of this, so yeah, I'll add it15:27
ghostmansdby the way... haven't we discussed somewhat more explicit name for it?15:27
ghostmansdIIRC that was during last conf call15:27
lkclsvshape2 makes sure people are aware it's using part(s) of the space used by svshape16:10
ghostmansdI'm mostly concerned of 2 :-)16:15
ghostmansdsvshape is fine16:15
ghostmansdAnything else we'd like to see for _word_ instructions?16:20
ghostmansdFor SVP64-augmented, there will be way more16:21
lkclpffh, looks frickin great.16:22
lkclah you want brackets on OE=1,Rc=1 btw16:22
ghostmansdYeah right16:23
lkclotherwise it gives the impression that OE and Rc are actual args of the operation16:23
ghostmansdReconstruct how it looks in the spec16:23
ghostmansdI think we should also print layout for static operands16:23
ghostmansdJust so that the users can compare it16:23
lkcloh btw you saw about target_addr, yesterday?16:23
lkclsigh yes that really does need to be a custom argument16:24
ghostmansdam, nope16:24
ghostmansdLikely I missed it16:24
ghostmansdlet me check logs16:24
ghostmansdaaah I see16:24
ghostmansdOK will update it16:25
lkclthere's actually quite a few hiding like that16:25
ghostmansdWhat if the first two bits are non-zero?16:25
lkclthat's a syntax error!16:26
ghostmansdAh wait16:26
ghostmansdThat's for asm16:26
lkcltry it on binutils-gas.16:26
ghostmansdfor disasm, we only check LI/BD field and append 0b0016:26
lkclLI (and BD) has to get *extracted* from target_addr by doing "target_addr>>2"16:26
lkclyes correct16:26
lkclwhich is why we totally missed it16:27
ghostmansdOK sure I'll update it after disasm16:27
lkcland revert the patch i did, sigh16:27
ghostmansdBasically this is rolling-back 1 commit16:27
ghostmansdAh yes, also mdwn16:27
lkclcommit 617e5af2116:28
lkclcommit 7656b425de316:28
lkclcommit 7fd42a88b16:28
lkclcommit 05cfb8a16:28
ghostmansdShould be better now, I also decided to output operands in binary16:36
ghostmansdI'll do the same for static operands16:36
lkcloh btw can you point me at a demo way of enumerating the full list of instructions?16:39
lkcland, important bit: does the data structure contain the XO width still?16:39
lkcl(the information from insndb.csv)16:40
ghostmansdwe're cooler than binutils16:40
ghostmansdyes, 1 sec16:40
lkclbtw do add these as actual usage-examples (
lkclas little test programs16:41
ghostmansdfrom openpower.decoder.power_enums import (16:42
ghostmansd    find_wiki_dir as _find_wiki_dir,16:42
ghostmansdfrom openpower.decoder.power_insn import (16:42
ghostmansd    Database as _Database,16:42
ghostmansddb = _Database(_find_wiki_dir())16:42
ghostmansdfor insn in db:16:42
ghostmansd    print(insn)16:42
lkclok :)16:42
lkclgot it16:43
ghostmansdinsn is of type power_insn.Record16:43
ghostmansdthere you can descend into ppc, svp64, etc.16:43
ghostmansdbasically it has all info I managed to collect in one place16:43
lkclahh it includes the section and the bitsel16:44
ghostmansdyes, sure16:44
lkclok how can i walk just insndb.csv on its own?16:44
ghostmansdI use these16:44
lkcli need to know the csv file names and the bitwidths in advance16:44
lkcl(in advance of enumerating).16:45
lkcli could do 2-pass sigh16:45
ghostmansdyes and no16:45
ghostmansdyou'll walk insnd.csv and all CSVs mentioned there16:45
lkclok great16:45
ghostmansdand collect these into ppcdb16:45
ghostmansdbut yeah this will give you PPC layer, w/o fields, SVP64 or markdown16:46
ghostmansdah no16:46
ghostmansdyou _have_ to instantiate FieldsDatabase and MdwnDatabase, too16:46
ghostmansdsince PPC database uses these for name resolving16:47
ghostmansdotherwise we cannot lookup instructions like `add.`16:47
lkcli need the *actual* contents of insndb.csv - the minor_xxx.csv filename - section - and the bitsel16:47
lkcli'll do it as 2-pass16:47
ghostmansdthen PPCDatabase is the best option, or simply only consider insn.ppc stuff16:47
ghostmansdI'd go with Database + insn.ppc16:48
ghostmansdother databases are not really meant to be used directly16:48
ghostmansd> btw do add these as actual usage-examples (
ghostmansdwhat do you mean? these are simple outputs from the crap I output from gas, then cut with objcopy to raw binary, then fed to pysvp64dis16:53
lkclyes, exactly.16:53
lkclbut i don't know that.16:53
lkcli have no idea how you did that.16:53
lkcltherefore nobody else will, either16:53
lkclsome actual examples are needed because i currently have to ask you, each time, "can you please run xyz" where i honeslty don't even know what "xyz" is16:54
lkclok for now i'm going to duplicate this code16:56
lkcl1092         with open(path, "r", encoding="UTF-8") as stream:16:56
lkcl1093             for section in parse(stream, Section.CSV):16:56
lkcl1094                 path = (root / section.path)16:56
lkcli need to be able to enumerate the *actual* contents of the actual insndb.csv file16:56
lkcl   not16:56
lkclenumerate *instructions* that have had the insndb.csv information *added* to them16:56
lkclokaaay got it.  Section instances.17:00
lkcli have what i need17:01
ghostmansdthat's what you meant17:07
lkclon it.17:07
ghostmansdsorry, difficult to switch :-)17:07
lkclbasically i'm going to generate a markdown table of the Power v3.1 Appendix D "Opcode Maps"17:07
ghostmansdneat :-)17:09
ghostmansdyeah that'd be handy17:09
lkclprogrammerjake and i ran into a problem where i'd mis-designed the transcendental tables17:09
lkclok now how do i match an XO against an instruction's PPCRecord?17:15
ghostmansdcf. Record.opcode17:18
ghostmansddef opcode(self):17:19
ghostmansdI think this is what you want17:19
lkcllet me try17:19
ghostmansdSimply discard static operands section17:19
ghostmansd(if you don't need them, and you likely don't)17:19
lkclexcellent, got FieldsOpcodes...17:21
lkclnow i have to match them17:22
ghostmansdwith int?17:22
ghostmansd((opcode.value & opcode.mask) == (key & opcode.mask))17:22
ghostmansdkey is your int17:22
lkcland it has to work even for the list-of-opcodes17:22
ghostmansdif it's a list then you will iterate17:23
ghostmansdcf. Database.__getitem__17:23
ghostmansdwe lookup by the opcode there17:23
ghostmansdby name too17:24
lkclright.  it's not matching correctly because FieldsOpcode contains too many bits17:26
lkcl[FieldsOpcode(value=0x78000004, mask=0xfc00001f)]17:26
lkcli *only* want the bits that were in the original insndb.csv17:26
lkclbecause those are the XO17:26
lkcli can exclude everything else, manually, with an additional masking17:27
ghostmansddid you discard static operands?17:27
ghostmansdin def opcode at Record...17:27
lkcli have no idea what they are or how to do it17:27
ghostmansdit does more17:27
ghostmansdthan you need17:28
ghostmansd> <ghostmansd> Simply discard static operands section17:28
lkcli have no idea what that means17:28
ghostmansddon't do stuff on line 54617:29
lkclahh ok.17:29
lkclgot it.17:29
ghostmansdand you'll get XO I think17:29
lkclyes of course, that's the major opcode.17:29
lkclor i could add the major opcode in.  that'd work too17:29
ghostmansdyep, sure17:29
ghostmansd"static operands" is another example of my idiotic naming :-)17:30
lkclF'in A! got it!17:30
ghostmansdthese are fields known in advance17:30
ghostmansdexamples: Rc=1, Oe=117:30
ghostmansdthey kinda act like operands...17:30
ghostmansd...but are not dynamic, provided by user17:30
lkclurrr they're all matching against 0x78000000017:30
ghostmansdso yeah this lead to idiotic "static" name17:30
lkcli obviously haven't quite got this right17:31
ghostmansdcould you give an example?17:31
ghostmansdsay some entry from CSV17:31
ghostmansdthat you'd like to match17:31
ghostmansdand the key you use to match17:31
lkcl010-,SHIFT_ROT,OP_RLC,NO      ,0,0,rldic,MD,17:32
ghostmansd010-,SHIFT_ROT,OP_RLC,NO      ,0,0,rldic,MD,17:32
ghostmansdOK 1 sec17:32
lkclgimme a mo to commit what i have17:33
lkclwrong end17:35
lkcli know17:35
lkclf*****g MSB0 order17:35
ghostmansdWhy do you do it manually?17:37
ghostmansdyou already have XO in section.opcode17:37
ghostmansdor, well, the primary part17:37
lkclbecause i have no idea that that is there17:37
lkclAttributeError: 'FieldsOpcode' object has no attribute 'XO'17:38
ghostmansd1 sec17:38
ghostmansdsection.opcode == 3017:38
ghostmansdfields = []17:39
ghostmansdif section.opcode:17:39
ghostmansd    fields += [(section.opcode.value, BitSel((0, 5)))]17:39
ghostmansd    fields += [(YOUR_VALUE_HERE, section.bitsel)]17:39
ghostmansd    fields += [(YOUR_VALUE_HERE, section.bitsel)]17:39
ghostmansdreturn FieldsOpcode(fields)17:39
ghostmansd^ the last line will take the parts you calculated and merge it17:39
ghostmansdlet me dive a bit more in the script17:40
ghostmansdyou check with insn.opcode, this is not correct if you only want to ensure XO17:41
lkclgetting there...17:41
lkcl Opcode(value=0x0000001e, mask=0x0000001e)17:41
lkclthat's what i need17:42
ghostmansdOK :-)17:42
lkclincluding lists but that's another story17:42
ghostmansdisn't it what you want?17:45
ghostmansd            fields = []17:46
ghostmansd            if section.opcode:17:46
ghostmansd                fields += [(section.opcode.value, BitSel((0, 5)))]17:46
ghostmansd                fields += [(key, section.bitsel)]17:46
ghostmansd            else:17:46
ghostmansd                fields += [(key, section.bitsel)]17:46
ghostmansd            opcode_to_match = FieldsOpcode(fields)17:46
lkclthey're all showing value=0x1e, mask=0x1e17:46
ghostmansdoops, hang on17:46
lkcl    # debug-print all opcodes first17:48
lkcl    for insn in insns:17:48
lkcl        opcode = insn.section.opcode17:48
lkcl        for op in opcode:17:48
lkcl            print ("op",, op)17:48
lkclop rldicl Opcode(value=0x0000001e, mask=0x0000001e)17:48
lkclop rldicr Opcode(value=0x0000001e, mask=0x0000001e)17:48
lkclop rldic Opcode(value=0x0000001e, mask=0x0000001e)17:48
ghostmansd-            opcode = insn.opcode17:50
ghostmansd+            opcode = FieldsOpcode(fields)17:50
ghostmansdbut I'm not sure whether the key is valid, please check it17:51
ghostmansdI haven't dive into lower upper and half and bitlen17:51
ghostmansdfrankly thanks to SelectableInt I really don't do it manually17:51
lkclahh that's giving values 0x78000000417:51
lkcli don't want the 0x70 bit17:52
lkclexcellent, got it17:52
lkclalmost there17:52
ghostmansdOK keep me posted17:53
ghostmansdI don't understand what happens wrt key, though17:54
ghostmansdbut, anyway, considering that you want to check some integer with the opcode without special fields, the code above should do the trick; perhaps you need even less strict mask.17:54
ghostmansdOr maybe you don't need even section.opcode17:55
ghostmansdand only need bitsels17:55
ghostmansdif so, drop `fields += [(insn.section.opcode.value, BitSel((0, 5)))]` line, too17:55
lkcldone already17:55
lkclhooo f****g rah.17:56
lkclat last17:56
ghostmansdso what was it?18:00
lkcljust me floundering around18:00
ghostmansdOK, was it at least MSB0? :-)18:01
lkclyes.  subtracting from 31-*end*18:01
lkclnot 31-*start*18:01
ghostmansdAh OK, I also see you didn't need section.opcode, too18:01
ghostmansdSo at least here my guess was correct :-)18:02
ghostmansdOK I heavily refactored and pushed the recent updates about verbose mode18:08
ghostmansdI did it so that it's up to operand to determine what "verbose" means18:09
ghostmansdcheck BD operand entry18:11
ghostmansd{00} shows the last two bits are ignored18:11
ghostmansdperhaps these should be expressed as ..18:11
ghostmansdanyway, you get the idea18:12
lkcloo, that's posh that is18:13
lkclremember that needs to be reverted to bc BO,BI,target_addr18:13
lkcl*target_addr* would be 00000000000010{00}18:14
lkclBO would just be 0000000000001018:14
ghostmansdAh yeah right18:15
ghostmansdWhat should be in dump, then? If I revert the stuff it'd be simply target_addr with custom repr18:16
ghostmansdand I can mention BO in custom repr18:16
lkcllkcl> *target_addr* would be 00000000000010{00}18:16
lkclif it was there at all18:16
ghostmansdno I mean I understand what happens18:16
lkclit'd be nice but hey18:16
ghostmansdI mean, how to print it better...18:17
lkclyes, i meant in the dump, it'd be nice to have target_addr actually print that out18:17
lkclbut it wouldn't have a list of fields18:17
lkclbut BO would18:17
ghostmansdOK I'll think how to handle it18:17
ghostmansdwe iterate over operands which come from markdown...18:18
ghostmansdand from markdown there must be target_addr...18:18
ghostmansdshould we print operand from markdown, or a real field?18:19
ghostmansdwhat'd be the output you'd expect?18:19
ghostmansdcurrent logic assumes stuff from markdown, but can define custom disassembly for these...18:19
ghostmansdwhat'd be the line you like?18:19
ghostmansdbut preferably a single line18:19
ghostmansdnot two18:19
lkcloh yes.  the line in the mdwn would be good18:20
lkclit may be necessary at some point to actually recreate those (sigh)18:20
ghostmansdso, like this?18:21
ghostmansd    target_addr 00000000000010.. [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]18:21
ghostmansdI'm kinda worried that it hides the real field...18:21
lkclBD is also needed18:22
lkcli _really meant_18:22
lkcl<lkcl> *target_addr* would be 00000000000010{00}18:22
ghostmansdit needs refactoring then...18:22
lkclas one of the lines18:22
lkcl*and* BD18:22
ghostmansdcould we come up with the way that can print it in one line?18:22
ghostmansdbecause this can be done easily18:22
ghostmansdI can tune the actual print18:22
ghostmansdbut preferrably only one line18:23
lkclmm.... well, target_addr is a non-existent field18:23
ghostmansdyeah, agree18:23
lkclbut yes i see no reason why it shouldn't be on the same line18:23
ghostmansdOK let me play with this code a bit...18:23
ghostmansd    BD     00000000000010{00} [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] (target_addr)18:28
ghostmansdhow about this?18:28
lkclit's target_addr that is 00000000000010{00}18:29
ghostmansdoh no wait18:29
lkclit should be18:29
ghostmansdtarget_addr >> 218:29
lkcl    BD     0000000000001018:29
ghostmansdand no {00}18:29
lkcl    BD     00000000000010  [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]  target_addr that is 00000000000010{00}18:29
ghostmansd    BD     00000000000010 (target_addr >> 2) [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]18:31
lkcltarget_addr = 00000000000010{00}18:31
lkclis clearer18:31
lkclor in decimal18:32
lkclah. sign-extended decimal18:32
lkclit's all kinda overkill but still useful for debug18:32
ghostmansdyes, exactly18:32
ghostmansdI'd like that we established some conventions on these18:33
ghostmansdsooner than later18:33
ghostmansdlikely this is not the only case18:33
ghostmansdhow about this?18:36
ghostmansdor rather (=target_addr[0:-2])18:36
lkclblurgh :)18:37
ghostmansdOK I'm open to suggestions :-)18:37
lkclMSB0 numbering.  target_addr>>2 would be better but is still not accurate due to it being sign-extended18:37
ghostmansdBut I agree on blurgh part18:38
lkclwould result in a -ve target_addr18:38
ghostmansdOK, (target_addr=(BD || 0b00))?18:38
lkclor... if we are going for pseudocode18:39
lkclthat'd be "accurate"18:39
ghostmansdCool! Cool cool cool.18:39
lkcldon't have to actually calculate it - just print it18:39
ghostmansd    BD     00000000000010 [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] (target_addr=EXTS(BD || 0b00))18:42
ghostmansdI moved it to the end so that the beginning is the same for all operands18:43
ghostmansdthat is, "{binary} {span} {hints}"18:43
ghostmansdOK pushed, you'll like the cheat with properties I used :-)18:44
lkclargh these opcode-matchings are doing my head in18:45
lkclcan you take a look?18:45
lkcli think i have an off-by-one in binsel.start/end18:45
lkclbut i can't resolve it18:45
ghostmansdOK what code?18:46
lkcli think it's just18:46
lkcl        key = i << (30-end) # MSB0-order shift up by *end*18:46
lkclrather than 31-end18:46
ghostmansdwhat's the expected output?18:48
ghostmansdsome line which you have now, compared to one you want18:48
lkcla table that *would* match that of v3.1 p1162 "Table 12"18:48
lkclif it wasn't for the fact that the buggers have set a different division width :)18:48
lkclthey've done {1}-high bit {3)-low bits18:49
lkcland i assumed the division would be equal18:49
* lkcl head spinning need to walk aroud18:50
ghostmansdcannot find the table yet18:52
ghostmansdAppendix E. Power ISA Instruction Set Sorted by Opcode?18:53
*** lxo <lxo!~lxo@gateway/tor-sasl/lxo> has quit IRC18:57
*** lxo <lxo!~lxo@gateway/tor-sasl/lxo> has joined #libre-soc18:58
ghostmansdLet's do it the other way round. Could you, please, explain one more time, what are you trying to achieve? Assuming you have insndb.csv, what do you want to do with it?19:00
lkclappendix C19:02
lkclcreate the tables from appendix C.19:02
lkclgoal: auto-create the tables from appendix C.19:02
lkclgive me a mo i'm adding an extra option "divpoint"19:03
lkclgot it19:05
lkclsorry, i was looking at v3.0C19:06
ghostmansddef doodle_do_table(path):19:06
ghostmansd    db = Database(root=find_wiki_dir())19:06
ghostmansd    for record in db:19:06
ghostmansd        if == path:19:06
ghostmansd            # THIS IS THE SECTION YOU NEED19:06
ghostmansdno need for the code where you create databases on your own, map them, etc.19:07
ghostmansdOK moving next...19:07
ghostmansd(don't really dive into details, I'll push the patch to branch)19:07
ghostmansdor even master, it doesn't break stuff19:07
lkclyes, master branch19:07
* lkcl afk again, can you help with the pattern-matching19:08
lkclappendix D19:08
lkcltable 1619:08
ghostmansdTable 16:EXT030: Extended Opcode Map for Opcode Space 0, Primary Opcode 30 (bits 27:30)19:09
ghostmansdOK I'm checking this19:09
lkcli know.19:10
lkclthe multiple-entries you normally have are missing19:10
lkclthe table *is* correct19:11
lkclbut the mask is wrong19:11
lkclahhh that's it19:11
lkclthe mask should in some cases be 0b1d19:11
lkclor sorry19:11
lkcl001-,SHIF     ,0,rldicr,MD,19:11
lkclthat's definitely not supposed to be a mask of 0x1e19:12
lkclit should be 0b1110019:12
lkclwhich is19:12
lkcl0x1c sorry19:12
lkcland yet19:12
lkclop rldicr FieldsOpcode(value=0x00000004, mask=0x0000001e)19:12
ghostmansd1 sec19:13
lkclgot it19:14
lkclit is because of         fields += [(insn.ppc.opcode.value, insn.ppc.bitsel)]19:14
lkclthat should be19:14
lkclnot insn.ppc.bitsel19:14
ghostmansdfields work with range or tuple19:16
ghostmansdhang on19:16
ghostmansdwhich value and mask do you expect for rldicr?19:20
lkclthe one that's in the CSV file19:28
lkclgot it!19:29
ghostmansdbits 0..5 are 3019:29
lkclgit pull - i have it19:30
ghostmansdI had no idea you simply wanted vanilla PPC opcode to be compared19:31
ghostmansdnote that it doesn't know about its section19:31
ghostmansdit's just what was in the minor_30.csv19:31
lkclthat's what's in the CSV file, that's what's in the Appendix Opcode Map19:31
lkcli have made one mistake:19:32
lkclmultiple entries are wiped out19:32
ghostmansdnow to iteration19:32
lkcl(svshape for example)19:32
ghostmansddef doodle_do_table(path):19:33
ghostmansd    insns = set()19:33
ghostmansd    db = Database(root=find_wiki_dir())19:33
ghostmansd    for insn in db:19:33
ghostmansd        if == path:19:33
ghostmansd            insns.add(insn)19:33
ghostmansdThis gets all instructions with the CSV you want19:33
ghostmansdthey will be in "insn" set19:34
lkclalready done.19:34
lkclfor insn in db:19:34
lkcl    insns[str(insn.section.path)].append(insn)19:34
lkclit's basically done19:34
ghostmansdI know19:35
ghostmansdI'm speaking of approach19:35
lkclthe only thing that's faulty is when there's multiple instructions19:35
ghostmansdYou don't need to create these databases on your own :-)19:35
lkcli'm not bothered - i'm "done" with that.  it works.19:35
lkclthis is a rush-hack-job19:35
ghostmansdto the faulty part19:35
lkclthe dictionary-by-instruction-name19:36
ghostmansdmultiple svshape?19:36
ghostmansdhash them by opcode19:36
ghostmansdor don't even put them to dict and use set of insns19:36
lkclthey'll all still enumerate though?19:37
ghostmansdand find by iteration (caching if you like)19:37
ghostmansdthat's one of the reasons why I suggest using the Database19:37
lkcli *think* actually it may be ok19:37
ghostmansdor well, store in dict a list of records19:37
ghostmansdup to you how to do it19:37
ghostmansdthis is one of the reasons for that default dict of default dict of sets19:38
lkcli know.19:38
lkclgot it19:38
lkclsorted i think19:38
ghostmansdon PPC database level you're fine, until you start collecting entries on your own19:39
ghostmansdif you do -- it's up to you how to keep, ehem, "collisions"19:39
lkclactually... just found out it isn't19:40
lkcli replaced one operation rldimi 011-19:40
lkclwith two lines19:40
lkcland 011119:40
lkclah 1 sec yep19:41
lkclno it's not showing up19:41
lkclthe 2nd entry doesn't get listed19:43
ghostmansdah yeah, I see...19:44
ghostmansdit seems I'm able to reproduce it19:44
lkclok whew19:44
ghostmansdah wait19:44
ghostmansdwhy should it?19:44
ghostmansdrecall the recent patch19:44
ghostmansdwe discussed, that we simply merge these19:44
ghostmansdand create a new opcode19:44
ghostmansdcheck the mask for these entries19:45
lkcl.... then i need direct access to the *merged* list19:45
ghostmansdrldic FieldsOpcode(value=0x78000008, mask=0xfc00001f)19:45
lkclwhere are those obtained from?19:45
lkcli need the actual original list19:45
lkclfrom which they are merged19:45
ghostmansdHm. It disappears.19:45
ghostmansdBut you can hack...19:45
lkclor... do i need it...19:45
ghostmansdditto def merge in power_insn19:46
ghostmansdand its invocation19:46
ghostmansdbefore _this_ gets called, you have set of instructions19:46
lkcl... yes, i need it, because these are displaying entries.19:46
ghostmansdwhich differ by opcode but have the same name19:46
ghostmansddb[section].add(_functools.reduce(merge, records))19:46
ghostmansdthis line merges such entries19:47
lkclok i'm going to add an option to stop that19:47
ghostmansdit's not that simple, the upper layer expects 1 instruction IIRC19:48
ghostmansdnot a list or set or whatever19:48
ghostmansdhang on19:48
ghostmansdOK what you can do...19:48
ghostmansddrop merge AND refactor PPCRecord.__getitem__19:48
ghostmansdso that it yields, not returns19:49
lkcli'm not going to be able to cope with that :)19:49
ghostmansdI can do it I think19:49
ghostmansdthis is just calling merge later19:49
ghostmansdthat is, not on PPC database layer19:49
* lkcl need to rest. a bit hyped up at the moment19:51
ghostmansdI'll do it tomorrow, OK?19:51
ghostmansdway too tired now19:51
*** octavius <octavius!> has joined #libre-soc19:54
*** ghostmansd[m] <ghostmansd[m]!> has quit IRC19:58
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@> has joined #libre-soc19:59
*** ghostmansd[m] <ghostmansd[m]!~ghostmans@> has quit IRC20:12
*** ghostmansd[m] <ghostmansd[m]!> has joined #libre-soc20:13
*** ghostmansd <ghostmansd!> has quit IRC20:50
*** ghostmansd <ghostmansd!> has joined #libre-soc21:16
ghostmansdYou know what?  Fuck it, I know it's a showstopper. I just did it.21:17
ghostmansdJust iterate over insn.ppc.21:17
ghostmansdAh, by the way, it's in dis branch, I'm again a bit ahead of the rest of the sources. I'm leaving the tests to you if you're brave enough to merge it. :-)21:18
ghostmansdIt actually was surprisingly easy. I had to introduce one smallish hack here (__getattr__), but even this one is not strictly needed, I'll drop it later.21:19
ghostmansdSo, yeah, just treat insn.ppc as a tuple (it in fact is a tuple; it should better have been a frozen set, but who gives a fuck). If you need to know all entries, iterate over insn.ppc; if you need the PPC opcode as if it was merged... unsurprisingly simply use insn.ppc.opcode.21:22
ghostmansdlkcl ^21:22
ghostmansdActually I probably wouldn't do it such simply unless I started from the merge, which is a funny coincidence.21:22
ghostmansdThese leads to two records, with opcode values being 0x4 and 0x5.21:24
*** octavius <octavius!> has quit IRC21:38
lkclghostmansd, thank you22:15
* lkcl needed rest22:16
ghostmansdlkcl, np22:21
lkcltime to run tests in dis branch and cut over, methinks22:24
ghostmansdlet me push22:25
ghostmansdI realized that I need to split stuff like D(RA) into two operands22:25
ghostmansdcurrently they're recognized as one22:25
lkclthat's done in..22:26
ghostmansdI know22:26
lkclor it was.  for ld-st-with-shift22:26
ghostmansdbut not in the part I need22:26
ghostmansdnot in pagereader22:26
ghostmansdoh well22:26
ghostmansdpagereader doesn't need it, actually22:26
lkclit's not hard22:26
ghostmansdI need it :-)22:26
ghostmansdyeah I know22:26
ghostmansdI'll split these at power_insn22:27
ghostmansdbut not today, I already worked since 10 AM22:27
lkclif passes all good for rebase on master?22:27
* lkcl brainmelting22:27
ghostmansdyep, feel free to rebase22:27
lkclsorry, rebase of master?22:27
lkclgreat. about 1/2 hr i imagine22:28
ghostmansdbut still quite a productive day22:28
ghostmansdnote that I had to change the way verbose output is done22:28
ghostmansdnow we're able to output multi-line22:28
ghostmansdI thought about traversing fields, and, well, some are way too long22:29
ghostmansdand from wide they became long :-)22:29
ghostmansdanyway, this is the best I could come up with, unless we want to dive into text wrapping (we don't)22:30
ghostmansdOK time to rest22:30
lkclnight :)22:30
*** ghostmansd <ghostmansd!> has quit IRC22:46
*** klys <klys!> has quit IRC23:14
*** lxo <lxo!~lxo@gateway/tor-sasl/lxo> has quit IRC23:29
*** lxo <lxo!~lxo@gateway/tor-sasl/lxo> has joined #libre-soc23:29
*** lxo <lxo!~lxo@gateway/tor-sasl/lxo> has joined #libre-soc23:31

Generated by 2.17.1 by Marius Gedminas - find it at!