OR-1 dataflow CPU sketch
at main 202 lines 5.9 kB view raw
1;SYNTAX TEST "Packages/dfasm/dfasm.sublime-syntax" 2 3; Test comment 4; <- comment.line.semicolon.dfasm 5 6; Test pragma 7@system pe=4, sm=1 8; <- keyword.control.pragma.dfasm 9;^^^^^^ keyword.control.pragma.dfasm 10; ^^ variable.parameter.dfasm 11; ^ keyword.operator.assignment.dfasm 12; ^ constant.numeric.dfasm 13 14; Test data definition with placement and port 15@val|sm0:5 = 0x42 16; <- punctuation.definition.reference.node.dfasm 17;^^^ entity.name.tag.dfasm 18; ^ punctuation.separator.placement.dfasm 19; ^^^ entity.other.attribute-name.placement.dfasm 20; ^ punctuation.separator.port.dfasm 21; ^ constant.numeric.port.dfasm 22; ^ keyword.operator.assignment.dfasm 23; ^^^^ constant.numeric.dfasm 24 25; Test instruction definition with label 26&c1|pe0 <| const, 3 27; <- punctuation.definition.reference.label.dfasm 28;^^ entity.name.label.dfasm 29; ^ punctuation.separator.placement.dfasm 30; ^^^ entity.other.attribute-name.placement.dfasm 31; ^^ keyword.operator.flow.in.dfasm 32; ^^^^^ keyword.other.opcode.dfasm 33; ^ punctuation.separator.dfasm 34; ^ constant.numeric.dfasm 35 36; Test named argument 37&serial|pe0 <| ior, dest=0x45 38; ^^^^ variable.parameter.dfasm 39; ^ keyword.operator.assignment.dfasm 40; ^^^^ constant.numeric.dfasm 41 42; Test plain edge with flow operators 43&a|pe0 |> &b:L 44; ^^ keyword.operator.flow.out.dfasm 45; ^ punctuation.definition.reference.label.dfasm 46; ^ entity.name.label.dfasm 47; ^ punctuation.separator.port.dfasm 48; ^ entity.other.attribute-name.port.dfasm 49 50; Test function definition 51$fib |> { 52; <- punctuation.definition.reference.function.dfasm 53;^^^ entity.name.function.dfasm 54; ^^ keyword.operator.flow.out.dfasm 55; ^ punctuation.section.block.dfasm 56 &n <| const, 10 57; ^ punctuation.definition.reference.label.dfasm 58; ^ entity.name.label.dfasm 59; ^^ keyword.operator.flow.in.dfasm 60; ^^^^^ keyword.other.opcode.dfasm 61; ^^ constant.numeric.dfasm 62} 63; <- punctuation.section.block.dfasm 64 65; Test regular string with escape sequence 66@hello = #str "hello\n" 67; ^ punctuation.definition.macro.dfasm 68; ^^^ entity.name.function.macro.dfasm 69; ^ string.quoted.double.dfasm 70; ^^ constant.character.escape.dfasm 71 72; Test raw string (no escape processing) 73@path = r"no\escapes" 74; ^^ storage.type.string.dfasm 75 76; Test byte string with hex escape 77@raw = b"\x01" 78; ^^ storage.type.string.dfasm 79 80; Test character literal 81'h' 82; <- string.quoted.single.dfasm 83 84; Test arithmetic opcodes 85&op_add <| add 86; ^^^ keyword.other.opcode.dfasm 87&op_sub <| sub 88; ^^^ keyword.other.opcode.dfasm 89&op_inc <| inc 90; ^^^ keyword.other.opcode.dfasm 91&op_dec <| dec 92; ^^^ keyword.other.opcode.dfasm 93&op_shiftl <| shiftl 94; ^^^^^^ keyword.other.opcode.dfasm 95&op_shiftr <| shiftr 96; ^^^^^^ keyword.other.opcode.dfasm 97&op_ashiftr <| ashiftr 98; ^^^^^^^ keyword.other.opcode.dfasm 99 100; Test logic opcodes 101&op_and <| and 102; ^^^ keyword.other.opcode.dfasm 103&op_or <| or 104; ^^ keyword.other.opcode.dfasm 105&op_xor <| xor 106; ^^^ keyword.other.opcode.dfasm 107&op_not <| not 108; ^^^ keyword.other.opcode.dfasm 109&op_eq <| eq 110; ^^ keyword.other.opcode.dfasm 111&op_lt <| lt 112; ^^ keyword.other.opcode.dfasm 113&op_lte <| lte 114; ^^^ keyword.other.opcode.dfasm 115&op_gt <| gt 116; ^^ keyword.other.opcode.dfasm 117&op_gte <| gte 118; ^^^ keyword.other.opcode.dfasm 119 120; Test branch opcodes 121&op_breq <| breq 122; ^^^^ keyword.other.opcode.dfasm 123&op_brgt <| brgt 124; ^^^^ keyword.other.opcode.dfasm 125&op_brge <| brge 126; ^^^^ keyword.other.opcode.dfasm 127&op_brof <| brof 128; ^^^^ keyword.other.opcode.dfasm 129&op_brty <| brty 130; ^^^^ keyword.other.opcode.dfasm 131 132; Test switch opcodes 133&op_sweq <| sweq 134; ^^^^ keyword.other.opcode.dfasm 135&op_swgt <| swgt 136; ^^^^ keyword.other.opcode.dfasm 137&op_swge <| swge 138; ^^^^ keyword.other.opcode.dfasm 139&op_swof <| swof 140; ^^^^ keyword.other.opcode.dfasm 141&op_swty <| swty 142; ^^^^ keyword.other.opcode.dfasm 143 144; Test routing opcodes 145&op_gate <| gate 146; ^^^^ keyword.other.opcode.dfasm 147&op_sel <| sel 148; ^^^ keyword.other.opcode.dfasm 149&op_merge <| merge 150; ^^^^^ keyword.other.opcode.dfasm 151&op_pass <| pass 152; ^^^^ keyword.other.opcode.dfasm 153&op_const <| const, 0 154; ^^^^^ keyword.other.opcode.dfasm 155&op_free_ctx <| free_ctx 156; ^^^^^^^^ keyword.other.opcode.dfasm 157 158; Test memory opcodes 159&op_read <| read 160; ^^^^ keyword.other.opcode.dfasm 161&op_write <| write 162; ^^^^^ keyword.other.opcode.dfasm 163&op_clear <| clear 164; ^^^^^ keyword.other.opcode.dfasm 165&op_alloc <| alloc 166; ^^^^^ keyword.other.opcode.dfasm 167&op_free <| free 168; ^^^^ keyword.other.opcode.dfasm 169&op_rd_inc <| rd_inc 170; ^^^^^^ keyword.other.opcode.dfasm 171&op_rd_dec <| rd_dec 172; ^^^^^^ keyword.other.opcode.dfasm 173&op_cmp_sw <| cmp_sw 174; ^^^^^^ keyword.other.opcode.dfasm 175 176; Test IO opcodes 177&op_ior <| ior 178; ^^^ keyword.other.opcode.dfasm 179&op_iow <| iow 180; ^^^ keyword.other.opcode.dfasm 181&op_iorw <| iorw 182; ^^^^ keyword.other.opcode.dfasm 183 184; Test system opcodes 185&op_load <| load_inst 186; ^^^^^^^^^ keyword.other.opcode.dfasm 187&op_route <| route_set 188; ^^^^^^^^^ keyword.other.opcode.dfasm 189 190; Test hex literal in data definition 191@data_hex = 0xDEADBEEF 192; ^^^^^^^^^^ constant.numeric.dfasm 193 194; Test multiple data values 195@data = 1, 2, 3 196; ^ constant.numeric.dfasm 197; ^ constant.numeric.dfasm 198; ^ constant.numeric.dfasm 199 200; Test hex in port position 201&node|pe0:0x10 |> &dest 202; ^^^^ constant.numeric.port.dfasm