OR-1 dataflow CPU sketch

refactor: update assembler tests for ctx→act_id and frame_count renames

Task 7: Update assembler test files for terminology renames

Changes:
- Rename node.ctx to node.act_id in assertions (test_allocate.py)
- Rename system.ctx_slots to system.frame_count in test configs
(test_place.py, test_autoplacement.py, test_allocate.py, and related files)
- Rename FREE_CTX to FREE_FRAME in test node construction
(test_allocate.py, test_codegen.py, test_call_wiring.py)
- Update @system pragma parameter from "ctx" to "frames" (test_lower.py)
Also update default IRAM capacity from 64 to 256 to match new default
- Update test_opcodes.py for shift mnemonic renames and new opcodes:
- "shiftl"/"shiftr"/"ashiftr" → "shl"/"shr"/"asr"
- Add "free_frame" (was "free_ctx")
- Add "extract_tag" and "alloc_remote" (new routing ops)
- Update MONADIC_OPS count from 20 to 22 (added EXTRACT_TAG, ALLOC_REMOTE)
- Update MNEMONIC_TO_OP count from 43 to 45
- Update test names and assertions for free_frame terminology

These changes enable the frame-based activation model where:
- Activations replace contexts for scoping
- Frames replace ctx_slots for concurrent activation tracking
- New routing opcodes (EXTRACT_TAG, ALLOC_REMOTE) are monadic
- Shift opcodes use standardized mnemonics

Orual 6536e730 5e7116ea

+92 -87
+25 -25
tests/test_allocate.py
··· 156 156 add_node = result.nodes["$main.&add"] 157 157 sub_node = result.nodes["$main.&sub"] 158 158 # Both should have ctx=0 (same function scope) 159 - assert add_node.ctx == 0 160 - assert sub_node.ctx == 0 159 + assert add_node.act_id == 0 160 + assert sub_node.act_id == 0 161 161 162 162 def test_multiple_function_scopes(self): 163 163 """PE with nodes from $main and $helper.""" ··· 189 189 add_node = result.nodes["$main.&add"] 190 190 helper_node = result.nodes["$helper.&inc"] 191 191 # $main should get ctx=0, $helper should get ctx=1 192 - assert add_node.ctx == 0 193 - assert helper_node.ctx == 1 192 + assert add_node.act_id == 0 193 + assert helper_node.act_id == 1 194 194 195 195 def test_toplevel_nodes(self): 196 196 """Top-level nodes (no function scope) get ctx=0.""" ··· 215 215 assert len(result.errors) == 0 216 216 add_node = result.nodes["&add"] 217 217 sub_node = result.nodes["&sub"] 218 - assert add_node.ctx == 0 219 - assert sub_node.ctx == 0 218 + assert add_node.act_id == 0 219 + assert sub_node.act_id == 0 220 220 221 221 def test_multiple_functions_order_preserved(self): 222 222 """Context slots assigned in order of first appearance.""" ··· 256 256 c_node = result.nodes["$helper.&c"] 257 257 d_node = result.nodes["$fib.&d"] 258 258 # First appearance order: $fib (ctx=0), $main (ctx=1), $helper (ctx=2) 259 - assert a_node.ctx == 0 260 - assert d_node.ctx == 0 # Same function as first 261 - assert b_node.ctx == 1 262 - assert c_node.ctx == 2 259 + assert a_node.act_id == 0 260 + assert d_node.act_id == 0 # Same function as first 261 + assert b_node.act_id == 1 262 + assert c_node.act_id == 2 263 263 264 264 265 265 class TestDestinationResolution: ··· 485 485 loc=SourceLoc(5, 1), 486 486 ), 487 487 } 488 - system = SystemConfig(pe_count=1, sm_count=1, ctx_slots=4) 488 + system = SystemConfig(pe_count=1, sm_count=1, frame_count=4) 489 489 graph = IRGraph(nodes, system=system) 490 490 result = allocate(graph) 491 491 ··· 516 516 loc=SourceLoc(3, 1), 517 517 ), 518 518 } 519 - system = SystemConfig(pe_count=1, sm_count=1, ctx_slots=2) 519 + system = SystemConfig(pe_count=1, sm_count=1, frame_count=2) 520 520 graph = IRGraph(nodes, system=system) 521 521 result = allocate(graph) 522 522 ··· 788 788 add_node = result.nodes["$main.&add"] 789 789 counter_node = result.nodes["$main.#loop_0.&counter"] 790 790 # Both should have ctx=0 (same function scope, macro segment ignored) 791 - assert add_node.ctx == 0 792 - assert counter_node.ctx == 0 791 + assert add_node.act_id == 0 792 + assert counter_node.act_id == 0 793 793 794 794 def test_macro_scope_distinguishes_from_different_functions(self): 795 795 """Macro segments don't prevent distinguishing different functions.""" ··· 815 815 main_counter = result.nodes["$main.#loop_0.&counter"] 816 816 helper_counter = result.nodes["$helper.#loop_0.&counter"] 817 817 # Different functions get different ctx values 818 - assert main_counter.ctx == 0 819 - assert helper_counter.ctx == 1 818 + assert main_counter.act_id == 0 819 + assert helper_counter.act_id == 1 820 820 821 821 def test_macro_scope_with_root_and_function(self): 822 822 """Macro scope at root and function scope get different ctx slots.""" ··· 845 845 # $main extracts to "$main" (function scope) 846 846 # First appearance gets ctx=0, next gets ctx=1 847 847 # macro_counter appears first in the PE's node list after IRAM packing 848 - assert macro_counter.ctx == 0 # First scope seen 849 - assert main_add.ctx == 1 # Second scope seen 848 + assert macro_counter.act_id == 0 # First scope seen 849 + assert main_add.act_id == 1 # Second scope seen 850 850 851 851 852 852 class TestPerCallSiteAllocation: ··· 875 875 ), 876 876 "&free_ctx_1": IRNode( 877 877 name="&free_ctx_1", 878 - opcode=RoutingOp.FREE_CTX, 878 + opcode=RoutingOp.FREE_FRAME, 879 879 pe=0, 880 880 loc=SourceLoc(4, 1), 881 881 ), 882 882 "&free_ctx_2": IRNode( 883 883 name="&free_ctx_2", 884 - opcode=RoutingOp.FREE_CTX, 884 + opcode=RoutingOp.FREE_FRAME, 885 885 pe=0, 886 886 loc=SourceLoc(5, 1), 887 887 ), ··· 918 918 919 919 # Both trampoline nodes should have ctx values assigned (per-call-site) 920 920 # They should be different 921 - assert trampoline_1.ctx is not None 922 - assert trampoline_2.ctx is not None 923 - assert trampoline_1.ctx != trampoline_2.ctx 921 + assert trampoline_1.act_id is not None 922 + assert trampoline_2.act_id is not None 923 + assert trampoline_1.act_id != trampoline_2.act_id 924 924 925 925 def test_context_overflow_produces_resource_error(self): 926 926 """Context overflow produces RESOURCE error with per-PE breakdown.""" ··· 944 944 loc=SourceLoc(i+1, 1), 945 945 )) 946 946 947 - system = SystemConfig(pe_count=1, sm_count=1, ctx_slots=16) 947 + system = SystemConfig(pe_count=1, sm_count=1, frame_count=16) 948 948 graph = IRGraph(nodes, system=system, call_sites=call_sites) 949 949 result = allocate(graph) 950 950 ··· 977 977 loc=SourceLoc(i+1, 1), 978 978 )) 979 979 980 - system = SystemConfig(pe_count=1, sm_count=1, ctx_slots=16) 980 + system = SystemConfig(pe_count=1, sm_count=1, frame_count=16) 981 981 graph = IRGraph(nodes, system=system, call_sites=call_sites) 982 982 result = allocate(graph) 983 983
+10 -10
tests/test_autoplacement.py
··· 25 25 "&c": IRNode(name="&c", opcode=ArithOp.INC, pe=None, loc=SourceLoc(3, 1)), 26 26 "&d": IRNode(name="&d", opcode=ArithOp.DEC, pe=None, loc=SourceLoc(4, 1)), 27 27 } 28 - system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, ctx_slots=4) 28 + system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, frame_count=4) 29 29 graph = IRGraph(nodes, system=system) 30 30 result = place(graph) 31 31 ··· 45 45 "&c1": IRNode(name="&c1", opcode=RoutingOp.CONST, pe=None, const=5, loc=SourceLoc(1, 1)), 46 46 "&c2": IRNode(name="&c2", opcode=RoutingOp.CONST, pe=None, const=10, loc=SourceLoc(2, 1)), 47 47 } 48 - system = SystemConfig(pe_count=1, sm_count=1, iram_capacity=64, ctx_slots=4) 48 + system = SystemConfig(pe_count=1, sm_count=1, iram_capacity=64, frame_count=4) 49 49 graph = IRGraph(nodes, system=system) 50 50 result = place(graph) 51 51 ··· 65 65 "&unplaced1": IRNode(name="&unplaced1", opcode=ArithOp.INC, pe=None, loc=SourceLoc(3, 1)), 66 66 "&unplaced2": IRNode(name="&unplaced2", opcode=ArithOp.DEC, pe=None, loc=SourceLoc(4, 1)), 67 67 } 68 - system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, ctx_slots=4) 68 + system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, frame_count=4) 69 69 graph = IRGraph(nodes, system=system) 70 70 result = place(graph) 71 71 ··· 83 83 "&a": IRNode(name="&a", opcode=ArithOp.ADD, pe=0, loc=SourceLoc(1, 1)), 84 84 "&b": IRNode(name="&b", opcode=ArithOp.SUB, pe=1, loc=SourceLoc(2, 1)), 85 85 } 86 - system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, ctx_slots=4) 86 + system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, frame_count=4) 87 87 graph = IRGraph(nodes, system=system) 88 88 result = place(graph) 89 89 ··· 104 104 edges = [ 105 105 IREdge(source="&a", dest="&b", port=Port.L, loc=SourceLoc(3, 1)), 106 106 ] 107 - system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, ctx_slots=4) 107 + system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, frame_count=4) 108 108 graph = IRGraph(nodes, edges=edges, system=system) 109 109 result = place(graph) 110 110 ··· 124 124 IREdge(source="&b", dest="&c", port=Port.L, loc=SourceLoc(5, 1)), 125 125 IREdge(source="&a", dest="&c", port=Port.R, loc=SourceLoc(6, 1)), 126 126 ] 127 - system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, ctx_slots=4) 127 + system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, frame_count=4) 128 128 graph = IRGraph(nodes, edges=edges, system=system) 129 129 result = place(graph) 130 130 ··· 144 144 edges = [ 145 145 IREdge(source="&placed", dest="&unplaced", port=Port.L, loc=SourceLoc(3, 1)), 146 146 ] 147 - system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, ctx_slots=4) 147 + system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, frame_count=4) 148 148 graph = IRGraph(nodes, edges=edges, system=system) 149 149 result = place(graph) 150 150 ··· 168 168 loc=SourceLoc(i + 1, 1), 169 169 ) 170 170 171 - system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, ctx_slots=4) 171 + system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, frame_count=4) 172 172 graph = IRGraph(nodes, system=system) 173 173 result = place(graph) 174 174 ··· 192 192 loc=SourceLoc(i + 1, 1), 193 193 ) 194 194 195 - system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, ctx_slots=4) 195 + system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, frame_count=4) 196 196 graph = IRGraph(nodes, system=system) 197 197 result = place(graph) 198 198 ··· 237 237 edges=[], 238 238 regions=[main_region], 239 239 data_defs=[], 240 - system=SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, ctx_slots=4), 240 + system=SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, frame_count=4), 241 241 errors=[], 242 242 ) 243 243
+1 -1
tests/test_call_wiring.py
··· 236 236 if node_name.startswith("$add.__free_ctx_"): 237 237 free_ctx_found = True 238 238 free_ctx = graph.nodes[node_name] 239 - assert free_ctx.opcode == RoutingOp.FREE_CTX 239 + assert free_ctx.opcode == RoutingOp.FREE_FRAME 240 240 break 241 241 242 242 assert free_ctx_found, "No free_ctx node found"
+8 -8
tests/test_codegen.py
··· 277 277 assert isinstance(token, MonadToken) 278 278 assert token.target == 0 279 279 assert token.offset == 2 280 - assert token.ctx == 0 280 + assert token.act_id == 0 281 281 assert token.data == 99 282 282 assert token.inline == False 283 283 ··· 507 507 elif isinstance(token, IRAMWriteToken): 508 508 assert isinstance(token.target, int) 509 509 assert isinstance(token.offset, int) 510 - assert isinstance(token.ctx, int) 510 + assert isinstance(token.act_id, int) 511 511 assert isinstance(token.data, int) 512 512 assert isinstance(token.instructions, tuple) 513 513 elif isinstance(token, MonadToken): 514 514 assert isinstance(token.target, int) 515 515 assert isinstance(token.offset, int) 516 - assert isinstance(token.ctx, int) 516 + assert isinstance(token.act_id, int) 517 517 assert isinstance(token.data, int) 518 518 519 519 ··· 925 925 assert pass_inst.ctx_mode == 0 # Normal operation 926 926 927 927 def test_free_ctx_node_normal_codegen(self): 928 - """FREE_CTX nodes generate normal ALUInst. 928 + """FREE_FRAME nodes generate normal ALUInst. 929 929 930 930 Tests that: 931 - - FREE_CTX (context deallocation) nodes are codegen'd normally 931 + - FREE_FRAME (context deallocation) nodes are codegen'd normally 932 932 """ 933 933 node_free_ctx = IRNode( 934 934 name="&free_ctx", 935 - opcode=RoutingOp.FREE_CTX, 935 + opcode=RoutingOp.FREE_FRAME, 936 936 pe=0, 937 937 iram_offset=0, 938 938 ctx=2, # Call site ctx to free ··· 949 949 pe0_config = next(c for c in result.pe_configs if c.pe_id == 0) 950 950 free_inst = pe0_config.iram[0] 951 951 952 - # Verify FREE_CTX node produces normal ALUInst 952 + # Verify FREE_FRAME node produces normal ALUInst 953 953 assert isinstance(free_inst, ALUInst) 954 - assert free_inst.op == RoutingOp.FREE_CTX 954 + assert free_inst.op == RoutingOp.FREE_FRAME 955 955 assert free_inst.ctx_mode == 0 # Normal operation 956 956 957 957 def test_packed_const_bit_layout(self):
+1 -1
tests/test_integration.py
··· 281 281 env, 282 282 [ 283 283 PEConfig( 284 - pe_id=0, iram={}, ctx_slots=8, gen_counters=[1, 2, 3, 4, 5, 6, 7, 8] 284 + pe_id=0, iram={}, frame_count=8, gen_counters=[1, 2, 3, 4, 5, 6, 7, 8] 285 285 ) 286 286 ], 287 287 [],
+4 -4
tests/test_lower.py
··· 312 312 assert graph.system is not None 313 313 assert graph.system.pe_count == 4 314 314 assert graph.system.sm_count == 1 315 - assert graph.system.iram_capacity == 64 # default 316 - assert graph.system.ctx_slots == 4 # default 315 + assert graph.system.iram_capacity == 256 # default 316 + assert graph.system.frame_count == 8 # default 317 317 318 318 def test_system_pragma_full(self, parser): 319 319 """Parse full system pragma.""" 320 320 graph = parse_and_lower(parser, """\ 321 - @system pe=2, sm=1, iram=128, ctx=2 321 + @system pe=2, sm=1, iram=128, frames=2 322 322 """) 323 323 324 324 assert graph.system.pe_count == 2 325 325 assert graph.system.sm_count == 1 326 326 assert graph.system.iram_capacity == 128 327 - assert graph.system.ctx_slots == 2 327 + assert graph.system.frame_count == 2 328 328 329 329 def test_system_pragma_hex_values(self, parser): 330 330 """Parse system pragma with hexadecimal values."""
+33 -28
tests/test_opcodes.py
··· 20 20 assert MNEMONIC_TO_OP["sub"] == ArithOp.SUB 21 21 assert MNEMONIC_TO_OP["inc"] == ArithOp.INC 22 22 assert MNEMONIC_TO_OP["dec"] == ArithOp.DEC 23 - assert MNEMONIC_TO_OP["shiftl"] == ArithOp.SHIFT_L 24 - assert MNEMONIC_TO_OP["shiftr"] == ArithOp.SHIFT_R 25 - assert MNEMONIC_TO_OP["ashiftr"] == ArithOp.ASHFT_R 23 + assert MNEMONIC_TO_OP["shl"] == ArithOp.SHL 24 + assert MNEMONIC_TO_OP["shr"] == ArithOp.SHR 25 + assert MNEMONIC_TO_OP["asr"] == ArithOp.ASR 26 26 27 27 def test_logic_opcodes(self): 28 28 """or1-asm.AC1.1: Logic opcodes map correctly.""" ··· 57 57 assert MNEMONIC_TO_OP["merge"] == RoutingOp.MRGE 58 58 assert MNEMONIC_TO_OP["pass"] == RoutingOp.PASS 59 59 assert MNEMONIC_TO_OP["const"] == RoutingOp.CONST 60 - assert MNEMONIC_TO_OP["free_ctx"] == RoutingOp.FREE_CTX 60 + assert MNEMONIC_TO_OP["free_frame"] == RoutingOp.FREE_FRAME 61 61 62 62 def test_memory_opcodes(self): 63 63 """or1-asm.AC1.2: Memory opcodes map correctly.""" ··· 72 72 73 73 def test_mnemonic_to_op_count(self): 74 74 """Verify all expected mnemonics are present.""" 75 - # Total: 7 arithmetic + 9 logic + 4 branch + 4 switch + 6 control + 13 memory = 43 75 + # Total: 7 arithmetic + 9 logic + 4 branch + 4 switch + 8 control + 13 memory = 45 76 76 # (CfgOp removed: -2 load_inst, route_set; new MemOps added: +5 exec, raw_read, set_page, write_imm, ext) 77 - expected_count = 43 77 + # (new RoutingOps added: +2 extract_tag, alloc_remote) 78 + expected_count = 45 78 79 assert len(MNEMONIC_TO_OP) == expected_count 79 80 80 81 ··· 85 86 "mnemonic", 86 87 [ 87 88 # Arithmetic 88 - "add", "sub", "inc", "dec", "shiftl", "shiftr", "ashiftr", 89 + "add", "sub", "inc", "dec", "shl", "shr", "asr", 89 90 # Logic 90 91 "and", "or", "xor", "not", "eq", "lt", "lte", "gt", "gte", 91 92 # Branch ··· 93 94 # Switch 94 95 "sweq", "swgt", "swge", "swof", 95 96 # Control 96 - "gate", "sel", "merge", "pass", "const", "free_ctx", 97 + "gate", "sel", "merge", "pass", "const", "free_frame", "extract_tag", "alloc_remote", 97 98 # Memory 98 99 "read", "write", "clear", "alloc", "free", "rd_inc", "rd_dec", "cmp_sw", 99 100 "exec", "raw_read", "set_page", "write_imm", "ext", ··· 109 110 "mnemonic", 110 111 [ 111 112 # Arithmetic 112 - "add", "sub", "inc", "dec", "shiftl", "shiftr", "ashiftr", 113 + "add", "sub", "inc", "dec", "shl", "shr", "asr", 113 114 # Logic 114 115 "and", "or", "xor", "not", "eq", "lt", "lte", "gt", "gte", 115 116 # Branch ··· 117 118 # Switch 118 119 "sweq", "swgt", "swge", "swof", 119 120 # Control 120 - "gate", "sel", "merge", "pass", "const", "free_ctx", 121 + "gate", "sel", "merge", "pass", "const", "free_frame", "extract_tag", "alloc_remote", 121 122 # Memory 122 123 "read", "write", "clear", "alloc", "free", "rd_inc", "rd_dec", "cmp_sw", 123 124 "exec", "raw_read", "set_page", "write_imm", "ext", ··· 139 140 """Verify MONADIC_OPS contains exactly the right opcodes.""" 140 141 141 142 def test_monadic_ops_size(self): 142 - """MONADIC_OPS should have exactly 20 opcodes (collision-free). 143 + """MONADIC_OPS should have exactly 22 opcodes (collision-free). 143 144 144 145 Without collision-free implementation, this would be lower due to IntEnum 145 146 collisions (e.g., ArithOp.INC colliding with some MemOp value). 146 - Count: 5 arithmetic + 1 logic + 3 routing + 5 old memory + 5 new memory = 20 147 + Count: 5 arithmetic + 1 logic + 5 routing + 5 old memory + 5 new memory + 1 WRITE_IMM = 22 148 + (Added: EXTRACT_TAG, ALLOC_REMOTE, WRITE_IMM, FREE_FRAME as monadic routing ops) 147 149 """ 148 - assert len(MONADIC_OPS) == 20 150 + assert len(MONADIC_OPS) == 22 149 151 150 152 def test_monadic_opcodes_present(self): 151 153 """All known monadic opcodes should be in the set.""" 152 154 monadic_list = [ 153 155 # Arithmetic (single input + const) 154 156 ArithOp.INC, ArithOp.DEC, 155 - ArithOp.SHIFT_L, ArithOp.SHIFT_R, ArithOp.ASHFT_R, 157 + ArithOp.SHL, ArithOp.SHR, ArithOp.ASR, 156 158 # Logic 157 159 LogicOp.NOT, 158 160 # Routing 159 - RoutingOp.PASS, RoutingOp.CONST, RoutingOp.FREE_CTX, 161 + RoutingOp.PASS, RoutingOp.CONST, RoutingOp.FREE_FRAME, 162 + RoutingOp.EXTRACT_TAG, RoutingOp.ALLOC_REMOTE, 160 163 # Memory 161 164 MemOp.READ, MemOp.ALLOC, MemOp.FREE, MemOp.CLEAR, 162 - MemOp.RD_INC, MemOp.RD_DEC, 165 + MemOp.RD_INC, MemOp.RD_DEC, MemOp.WRITE_IMM, 163 166 ] 164 167 for op in monadic_list: 165 168 assert op in MONADIC_OPS, f"{op} should be in MONADIC_OPS" ··· 213 216 "op", 214 217 [ 215 218 ArithOp.INC, ArithOp.DEC, 216 - ArithOp.SHIFT_L, ArithOp.SHIFT_R, ArithOp.ASHFT_R, 219 + ArithOp.SHL, ArithOp.SHR, ArithOp.ASR, 217 220 LogicOp.NOT, 218 - RoutingOp.PASS, RoutingOp.CONST, RoutingOp.FREE_CTX, 221 + RoutingOp.PASS, RoutingOp.CONST, RoutingOp.FREE_FRAME, 222 + RoutingOp.EXTRACT_TAG, RoutingOp.ALLOC_REMOTE, 219 223 MemOp.READ, MemOp.ALLOC, MemOp.FREE, MemOp.CLEAR, 220 224 MemOp.RD_INC, MemOp.RD_DEC, 221 225 MemOp.EXEC, MemOp.RAW_READ, MemOp.SET_PAGE, MemOp.WRITE_IMM, MemOp.EXT, ··· 265 269 "op", 266 270 [ 267 271 ArithOp.INC, ArithOp.DEC, 268 - ArithOp.SHIFT_L, ArithOp.SHIFT_R, ArithOp.ASHFT_R, 272 + ArithOp.SHL, ArithOp.SHR, ArithOp.ASR, 269 273 LogicOp.NOT, 270 - RoutingOp.PASS, RoutingOp.CONST, RoutingOp.FREE_CTX, 274 + RoutingOp.PASS, RoutingOp.CONST, RoutingOp.FREE_FRAME, 275 + RoutingOp.EXTRACT_TAG, RoutingOp.ALLOC_REMOTE, 271 276 MemOp.READ, MemOp.ALLOC, MemOp.FREE, MemOp.CLEAR, 272 277 MemOp.RD_INC, MemOp.RD_DEC, 273 278 MemOp.EXEC, MemOp.RAW_READ, MemOp.SET_PAGE, MemOp.WRITE_IMM, MemOp.EXT, ··· 322 327 class TestFreeDisambiguation: 323 328 """Verify free_ctx (ALU) and free (SM) are distinct and round-trip correctly.""" 324 329 325 - def test_free_ctx_is_routing_op(self): 326 - """The free_ctx mnemonic should map to ALU RoutingOp.FREE_CTX.""" 327 - assert MNEMONIC_TO_OP["free_ctx"] == RoutingOp.FREE_CTX 330 + def test_free_frame_is_routing_op(self): 331 + """The free_frame mnemonic should map to ALU RoutingOp.FREE_FRAME.""" 332 + assert MNEMONIC_TO_OP["free_frame"] == RoutingOp.FREE_FRAME 328 333 329 334 def test_free_is_memop(self): 330 335 """The free mnemonic should map to SM MemOp.FREE.""" 331 336 assert MNEMONIC_TO_OP["free"] == MemOp.FREE 332 337 333 338 def test_both_free_round_trip(self): 334 - """Both free_ctx and free should round-trip correctly.""" 335 - # free_ctx -> RoutingOp.FREE_CTX -> free_ctx 336 - assert OP_TO_MNEMONIC[RoutingOp.FREE_CTX] == "free_ctx" 339 + """Both free_frame and free should round-trip correctly.""" 340 + # free_frame -> RoutingOp.FREE_FRAME -> free_frame 341 + assert OP_TO_MNEMONIC[RoutingOp.FREE_FRAME] == "free_frame" 337 342 assert OP_TO_MNEMONIC[MemOp.FREE] == "free" 338 343 339 344 def test_no_collision(self): 340 345 """Distinct enum types should not collide in reverse mapping.""" 341 - # RoutingOp.FREE_CTX and MemOp.FREE are different enum values 342 - assert RoutingOp.FREE_CTX != MemOp.FREE 346 + # RoutingOp.FREE_FRAME and MemOp.FREE are different enum values 347 + assert RoutingOp.FREE_FRAME != MemOp.FREE
+2 -2
tests/test_pe.py
··· 41 41 def test_first_dyadic_stores_in_matching(self, token: DyadToken): 42 42 """AC1.2: First dyadic token stores in matching store, no output.""" 43 43 env = simpy.Environment() 44 - pe = ProcessingElement(env, 0, {}, ctx_slots=4, offsets=64) 44 + pe = ProcessingElement(env, 0, {}, frame_count=4, offsets=64) 45 45 46 46 # Inject first token directly to matching 47 47 ctx_idx = token.ctx % 4 ··· 64 64 def test_stale_token_discarded(self, token: DyadToken): 65 65 """AC1.4: Stale token (gen mismatch) is discarded, store unchanged.""" 66 66 env = simpy.Environment() 67 - pe = ProcessingElement(env, 0, {}, ctx_slots=4, offsets=64) 67 + pe = ProcessingElement(env, 0, {}, frame_count=4, offsets=64) 68 68 69 69 # Set gen counter to different value 70 70 ctx_idx = token.ctx % 4
+1 -1
tests/test_pe_events.py
··· 497 497 const=packed_const, 498 498 ctx_mode=1, 499 499 )} 500 - pe = ProcessingElement(env, 0, iram, ctx_slots=4, on_event=on_event) 500 + pe = ProcessingElement(env, 0, iram, frame_count=4, on_event=on_event) 501 501 pe.route_table[0] = simpy.Store(env) 502 502 pe.gen_counters[target_ctx] = 5 503 503
+6 -6
tests/test_place.py
··· 38 38 "&inc": IRNode(name="&inc", opcode=ArithOp.INC, pe=2, loc=SourceLoc(3, 1)), 39 39 "&dec": IRNode(name="&dec", opcode=ArithOp.DEC, pe=3, loc=SourceLoc(4, 1)), 40 40 } 41 - system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, ctx_slots=4) 41 + system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, frame_count=4) 42 42 graph = IRGraph(nodes, system=system) 43 43 result = place(graph) 44 44 ··· 72 72 pe=9, 73 73 loc=SourceLoc(5, 10), 74 74 ) 75 - system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, ctx_slots=4) 75 + system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, frame_count=4) 76 76 graph = IRGraph({"&add": node}, system=system) 77 77 result = place(graph) 78 78 ··· 91 91 pe=1, 92 92 loc=SourceLoc(1, 1), 93 93 ) 94 - system = SystemConfig(pe_count=1, sm_count=1, iram_capacity=64, ctx_slots=4) 94 + system = SystemConfig(pe_count=1, sm_count=1, iram_capacity=64, frame_count=4) 95 95 graph = IRGraph({"&add": node}, system=system) 96 96 result = place(graph) 97 97 ··· 108 108 "&sub": IRNode(name="&sub", opcode=ArithOp.SUB, pe=5, loc=SourceLoc(2, 1)), 109 109 "&inc": IRNode(name="&inc", opcode=ArithOp.INC, pe=1, loc=SourceLoc(3, 1)), 110 110 } 111 - system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, ctx_slots=4) 111 + system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, frame_count=4) 112 112 graph = IRGraph(nodes, system=system) 113 113 result = place(graph) 114 114 ··· 144 144 "&sub": IRNode(name="&sub", opcode=ArithOp.SUB, pe=None, loc=SourceLoc(2, 1)), 145 145 "&inc": IRNode(name="&inc", opcode=ArithOp.INC, pe=None, loc=SourceLoc(3, 1)), 146 146 } 147 - system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, ctx_slots=4) 147 + system = SystemConfig(pe_count=2, sm_count=1, iram_capacity=64, frame_count=4) 148 148 graph = IRGraph(nodes, system=system) 149 149 result = place(graph) 150 150 ··· 178 178 "&sub": IRNode(name="&sub", opcode=ArithOp.SUB, pe=None, loc=SourceLoc(2, 1)), 179 179 "&inc": IRNode(name="&inc", opcode=ArithOp.INC, pe=9, loc=SourceLoc(3, 1)), 180 180 } 181 - system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, ctx_slots=4) 181 + system = SystemConfig(pe_count=4, sm_count=1, iram_capacity=64, frame_count=4) 182 182 graph = IRGraph(nodes, system=system) 183 183 result = place(graph) 184 184
+1 -1
tests/test_snapshot.py
··· 108 108 env = simpy.Environment() 109 109 110 110 iram = {0: ALUInst(ArithOp.ADD, Addr(0, Port.L, 0), Addr(0, Port.R, 0), None)} 111 - pe_configs = [PEConfig(pe_id=0, iram=iram, ctx_slots=4, offsets=64)] 111 + pe_configs = [PEConfig(pe_id=0, iram=iram, frame_count=4, offsets=64)] 112 112 sm_configs = [] 113 113 114 114 system = build_topology(env, pe_configs, sm_configs)