From e3a5a8356d085c96c97d5c917e1c91225bafa178 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 7 Nov 2025 16:27:39 +0100 Subject: [PATCH] index error in the aarch64 fix solved --- src/copapy/_compiler.py | 4 +++- tests/test_issue001_aarch64.py | 16 ++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/copapy/_compiler.py b/src/copapy/_compiler.py index 1b95445..9150aed 100644 --- a/src/copapy/_compiler.py +++ b/src/copapy/_compiler.py @@ -143,9 +143,11 @@ def add_write_ops(net_node_list: list[tuple[Net | None, Node]], const_nets: list yield None, node if net: + # Update virtual register state with result net and 2. parameter net registers[0] = net if len(node.args) > 1: - registers[1] = net + registers[1] = node.args[1] + #print("* reg", node.name, [transl_type(r.dtype) if r else 'int' for r in registers]) if net in read_back_nets and net not in stored_nets: type_list = [transl_type(r.dtype) if r else 'int' for r in registers] diff --git a/tests/test_issue001_aarch64.py b/tests/test_issue001_aarch64.py index 04f038b..601521e 100644 --- a/tests/test_issue001_aarch64.py +++ b/tests/test_issue001_aarch64.py @@ -22,7 +22,7 @@ def parse_results(log_text: str) -> dict[int, bytes]: for match in matches: value_str: list[str] = match.group(3).strip().split(' ') - print('--', value_str) + #print('--', value_str) value = bytes(int(v, base=16) for v in value_str) if len(value) <= 8: var_dict[int(match.group(1))] = value @@ -81,17 +81,13 @@ def iiftests(c1: NumLike) -> list[NumLike]: def test_compile(): + c_i = variable(9) + c_f = variable(1.111) + c_b = variable(True) - a1 = 0.0 - a2 = 3 - - c1 = variable(a1) - c2 = variable(a2) + ret_test = function1(c_i) + function1(c_f) + function2(c_i) + function2(c_f) + function3(c_i) + function4(c_i) + function5(c_b) + [variable(9) % 2] + iiftests(c_i) + iiftests(c_f) + ret_ref = function1(9) + function1(1.111) + function2(9) + function2(1.111) + function3(9) + function4(9) + function5(True) + [9 % 2] + iiftests(9) + iiftests(1.111) - ret_test = [c1 + c2, c2 + c2] - ret_ref: list[int | float] = [a1 + a2, a2 + a2] - - #out = [Write(r) for r in ret_test] out = [Write(r) for r in ret_test] #ret_test += [c_i, v2]