[otbn] Widen columns slightly when disassembling
This avoids long instructions getting misaligned. Also, move the
alignment number into shared code: there's no reason for it not to
match between otbnsim and otbn-objdump.
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/hw/ip/otbn/dv/otbnsim/sim/isa.py b/hw/ip/otbn/dv/otbnsim/sim/isa.py
index 46a9f7c..98e564e 100644
--- a/hw/ip/otbn/dv/otbnsim/sim/isa.py
+++ b/hw/ip/otbn/dv/otbnsim/sim/isa.py
@@ -102,7 +102,7 @@
assert pc == old_pc
return old_disasm
- disasm = self.insn.disassemble(pc, self.op_vals, 12)
+ disasm = self.insn.disassemble(pc, self.op_vals)
self._disasm = (pc, disasm)
return disasm
diff --git a/hw/ip/otbn/dv/otbnsim/sim/sim.py b/hw/ip/otbn/dv/otbnsim/sim/sim.py
index 7b9e3d5..cc58681 100644
--- a/hw/ip/otbn/dv/otbnsim/sim/sim.py
+++ b/hw/ip/otbn/dv/otbnsim/sim/sim.py
@@ -102,4 +102,4 @@
def _print_trace(self, pc: int, disasm: str, changes: List[Trace]) -> None:
'''Print a trace of the current instruction to verbose_file'''
changes_str = ', '.join([t.trace() for t in changes])
- print('{:08x} | {:35} | [{}]'.format(pc, disasm, changes_str))
+ print('{:08x} | {:45} | [{}]'.format(pc, disasm, changes_str))
diff --git a/hw/ip/otbn/util/otbn-objdump b/hw/ip/otbn/util/otbn-objdump
index 05a1712..cfb239b 100755
--- a/hw/ip/otbn/util/otbn-objdump
+++ b/hw/ip/otbn/util/otbn-objdump
@@ -97,7 +97,7 @@
# Similarly, we know we have a syntax (again, get_insn_masks requires it).
# The rendering of the fields is done by the syntax object.
- return match.group(1) + insn.disassemble(pc, op_vals, 7)
+ return match.group(1) + insn.disassemble(pc, op_vals)
def get_insn_masks(insns_file: InsnsFile) -> List[Tuple[int, int, Insn]]:
diff --git a/hw/ip/otbn/util/rig/program.py b/hw/ip/otbn/util/rig/program.py
index 4337919..9841249 100644
--- a/hw/ip/otbn/util/rig/program.py
+++ b/hw/ip/otbn/util/rig/program.py
@@ -46,7 +46,7 @@
assert op_val is not None
op_vals[operand.name] = op_val
- return self.insn.disassemble(cur_pc, op_vals, 14)
+ return self.insn.disassemble(cur_pc, op_vals)
def to_json(self) -> object:
'''Serialize to an object that can be written as JSON'''
diff --git a/hw/ip/otbn/util/shared/insn_yaml.py b/hw/ip/otbn/util/shared/insn_yaml.py
index f3fe784..3234899 100644
--- a/hw/ip/otbn/util/shared/insn_yaml.py
+++ b/hw/ip/otbn/util/shared/insn_yaml.py
@@ -185,8 +185,7 @@
def disassemble(self,
cur_pc: int,
- op_vals: Dict[str, int],
- mnem_width: int) -> str:
+ op_vals: Dict[str, int]) -> str:
'''Return disassembly for this instruction
op_vals should be a dictionary mapping operand names to operand values
@@ -201,8 +200,8 @@
else:
mnem += ' '
- if len(mnem) < mnem_width:
- mnem += ' ' * (mnem_width - len(mnem))
+ if len(mnem) < 15:
+ mnem += ' ' * (15 - len(mnem))
# The lstrip here deals with a tricky corner case for instructions like
# bn.mulqacc if the .z option isn't supplied. In that case, the syntax