Skip to content

Commit

Permalink
M7: Adjust MAC forwarding paths
Browse files Browse the repository at this point in the history
  • Loading branch information
mkannwischer committed Dec 20, 2024
1 parent eaa2e75 commit 1795e7d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions slothy/targets/arm_v7m/cortex_m7.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,16 @@ def get_latency(src, out_idx, dst):
latency = lookup_multidict(default_latencies, src)

# Forwarding path to MAC instructions
if instclass_dst in [mla, mls, smlabb, smlabt, smlatt, smlatb] and src.args_out[0] == dst.args_in[2]:
if instclass_dst in [mla, mls, smlabb, smlabt, smlatt, smlatb] and dst.args_in[2] in (src.args_out + src.args_in_out):
latency = latency - 1

if instclass_dst in [smlal] and \
(src.args_out[0] == dst.args_in_out[0] or src.args_out[0] == dst.args_in_out[1]):
latency = latency - 1
if instclass_dst in [smlal]:
if len(src.args_out) > 1:
if (src.args_out[0] == dst.args_in_out[0] or src.args_out[0] == dst.args_in_out[1]):
latency = latency - 1
elif len(src.args_in_out) > 1:
if (src.args_in_out[0] == dst.args_in_out[0] or src.args_in_out[0] == dst.args_in_out[1]):
latency = latency - 1

# Multiply accumulate chain latency is 1
if instclass_src in [smlal] and instclass_dst in [smlal] and \
Expand Down

0 comments on commit 1795e7d

Please sign in to comment.