aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2022-05-10 12:42:27 +0100
committerJohan Alfvén <johan.alfven@arm.com>2022-05-11 13:27:25 +0200
commit114baba1c84d724f049af09a4601ff9038085ac4 (patch)
tree9d24eb06260b09dfdb386e78d58b762ea3e129f4
parente80038a6e5378504d257c5b5db0a15a090df4424 (diff)
downloadethos-u-vela-114baba1c84d724f049af09a4601ff9038085ac4.tar.gz
MLBEDSW-6452: Add byte offset in command stream
- Added the offset address to the command stream disassembly Signed-off-by: Tim Hall <tim.hall@arm.com> Change-Id: I55c6ef59878c90c21d41051c076da6c1f0fa4201
-rw-r--r--ethosu/vela/register_command_stream_generator.py37
1 files changed, 24 insertions, 13 deletions
diff --git a/ethosu/vela/register_command_stream_generator.py b/ethosu/vela/register_command_stream_generator.py
index 7858e70..0e68b14 100644
--- a/ethosu/vela/register_command_stream_generator.py
+++ b/ethosu/vela/register_command_stream_generator.py
@@ -136,29 +136,40 @@ class CommandStreamEmitter:
return [elem for cmd in self.cmd_stream for elem in cmd]
def print_cmds(self):
- print("Code: Command: Param: Payload:")
+ s = f" {'Offset':6}:"
+ s += f" {'Payload':8}"
+ s += f"{'Param':4}" # no leading space for alignment
+ s += f" {'Code':4}"
+ s += f" - {'Command':30}"
+ s += f" {'Param':5}"
+ print(s)
+
+ offset = 0
for words_for_one_command in self.cmd_stream:
code = words_for_one_command[0] & 0x0000FFFF # lower 16 bits
param = words_for_one_command[0] >> 16 # higher 16 bits
payload_mode = CmdMode(code & CmdMode.Mask)
- # code and command
- s = " 0x%04x " % code
+ s = f"0x{offset:06x}:"
+
if payload_mode == CmdMode.NoPayload:
- s += str(cmd0(code & CmdMode.CmdOpMask))
+ s += f" {'':8}"
else:
- s += str(cmd1(code & CmdMode.CmdOpMask))
+ assert payload_mode == CmdMode.Payload32
+ s += f" {words_for_one_command[1]:08x}"
- s = s.ljust(40)
- s += "%5d" % param
+ s += f" {param:04x}"
+ s += f" {code:04x}"
- # payload
- if payload_mode == CmdMode.Payload32:
- s += " 0x%08x (%d)" % (words_for_one_command[1], words_for_one_command[1])
+ if payload_mode == CmdMode.NoPayload:
+ s += f" - {cmd0(code & CmdMode.CmdOpMask):30}"
+ offset += 4
else:
- s += " -"
+ s += f" - {cmd1(code & CmdMode.CmdOpMask):30}"
+ offset += 8
+ s += f" {param:5}"
print(s)
def cmd0_with_param(self, cmd: cmd0, param):
@@ -1047,8 +1058,8 @@ def generate_command_stream(
if verbose:
emit.print_cmds()
- print("number of commands", len(emit.cmd_stream))
- print("command stream length in words", len(res))
+ print(f"Number of commands = {len(emit.cmd_stream)}")
+ print(f"Command stream length = {emit.size_in_bytes()} bytes")
return res