step 1 to 5
This commit is contained in:
289
snippets/riscv.json
Normal file
289
snippets/riscv.json
Normal file
@@ -0,0 +1,289 @@
|
||||
{
|
||||
"Load Immediate": {
|
||||
"prefix": "li",
|
||||
"body": [
|
||||
"li ${1:reg}, ${2:immediate}"
|
||||
],
|
||||
"description": "Load immediate value into register"
|
||||
},
|
||||
"Load Address": {
|
||||
"prefix": "la",
|
||||
"body": [
|
||||
"la ${1:reg}, ${2:label}"
|
||||
],
|
||||
"description": "Load address of label into register"
|
||||
},
|
||||
"Add": {
|
||||
"prefix": "add",
|
||||
"body": [
|
||||
"add ${1:rd}, ${2:rs1}, ${3:rs2}"
|
||||
],
|
||||
"description": "Add two registers"
|
||||
},
|
||||
"Add Immediate": {
|
||||
"prefix": "addi",
|
||||
"body": [
|
||||
"addi ${1:rd}, ${2:rs1}, ${3:immediate}"
|
||||
],
|
||||
"description": "Add immediate to register"
|
||||
},
|
||||
"Subtract": {
|
||||
"prefix": "sub",
|
||||
"body": [
|
||||
"sub ${1:rd}, ${2:rs1}, ${3:rs2}"
|
||||
],
|
||||
"description": "Subtract two registers"
|
||||
},
|
||||
"Move": {
|
||||
"prefix": "mv",
|
||||
"body": [
|
||||
"mv ${1:rd}, ${2:rs}"
|
||||
],
|
||||
"description": "Move register (pseudo-instruction)"
|
||||
},
|
||||
"Load Word": {
|
||||
"prefix": "lw",
|
||||
"body": [
|
||||
"lw ${1:rd}, ${2:offset}(${3:rs1})"
|
||||
],
|
||||
"description": "Load word from memory"
|
||||
},
|
||||
"Load Byte": {
|
||||
"prefix": "lb",
|
||||
"body": [
|
||||
"lb ${1:rd}, ${2:offset}(${3:rs1})"
|
||||
],
|
||||
"description": "Load byte from memory"
|
||||
},
|
||||
"Load Half": {
|
||||
"prefix": "lh",
|
||||
"body": [
|
||||
"lh ${1:rd}, ${2:offset}(${3:rs1})"
|
||||
],
|
||||
"description": "Load halfword from memory"
|
||||
},
|
||||
"Store Word": {
|
||||
"prefix": "sw",
|
||||
"body": [
|
||||
"sw ${1:rs2}, ${2:offset}(${3:rs1})"
|
||||
],
|
||||
"description": "Store word to memory"
|
||||
},
|
||||
"Store Byte": {
|
||||
"prefix": "sb",
|
||||
"body": [
|
||||
"sb ${1:rs2}, ${2:offset}(${3:rs1})"
|
||||
],
|
||||
"description": "Store byte to memory"
|
||||
},
|
||||
"Store Half": {
|
||||
"prefix": "sh",
|
||||
"body": [
|
||||
"sh ${1:rs2}, ${2:offset}(${3:rs1})"
|
||||
],
|
||||
"description": "Store halfword to memory"
|
||||
},
|
||||
"Branch Equal": {
|
||||
"prefix": "beq",
|
||||
"body": [
|
||||
"beq ${1:rs1}, ${2:rs2}, ${3:label}"
|
||||
],
|
||||
"description": "Branch if equal"
|
||||
},
|
||||
"Branch Not Equal": {
|
||||
"prefix": "bne",
|
||||
"body": [
|
||||
"bne ${1:rs1}, ${2:rs2}, ${3:label}"
|
||||
],
|
||||
"description": "Branch if not equal"
|
||||
},
|
||||
"Branch Less Than": {
|
||||
"prefix": "blt",
|
||||
"body": [
|
||||
"blt ${1:rs1}, ${2:rs2}, ${3:label}"
|
||||
],
|
||||
"description": "Branch if less than (signed)"
|
||||
},
|
||||
"Branch Greater Equal": {
|
||||
"prefix": "bge",
|
||||
"body": [
|
||||
"bge ${1:rs1}, ${2:rs2}, ${3:label}"
|
||||
],
|
||||
"description": "Branch if greater or equal (signed)"
|
||||
},
|
||||
"Jump": {
|
||||
"prefix": "j",
|
||||
"body": [
|
||||
"j ${1:label}"
|
||||
],
|
||||
"description": "Unconditional jump"
|
||||
},
|
||||
"Jump and Link": {
|
||||
"prefix": "jal",
|
||||
"body": [
|
||||
"jal ${1:rd}, ${2:label}"
|
||||
],
|
||||
"description": "Jump and link"
|
||||
},
|
||||
"Jump and Link Register": {
|
||||
"prefix": "jalr",
|
||||
"body": [
|
||||
"jalr ${1:rd}, ${2:rs1}, ${3:offset}"
|
||||
],
|
||||
"description": "Jump and link register"
|
||||
},
|
||||
"Environment Call": {
|
||||
"prefix": "ecall",
|
||||
"body": [
|
||||
"ecall"
|
||||
],
|
||||
"description": "System call"
|
||||
},
|
||||
"No Operation": {
|
||||
"prefix": "nop",
|
||||
"body": [
|
||||
"nop"
|
||||
],
|
||||
"description": "No operation"
|
||||
},
|
||||
"Return": {
|
||||
"prefix": "ret",
|
||||
"body": [
|
||||
"ret"
|
||||
],
|
||||
"description": "Return from function"
|
||||
},
|
||||
"XOR": {
|
||||
"prefix": "xor",
|
||||
"body": [
|
||||
"xor ${1:rd}, ${2:rs1}, ${3:rs2}"
|
||||
],
|
||||
"description": "Exclusive OR"
|
||||
},
|
||||
"XOR Immediate": {
|
||||
"prefix": "xori",
|
||||
"body": [
|
||||
"xori ${1:rd}, ${2:rs1}, ${3:immediate}"
|
||||
],
|
||||
"description": "XOR with immediate"
|
||||
},
|
||||
"OR": {
|
||||
"prefix": "or",
|
||||
"body": [
|
||||
"or ${1:rd}, ${2:rs1}, ${3:rs2}"
|
||||
],
|
||||
"description": "Bitwise OR"
|
||||
},
|
||||
"OR Immediate": {
|
||||
"prefix": "ori",
|
||||
"body": [
|
||||
"ori ${1:rd}, ${2:rs1}, ${3:immediate}"
|
||||
],
|
||||
"description": "OR with immediate"
|
||||
},
|
||||
"AND": {
|
||||
"prefix": "and",
|
||||
"body": [
|
||||
"and ${1:rd}, ${2:rs1}, ${3:rs2}"
|
||||
],
|
||||
"description": "Bitwise AND"
|
||||
},
|
||||
"AND Immediate": {
|
||||
"prefix": "andi",
|
||||
"body": [
|
||||
"andi ${1:rd}, ${2:rs1}, ${3:immediate}"
|
||||
],
|
||||
"description": "AND with immediate"
|
||||
},
|
||||
"Shift Left Logical": {
|
||||
"prefix": "sll",
|
||||
"body": [
|
||||
"sll ${1:rd}, ${2:rs1}, ${3:rs2}"
|
||||
],
|
||||
"description": "Shift left logical"
|
||||
},
|
||||
"Shift Left Logical Immediate": {
|
||||
"prefix": "slli",
|
||||
"body": [
|
||||
"slli ${1:rd}, ${2:rs1}, ${3:shamt}"
|
||||
],
|
||||
"description": "Shift left logical immediate"
|
||||
},
|
||||
"Shift Right Logical": {
|
||||
"prefix": "srl",
|
||||
"body": [
|
||||
"srl ${1:rd}, ${2:rs1}, ${3:rs2}"
|
||||
],
|
||||
"description": "Shift right logical"
|
||||
},
|
||||
"Shift Right Logical Immediate": {
|
||||
"prefix": "srli",
|
||||
"body": [
|
||||
"srli ${1:rd}, ${2:rs1}, ${3:shamt}"
|
||||
],
|
||||
"description": "Shift right logical immediate"
|
||||
},
|
||||
"Text Section": {
|
||||
"prefix": ".text",
|
||||
"body": [
|
||||
".text"
|
||||
],
|
||||
"description": "Text section directive"
|
||||
},
|
||||
"Data Section": {
|
||||
"prefix": ".data",
|
||||
"body": [
|
||||
".data"
|
||||
],
|
||||
"description": "Data section directive"
|
||||
},
|
||||
"Global Symbol": {
|
||||
"prefix": ".globl",
|
||||
"body": [
|
||||
".globl ${1:symbol}"
|
||||
],
|
||||
"description": "Make symbol globally visible"
|
||||
},
|
||||
"Word Data": {
|
||||
"prefix": ".word",
|
||||
"body": [
|
||||
".word ${1:value}"
|
||||
],
|
||||
"description": "Define 32-bit word"
|
||||
},
|
||||
"Byte Data": {
|
||||
"prefix": ".byte",
|
||||
"body": [
|
||||
".byte ${1:value}"
|
||||
],
|
||||
"description": "Define byte"
|
||||
},
|
||||
"String Data": {
|
||||
"prefix": ".string",
|
||||
"body": [
|
||||
".string \"${1:text}\""
|
||||
],
|
||||
"description": "Define null-terminated string"
|
||||
},
|
||||
"ASCII String": {
|
||||
"prefix": ".ascii",
|
||||
"body": [
|
||||
".ascii \"${1:text}\""
|
||||
],
|
||||
"description": "Define ASCII string (no null terminator)"
|
||||
},
|
||||
"Space Allocation": {
|
||||
"prefix": ".space",
|
||||
"body": [
|
||||
".space ${1:bytes}"
|
||||
],
|
||||
"description": "Reserve space in bytes"
|
||||
},
|
||||
"Align": {
|
||||
"prefix": ".align",
|
||||
"body": [
|
||||
".align ${1:boundary}"
|
||||
],
|
||||
"description": "Align to boundary"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user