{ "Module": { "prefix": "module", "body": [ "module ${1:name} (", " input logic ${2:clk},", " input logic ${3:rst_n}$4", ");", " $0", "endmodule" ], "description": "Module with a port list" }, "Parameterized module": { "prefix": "modulep", "body": [ "module ${1:name} #(", " parameter int ${2:WIDTH} = ${3:8}", ") (", " input logic ${4:clk},", " input logic ${5:rst_n}$6", ");", " $0", "endmodule" ], "description": "Module with parameters and ports" }, "Unique case": { "prefix": "uniquecase", "body": [ "unique case (${1:sel})", " ${2:value}: ${3:statement};", " default: ${4:statement};", "endcase" ], "description": "unique case with a default branch" }, "FSM skeleton": { "prefix": "fsm", "body": [ "typedef enum logic [${1:1}:0] {", " ${2:Idle},", " ${3:Busy}", "} state_e;", "", "state_e state_q, state_d;", "", "always_comb begin", " state_d = state_q;", " unique case (state_q)", " $2: state_d = ${6:$3};", " $3: state_d = $2;", " default: state_d = $2;", " endcase", "end", "", "always_ff @(posedge ${4:clk} or negedge ${5:rst_n}) begin", " if (!$5) state_q <= $2;", " else state_q <= state_d;", "end" ], "description": "Two-process state machine: enum, next-state logic, state register" }, "typedef enum": { "prefix": "enum", "body": [ "typedef enum logic [${1:1}:0] {", " ${2:ValueA},", " ${3:ValueB}", "} ${4:name_e};" ], "description": "typedef enum" }, "typedef struct": { "prefix": "struct", "body": [ "typedef struct packed {", " logic ${1:[7:0]} ${2:field};", "} ${3:name_t};" ], "description": "typedef struct packed" }, "Function": { "prefix": "function", "body": [ "function automatic ${1:logic [7:0]} ${2:name}(input ${3:logic [7:0]} ${4:arg});", " $0", " return ${5:result};", "endfunction" ], "description": "Automatic function" }, "Task": { "prefix": "task", "body": [ "task automatic ${1:name}(input ${2:logic [7:0]} ${3:arg});", " $0", "endtask" ], "description": "Automatic task" }, "Interface": { "prefix": "interface", "body": [ "interface ${1:name}_if (input logic ${2:clk});", " logic ${3:valid};", " logic ${4:ready};", "", " modport ${5:master} (output $3, input $4);", " modport ${6:slave} (input $3, output $4);", "endinterface" ], "description": "Interface with two modports" }, "Package": { "prefix": "package", "body": [ "package ${1:${TM_FILENAME_BASE}};", " $0", "endpackage" ], "description": "Package named after the file" }, "Class": { "prefix": "class", "body": [ "class ${1:name};", " function new();", " $0", " endfunction", "endclass" ], "description": "Class with a constructor" }, "Assert property": { "prefix": "assertp", "body": [ "${1:label}: assert property (@(posedge ${2:clk}) disable iff (!${3:rst_n})", " ${4:antecedent} |-> ${5:consequent})", " else \\$error(\"${6:$1 failed}\");" ], "description": "Labeled concurrent assertion with disable iff" }, "Generate for": { "prefix": "genfor", "body": [ "for (genvar ${1:i} = 0; $1 < ${2:N}; $1++) begin : ${3:gen_$1}", " $0", "end" ], "description": "Generate for loop with a named block" }, "Testbench skeleton": { "prefix": "tb", "body": [ "module ${1:${TM_FILENAME_BASE}};", " logic clk = 0;", " logic rst_n;", "", " always #${2:5} clk = ~clk;", "", " initial begin", " rst_n = 0;", " repeat (2) @(posedge clk);", " rst_n = 1;", " $0", " \\$finish;", " end", "endmodule" ], "description": "Testbench with clock and reset" }, "Include guard": { "prefix": "guard", "body": [ "`ifndef ${1:${TM_FILENAME_BASE/(.*)/${1:/upcase}/}_SVH}", "`define $1", "", "$0", "", "`endif // $1" ], "description": "ifndef/define include guard from the file name" } }