From b563fa7a10c4a8f7344a4a55ace51e3cd7288ffd Mon Sep 17 00:00:00 2001 From: Paolo Cretaro Date: Tue, 29 Dec 2015 15:48:20 +0100 Subject: [PATCH] Add verilog snippets and refactor systemverilog removing duplicates --- snippets/systemverilog.snippets | 60 ++----------------------------- snippets/verilog.snippets | 63 +++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 57 deletions(-) create mode 100644 snippets/verilog.snippets diff --git a/snippets/systemverilog.snippets b/snippets/systemverilog.snippets index 86d664f..70a9d2d 100644 --- a/snippets/systemverilog.snippets +++ b/snippets/systemverilog.snippets @@ -1,37 +1,6 @@ -# if statement -snippet if - if (${1}) begin - ${0} - end -# If/else statements -snippet ife - if (${1}) begin - ${2} - end - else begin - ${1} - 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} - end -# Repeat Loop -snippet rep - repeat (${1}) begin - ${0} - end -# Foreach Loopo +extends verilog + +# Foreach Loop snippet fe foreach (${1}) begin ${0} @@ -41,24 +10,6 @@ snippet dowh do begin ${0} end while (${1}); -# Case statement -snippet case - case (${1}) - {$2}: begin - ${0} - end - default: begin - end - endcase -# CaseZ statement -snippet casez -casez (${1}) - {$2}: begin - ${0} - end - default: begin - end - endcase # Combinational always block snippet alc always_comb begin ${1:: statement_label} @@ -74,11 +25,6 @@ snippet all always_latch begin ${1:: statement_label} ${0} end $1 -# Module block -snippet mod - module ${1:module_name} (${2}); - ${0} - endmodule : $1 # Class snippet cl class ${1:class_name}; diff --git a/snippets/verilog.snippets b/snippets/verilog.snippets new file mode 100644 index 0000000..5cd80f3 --- /dev/null +++ b/snippets/verilog.snippets @@ -0,0 +1,63 @@ +# if statement +snippet if + if (${1}) begin + ${0} + end +# If/else statements +snippet ife + if (${1}) begin + ${2} + end + else begin + ${1} + 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} + end +# Repeat Loop +snippet rep + repeat (${1}) begin + ${0} + end +# Case statement +snippet case + case (${1:/* variable */}) + ${2:/* value */}: begin + ${3} + end + default: begin + ${4} + end + endcase +# CaseZ statement +snippet casez + casez (${1:/* variable */}) + ${2:/* value */}: begin + ${3} + end + default: begin + ${4} + end + endcase +# Always block +snippet al + always @(${1:/* sensitive list */}) begin + ${0} + end +# Module block +snippet mod + module ${1:module_name} (${2}); + ${0} + endmodule