From: Luke Kenneth Casson Leighton Date: Sun, 29 Nov 2020 16:06:05 +0000 (+0000) Subject: add identification of immediates to keys table X-Git-Tag: convert-csv-opcode-to-binary~1626 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86c190b0e5c871d847987edcf456b467688da0a2;p=libreriscv.git add identification of immediates to keys table --- diff --git a/openpower/opcode_regs_deduped.mdwn b/openpower/opcode_regs_deduped.mdwn index 76502b224..20df3acc9 100644 --- a/openpower/opcode_regs_deduped.mdwn +++ b/openpower/opcode_regs_deduped.mdwn @@ -45,41 +45,41 @@ CRio | R/TBD - needs subdivision (cr ops) | # keys [[!table data=""" -unit | in | outcnt | CR in | CR out | imm| name | -LDST | 1 | 1 | 0 | 0 | 1| LDST-1R-1W-imm | -LDST | 1 | 2 | 0 | 0 | 1| LDST-1R-2W-imm | -LDST | 2 | 0 | 0 | 0 | 1| LDST-2R-imm | -LDST | 2 | 1 | 0 | 0 | | LDST-2R-1W | -LDST | 2 | 1 | 0 | 0 | 1| LDST-2R-1W-imm | -LDST | 2 | 2 | 0 | 0 | | LDST-2R-2W | -LDST | 3 | 0 | 0 | 0 | | LDST-3R | -LDST | 3 | 0 | 0 | 1 | | LDST-3R-CRo | -LDST | 3 | 1 | 0 | 0 | | LDST-3R-1W | -OTHER | 0 | 0 | 0 | 0 | | | -OTHER | 0 | 0 | 0 | 0 | 1| imm | -OTHER | 0 | 0 | 1 | 0 | | CRi | -OTHER | 0 | 0 | 1 | 0 | 1| CRi | -OTHER | 0 | 0 | 1 | 1 | | CRio | -OTHER | 0 | 1 | 0 | 0 | | 1W | -OTHER | 0 | 1 | 1 | 0 | | 1W-CRi | -OTHER | 1 | 0 | 0 | 0 | | 1R | -OTHER | 1 | 0 | 0 | 0 | 1| 1R-imm | -OTHER | 1 | 0 | 0 | 1 | 1| 1R-CRo | -OTHER | 1 | 0 | 1 | 1 | | 1R-CRio | -OTHER | 1 | 1 | 0 | 0 | | 1R-1W | -OTHER | 1 | 1 | 0 | 0 | 1| 1R-1W-imm | -OTHER | 1 | 1 | 0 | 1 | | 1R-1W-CRo | -OTHER | 1 | 1 | 0 | 1 | 1| 1R-1W-CRo | -OTHER | 1 | 1 | 1 | 1 | | 1R-1W-CRio | -OTHER | 2 | 0 | 0 | 0 | | 2R | -OTHER | 2 | 0 | 0 | 1 | | 2R-CRo | -OTHER | 2 | 0 | 1 | 1 | | 2R-CRio | -OTHER | 2 | 1 | 0 | 0 | | 2R-1W | -OTHER | 2 | 1 | 0 | 1 | | 2R-1W-CRo | -OTHER | 2 | 1 | 0 | 1 | 1| 2R-1W-CRo | -OTHER | 2 | 1 | 1 | 0 | | 2R-1W-CRi | -OTHER | 2 | 1 | 1 | 1 | | 2R-1W-CRio | -OTHER | 3 | 1 | 1 | 1 | | 3R-1W-CRio | +unit | in | outcnt | CR in | CR out | imm| imms | name | +LDST | 1 | 1 | 0 | 0 | 1| SI/DS | LDST-1R-1W-imm | +LDST | 1 | 2 | 0 | 0 | 1| SI/DS | LDST-1R-2W-imm | +LDST | 2 | 0 | 0 | 0 | 1| SI/DS | LDST-2R-imm | +LDST | 2 | 1 | 0 | 0 | | | LDST-2R-1W | +LDST | 2 | 1 | 0 | 0 | 1| SI/DS | LDST-2R-1W-imm | +LDST | 2 | 2 | 0 | 0 | | | LDST-2R-2W | +LDST | 3 | 0 | 0 | 0 | | | LDST-3R | +LDST | 3 | 0 | 0 | 1 | | | LDST-3R-CRo | +LDST | 3 | 1 | 0 | 0 | | | LDST-3R-1W | +OTHER | 0 | 0 | 0 | 0 | | | | +OTHER | 0 | 0 | 0 | 0 | 1| LI | imm | +OTHER | 0 | 0 | 1 | 0 | | | CRi | +OTHER | 0 | 0 | 1 | 0 | 1| BD | CRi | +OTHER | 0 | 0 | 1 | 1 | | | CRio | +OTHER | 0 | 1 | 0 | 0 | | | 1W | +OTHER | 0 | 1 | 1 | 0 | | | 1W-CRi | +OTHER | 1 | 0 | 0 | 0 | | | 1R | +OTHER | 1 | 0 | 0 | 0 | 1| SI | 1R-imm | +OTHER | 1 | 0 | 0 | 1 | 1| SI/UI | 1R-CRo | +OTHER | 1 | 0 | 1 | 1 | | | 1R-CRio | +OTHER | 1 | 1 | 0 | 0 | | | 1R-1W | +OTHER | 1 | 1 | 0 | 0 | 1| SI/UI | 1R-1W-imm | +OTHER | 1 | 1 | 0 | 1 | | | 1R-1W-CRo | +OTHER | 1 | 1 | 0 | 1 | 1| M1/SI/SH/UI/SH32 | 1R-1W-CRo | +OTHER | 1 | 1 | 1 | 1 | | | 1R-1W-CRio | +OTHER | 2 | 0 | 0 | 0 | | | 2R | +OTHER | 2 | 0 | 0 | 1 | | | 2R-CRo | +OTHER | 2 | 0 | 1 | 1 | | | 2R-CRio | +OTHER | 2 | 1 | 0 | 0 | | | 2R-1W | +OTHER | 2 | 1 | 0 | 1 | | | 2R-1W-CRo | +OTHER | 2 | 1 | 0 | 1 | 1| SH/SH32 | 2R-1W-CRo | +OTHER | 2 | 1 | 1 | 0 | | | 2R-1W-CRi | +OTHER | 2 | 1 | 1 | 1 | | | 2R-1W-CRio | +OTHER | 3 | 1 | 1 | 1 | | | 3R-1W-CRio | """]] ## LDST-1R-1W-imm (I) diff --git a/openpower/sv_analysis.py b/openpower/sv_analysis.py index 8311e2855..9464ddfd4 100644 --- a/openpower/sv_analysis.py +++ b/openpower/sv_analysis.py @@ -151,6 +151,7 @@ def process_csvs(): bykey = {} primarykeys = set() dictkeys = OrderedDict() + immediates = {} print ("# OpenPOWER ISA register 'profile's") print ('') @@ -188,6 +189,13 @@ def process_csvs(): bykey[key].append((csvname, row['opcode'], row['comment'], row['form'].upper() + '-Form')) + # detect immediates, collate them (useful info) + if row['in2'].startswith('CONST_'): + imm = row['in2'].split("_")[1] + if key not in immediates: + immediates[key] = set() + immediates[key].add(imm) + primarykeys = list(primarykeys) primarykeys.sort() @@ -237,11 +245,14 @@ def process_csvs(): print ("# keys") print ('') print ('[[!table data="""') - print (tformat(tablecols) + " name |") + print (tformat(tablecols) + " imms | name |") for key in primarykeys: name = keyname(dictkeys[key]) - print (tformat(dictkeys[key].values()) + " %s |" % name) + row = tformat(dictkeys[key].values()) + row += " %s | " % ("/".join(list(immediates.get(key, "")))) + row += " %s |" % name + print (row) print ('"""]]') print ('')