SystemVerilog mode

x
 
1
// Literals
2
1'b0
3
1'bx
4
1'bz
5
16'hDC78
6
'hdeadbeef
7
'b0011xxzz
8
1234
9
32'd5678
10
3.4e6
11
-128.7
12
13
// Macro definition
14
`define BUS_WIDTH = 8;
15
16
// Module definition
17
module block(
18
  input                   clk,
19
  input                   rst_n,
20
  input  [`BUS_WIDTH-1:0] data_in,
21
  output [`BUS_WIDTH-1:0] data_out
22
);
23
24
  always @(posedge clk or negedge rst_n) begin
25
26
    if (~rst_n) begin
27
      data_out <= 8'b0;
28
    end else begin
29
      data_out <= data_in;
30
    end
31
32
    if (~rst_n)
33
      data_out <= 8'b0;
34
    else
35
      data_out <= data_in;
36
37
    if (~rst_n)
38
      begin
39
        data_out <= 8'b0;
40
      end
41
    else
42
      begin
43
        data_out <= data_in;
44
      end
45
46
  end
47
48
endmodule
49
50
// Class definition
51
class test;
52
53
  /**
54
   * Sum two integers
55
   */
56
  function int sum(int a, int b);
57
    int result = a + b;
58
    string msg = $sformatf("%d + %d = %d", a, b, result);
59
    $display(msg);
60
    return result;
61
  endfunction
62
63
  task delay(int num_cycles);
64
    repeat(num_cycles) #1;
65
  endtask
66
67
endclass
68
69

Syntax highlighting and indentation for the Verilog and SystemVerilog languages (IEEE 1800).

Configuration options:

MIME types defined: text/x-verilog and text/x-systemverilog.