main: ALLOCATEC 8, q100 ; q100 is the thread capability storage MMS q10, q11 MOVECL 7, q0 MOVE @q100, q10 spawnloop: MOVE @q0, q10 SPAWNLBC memtest, q8 MOVE q8, q11 SEQC @q0, 0, q1 SUBC q0, 1, q0 BRNZ q1, initvects BR spawnloop initvects: FLUSHQ q0 FLUSHQ q1 MOVECL 0, q0 MOVECL 7, q1 MML q12, q13 MML q14, q15 MOVE @q100, q12 MOVE @q100, q14 initloop: MOVE @q0, q12 ; load the thread capability MOVE @q1, q14 ; load the dest thread capability MOVE @q13, q80 MAPQC q20, q0, q80 PROCID q20 ; send our procID to the memory test thread PRINTQNNL q13 PRINTS " " PRINTQ @q15 MOVE q15, q20 UNMAPQ q20 ADDC q0, 1, q0 SUBC q1, 1, q1 SEQC @q0, 8, q2 BRNZ q2, waitdone BR initloop waitdone: PRINTS "all threads started" CYCLES FLUSHQ q0 FLUSHQ q1 FLUSHQ q2 MOVECL 0, q0 PRINTS "threads completed..." waitdoneloop: PRINTSNNL "completed: " PRINTQ q42 ; completed threads put their capability here ADDC q0, 1, q0 SEQC @q0, 8, q1 BRNZ q1, alldone BR waitdoneloop alldone: PRINTS " " PRINTS "benchmark done" CYCLES HALT memtest: MOVE q0, q100 ; expect our caller's thread id MOVE q0, q101 ; expect our coordinate's thread id MAPQC q30, q5, @q101 ; q5 in the destination is where we send our stuff MAPQC q31, q42,@q100 ; q42 in caller is where we put our return code ALLOCATEC 128, q102 ; our send vector to work with MOVECL 0, q10 ; our send index MMS q20, q21 MML q22, q23 MOVE @q102, q20 MOVE @q102, q22 oploop: MOVE @q10, q22 ; get our send data MOVE @q10, q20 ; setup our store data ADDC q10, 1, q10 ; unroll once MOVE @q10, q22 ; get our send data MOVE @q10, q20 ; setup our store data ADDC q10, 1, q10 MOVE q23, q30 ; send the data MOVE q23, q30 ; send the data MOVE q5, q6 MOVE q5, q6 MOVE q6, q21 ; store our incoming data from our partner MOVE q6, q21 ; store our incoming data from our partner SGEC @q10, 128, q11 BRNZ q11, endmemloop BR oploop endmemloop: PROCID q31 ; return our completion code HALT