requested changes and personal modifications
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
diff --git a/components.js b/components.js
index 53ff134..3140fd4 100644
--- a/components.js
+++ b/components.js
@@ -328,10 +328,6 @@ var components = {
"require": "clike",
"owner": "chrischares"
},
- "system_verilog": {
- "title": "System Verilog",
- "owner": "a-rey"
- },
"twig": {
"title": "Twig",
"require": "markup",
@@ -342,6 +338,10 @@ var components = {
"require": "javascript",
"owner": "vkbansal"
},
+ "verilog": {
+ "title": "Verilog & System Verilog",
+ "owner": "a-rey"
+ },
"vhdl": {
"title": "VHDL",
"owner": "a-rey"
diff --git a/components/prism-system_verilog.js b/components/prism-system_verilog.js
deleted file mode 100644
index 99a0cbf..0000000
--- a/components/prism-system_verilog.js
+++ /dev/null
@@ -1,23 +0,0 @@
-Prism.languages.system_verilog = {
- 'comment': /\/\/.*|\/\*[\w\W]*?\*\//,
- 'string': /"(\\\n|\\?.)*?"/,
- // support for any kernel function (ex: $display())
- 'property': /(?!\b)\$\w+\b/,
- // support for user defined constants (ex: `define)
- 'constant': /(?!\b)`\w+\b/,
- 'function': {
- 'pattern': /[a-z0-9_]+\(/i,
- 'inside': {
- 'punctuation': /\(/
- }
- },
- 'boolean': /\b(true|false)\b/i,
- // support for verilog and system verilog keywords
- 'keyword': /\b(alias|and|assert|assign|assume|automatic|before|begin|bind|bins|binsof|bit|break|buf|bufif0|bufif1|byte|class|case|casex|casez|cell|chandle|clocking|cmos|config|const|constraint|context|continue|cover|covergroup|coverpoint|cross|deassign|default|defparam|design|disable|dist|do|edge|else|end|endcase|endclass|endclocking|endconfig|endfunction|endgenerate|endgroup|endinterface|endmodule|endpackage|endprimitive|endprogram|endproperty|endspecify|endsequence|endtable|endtask|enum|event|expect|export|extends|extern|final|first_match|for|force|foreach|forever|fork|forkjoin|function|generate|genvar|highz0|highz1|if|iff|ifnone|ignore_bins|illegal_bins|import|incdir|include|initial|inout|input|inside|instance|int|integer|interface|intersect|join|join_any|join_none|large|liblist|library|local|localparam|logic|longint|macromodule|matches|medium|modport|module|nand|negedge|new|nmos|nor|noshowcancelled|not|notif0|notif1|null|or|output|package|packed|parameter|pmos|posedge|primitive|priority|program|property|protected|pull0|pull1|pulldown|pullup|pulsestyle_onevent|pulsestyle_ondetect|pure|rand|randc|randcase|randsequence|rcmos|real|realtime|ref|reg|release|repeat|return|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|sequence|shortint|shortreal|showcancelled|signed|small|solve|specify|specparam|static|string|strong0|strong1|struct|super|supply0|supply1|table|tagged|task|this|throughout|time|timeprecision|timeunit|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|type|typedef|union|unique|unsigned|use|uwire|var|vectored|virtual|void|wait|wait_order|wand|weak0|weak1|while|wildcard|wire|with|within|wor|xnor|xor)\b/,
- // bold highlighting for all verilog and system verilog logic blocks
- 'important': /\b(always_latch|always_comb|always_ff|always) ?@?/,
- // support for time ticks, vectors, and real numbers
- 'number': /(?!\b)#{1,2}\d+|(\b\d+)?'[odbh] ?[\da-f10zx_\?]+|\b\d+[._]?(e-?\d+)?/i,
- 'operator': /[-+\{\}]|!=?|<{1,2}=?|>{1,2}=?|={1,3}|\^|~|%|&{1,2}|\|?\||\?|\*|\//,
- 'punctuation': /[[\];(),.:]/,
-};
\ No newline at end of file
diff --git a/components/prism-system_verilog.min.js b/components/prism-system_verilog.min.js
deleted file mode 100644
index 60470bc..0000000
--- a/components/prism-system_verilog.min.js
+++ /dev/null
@@ -1 +0,0 @@
-Prism.languages.system_verilog={comment:/\/\/.*|\/\*[\w\W]*?\*\//,string:/"(\\\n|\\?.)*?"/,property:/(?!\b)\$\w+\b/,constant:/(?!\b)`\w+\b/,"function":{pattern:/[a-z0-9_]+\(/i,inside:{punctuation:/\(/}},"boolean":/\b(true|false)\b/i,keyword:/\b(alias|and|assert|assign|assume|automatic|before|begin|bind|bins|binsof|bit|break|buf|bufif0|bufif1|byte|class|case|casex|casez|cell|chandle|clocking|cmos|config|const|constraint|context|continue|cover|covergroup|coverpoint|cross|deassign|default|defparam|design|disable|dist|do|edge|else|end|endcase|endclass|endclocking|endconfig|endfunction|endgenerate|endgroup|endinterface|endmodule|endpackage|endprimitive|endprogram|endproperty|endspecify|endsequence|endtable|endtask|enum|event|expect|export|extends|extern|final|first_match|for|force|foreach|forever|fork|forkjoin|function|generate|genvar|highz0|highz1|if|iff|ifnone|ignore_bins|illegal_bins|import|incdir|include|initial|inout|input|inside|instance|int|integer|interface|intersect|join|join_any|join_none|large|liblist|library|local|localparam|logic|longint|macromodule|matches|medium|modport|module|nand|negedge|new|nmos|nor|noshowcancelled|not|notif0|notif1|null|or|output|package|packed|parameter|pmos|posedge|primitive|priority|program|property|protected|pull0|pull1|pulldown|pullup|pulsestyle_onevent|pulsestyle_ondetect|pure|rand|randc|randcase|randsequence|rcmos|real|realtime|ref|reg|release|repeat|return|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|sequence|shortint|shortreal|showcancelled|signed|small|solve|specify|specparam|static|string|strong0|strong1|struct|super|supply0|supply1|table|tagged|task|this|throughout|time|timeprecision|timeunit|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|type|typedef|union|unique|unsigned|use|uwire|var|vectored|virtual|void|wait|wait_order|wand|weak0|weak1|while|wildcard|wire|with|within|wor|xnor|xor)\b/,important:/\b(always_latch|always_comb|always_ff|always) ?@?/,number:/(?!\b)#{1,2}\d+|(\b\d+)?'[odbh] ?[\da-f10zx_\?]+|\b\d+[._]?(e-?\d+)?/i,operator:/[-+\{\}]|!=?|<{1,2}=?|>{1,2}=?|={1,3}|\^|~|%|&{1,2}|\|?\||\?|\*|\//,punctuation:/[[\];(),.:]/};
\ No newline at end of file
diff --git a/components/prism-verilog.js b/components/prism-verilog.js
new file mode 100644
index 0000000..868b886
--- /dev/null
+++ b/components/prism-verilog.js
@@ -0,0 +1,17 @@
+Prism.languages.verilog = {
+ 'comment': /\/\/.*|\/\*[\w\W]*?\*\//,
+ 'string': /"(\\(?:\r\n?|\n)|\\?.)*?"/,
+ // support for any kernel function (ex: $display())
+ 'property': /\B\$\w+\b/,
+ // support for user defined constants (ex: `define)
+ 'constant': /\B`\w+\b/,
+ 'function': /[a-z\d_]+(?=\()/i,
+ // support for verilog and system verilog keywords
+ 'keyword': /\b(alias|and|assert|assign|assume|automatic|before|begin|bind|bins|binsof|bit|break|buf|bufif0|bufif1|byte|class|case|casex|casez|cell|chandle|clocking|cmos|config|const|constraint|context|continue|cover|covergroup|coverpoint|cross|deassign|default|defparam|design|disable|dist|do|edge|else|end|endcase|endclass|endclocking|endconfig|endfunction|endgenerate|endgroup|endinterface|endmodule|endpackage|endprimitive|endprogram|endproperty|endspecify|endsequence|endtable|endtask|enum|event|expect|export|extends|extern|final|first_match|for|force|foreach|forever|fork|forkjoin|function|generate|genvar|highz0|highz1|if|iff|ifnone|ignore_bins|illegal_bins|import|incdir|include|initial|inout|input|inside|instance|int|integer|interface|intersect|join|join_any|join_none|large|liblist|library|local|localparam|logic|longint|macromodule|matches|medium|modport|module|nand|negedge|new|nmos|nor|noshowcancelled|not|notif0|notif1|null|or|output|package|packed|parameter|pmos|posedge|primitive|priority|program|property|protected|pull0|pull1|pulldown|pullup|pulsestyle_onevent|pulsestyle_ondetect|pure|rand|randc|randcase|randsequence|rcmos|real|realtime|ref|reg|release|repeat|return|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|sequence|shortint|shortreal|showcancelled|signed|small|solve|specify|specparam|static|string|strong0|strong1|struct|super|supply0|supply1|table|tagged|task|this|throughout|time|timeprecision|timeunit|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|type|typedef|union|unique|unsigned|use|uwire|var|vectored|virtual|void|wait|wait_order|wand|weak0|weak1|while|wildcard|wire|with|within|wor|xnor|xor)\b/,
+ // bold highlighting for all verilog and system verilog logic blocks
+ 'important': /\b(always_latch|always_comb|always_ff|always) ?@?/,
+ // support for time ticks, vectors, and real numbers
+ 'number': /\B##?\d+|(\b\d+)?'[odbh] ?[\da-fzx_?]+|\b\d*[._]?\d+(e[-+]?\d+)?/i,
+ 'operator': /[-+{}^~%*\/?=!<>&|]+/,
+ 'punctuation': /[[\];(),.:]/,
+};
\ No newline at end of file
diff --git a/components/prism-verilog.min.js b/components/prism-verilog.min.js
new file mode 100644
index 0000000..bb11cc5
--- /dev/null
+++ b/components/prism-verilog.min.js
@@ -0,0 +1 @@
+Prism.languages.verilog={comment:/\/\/.*|\/\*[\w\W]*?\*\//,string:/"(\\(?:\r\n?|\n)|\\?.)*?"/,property:/\B\$\w+\b/,constant:/\B`\w+\b/,"function":/[a-z\d_]+(?=\()/i,keyword:/\b(alias|and|assert|assign|assume|automatic|before|begin|bind|bins|binsof|bit|break|buf|bufif0|bufif1|byte|class|case|casex|casez|cell|chandle|clocking|cmos|config|const|constraint|context|continue|cover|covergroup|coverpoint|cross|deassign|default|defparam|design|disable|dist|do|edge|else|end|endcase|endclass|endclocking|endconfig|endfunction|endgenerate|endgroup|endinterface|endmodule|endpackage|endprimitive|endprogram|endproperty|endspecify|endsequence|endtable|endtask|enum|event|expect|export|extends|extern|final|first_match|for|force|foreach|forever|fork|forkjoin|function|generate|genvar|highz0|highz1|if|iff|ifnone|ignore_bins|illegal_bins|import|incdir|include|initial|inout|input|inside|instance|int|integer|interface|intersect|join|join_any|join_none|large|liblist|library|local|localparam|logic|longint|macromodule|matches|medium|modport|module|nand|negedge|new|nmos|nor|noshowcancelled|not|notif0|notif1|null|or|output|package|packed|parameter|pmos|posedge|primitive|priority|program|property|protected|pull0|pull1|pulldown|pullup|pulsestyle_onevent|pulsestyle_ondetect|pure|rand|randc|randcase|randsequence|rcmos|real|realtime|ref|reg|release|repeat|return|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|sequence|shortint|shortreal|showcancelled|signed|small|solve|specify|specparam|static|string|strong0|strong1|struct|super|supply0|supply1|table|tagged|task|this|throughout|time|timeprecision|timeunit|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|type|typedef|union|unique|unsigned|use|uwire|var|vectored|virtual|void|wait|wait_order|wand|weak0|weak1|while|wildcard|wire|with|within|wor|xnor|xor)\b/,important:/\b(always_latch|always_comb|always_ff|always) ?@?/,number:/\B##?\d+|(\b\d+)?'[odbh] ?[\da-fzx_?]+|\b\d*[._]?\d+(e[-+]?\d+)?/i,operator:/[-+{}^~%*\/?=!<>&|]+/,punctuation:/[[\];(),.:]/};
\ No newline at end of file
diff --git a/examples/prism-system_verilog.html b/examples/prism-system_verilog.html
deleted file mode 100644
index 2bbd840..0000000
--- a/examples/prism-system_verilog.html
+++ /dev/null
@@ -1,104 +0,0 @@
-<h1>System Verilog</h1>
-<p>To use this language, use the class "language-system_verilog".</p>
-
-<h2>Comments</h2>
-<pre><code>/* Multiline comments in Verilog
- look like C comments and // is OK in here. */
-// Single-line comment in Verilog.</code></pre>
-
-<h2>Literals</h2>
-<pre><code>// example code from: http://iroi.seu.edu.cn/books/asics/Book2/CH11/CH11.02.htm
-module declarations;
- parameter H12_UNSIZED = 'h 12;
- parameter H12_SIZED = 6'h 12;
- parameter D42 = 8'B0010_1010;
- parameter D123 = 123;
- parameter D63 = 8'o 77;
- parameter A = 'h x, B = 'o x, C = 8'b x, D = 'h z, E = 16'h ????;
- reg [3:0] B0011,Bxxx1,Bzzz1;
- real R1,R2,R3;
- integer I1,I3,I_3;
- parameter BXZ = 8'b1x0x1z0z;
-
- initial begin
- B0011 = 4'b11; Bxxx1 = 4'bx1; Bzzz1 = 4'bz1;
- R1 = 0.1e1; R2 = 2.0; R3 = 30E-01;
- I1 = 1.1; I3 = 2.5; I_3 = -2.5;
- end
-
- initial begin #1;
- $display("H12_UNSIZED, H12_SIZED (hex) = %h, %h",H12_UNSIZED, H12_SIZED);
- $display("D42 (bin) = %b",D42," (dec) = %d",D42);
- $display("D123 (hex) = %h",D123," (dec) = %d",D123);
- $display("D63 (oct) = %o",D63);
- $display("A (hex) = %h",A," B (hex) = %h",B);
- $display("C (hex) = %h",C," D (hex) = %h",D," E (hex) = %h",E);
- $display("BXZ (bin) = %b",BXZ," (hex) = %h",BXZ);
- $display("B0011, Bxxx1, Bzzz1 (bin) = %b, %b, %b",B0011,Bxxx1,Bzzz1);
- $display("R1, R2, R3 (e, f, g) = %e, %f, %g", R1, R2, R3);
- $display("I1, I3, I_3 (d) = %d, %d, %d", I1, I3, I_3);
- end
-endmodule</code></pre>
-
-<h2>Full example</h2>
-<pre><code>`include "internal_defines.vh"
-
-//*****************************************************************************
-// memory_decoder: a custom module used to handle memory transactions
-//*****************************************************************************
-//
-// out_mem (output) - The output to memory
-// out_reg (output) - The output to the register file
-// mem_we (output) - Which byte in the word to write too
-// mem_in (input) - The input from memory
-// addr_in (input) - The lowest 2 bits of byte offset to store in memory
-// data_in (input) - The input from the register file to be stored
-// l_bit (input) - The load bit signal (control)
-// b_bit (input) - The byte bit signal (control)
-//
-module memory_decoder(out_mem, out_reg, mem_in, data_in, l_bit, b_bit, addr_in,
- mem_we);
-
- output reg [31:0] out_mem, out_reg;
- output reg [3:0] mem_we;
- input [31:0] mem_in, data_in;
- input [1:0] addr_in;
- input l_bit, b_bit;
-
- always_comb begin
- mem_we = 4'b0000; // dont write memory by default
- if (l_bit == 1) begin // ldr and ldrb
- out_mem = mem_in; // dont change memory!
- if (b_bit == 1) begin
- /* figure out which byte to load from memory */
- case (addr_in)
- 2'b00: out_reg = {24'b00, mem_in[7:0]};
- 2'b01: out_reg = {24'b00, mem_in[15:8]};
- 2'b10: out_reg = {24'b00, mem_in[23:16]};
- 2'b11: out_reg = {24'b00, mem_in[31:24]};
- endcase
- end
- else begin
- out_reg = mem_in;
- end
- end
- else begin // str and strb
- out_reg = `UNKNOWN; // We are not reading from mem
- if (b_bit == 1) begin
- /* figure out which byte to write to in memory */
- out_mem = {4{data_in[7:0]}};
- case (addr_in)
- 2'b00: mem_we = 4'b1000;
- 2'b01: mem_we = 4'b0100;
- 2'b10: mem_we = 4'b0010;
- 2'b11: mem_we = 4'b0001;
- endcase
- end
- else begin
- mem_we = 4'b1111; // write to all channels
- out_mem = data_in;
- end
- end
- end
-
-endmodule</code></pre>
\ No newline at end of file
diff --git a/examples/prism-verilog.html b/examples/prism-verilog.html
new file mode 100644
index 0000000..315d385
--- /dev/null
+++ b/examples/prism-verilog.html
@@ -0,0 +1,104 @@
+<h1>Verilog & System Verilog</h1>
+<p>To use this language, use the class "language-verilog". Note that this package supports syntax highlighting for both Verilog and System Verilog.</p>
+
+<h2>Comments</h2>
+<pre><code>/* Multiline comments in Verilog
+ look like C comments and // is OK in here. */
+// Single-line comment in Verilog.</code></pre>
+
+<h2>Literals</h2>
+<pre><code>// example code from: http://iroi.seu.edu.cn/books/asics/Book2/CH11/CH11.02.htm
+module declarations;
+ parameter H12_UNSIZED = 'h 12;
+ parameter H12_SIZED = 6'h 12;
+ parameter D42 = 8'B0010_1010;
+ parameter D123 = 123;
+ parameter D63 = 8'o 77;
+ parameter A = 'h x, B = 'o x, C = 8'b x, D = 'h z, E = 16'h ????;
+ reg [3:0] B0011,Bxxx1,Bzzz1;
+ real R1,R2,R3;
+ integer I1,I3,I_3;
+ parameter BXZ = 8'b1x0x1z0z;
+
+ initial begin
+ B0011 = 4'b11; Bxxx1 = 4'bx1; Bzzz1 = 4'bz1;
+ R1 = 0.1e1; R2 = 2.0; R3 = 30E-01;
+ I1 = 1.1; I3 = 2.5; I_3 = -2.5;
+ end
+
+ initial begin #1;
+ $display("H12_UNSIZED, H12_SIZED (hex) = %h, %h",H12_UNSIZED, H12_SIZED);
+ $display("D42 (bin) = %b",D42," (dec) = %d",D42);
+ $display("D123 (hex) = %h",D123," (dec) = %d",D123);
+ $display("D63 (oct) = %o",D63);
+ $display("A (hex) = %h",A," B (hex) = %h",B);
+ $display("C (hex) = %h",C," D (hex) = %h",D," E (hex) = %h",E);
+ $display("BXZ (bin) = %b",BXZ," (hex) = %h",BXZ);
+ $display("B0011, Bxxx1, Bzzz1 (bin) = %b, %b, %b",B0011,Bxxx1,Bzzz1);
+ $display("R1, R2, R3 (e, f, g) = %e, %f, %g", R1, R2, R3);
+ $display("I1, I3, I_3 (d) = %d, %d, %d", I1, I3, I_3);
+ end
+endmodule</code></pre>
+
+<h2>Full example</h2>
+<pre><code>`include "internal_defines.vh"
+
+//*****************************************************************************
+// memory_decoder: a custom module used to handle memory transactions
+//*****************************************************************************
+//
+// out_mem (output) - The output to memory
+// out_reg (output) - The output to the register file
+// mem_we (output) - Which byte in the word to write too
+// mem_in (input) - The input from memory
+// addr_in (input) - The lowest 2 bits of byte offset to store in memory
+// data_in (input) - The input from the register file to be stored
+// l_bit (input) - The load bit signal (control)
+// b_bit (input) - The byte bit signal (control)
+//
+module memory_decoder(out_mem, out_reg, mem_in, data_in, l_bit, b_bit, addr_in,
+ mem_we);
+
+ output reg [31:0] out_mem, out_reg;
+ output reg [3:0] mem_we;
+ input [31:0] mem_in, data_in;
+ input [1:0] addr_in;
+ input l_bit, b_bit;
+
+ always_comb begin
+ mem_we = 4'b0000; // dont write memory by default
+ if (l_bit == 1) begin // ldr and ldrb
+ out_mem = mem_in; // dont change memory!
+ if (b_bit == 1) begin
+ /* figure out which byte to load from memory */
+ case (addr_in)
+ 2'b00: out_reg = {24'b00, mem_in[7:0]};
+ 2'b01: out_reg = {24'b00, mem_in[15:8]};
+ 2'b10: out_reg = {24'b00, mem_in[23:16]};
+ 2'b11: out_reg = {24'b00, mem_in[31:24]};
+ endcase
+ end
+ else begin
+ out_reg = mem_in;
+ end
+ end
+ else begin // str and strb
+ out_reg = `UNKNOWN; // We are not reading from mem
+ if (b_bit == 1) begin
+ /* figure out which byte to write to in memory */
+ out_mem = {4{data_in[7:0]}};
+ case (addr_in)
+ 2'b00: mem_we = 4'b1000;
+ 2'b01: mem_we = 4'b0100;
+ 2'b10: mem_we = 4'b0010;
+ 2'b11: mem_we = 4'b0001;
+ endcase
+ end
+ else begin
+ mem_we = 4'b1111; // write to all channels
+ out_mem = data_in;
+ end
+ end
+ end
+
+endmodule</code></pre>
\ No newline at end of file