def tformat(d):
- return ' | '.join(d) + " |"
+ return "| " + ' | '.join(d) + " |"
def keyname(row):
insns = {} # dictionary of CSV row, by instruction
insn_to_csv = {}
- print("# OpenPOWER ISA register 'profile's")
+ print("# Draft SVP64 Power ISA register 'profile's")
print('')
print("this page is auto-generated, do not edit")
print("created by http://libre-soc.org/openpower/sv_analysis.py")
# Ignore those containing: valid test sprs
for fname in glob(pth):
- print("sv analysis checking", fname)
+ #print("sv analysis checking", fname)
_, name = os.path.split(fname)
if '-' in name:
continue
for row in csv:
if blank_key(row):
continue
- print("row", row)
+ #print("row", row)
insn_name = row['comment']
condition = row['CONDITIONS']
# skip instructions that are not suitable
}
print("# map to old SV Prefix")
print('')
- print('[[!table data="""')
+ print('|internal key | public name |')
+ print('|----- | ---------- |')
for key in primarykeys:
name = keyname(dictkeys[key])
value = mapsto.get(name, "-")
print(tformat([name, value + " "]))
- print('"""]]')
+ print('')
print('')
print("# keys")
print('')
- print('[[!table data="""')
print(tformat(tablecols) + " imms | name |")
+ print(tformat([" - "] * (len(tablecols)+2)))
# print out the keys and the table from which they're derived
for key in primarykeys:
row += " %s | " % ("/".join(imms))
row += " %s |" % name
print(row)
- print('"""]]')
+ print('')
print('')
# print out, by remap name, all the instructions under that category
value = mapsto.get(name, "-")
print("## %s (%s)" % (name, value))
print('')
- print('[[!table data="""')
- print(tformat(['CSV', 'opcode', 'asm', 'form']))
+ print(tformat(['CSV', 'opcode', 'asm', 'flags', 'form']))
+ print(tformat(['---', '------', '---', '-----', '----']))
rows = bykey[key]
rows.sort()
for row in rows:
print(tformat(row))
- print('"""]]')
+ print('')
print('')
# for fname, csv in csvs.items():
# if row[idx] == 'NONE':
# row[idx] = ''
# get the instruction
- print(key, row)
+ #print(key, row)
insn_name = row[2]
condition = row[3]
insn = insns[(insn_name, condition)]
else:
regs.append('')
- print("regs", insn_name, regs)
+ #print("regs", insn_name, regs)
# for LD/ST FP, use FRT/FRS not RT/RS, and use CR1 not CR0
if insn_name.startswith("lf"):
# Ignore those containing: valid test sprs
for fname in glob(pth):
- print("post-checking", fname)
+ #print("post-checking", fname)
_, name = os.path.split(fname)
if '-' in name:
continue
re = re.replace("1P", "P1")
re = re.replace("2P", "P2")
row.append(re)
- print("sventry", sventry)
+ #print("sventry", sventry)
for colname in sv_cols:
if sventry is None:
re = 'NONE'
def main():
+ import os
+ os.environ['SILENCELOG'] = '1'
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--format",
type=Format, choices=Format, default=Format.VHDL,