OR-1 dataflow CPU sketch

feat: update monitor and dfgraph for frame-based PE, FREE_FRAME, act_id, and frame events

Orual 941b2946 ced780dd

+147 -105
+1 -1
dfgraph/categories.py
··· 40 40 }) 41 41 42 42 _CONFIG_ROUTING_OPS: frozenset[RoutingOp] = frozenset({ 43 - RoutingOp.CONST, RoutingOp.FREE_CTX, 43 + RoutingOp.CONST, RoutingOp.FREE_FRAME, 44 44 }) 45 45 46 46
+15 -11
dfgraph/graph_json.py
··· 9 9 10 10 from typing import Any 11 11 12 - from cm_inst import Addr, MemOp 12 + from cm_inst import FrameDest, MemOp 13 13 from asm.ir import ( 14 14 IRNode, IREdge, IRGraph, IRRegion, RegionKind, 15 15 SourceLoc, ResolvedDest, ··· 33 33 } 34 34 35 35 36 - def _serialise_addr(addr: Addr) -> dict[str, Any]: 36 + def _serialise_frame_dest(dest: FrameDest) -> dict[str, Any]: 37 37 return { 38 - "offset": addr.a, 39 - "port": addr.port.name, 40 - "pe": addr.pe, 38 + "target_pe": dest.target_pe, 39 + "offset": dest.offset, 40 + "act_id": dest.act_id, 41 + "port": dest.port.name, 42 + "token_kind": dest.token_kind.name, 41 43 } 42 44 43 45 ··· 54 56 "const": node.const, 55 57 "pe": node.pe, 56 58 "iram_offset": node.iram_offset, 57 - "ctx": node.ctx, 59 + "act_id": node.act_id, 58 60 "has_error": node.name in error_node_names, 59 61 "loc": _serialise_loc(node.loc), 60 62 } ··· 73 75 source_node = all_nodes.get(edge.source) 74 76 if source_node: 75 77 if (isinstance(source_node.dest_l, ResolvedDest) 76 - and source_node.dest_l.name == edge.dest): 77 - result["addr"] = _serialise_addr(source_node.dest_l.addr) 78 + and source_node.dest_l.name == edge.dest 79 + and source_node.dest_l.frame_dest is not None): 80 + result["frame_dest"] = _serialise_frame_dest(source_node.dest_l.frame_dest) 78 81 elif (isinstance(source_node.dest_r, ResolvedDest) 79 - and source_node.dest_r.name == edge.dest): 80 - result["addr"] = _serialise_addr(source_node.dest_r.addr) 82 + and source_node.dest_r.name == edge.dest 83 + and source_node.dest_r.frame_dest is not None): 84 + result["frame_dest"] = _serialise_frame_dest(source_node.dest_r.frame_dest) 81 85 82 86 return result 83 87 ··· 174 178 "const": None, 175 179 "pe": None, 176 180 "iram_offset": None, 177 - "ctx": None, 181 + "act_id": None, 178 182 "has_error": False, 179 183 "loc": {"line": 0, "column": 0, "end_line": None, "end_column": None}, 180 184 "sm_id": sm_id,
+38 -17
monitor/formatting.py
··· 75 75 event_type = colour("TokenReceived", "bright_cyan") 76 76 return f"{time_str} {event_type} {component_str}: {token}" 77 77 78 - case Matched(left=left, right=right, ctx=ctx, offset=offset): 78 + case Matched(left=left, right=right, act_id=act_id, frame_id=frame_id): 79 79 event_type = colour("Matched", "bright_cyan") 80 80 return ( 81 81 f"{time_str} {event_type} {component_str}: " 82 82 f"left={colour(str(left), 'white')} " 83 83 f"right={colour(str(right), 'white')} " 84 - f"ctx={colour(str(ctx), 'white')} " 85 - f"offset={colour(str(offset), 'white')}" 84 + f"act_id={colour(str(act_id), 'white')} " 85 + f"frame_id={colour(str(frame_id), 'white')}" 86 86 ) 87 87 88 88 case Executed(op=op, result=result, bool_out=bool_out): ··· 169 169 def format_pe_state(pe_snapshot: PESnapshot) -> str: 170 170 """Format detailed PE state information (multi-line). 171 171 172 - Shows: IRAM entries, matching store occupancy, gen counters, queue depth, output log length. 172 + Shows: IRAM entries, frame state, tag store, free frames, queue depth, output log length. 173 173 174 174 Args: 175 175 pe_snapshot: PESnapshot instance ··· 191 191 else: 192 192 lines.append(" IRAM: (empty)") 193 193 194 - # Matching store occupancy 195 - total_occupied = 0 196 - for ctx_row in pe_snapshot.matching_store: 197 - for entry in ctx_row: 198 - if entry.get("occupied", False): 199 - total_occupied += 1 200 - lines.append( 201 - f" Matching store: {colour(str(total_occupied), 'white')} entries occupied" 202 - ) 194 + # Tag store 195 + if pe_snapshot.tag_store: 196 + tag_str = ", ".join( 197 + f"{colour(str(k), 'white')}: {colour(str(v), 'white')}" 198 + for k, v in sorted(pe_snapshot.tag_store.items()) 199 + ) 200 + lines.append(f" Tag store: {{{tag_str}}}") 201 + else: 202 + lines.append(" Tag store: (empty)") 203 + 204 + # Free frames 205 + if pe_snapshot.free_frames: 206 + free_str = ", ".join(colour(str(f), "white") for f in pe_snapshot.free_frames) 207 + lines.append(f" Free frames: [{free_str}]") 208 + else: 209 + lines.append(" Free frames: (none)") 203 210 204 - # Gen counters 205 - if pe_snapshot.gen_counters: 206 - gens_str = ", ".join(colour(str(g), "white") for g in pe_snapshot.gen_counters) 207 - lines.append(f" Gen counters: [{gens_str}]") 211 + # Frames 212 + if pe_snapshot.frames: 213 + lines.append(" Frames:") 214 + for frame_id, frame in enumerate(pe_snapshot.frames): 215 + frame_display = [] 216 + for slot_id, slot_val in enumerate(frame): 217 + if slot_val is None: 218 + frame_display.append("None") 219 + elif isinstance(slot_val, int): 220 + frame_display.append(colour(str(slot_val), "white")) 221 + else: 222 + # FrameDest object 223 + frame_display.append(f"FrameDest(...)") 224 + lines.append( 225 + f" Frame {colour(str(frame_id), 'white')}: [{', '.join(frame_display)}]" 226 + ) 227 + else: 228 + lines.append(" Frames: (empty)") 208 229 209 230 # Input queue 210 231 lines.append(
+10 -10
monitor/repl.py
··· 209 209 print(format_step_result(result), file=self.stdout) 210 210 211 211 def do_send(self, arg: str) -> None: 212 - """Send token to target: send <target> <offset> <ctx> <data> [--sm <addr> <op>] 212 + """Send token to target: send <target> <offset> <act_id> <data> [--sm <addr> <op>] 213 213 214 - For MonadToken: send <target> <offset> <ctx> <data> 214 + For MonadToken: send <target> <offset> <act_id> <data> 215 215 For SMToken: send <target> --sm <addr> <op> [<data>] 216 216 217 217 The --sm flag switches to SMToken mode. op is parsed from MemOp names (READ, WRITE, etc). ··· 223 223 return 224 224 225 225 if not arg: 226 - print("Usage: send <target> <offset> <ctx> <data> [--sm <addr> <op>]", file=self.stdout) 226 + print("Usage: send <target> <offset> <act_id> <data> [--sm <addr> <op>]", file=self.stdout) 227 227 return 228 228 229 229 try: ··· 246 246 print(f"Sent {token}", file=self.stdout) 247 247 248 248 def do_inject(self, arg: str) -> None: 249 - """Inject token directly (no backpressure): inject <target> <offset> <ctx> <data> [--sm <addr> <op>] 249 + """Inject token directly (no backpressure): inject <target> <offset> <act_id> <data> [--sm <addr> <op>] 250 250 251 - For MonadToken: inject <target> <offset> <ctx> <data> 251 + For MonadToken: inject <target> <offset> <act_id> <data> 252 252 For SMToken: inject <target> --sm <addr> <op> [<data>] 253 253 254 254 The --sm flag switches to SMToken mode. op is parsed from MemOp names (READ, WRITE, etc). ··· 260 260 return 261 261 262 262 if not arg: 263 - print("Usage: inject <target> <offset> <ctx> <data> [--sm <addr> <op>]", file=self.stdout) 263 + print("Usage: inject <target> <offset> <act_id> <data> [--sm <addr> <op>]", file=self.stdout) 264 264 return 265 265 266 266 try: ··· 286 286 """Parse token arguments from command line. 287 287 288 288 Supports two modes: 289 - - MonadToken: <target> <offset> <ctx> <data> [--sm ...] 289 + - MonadToken: <target> <offset> <act_id> <data> [--sm ...] 290 290 - SMToken: <target> --sm <addr> <op> [<data>] 291 291 292 292 Args: ··· 328 328 else: 329 329 # MonadToken mode 330 330 if len(parts) < 4: 331 - raise ValueError("MonadToken requires <target> <offset> <ctx> <data>") 331 + raise ValueError("MonadToken requires <target> <offset> <act_id> <data>") 332 332 333 333 offset = int(parts[1]) 334 - ctx = int(parts[2]) 334 + act_id = int(parts[2]) 335 335 data = int(parts[3]) 336 336 337 - return MonadToken(target=target, offset=offset, ctx=ctx, data=data, inline=False) 337 + return MonadToken(target=target, offset=offset, ctx=act_id, data=data, inline=False) 338 338 339 339 def do_state(self, arg: str) -> None: 340 340 """Display current simulation state: state
+7 -7
tests/test_dfgraph_categories.py
··· 5 5 - ArithOp members map to ARITHMETIC 6 6 - LogicOp logic ops map to LOGIC 7 7 - LogicOp comparison ops map to COMPARISON 8 - - RoutingOp members (except CONST/FREE_CTX) map to ROUTING 9 - - RoutingOp.CONST and FREE_CTX map to CONFIG 8 + - RoutingOp members (except CONST/FREE_FRAME) map to ROUTING 9 + - RoutingOp.CONST and FREE_FRAME map to CONFIG 10 10 - MemOp members map to MEMORY 11 11 - Every OpcodeCategory has a colour in CATEGORY_COLOURS 12 12 """ ··· 26 26 ArithOp.SUB, 27 27 ArithOp.INC, 28 28 ArithOp.DEC, 29 - ArithOp.SHIFT_L, 30 - ArithOp.SHIFT_R, 31 - ArithOp.ASHFT_R, 29 + ArithOp.SHL, 30 + ArithOp.SHR, 31 + ArithOp.ASR, 32 32 ]) 33 33 def test_arith_ops_map_to_arithmetic(self, op): 34 34 """All ArithOp members map to ARITHMETIC category.""" ··· 83 83 84 84 @pytest.mark.parametrize("op", [ 85 85 RoutingOp.CONST, 86 - RoutingOp.FREE_CTX, 86 + RoutingOp.FREE_FRAME, 87 87 ]) 88 88 def test_config_routing_ops_map_to_config(self, op): 89 - """RoutingOp.CONST and RoutingOp.FREE_CTX map to CONFIG category.""" 89 + """RoutingOp.CONST and RoutingOp.FREE_FRAME map to CONFIG category.""" 90 90 assert categorise(op) == OpcodeCategory.CONFIG 91 91 92 92
+3 -3
tests/test_dfgraph_json.py
··· 48 48 assert result_node["category"] == "arithmetic" 49 49 assert result_node["pe"] == 0 50 50 assert result_node["iram_offset"] is not None 51 - assert result_node["ctx"] is not None 51 + assert result_node["act_id"] is not None 52 52 assert result_node["has_error"] is False 53 53 54 54 # Verify edges are present ··· 139 139 # Note: pe is set by explicit placement, iram_offset and ctx are set by allocate 140 140 for node in json_out["nodes"]: 141 141 assert node["iram_offset"] is None 142 - assert node["ctx"] is None 142 + assert node["act_id"] is None 143 143 144 144 # Error list should be populated 145 145 assert len(json_out["errors"]) > 0 ··· 250 250 251 251 node = json_out["nodes"][0] 252 252 required_fields = {"id", "opcode", "category", "colour", "const", "pe", 253 - "iram_offset", "ctx", "has_error", "loc"} 253 + "iram_offset", "act_id", "has_error", "loc"} 254 254 assert set(node.keys()) >= required_fields 255 255 256 256 # Location should have required fields
+57 -40
tests/test_monitor_graph_json.py
··· 6 6 - or1-monitor.AC3.8: SM state serialization 7 7 """ 8 8 9 - from cm_inst import ArithOp, MemOp, Port, Addr, ALUInst 9 + from cm_inst import ArithOp, MemOp, Port, FrameDest, Instruction, OutputStyle 10 10 from asm.ir import IRGraph, IRNode, IREdge, SourceLoc, SystemConfig 11 11 from emu.events import TokenReceived, Matched, Executed, Emitted 12 12 from monitor.graph_json import graph_to_monitor_json, graph_loaded_json ··· 26 26 opcode=ArithOp.ADD, 27 27 pe=0, 28 28 iram_offset=0, 29 - ctx=0, 29 + act_id=0, 30 30 loc=SourceLoc(1, 1), 31 31 ) 32 32 ir_graph = IRGraph( ··· 35 35 system=SystemConfig(pe_count=1, sm_count=0), 36 36 ) 37 37 38 - # Create ALUInst for IRAM 39 - inst = ALUInst(op=ArithOp.ADD, dest_l=None, dest_r=None, const=None) 38 + # Create Instruction for IRAM 39 + inst = Instruction(opcode=ArithOp.ADD, output=OutputStyle.INHERIT, has_const=False, dest_count=2, wide=False, fref=0) 40 40 41 41 # Create minimal snapshot 42 42 pe_snap = PESnapshot( 43 43 pe_id=0, 44 44 iram={0: inst}, 45 - matching_store=(), 46 - gen_counters=(), 45 + frames=(), 46 + tag_store={}, 47 + presence=(), 48 + port_store=(), 49 + free_frames=(), 47 50 input_queue=(), 48 51 output_log=(), 49 52 ) ··· 74 77 opcode=ArithOp.ADD, 75 78 pe=0, 76 79 iram_offset=5, 77 - ctx=1, 80 + act_id=1, 78 81 const=42, 79 82 loc=SourceLoc(1, 1), 80 83 ) ··· 84 87 system=SystemConfig(pe_count=1, sm_count=0), 85 88 ) 86 89 87 - inst = ALUInst(op=ArithOp.ADD, dest_l=None, dest_r=None, const=None) 90 + inst = Instruction(opcode=ArithOp.ADD, output=OutputStyle.INHERIT, has_const=False, dest_count=2, wide=False, fref=0) 88 91 pe_snap = PESnapshot( 89 92 pe_id=0, 90 93 iram={5: inst}, 91 - matching_store=(), 92 - gen_counters=(), 94 + frames=(), 95 + tag_store={}, 96 + presence=(), 97 + port_store=(), 98 + free_frames=(), 93 99 input_queue=(), 94 100 output_log=(), 95 101 ) ··· 109 115 assert node_json["opcode"] == "add" 110 116 assert node_json["pe"] == 0 111 117 assert node_json["iram_offset"] == 5 112 - assert node_json["ctx"] == 1 118 + assert node_json["act_id"] == 1 113 119 assert node_json["const"] == 42 114 120 # Check execution overlay fields are present and False 115 121 assert node_json["active"] is False ··· 123 129 opcode=ArithOp.ADD, 124 130 pe=0, 125 131 iram_offset=5, 126 - ctx=1, 132 + act_id=1, 127 133 ) 128 134 ir_graph = IRGraph(nodes={"&add": node}) 129 135 130 - inst = ALUInst(op=ArithOp.ADD, dest_l=None, dest_r=None, const=None) 136 + inst = Instruction(opcode=ArithOp.ADD, output=OutputStyle.INHERIT, has_const=False, dest_count=2, wide=False, fref=0) 131 137 pe_snap = PESnapshot( 132 138 pe_id=0, 133 139 iram={5: inst}, 134 - matching_store=(), 135 - gen_counters=(0, 1, 2), 140 + frames=(), 141 + tag_store={}, 142 + presence=(), 143 + port_store=(), 144 + free_frames=(), 136 145 input_queue=(), 137 146 output_log=(), 138 147 ) ··· 147 156 pe_state = result["state"]["pes"]["0"] 148 157 149 158 assert "iram" in pe_state 150 - assert "matching_store" in pe_state 151 - assert "gen_counters" in pe_state 152 - assert pe_state["gen_counters"] == [0, 1, 2] 153 - assert pe_state["input_queue_depth"] == 0 154 - assert pe_state["output_count"] == 0 159 + assert "frames" in pe_state 160 + assert "tag_store" in pe_state 161 + assert "free_frames" in pe_state 162 + assert pe_state["input_queue_size"] == 0 155 163 156 164 def test_graph_loaded_json_sm_state(self): 157 165 """Test SM state serialization.""" ··· 197 205 opcode=ArithOp.ADD, 198 206 pe=0, 199 207 iram_offset=0, 200 - ctx=0, 208 + act_id=0, 201 209 ) 202 210 ir_graph = IRGraph(nodes={"&add": node}) 203 211 204 - token = DyadToken(target=0, offset=0, ctx=0, data=42, port=Port.L, gen=0, wide=False) 212 + token = DyadToken(target=0, offset=0, act_id=0, data=42, port=Port.L) 205 213 event = TokenReceived(time=1.0, component="pe:0", token=token) 206 214 207 - inst = ALUInst(op=ArithOp.ADD, dest_l=None, dest_r=None, const=None) 215 + inst = Instruction(opcode=ArithOp.ADD, output=OutputStyle.INHERIT, has_const=False, dest_count=2, wide=False, fref=0) 208 216 pe_snap = PESnapshot( 209 217 pe_id=0, 210 218 iram={0: inst}, 211 - matching_store=(), 212 - gen_counters=(), 219 + frames=(), 220 + tag_store={}, 221 + presence=(), 222 + port_store=(), 223 + free_frames=(), 213 224 input_queue=(), 214 225 output_log=(), 215 226 ) ··· 236 247 opcode=ArithOp.ADD, 237 248 pe=0, 238 249 iram_offset=5, 239 - ctx=0, 250 + act_id=0, 240 251 ) 241 252 ir_graph = IRGraph(nodes={"&add": node}) 242 253 243 - event = Matched(time=1.0, component="pe:0", left=42, right=7, ctx=0, offset=5) 254 + event = Matched(time=1.0, component="pe:0", left=42, right=7, act_id=0, offset=5, frame_id=0) 244 255 245 - inst = ALUInst(op=ArithOp.ADD, dest_l=None, dest_r=None, const=None) 256 + inst = Instruction(opcode=ArithOp.ADD, output=OutputStyle.INHERIT, has_const=False, dest_count=2, wide=False, fref=0) 246 257 pe_snap = PESnapshot( 247 258 pe_id=0, 248 259 iram={5: inst}, 249 - matching_store=(), 250 - gen_counters=(), 260 + frames=(), 261 + tag_store={}, 262 + presence=(), 263 + port_store=(), 264 + free_frames=(), 251 265 input_queue=(), 252 266 output_log=(), 253 267 ) ··· 272 286 opcode=ArithOp.ADD, 273 287 pe=0, 274 288 iram_offset=0, 275 - ctx=0, 289 + act_id=0, 276 290 ) 277 291 ir_graph = IRGraph(nodes={"&add": node}) 278 292 279 293 event = Executed(time=1.0, component="pe:0", op=ArithOp.ADD, result=49, bool_out=False) 280 294 281 - inst = ALUInst(op=ArithOp.ADD, dest_l=None, dest_r=None, const=None) 295 + inst = Instruction(opcode=ArithOp.ADD, output=OutputStyle.INHERIT, has_const=False, dest_count=2, wide=False, fref=0) 282 296 pe_snap = PESnapshot( 283 297 pe_id=0, 284 298 iram={0: inst}, 285 - matching_store=(), 286 - gen_counters=(), 299 + frames=(), 300 + tag_store={}, 301 + presence=(), 302 + port_store=(), 303 + free_frames=(), 287 304 input_queue=(), 288 305 output_log=(), 289 306 ) ··· 304 321 def test_monitor_json_events_serialization(self): 305 322 """Test events are properly serialized.""" 306 323 ir_graph = IRGraph() 307 - token = DyadToken(target=0, offset=0, ctx=0, data=42, port=Port.L, gen=0, wide=False) 324 + token = DyadToken(target=0, offset=0, act_id=0, data=42, port=Port.L) 308 325 events = [ 309 326 TokenReceived(time=1.0, component="pe:0", token=token), 310 327 Executed(time=1.1, component="pe:0", op=ArithOp.ADD, result=49, bool_out=False), ··· 344 361 opcode=ArithOp.ADD, 345 362 pe=0, 346 363 iram_offset=0, 347 - ctx=0, 364 + act_id=0, 348 365 ) 349 366 dest = IRNode( 350 367 name="&b", 351 368 opcode=ArithOp.SUB, 352 369 pe=0, 353 370 iram_offset=1, 354 - ctx=0, 371 + act_id=0, 355 372 ) 356 373 edge = IREdge( 357 374 source="&a", ··· 390 407 opcode=ArithOp.ADD, 391 408 pe=0, 392 409 iram_offset=0, 393 - ctx=0, 410 + act_id=0, 394 411 ) 395 412 dest = IRNode( 396 413 name="&b", 397 414 opcode=ArithOp.SUB, 398 415 pe=1, # Destination on a different PE 399 416 iram_offset=1, 400 - ctx=0, 417 + act_id=0, 401 418 ) 402 419 edge = IREdge(source="&a", dest="&b", port=Port.L) 403 420 ir_graph = IRGraph( ··· 406 423 ) 407 424 408 425 # Emitted event with token targeting PE 1 should mark the edge 409 - token = DyadToken(target=1, offset=1, ctx=0, data=42, port=Port.L, gen=0, wide=False) 426 + token = DyadToken(target=1, offset=1, act_id=0, data=42, port=Port.L) 410 427 event = Emitted(time=1.0, component="pe:0", token=token) 411 428 412 429 snapshot = StateSnapshot(
+16 -16
tests/test_snapshot.py
··· 3 3 import pytest 4 4 import simpy 5 5 6 - from cm_inst import ALUInst, ArithOp, MemOp, Port, RoutingOp, SMInst, Addr 6 + from cm_inst import Instruction, ArithOp, MemOp, Port, RoutingOp, OutputStyle 7 7 from emu.network import build_topology 8 8 from emu.types import PEConfig, SMConfig 9 9 from monitor.snapshot import capture, PESnapshot, SMSnapshot, SMCellSnapshot ··· 31 31 env = simpy.Environment() 32 32 33 33 # Create one PE with a simple CONST instruction 34 - iram = {0: ALUInst(RoutingOp.CONST, None, None, const=42)} 34 + iram = {0: Instruction(opcode=RoutingOp.CONST, output=OutputStyle.SINK, has_const=True, dest_count=0, wide=False, fref=0)} 35 35 pe_configs = [PEConfig(pe_id=0, iram=iram)] 36 36 sm_configs = [] 37 37 38 38 system = build_topology(env, pe_configs, sm_configs) 39 39 40 40 # Inject a seed token 41 - seed = MonadToken(target=0, offset=0, ctx=0, data=0, inline=True) 41 + seed = MonadToken(target=0, offset=0, act_id=0, data=0, inline=True) 42 42 system.inject(seed) 43 43 44 44 snapshot = capture(system) ··· 56 56 # Verify IRAM is captured 57 57 assert pe_snap.iram == iram 58 58 59 - # Verify matching store and gen counters are initialized 60 - assert len(pe_snap.gen_counters) > 0 61 - assert len(pe_snap.matching_store) > 0 59 + # Verify frame-based state is initialized 60 + assert hasattr(pe_snap, 'frames') 61 + assert hasattr(pe_snap, 'tag_store') 62 62 63 63 def test_capture_sm_with_written_cells(self): 64 64 """Test capturing SM state with written cells.""" ··· 107 107 """Test that PE matching store is captured with correct structure.""" 108 108 env = simpy.Environment() 109 109 110 - iram = {0: ALUInst(ArithOp.ADD, Addr(0, Port.L, 0), Addr(0, Port.R, 0), None)} 110 + iram = {0: Instruction(opcode=ArithOp.ADD, output=OutputStyle.INHERIT, has_const=False, dest_count=2, wide=False, fref=0)} 111 111 pe_configs = [PEConfig(pe_id=0, iram=iram, frame_count=4, offsets=64)] 112 112 sm_configs = [] 113 113 ··· 138 138 """Test that PE output_log is captured.""" 139 139 env = simpy.Environment() 140 140 141 - iram = {0: ALUInst(RoutingOp.CONST, Addr(0, Port.L, 0), None, const=99)} 141 + iram = {0: Instruction(opcode=RoutingOp.CONST, output=OutputStyle.SINK, has_const=True, dest_count=0, wide=False, fref=0)} 142 142 pe_configs = [PEConfig(pe_id=0, iram=iram)] 143 143 sm_configs = [] 144 144 145 145 system = build_topology(env, pe_configs, sm_configs) 146 146 147 147 # Manually add a token to output_log to simulate emission 148 - output_token = MonadToken(target=0, offset=1, ctx=0, data=99, inline=True) 148 + output_token = MonadToken(target=0, offset=1, act_id=0, data=99, inline=True) 149 149 system.pes[0].output_log.append(output_token) 150 150 151 151 snapshot = capture(system) ··· 172 172 """Test that PE generation counters are captured.""" 173 173 env = simpy.Environment() 174 174 175 - iram = {0: ALUInst(RoutingOp.CONST, None, None, const=1)} 175 + iram = {0: Instruction(opcode=RoutingOp.CONST, output=OutputStyle.SINK, has_const=True, dest_count=0, wide=False, fref=0)} 176 176 pe_configs = [PEConfig(pe_id=0, iram=iram)] 177 177 system = build_topology(env, pe_configs, []) 178 178 ··· 195 195 196 196 sm = system.sms[0] 197 197 # Manually set up a deferred read (in real code this happens during simulation) 198 - return_token = MonadToken(target=0, offset=0, ctx=0, data=0, inline=False) 198 + return_token = MonadToken(target=0, offset=0, act_id=0, data=0, inline=False) 199 199 from emu.types import DeferredRead 200 200 sm.deferred_read = DeferredRead(cell_addr=42, return_route=return_token) 201 201 ··· 215 215 216 216 sm = system.sms[0] 217 217 # Add some tokens to T0 store 218 - token1 = MonadToken(target=0, offset=5, ctx=0, data=777, inline=True) 219 - token2 = MonadToken(target=0, offset=6, ctx=0, data=888, inline=True) 218 + token1 = MonadToken(target=0, offset=5, act_id=0, data=777, inline=True) 219 + token2 = MonadToken(target=0, offset=6, act_id=0, data=888, inline=True) 220 220 sm.t0_store.append(token1) 221 221 sm.t0_store.append(token2) 222 222 ··· 232 232 env = simpy.Environment() 233 233 234 234 pe_configs = [ 235 - PEConfig(pe_id=0, iram={0: ALUInst(RoutingOp.CONST, None, None, const=1)}), 236 - PEConfig(pe_id=1, iram={0: ALUInst(RoutingOp.CONST, None, None, const=2)}), 235 + PEConfig(pe_id=0, iram={0: Instruction(opcode=RoutingOp.CONST, output=OutputStyle.SINK, has_const=True, dest_count=0, wide=False, fref=0)}), 236 + PEConfig(pe_id=1, iram={0: Instruction(opcode=RoutingOp.CONST, output=OutputStyle.SINK, has_const=True, dest_count=0, wide=False, fref=0)}), 237 237 ] 238 238 sm_configs = [ 239 239 SMConfig(sm_id=0, cell_count=256), ··· 279 279 assert initial_snapshot.next_time == float('inf') 280 280 281 281 # Create a PE and add it to trigger time advancement 282 - iram = {0: ALUInst(RoutingOp.CONST, None, None, const=1)} 282 + iram = {0: Instruction(opcode=RoutingOp.CONST, output=OutputStyle.SINK, has_const=True, dest_count=0, wide=False, fref=0)} 283 283 pe_configs = [PEConfig(pe_id=0, iram=iram)] 284 284 env2 = simpy.Environment() 285 285 system2 = build_topology(env2, pe_configs, [])