; OR1 Monitor Demo Program ; ; Computes (3 + 7) on PE0, writes the result (10) to SM cell 0, ; then PE1 reads it back and checks if it equals 10 using SWEQ. ; ; This exercises: ; - Seed token injection (const nodes) ; - Dyadic matching (add waits for both operands) ; - Cross-PE token routing (PE0 -> PE1) ; - SM write and read with I-structure semantics ; - Comparison / switch routing (sweq) ; - Multiple PEs active across different ticks ; ; Expected execution flow: ; t=0: const seeds arrive at c_three, c_seven, c_expected, c_read_trigger ; t=0: c_three and c_seven match at adder -> executes ADD(3,7) = 10 ; t=0: adder emits result (10) to writer on PE0 ; t=0: writer is monadic (const addr), emits WRITE(cell=0, data=10) to SM0 ; t=0: SM0 writes cell 0 = 10 ; t=0: c_read_trigger fires reader on PE1 -> READ(cell=0) ; t=0: SM0 satisfies read (cell already FULL) -> returns 10 to checker on PE1 ; t=0: c_expected (10) and SM read result (10) match at checker -> SWEQ ; t=0: checker compares: 10 == 10 -> bool_out=true ; ; In the monitor you should see: ; - PE0 cluster: c_three, c_seven, adder, writer all light up ; - PE1 cluster: c_expected, c_read_trigger, reader, checker light up ; - SM cell 0 transitions from EMPTY to FULL ; - Token flow edges animate across PE boundary ; - Half-match visible on adder/checker before second operand arrives @system pe=2, sm=1 ; PE0: compute 3 + 7 and write result to SM &c_three|pe0 <| const, 3 &c_seven|pe0 <| const, 7 &adder|pe0 <| add &writer|pe0 <| write, 0 &c_three|pe0 |> &adder|pe0:L &c_seven|pe0 |> &adder|pe0:R &adder|pe0 |> &writer|pe0:L ; PE1: read SM cell 0 and compare against expected value &c_expected|pe1 <| const, 10 &c_read_trigger|pe1 <| const, 0 &reader|pe1 <| read, 0 &checker|pe1 <| sweq &c_read_trigger|pe1 |> &reader|pe1:L &reader|pe1 |> &checker|pe1:L &c_expected|pe1 |> &checker|pe1:R