diff --git a/UltiSnips/systemverilog.snippets b/UltiSnips/systemverilog.snippets new file mode 100644 index 000000000..1e6c97c28 --- /dev/null +++ b/UltiSnips/systemverilog.snippets @@ -0,0 +1 @@ +extends verilog diff --git a/UltiSnips/verilog.snippets b/UltiSnips/verilog.snippets new file mode 100644 index 000000000..ef8d321b0 --- /dev/null +++ b/UltiSnips/verilog.snippets @@ -0,0 +1,16 @@ +snippet in "Input" +input${1: [${2:n}:${3:0}]} ${0:name} +endsnippet + +snippet out "Output" +output${1: reg}${2: [${3:n}:${4:0}]} ${0:name} +endsnippet + +snippet reg "Register variable" +reg${1: [${2:n}:${3:0}]} ${4:name}; +endsnippet + +snippet wire "Wire variable" +wire${1: [${2:n}:${3:0}]} ${4:name}; +endsnippet + diff --git a/UltiSnips/verilog_systemverilog.snippets b/UltiSnips/verilog_systemverilog.snippets new file mode 100644 index 000000000..07d26b409 --- /dev/null +++ b/UltiSnips/verilog_systemverilog.snippets @@ -0,0 +1 @@ +extends systemverilog diff --git a/snippets/systemverilog.snippets b/snippets/systemverilog.snippets index 828a6de9c..f15a48a09 100644 --- a/snippets/systemverilog.snippets +++ b/snippets/systemverilog.snippets @@ -1,122 +1,77 @@ extends verilog -# Foreach Loop -snippet forea - foreach (${1}) begin - ${0} - end -# Do-while statement -snippet dowh - do begin - ${0} - end while (${1}); -# Combinational always block -snippet alc +# -------------------------------------------------------------------------------- +snippet alc "Always combinational" always_comb begin ${1:: statement_label} - ${0} + ${2:${VISUAL}} end $1 -# Sequential logic -snippet alff +# -------------------------------------------------------------------------------- +snippet alff "Always flip-flop" always_ff @(posedge ${1:clk}) begin ${2:: statement_label} - ${0} + ${3:${VISUAL}} end $2 -# Latched logic -snippet all +# -------------------------------------------------------------------------------- +snippet all "Always latch" always_latch begin ${1:: statement_label} - ${0} + ${2:${VISUAL}} end $1 -# Class -snippet cl +# -------------------------------------------------------------------------------- +snippet cl "Class" class ${1:class_name}; // data or class properties - ${0} + ${2:${VISUAL}} // initialization function new(); endfunction : new endclass : $1 -# Typedef structure -snippet types - typedef struct { - ${0} - } ${1:name_t}; -# Program block -snippet prog - program ${1:program_name} (); - ${0} - endprogram : $1 -# Interface block +# -------------------------------------------------------------------------------- +snippet clock "Clocking group" + clocking ${1:clocking_name} @(${2:posedge} ${3:clk}); + ${4:${VISUAL}} + endclocking : $1 +# -------------------------------------------------------------------------------- +snippet cg "Coverage group" + covergroup ${1:group_name} @(${2:posedge} ${3:clk}); + ${4:${VISUAL}} + endgroup : $1 +# -------------------------------------------------------------------------------- +snippet dowh "Do..while loop" + do begin + ${2:${VISUAL}} + end while (${1}); +# -------------------------------------------------------------------------------- +snippet forea "Foreach loop" + foreach (${1}) begin + ${2:${VISUAL}} + end +# -------------------------------------------------------------------------------- snippet intf interface ${1:program_name} (); // nets - ${0} + ${2:${VISUAL}} // clocking // modports endinterface : $1 -# Clocking Block -snippet clock - clocking ${1:clocking_name} @(${2:posedge} ${3:clk}); - ${0} - endclocking : $1 -# Covergroup construct -snippet cg - covergroup ${1:group_name} @(${2:posedge} ${3:clk}); - ${0} - endgroup : $1 -# Package declaration +# -------------------------------------------------------------------------------- snippet pkg package ${1:package_name}; - ${0} + ${2:${VISUAL}} endpackage : $1 - -snippet uvm_object - // Class: $1 - // - class ${1:my_class} extends ${2:uvm_object}; - \`uvm_object_utils($1); - - // Group: Variables - - - // Group: Constraints - - - // Group: Functions - - // Constructor: new - function new(string name = "$1"); - super.new(name); - endfunction: new - $0 - endclass: $1 - - -snippet uvm_object_with_parameters - // Class: $1 - // - class ${1:my_class} #(${2:parameters}) extends ${3:uvm_object}; - typedef $1 #(${2/(\b(parameter|type)\s+([A-Za-z_][A-Za-z0-9_$]*)(\s*=\s*([A-Za-z0-9_$]+))?)*\b/$3/g}) this_type_t; - \`uvm_object_param_utils(this_type_t); - - // Group: Variables - - - // Group: Constraints - - - // Group: Functions - - // Constructor: new - function new(string name = "$1"); - super.new(name); - endfunction: new - $0 - endclass: $1 - - +# -------------------------------------------------------------------------------- +snippet prog + program ${1:program_name} (); + ${2:${VISUAL}} + endprogram : $1 +# -------------------------------------------------------------------------------- +snippet types "Struct typedef" + typedef struct { + ${2:${VISUAL}} + } ${1:name_t}; +# -------------------------------------------------------------------------------- snippet uvm_component // Class: $1 // @@ -144,36 +99,7 @@ snippet uvm_component $0 endclass: $1 - - -snippet uvm_component_with_parameters - // Class: $1 - // - class ${1:my_class} #(${2:parameters}) extends ${3:uvm_component}; - typedef $1 #(${2/(\b(parameter|type)\s+([A-Za-z_][A-Za-z0-9_$]*)(\s*=\s*([A-Za-z0-9_$]+))?)*\b/$3/g}) this_type_t; - \`uvm_component_param_utils(this_type_t); - - // Group: Configuration Object(s) - - // Var: config_obj - ${4:config_obj_t} config_obj; - - - // Group: Components - - - // Group: Variables - - - // Constructor: new - function new(string name = "$1", uvm_component parent); - super.new(name, parent); - endfunction: new - - $0 - endclass: $1 - - +# -------------------------------------------------------------------------------- snippet uvm_component_extended // Class: $1 // @@ -283,13 +209,38 @@ snippet uvm_component_extended function void $1::extract_phase(uvm_phase phase); super.extract_phase(phase); endfunction: extract_phase +# -------------------------------------------------------------------------------- +snippet uvm_component_with_parameters + // Class: $1 + // + class ${1:my_class} #(${2:parameters}) extends ${3:uvm_component}; + typedef $1 #(${2/(\b(parameter|type)\s+([A-Za-z_][A-Za-z0-9_$]*)(\s*=\s*([A-Za-z0-9_$]+))?)*\b/$3/g}) this_type_t; + \`uvm_component_param_utils(this_type_t); + // Group: Configuration Object(s) + // Var: config_obj + ${4:config_obj_t} config_obj; -snippet uvm_sequence + + // Group: Components + + + // Group: Variables + + + // Constructor: new + function new(string name = "$1", uvm_component parent); + super.new(name, parent); + endfunction: new + + $0 + endclass: $1 +# -------------------------------------------------------------------------------- +snippet uvm_object // Class: $1 // - class ${1:my_class} extends ${2:uvm_sequence}; + class ${1:my_class} extends ${2:uvm_object}; \`uvm_object_utils($1); // Group: Variables @@ -304,62 +255,36 @@ snippet uvm_sequence function new(string name = "$1"); super.new(name); endfunction: new + $0 + endclass: $1 +# -------------------------------------------------------------------------------- +snippet uvm_object_with_parameters + // Class: $1 + // + class ${1:my_class} #(${2:parameters}) extends ${3:uvm_object}; + typedef $1 #(${2/(\b(parameter|type)\s+([A-Za-z_][A-Za-z0-9_$]*)(\s*=\s*([A-Za-z0-9_$]+))?)*\b/$3/g}) this_type_t; + \`uvm_object_param_utils(this_type_t); - // Task: pre_start - // This task is a user-definable callback that is called before the optional - // execution of . - // extern virtual task pre_start(); - - // Task: pre_body - // This task is a user-definable callback that is called before the execution - // of ~only~ when the sequence is started with . - // If is called with ~call_pre_post~ set to 0, ~pre_body~ is not called. - // extern virtual task pre_body(); + // Group: Variables - // Task: pre_do - // This task is a user-definable callback task that is called ~on the parent - // sequence~, if any. The sequence has issued a wait_for_grant() call and after - // the sequencer has selected this sequence, and before the item is randomized. - // - // Although pre_do is a task, consuming simulation cycles may result in unexpected - // behavior on the driver. - // extern virtual task pre_do(bit is_item); - // Function: mid_do - // This function is a user-definable callback function that is called after the - // sequence item has been randomized, and just before the item is sent to the - // driver. - // extern virtual function void mid_do(uvm_sequence_item this_item); - - // Task: body - // This is the user-defined task where the main sequence code resides. - extern virtual task body(); + // Group: Constraints - // Function: post_do - // This function is a user-definable callback function that is called after the - // driver has indicated that it has completed the item, using either this - // item_done or put methods. - // extern virtual function void post_do(uvm_sequence_item this_item); - // Task: post_body - // This task is a user-definable callback task that is called after the execution - // of ~only~ when the sequence is started with . - // If is called with ~call_pre_post~ set to 0, ~post_body~ is not called. - // extern virtual task post_body(); + // Group: Functions - // Task: post_start - // This task is a user-definable callback that is called after the optional - // execution of . - // extern virtual task post_start(); + // Constructor: new + function new(string name = "$1"); + super.new(name); + endfunction: new $0 endclass: $1 - -snippet uvm_sequence_with_parameters +# -------------------------------------------------------------------------------- +snippet uvm_sequence // Class: $1 // - class ${1:my_class} #(${2:parameters}) extends ${3:uvm_sequence}; - typedef $1 #(${2/(\b(parameter|type)\s+([A-Za-z_][A-Za-z0-9_$]*)(\s*=\s*([A-Za-z0-9_$]+))?)*\b/$3/g}) this_type_t; - \`uvm_object_param_utils(this_type_t); + class ${1:my_class} extends ${2:uvm_sequence}; + \`uvm_object_utils($1); // Group: Variables @@ -422,7 +347,7 @@ snippet uvm_sequence_with_parameters // extern virtual task post_start(); $0 endclass: $1 - +# -------------------------------------------------------------------------------- snippet uvm_sequence_functions // task ${1:my_class::}pre_start(); // endtask: pre_start @@ -455,8 +380,7 @@ snippet uvm_sequence_functions // task $1post_start(); // endtask: post_start - - +# -------------------------------------------------------------------------------- snippet uvm_sequence_item // Class: $1 // @@ -506,8 +430,104 @@ snippet uvm_sequence_item /* Functions */ /*----------------------------------------------------------------------------*/ +# -------------------------------------------------------------------------------- +snippet uvm_sequence_item_convert2string + function string ${1:my_class}${2:::}convert2string(); + string s; + + /* chain the convert2string with parent classes */ + s = super.convert2string(); + + /* list of local properties to be printed: */ + // guide 0---4---8--12--16--20--24--28--32--36--40--44--48-- + // s = {s, \$sformatf("property_label : 0x%0h\n", property_name)}; + // s = {s, \$sformatf("property_label : %0d\n", property_name)}; + + return s; + endfunction: convert2string$0 +# -------------------------------------------------------------------------------- +snippet uvm_sequence_item_do_compare + function bit ${1:my_class}${2:::}do_compare(uvm_object rhs, uvm_comparer comparer); + this_type_t rhs_; + + if (!\$cast(rhs_, rhs)) begin + \`uvm_error({this.get_name(), ".do_compare()"}, "Cast failed!"); + return; + end + // \`uvm_info({this.get_name(), ".do_compare()"}, "Cast succeded.", UVM_HIGH); + + /* chain the compare with parent classes */ + do_compare = super.do_compare(rhs, comparer); + + /* list of local properties to be compared: */ + do_compare &= ( + // && + // + ); + endfunction: do_compare$0 +# -------------------------------------------------------------------------------- +snippet uvm_sequence_item_do_copy + function void ${1:my_class}${2:::}do_copy(uvm_object rhs); + this_type_t rhs_; + + if (!\$cast(rhs_, rhs)) begin + \`uvm_error({this.get_name(), ".do_copy()"}, "Cast failed!"); + return; + end + // \`uvm_info({this.get_name(), ".do_copy()"}, "Cast succeded.", UVM_HIGH); + + /* chain the copy with parent classes */ + super.do_copy(rhs); + /* list of local properties to be copied */ + // ; + endfunction: do_copy$0 +# -------------------------------------------------------------------------------- +snippet uvm_sequence_item_do_pack + function void ${1:my_class}${2:::}do_pack(uvm_packer packer); + /* chain the pack with parent classes */ + super.do_pack(packer); + + /* list of local properties to be packed: */ + // note: look up the appropriate macro(s) for your properties! + // \`uvm_pack_int(property_name); + // \`uvm_pack_queue(property_name); + // \`uvm_pack_string(property_name); + endfunction: do_pack$0 +# -------------------------------------------------------------------------------- +snippet uvm_sequence_item_do_print + function void ${1:my_class}${2:::}do_print(uvm_printer printer) + /* chain the print with parent classes */ + super.do_print(printer); + + /* list of local properties to be printed: */ + // printer.print_string("property_label", property_name); + // printer.print_field_int("property_label", property_name, \$bits(property_name), UVM_HEX); + endfunction: do_print$0 +# -------------------------------------------------------------------------------- +snippet uvm_sequence_item_do_record + function void ${1:my_class}${2:::}do_record(uvm_recorder recorder); + /* chain the record with parent classes */ + super.do_record(recorder); + /* list of local properties to be recorded: */ + /* note: use uvm_record_int, uvm_record_string, uvm_record_time, uvm_record_real for known basic types. */ + // \`uvm_record_string("property_label", property_name); + // \`uvm_record_int("property_label", property_name, \$bits(property_name), UVM_HEX); + endfunction: do_record$0 +# -------------------------------------------------------------------------------- +snippet uvm_sequence_item_do_unpack + function void ${1:my_class}${2:::}do_unpack(uvm_packer packer); + /* chain the unpack with parent classes */ + super.do_unpack(packer); + + /* list of local properties to be unpacked: */ + // note: look up the appropriate macro(s) for your properties! + // \`uvm_unpack_int(property_name); + // \`uvm_unpack_queue(property_name); + // \`uvm_unpack_string(property_name); + endfunction: do_unpack$0 +# -------------------------------------------------------------------------------- snippet uvm_sequence_item_with_parameters // Class: $1 // @@ -557,108 +577,73 @@ snippet uvm_sequence_item_with_parameters /* Functions */ /*----------------------------------------------------------------------------*/ +# -------------------------------------------------------------------------------- +snippet uvm_sequence_with_parameters + // Class: $1 + // + class ${1:my_class} #(${2:parameters}) extends ${3:uvm_sequence}; + typedef $1 #(${2/(\b(parameter|type)\s+([A-Za-z_][A-Za-z0-9_$]*)(\s*=\s*([A-Za-z0-9_$]+))?)*\b/$3/g}) this_type_t; + \`uvm_object_param_utils(this_type_t); + // Group: Variables -snippet uvm_sequence_item_do_copy - function void ${1:my_class}${2:::}do_copy(uvm_object rhs); - this_type_t rhs_; - - if (!\$cast(rhs_, rhs)) begin - \`uvm_error({this.get_name(), ".do_copy()"}, "Cast failed!"); - return; - end - // \`uvm_info({this.get_name(), ".do_copy()"}, "Cast succeded.", UVM_HIGH); - - /* chain the copy with parent classes */ - super.do_copy(rhs); - - /* list of local properties to be copied */ - // ; - endfunction: do_copy$0 - - - -snippet uvm_sequence_item_do_compare - function bit ${1:my_class}${2:::}do_compare(uvm_object rhs, uvm_comparer comparer); - this_type_t rhs_; - - if (!\$cast(rhs_, rhs)) begin - \`uvm_error({this.get_name(), ".do_compare()"}, "Cast failed!"); - return; - end - // \`uvm_info({this.get_name(), ".do_compare()"}, "Cast succeded.", UVM_HIGH); - - /* chain the compare with parent classes */ - do_compare = super.do_compare(rhs, comparer); - - /* list of local properties to be compared: */ - do_compare &= ( - // && - // - ); - endfunction: do_compare$0 - - - -snippet uvm_sequence_item_convert2string - function string ${1:my_class}${2:::}convert2string(); - string s; - - /* chain the convert2string with parent classes */ - s = super.convert2string(); - /* list of local properties to be printed: */ - // guide 0---4---8--12--16--20--24--28--32--36--40--44--48-- - // s = {s, \$sformatf("property_label : 0x%0h\n", property_name)}; - // s = {s, \$sformatf("property_label : %0d\n", property_name)}; + // Group: Constraints - return s; - endfunction: convert2string$0 + // Group: Functions + // Constructor: new + function new(string name = "$1"); + super.new(name); + endfunction: new -snippet uvm_sequence_item_do_print - function void ${1:my_class}${2:::}do_print(uvm_printer printer) - /* chain the print with parent classes */ - super.do_print(printer); + // Task: pre_start + // This task is a user-definable callback that is called before the optional + // execution of . + // extern virtual task pre_start(); - /* list of local properties to be printed: */ - // printer.print_string("property_label", property_name); - // printer.print_field_int("property_label", property_name, \$bits(property_name), UVM_HEX); - endfunction: do_print$0 + // Task: pre_body + // This task is a user-definable callback that is called before the execution + // of ~only~ when the sequence is started with . + // If is called with ~call_pre_post~ set to 0, ~pre_body~ is not called. + // extern virtual task pre_body(); -snippet uvm_sequence_item_do_record - function void ${1:my_class}${2:::}do_record(uvm_recorder recorder); - /* chain the record with parent classes */ - super.do_record(recorder); + // Task: pre_do + // This task is a user-definable callback task that is called ~on the parent + // sequence~, if any. The sequence has issued a wait_for_grant() call and after + // the sequencer has selected this sequence, and before the item is randomized. + // + // Although pre_do is a task, consuming simulation cycles may result in unexpected + // behavior on the driver. + // extern virtual task pre_do(bit is_item); - /* list of local properties to be recorded: */ - /* note: use uvm_record_int, uvm_record_string, uvm_record_time, uvm_record_real for known basic types. */ - // \`uvm_record_string("property_label", property_name); - // \`uvm_record_int("property_label", property_name, \$bits(property_name), UVM_HEX); - endfunction: do_record$0 + // Function: mid_do + // This function is a user-definable callback function that is called after the + // sequence item has been randomized, and just before the item is sent to the + // driver. + // extern virtual function void mid_do(uvm_sequence_item this_item); -snippet uvm_sequence_item_do_pack - function void ${1:my_class}${2:::}do_pack(uvm_packer packer); - /* chain the pack with parent classes */ - super.do_pack(packer); + // Task: body + // This is the user-defined task where the main sequence code resides. + extern virtual task body(); - /* list of local properties to be packed: */ - // note: look up the appropriate macro(s) for your properties! - // \`uvm_pack_int(property_name); - // \`uvm_pack_queue(property_name); - // \`uvm_pack_string(property_name); - endfunction: do_pack$0 + // Function: post_do + // This function is a user-definable callback function that is called after the + // driver has indicated that it has completed the item, using either this + // item_done or put methods. + // extern virtual function void post_do(uvm_sequence_item this_item); -snippet uvm_sequence_item_do_unpack - function void ${1:my_class}${2:::}do_unpack(uvm_packer packer); - /* chain the unpack with parent classes */ - super.do_unpack(packer); + // Task: post_body + // This task is a user-definable callback task that is called after the execution + // of ~only~ when the sequence is started with . + // If is called with ~call_pre_post~ set to 0, ~post_body~ is not called. + // extern virtual task post_body(); - /* list of local properties to be unpacked: */ - // note: look up the appropriate macro(s) for your properties! - // \`uvm_unpack_int(property_name); - // \`uvm_unpack_queue(property_name); - // \`uvm_unpack_string(property_name); - endfunction: do_unpack$0 + // Task: post_start + // This task is a user-definable callback that is called after the optional + // execution of . + // extern virtual task post_start(); + $0 + endclass: $1 diff --git a/snippets/verilog.snippets b/snippets/verilog.snippets index 16bacc2a3..659fc8a72 100644 --- a/snippets/verilog.snippets +++ b/snippets/verilog.snippets @@ -1,99 +1,140 @@ -# if statement -snippet if +snippet . "IO when instantiating the module" + .${1:io_name}(${2:$1}) +# -------------------------------------------------------------------------------- +snippet al "Always block" + always @(${1:/* sensitive list */}) begin + ${2:${VISUAL}} + end +# -------------------------------------------------------------------------------- +snippet as "Assign" + assign ${1:name} = ${2:value}; +# -------------------------------------------------------------------------------- +snippet be "Begin-end" + begin + ${1:${VISUAL}} + end +# -------------------------------------------------------------------------------- +snippet case "Case(xz) statement" + case${1:x} (${2:/* variable */}) + ${3:/* value */}: begin + ${4} + end + default: begin + ${5} + end + endcase +# -------------------------------------------------------------------------------- +snippet cond "Conditional operator" + (${1:if}) ? ${2:then} : ${3:else}; +# -------------------------------------------------------------------------------- +snippet eif "Else if" + else if (${1}) begin + ${2:${VISUAL}} + end +# -------------------------------------------------------------------------------- +snippet el "Else" + else begin + ${1:${VISUAL}} + end +# -------------------------------------------------------------------------------- +snippet for "For loop" + for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) begin + ${4:${VISUAL}} + end +# -------------------------------------------------------------------------------- +snippet forev "Forever loop" + forever begin + ${1:${VISUAL}} + end +# -------------------------------------------------------------------------------- +snippet fun "Function" + function ${1:void} ${2:name}(${3}); + ${4:${VISUAL}} + endfunction: $2 +# -------------------------------------------------------------------------------- +snippet gen "Generate block" + generate + ${1:${VISUAL}} + endgenerate +# -------------------------------------------------------------------------------- +snippet if "If statement" if (${1}) begin - ${0} + ${2:${VISUAL}} end -# If/else statements -snippet ife +# -------------------------------------------------------------------------------- +snippet ife "If-else statement" if (${1}) begin ${2} end else begin ${3} end -# Else if statement -snippet eif - else if (${1}) begin - ${0} - end -#Else statement -snippet el - else begin - ${0} - end -# While statement -snippet wh - while (${1}) begin - ${0} +# -------------------------------------------------------------------------------- +snippet ini "Initial block" + initial begin + ${1:${VISUAL}} end -# Repeat Loop -snippet rep +# -------------------------------------------------------------------------------- +snippet inst "Instantiate module" + ${1:module_name} ${2:$1}_inst (${3:.*}); +# -------------------------------------------------------------------------------- +snippet instp "Instantiate module with parameters" + ${1:module_name} #(${2:parameters}) ${3:$1}_inst (${4:.*}); +# -------------------------------------------------------------------------------- +snippet lpar "Local parameter" + localparam ${1:name} = ${0:value} +# -------------------------------------------------------------------------------- +snippet mod "Module" + module ${1:`vim_snippets#Filename('$1', 'name')`} (${2}); + ${0:${VISUAL}} + endmodule +# -------------------------------------------------------------------------------- +snippet modp "Module with parameters" + module ${1:`vim_snippets#Filename('$1', 'name')`} #(${2}) (${3}); + ${0:${VISUAL}} + endmodule +# -------------------------------------------------------------------------------- +snippet neg "Negative edge" + negedge ${0:signal} +# -------------------------------------------------------------------------------- +snippet rep "Repeat loop" repeat (${1}) begin - ${0} + ${2:${VISUAL}} end -# Case statement -snippet case - case (${1:/* variable */}) - ${2:/* value */}: begin - ${3} - end - default: begin +# -------------------------------------------------------------------------------- +snippet par "Parameter definition" + parameter ${1:name} = ${0:value} +# -------------------------------------------------------------------------------- +snippet pos "Positive edge" + posedge ${0:signal} +# -------------------------------------------------------------------------------- +snippet seq "Sequential block" + always @(${1:posedge clk}${2:, posedge rst}) begin + if (${3:rst}) begin ${4} end - endcase -# CaseZ statement -snippet casez - casez (${1:/* variable */}) - ${2:/* value */}: begin - ${3} + else begin + ${5} end - default: begin - ${4} - end - endcase -# Always block -snippet al - always @(${1:/* sensitive list */}) begin - ${0} - end -# Module block -snippet mod - module ${1:`vim_snippets#Filename('$1', 'name')`} (${2}); - ${0} - endmodule -# For -snippet for - for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) begin - ${4} - end -# Forever -snippet forev - forever begin - ${0} end -# Function -snippet fun - function ${1:void} ${2:name}(${3}); - ${0} - endfunction: $2 -# Task -snippet task +# -------------------------------------------------------------------------------- +snippet task "Task definition" task ${1:name}(${2}); - ${0} + ${3:${VISUAL}} endtask: $1 -# Initial -snippet ini - initial begin - ${0} - end -# typedef struct packed -snippet tdsp - typedef struct packed { - int ${2:data}; - } ${1:`vim_snippets#Filename('$1_t', 'name')`}; -# typedef eum -snippet tde +# -------------------------------------------------------------------------------- +snippet tde "Typedef enum" typedef enum ${2:logic[15:0]} { ${3:REG = 16'h0000} } ${1:my_dest_t}; +# -------------------------------------------------------------------------------- +snippet tdsp "Typedef struct packed" + typedef struct packed { + int ${2:data}; + } ${1:`vim_snippets#Filename('$1_t', 'name')`}; +# -------------------------------------------------------------------------------- +snippet wh "While loop" + while (${1}) begin + ${2:${VISUAL}} + end diff --git a/snippets/verilog_systemverilog.snippets b/snippets/verilog_systemverilog.snippets new file mode 100644 index 000000000..07d26b409 --- /dev/null +++ b/snippets/verilog_systemverilog.snippets @@ -0,0 +1 @@ +extends systemverilog