verilog_gen 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -0
  3. data/README.md +22 -1
  4. data/Rakefile +20 -0
  5. data/bin/hdl_equal +82 -0
  6. data/bin/vgen +57 -1
  7. data/bin/vscan +354 -0
  8. data/demos/router/Makefile +11 -0
  9. data/demos/router/build/chip1_router.rb +50 -0
  10. data/demos/router/build/chip2_router.rb +33 -0
  11. data/demos/router/build/generic_router.rb +96 -0
  12. data/demos/router/rtl/fifo_ctrl.v +93 -0
  13. data/demos/router/rtl/flop_delay.v +37 -0
  14. data/demos/router/rtl/generic_mem.v +38 -0
  15. data/demos/router/rtl/router_ctrl.v +73 -0
  16. data/demos/router/rtl/rr_arb.v +55 -0
  17. data/demos/router/vendors/vendor1/mem_16nm_bist_ctrl.v +56 -0
  18. data/demos/router/vendors/vendor1/mem_16nm_ram4x64.v +50 -0
  19. data/demos/router/vendors/vendor1/mem_16nm_ram8x64.v +50 -0
  20. data/demos/router/vendors/vendor2/mem_16nm_bist_ctrl.v +56 -0
  21. data/demos/router/vendors/vendor2/mem_16nm_ram12x73.v +50 -0
  22. data/demos/router/vendors/vendor2/mem_16nm_ram4x73.v +50 -0
  23. data/docs/demo.md +142 -0
  24. data/docs/sst.md +76 -0
  25. data/features/cucumber.yml +1 -0
  26. data/features/hdl_equal/hello.feature +9 -0
  27. data/features/hdl_equal/leaf_compare.feature +11 -0
  28. data/features/hdl_equal/neg_compare.feature +17 -0
  29. data/features/hdl_equal/port_width_compare.feature +17 -0
  30. data/features/sprint1/hello.feature +9 -0
  31. data/features/sprint1/hier_connect_1.feature +81 -0
  32. data/features/sprint1/hier_connect_2.feature +91 -0
  33. data/features/sprint1/hier_connect_3.feature +90 -0
  34. data/features/sprint1/inhibit_port.feature +41 -0
  35. data/features/sprint1/input_connect.feature +79 -0
  36. data/features/sprint1/leaf_rename.feature +41 -0
  37. data/features/sprint1/new_leaf_design.erb +52 -0
  38. data/features/sprint1/output_connect.feature +79 -0
  39. data/features/sprint1/regex_port_rewrites.feature +43 -0
  40. data/features/sprint1/subrange_port.feature +43 -0
  41. data/features/sprint1/swap_leaf.feature +122 -0
  42. data/features/sprint1/tie_port.feature +40 -0
  43. data/features/sprint1/unused_port.feature +41 -0
  44. data/features/sprint1/vector_split.feature +41 -0
  45. data/features/sprint1/wire_connect.feature +46 -0
  46. data/features/sprint2/expression_net.feature +41 -0
  47. data/features/sprint2/fifo.feature +61 -0
  48. data/features/sprint2/wire_expression.feature +48 -0
  49. data/features/step_definitions/vgen_steps.rb +3 -0
  50. data/features/support/env.rb +3 -1
  51. data/features/vgen/add_child.feature +60 -0
  52. data/features/vgen/fifo_ctrl.feature +24 -0
  53. data/features/vgen/hello.feature +9 -0
  54. data/features/vgen/leaf_node.feature +15 -0
  55. data/features/vgen/output_dir.feature +19 -0
  56. data/features/vgen/simple_node.feature +24 -0
  57. data/features/vgen/thin_hookup.feature +22 -0
  58. data/features/vscan/bad_path.feature +9 -0
  59. data/features/vscan/class_override.feature +23 -0
  60. data/features/vscan/class_override_path.feature +23 -0
  61. data/features/vscan/complex_expressions.feature +47 -0
  62. data/features/vscan/data_types_2001.feature +36 -0
  63. data/features/vscan/data_types_sv.feature +53 -0
  64. data/features/vscan/hello.feature +9 -0
  65. data/features/vscan/hiearchy_path.feature +23 -0
  66. data/features/vscan/illegal_argument.feature +9 -0
  67. data/features/vscan/inout.feature +23 -0
  68. data/features/vscan/interface_nested.feature +53 -0
  69. data/features/vscan/interface_nested_no_out.feature +48 -0
  70. data/features/vscan/interface_param_default.feature +41 -0
  71. data/features/vscan/interface_param_override.feature +27 -0
  72. data/features/vscan/interface_port.feature +41 -0
  73. data/features/vscan/interface_sv.feature +35 -0
  74. data/features/vscan/leaf_1995.feature +27 -0
  75. data/features/vscan/leaf_2001.feature +25 -0
  76. data/features/vscan/leaf_negative_1995.feature +24 -0
  77. data/features/vscan/leaf_sv.feature +25 -0
  78. data/features/vscan/localparam_2001.feature +38 -0
  79. data/features/vscan/missing_parameter.feature +24 -0
  80. data/features/vscan/multiple_class.feature +9 -0
  81. data/features/vscan/multiple_flavors.feature +64 -0
  82. data/features/vscan/multiple_modules.feature +60 -0
  83. data/features/vscan/name_mismatch.feature +24 -0
  84. data/features/vscan/net_type.feature +67 -0
  85. data/features/vscan/parameter_override.feature +43 -0
  86. data/features/vscan/parameters_1995.feature +43 -0
  87. data/features/vscan/parameters_2001.feature +38 -0
  88. data/features/vscan/read_only.feature +19 -0
  89. data/features/vscan/reverse_vectors_1995.feature +33 -0
  90. data/features/vscan/single_line_1995.feature +24 -0
  91. data/features/vscan/vectors_1995.feature +33 -0
  92. data/features/vscan/vectors_2001.feature +29 -0
  93. data/features/vscan/vectors_sv.feature +31 -0
  94. data/lib/templates/helpers.rb +85 -0
  95. data/lib/templates/v2k_template.erb +6 -0
  96. data/lib/verilog_gen.rb +8 -3
  97. data/lib/verilog_gen/hdl_module.rb +274 -0
  98. data/lib/verilog_gen/hookup.rb +153 -0
  99. data/lib/verilog_gen/pin.rb +39 -0
  100. data/lib/verilog_gen/port.rb +109 -0
  101. data/lib/verilog_gen/proxy.rb +33 -0
  102. data/lib/verilog_gen/string.rb +38 -0
  103. data/lib/verilog_gen/version.rb +1 -1
  104. data/spec/fixture/generic_mem.v +38 -0
  105. data/spec/hdl_child_array_spec.rb +29 -0
  106. data/spec/hdl_hier_spec.rb +45 -0
  107. data/spec/hdl_hookup.spec +37 -0
  108. data/spec/hdl_module_spec.rb +117 -0
  109. data/spec/hdl_output_spec.rb +88 -0
  110. data/spec/hdl_port_spec.rb +35 -0
  111. data/spec/hdl_remove_child.spec +37 -0
  112. data/spec/pin_spec.rb +37 -0
  113. data/spec/port_spec.rb +90 -0
  114. data/spec/proxy_spec.rb +41 -0
  115. data/spec/spec_helper.rb +2 -0
  116. data/verilog_gen.gemspec +1 -1
  117. metadata +194 -8
  118. data/features/hello.feature +0 -8
  119. data/features/support/aruba.rb +0 -1
@@ -0,0 +1,27 @@
1
+ Feature: convert a system verilog format to ruby.
2
+ @wip
3
+ Scenario: System Verilog interfaces (with parameters)
4
+ Given a file named "leaf.sv" with:
5
+ """
6
+ interface intf #(PARAM1=3) (
7
+ input logic [PARAM1:0] in1, in2,
8
+ output [PARAM1-1:0] out
9
+ );
10
+ wire pin;
11
+ endinterface: intf
12
+ """
13
+ And a file named "expect.rb" with:
14
+ """
15
+ class Intf_wide < VerilogGen::HdlInterface
16
+ set_proxy true
17
+ set_file_name "leaf.sv"
18
+ set_interface_name "intf"
19
+ add_port "in1", direction: "input", type: "logic", packed: "[5:0]"
20
+ add_port "in2", direction: "output", type: "logic", packed: "[5:0]"
21
+ add_port "out", direction: "output", type: "logic", packed: "[4:0]"
22
+ end
23
+ """
24
+ When I run `csh -c '../../bin/vscan PARAM1=5 -class Intf_wide leaf.sv > Intf_wide.rb'`
25
+ Then a file named "Intf_wide.rb" should exist
26
+ When I run `hdl_equal expect.rb Intf_wide.rb`
27
+ Then the exit status should be 0
@@ -0,0 +1,41 @@
1
+ Feature: convert a system verilog format to ruby.
2
+ @wip
3
+ Scenario: System Verilog interfaces
4
+ Given a file named "leaf.sv" with:
5
+ """
6
+ interface intf (
7
+ input logic [3:0] in1, in2,
8
+ output [2:0] out
9
+ );
10
+ wire pin;
11
+ endinterface: intf
12
+
13
+ module leaf (
14
+ input wire clk,
15
+ intf port_interface
16
+ );
17
+ endmodule
18
+ """
19
+ And a file named "expect.rb" with:
20
+ """
21
+ class Leaf < VerilogGen::HdlModule
22
+ set_proxy true
23
+ set_file_name "leaf.sv"
24
+ set_module_name "leaf"
25
+ add_port "clk", direction: "input", type: "wire"
26
+ add_interface "port_interface", type: "intf"
27
+ end
28
+ class Intf < VerilogGen::HdlInterface
29
+ set_proxy true
30
+ set_file_name "leaf.sv"
31
+ set_interface_name "intf"
32
+ add_port "in1", direction: "input", type: "logic", packed: "[3:0]"
33
+ add_port "in2", direction: "output", type: "logic", packed: "[3:0]"
34
+ add_port "out", direction: "output", type: "logic", packed: "[2:0]"
35
+ end
36
+ end
37
+ """
38
+ When I run `csh -c '../../bin/vscan leaf.sv > leaf.rb'`
39
+ Then a file named "leaf.rb" should exist
40
+ When I run `hdl_equal expect.rb leaf.rb`
41
+ Then the exit status should be 0
@@ -0,0 +1,35 @@
1
+ Feature: convert a system verilog format to ruby.
2
+ @wip
3
+ Scenario: System Verilog interfaces
4
+ Given a file named "leaf.sv" with:
5
+ """
6
+ interface intf;
7
+ logic [3:0] in1, in2;
8
+ logic [2:0] out;
9
+ endinterface: intf
10
+
11
+ module leaf (
12
+ input wire clk,
13
+ intf port_interface
14
+ );
15
+ endmodule
16
+ """
17
+ And a file named "expect.rb" with:
18
+ """
19
+ class Leaf < VerilogGen::HdlModule
20
+ set_proxy true
21
+ set_file_name "leaf.sv"
22
+ set_module_name "leaf"
23
+ add_port "clk", direction: "input", type: "wire"
24
+ add_interface "port_interface", type: "intf"
25
+ end
26
+ class Intf < VerilogGen::HdlInterface
27
+ set_proxy true
28
+ set_file_name "leaf.sv"
29
+ set_interface_name "intf"
30
+ end
31
+ """
32
+ When I run `csh -c '../../bin/vscan leaf.sv > leaf.rb'`
33
+ Then a file named "leaf.rb" should exist
34
+ When I run `hdl_equal expect.rb leaf.rb`
35
+ Then the exit status should be 0
@@ -0,0 +1,27 @@
1
+ Feature: convert a verilog 1364 format to ruby.
2
+
3
+ Scenario: Single input port
4
+ Given a file named "leaf.v" with:
5
+ """
6
+ module leaf (
7
+ in,
8
+ out
9
+ );
10
+ input in;
11
+ output out;
12
+ endmodule
13
+ """
14
+ And a file named "expect.rb" with:
15
+ """
16
+ class Leaf < VerilogGen::HdlModule
17
+ set_proxy true
18
+ set_file_name "leaf.v"
19
+ set_module_name "leaf"
20
+ add_port "in", direction: "input", type: "wire"
21
+ add_port "out", direction: "output", type: "wire"
22
+ end
23
+ """
24
+ When I run `csh -c '../../bin/vscan leaf.v > leaf.rb'`
25
+ Then a file named "leaf.rb" should exist
26
+ When I run `hdl_equal expect.rb leaf.rb`
27
+ Then the exit status should be 0
@@ -0,0 +1,25 @@
1
+ Feature: convert a verilog 1364-2001 format to ruby.
2
+
3
+ Scenario: Single input port
4
+ Given a file named "leaf.v" with:
5
+ """
6
+ module leaf (
7
+ input in,
8
+ output out
9
+ );
10
+ endmodule
11
+ """
12
+ And a file named "expect.rb" with:
13
+ """
14
+ class Leaf < VerilogGen::HdlModule
15
+ set_proxy true
16
+ set_file_name "leaf.v"
17
+ set_module_name "leaf"
18
+ add_port "in", direction: "input", type: "wire"
19
+ add_port "out", direction: "output", type: "wire"
20
+ end
21
+ """
22
+ When I run `csh -c '../../bin/vscan leaf.v > leaf.rb'`
23
+ Then a file named "leaf.rb" should exist
24
+ When I run `hdl_equal expect.rb leaf.rb`
25
+ Then the exit status should be 0
@@ -0,0 +1,24 @@
1
+ Feature: convert a verilog 1364 format to ruby.
2
+
3
+ Scenario: Single input port, negative test
4
+ Given a file named "leaf.v" with:
5
+ """
6
+ module leaf(in, out);
7
+ input in;
8
+ output out;
9
+ endmodule
10
+ """
11
+ And a file named "expect.rb" with:
12
+ """
13
+ class Leaf < VerilogGen::HdlModule
14
+ set_proxy true
15
+ set_file_name "leaf.v"
16
+ set_module_name "leaf"
17
+ add_port "in", direction: "output", type: "wire"
18
+ add_port "out", direction: "output", type: "wire"
19
+ end
20
+ """
21
+ When I run `csh -c '../../bin/vscan leaf.v > leaf.rb'`
22
+ Then a file named "leaf.rb" should exist
23
+ When I run `hdl_equal expect.rb leaf.rb`
24
+ Then the exit status should not be 0
@@ -0,0 +1,25 @@
1
+ Feature: convert a system verilog format to ruby.
2
+
3
+ Scenario: Single input port
4
+ Given a file named "leaf.sv" with:
5
+ """
6
+ module leaf (
7
+ input logic [3:0] in,
8
+ output reg [2:0] out,
9
+ );
10
+ endmodule
11
+ """
12
+ And a file named "expect.rb" with:
13
+ """
14
+ class Leaf < VerilogGen::HdlModule
15
+ set_proxy true
16
+ set_file_name "leaf.sv"
17
+ set_module_name "leaf"
18
+ add_port "in", direction: "input", packed: "[3:0]", type: "logic"
19
+ add_port "out", direction: "output", packed: "[2:0]", type: "reg"
20
+ end
21
+ """
22
+ When I run `csh -c '../../bin/vscan leaf.sv > leaf.rb'`
23
+ Then a file named "leaf.rb" should exist
24
+ When I run `hdl_equal expect.rb leaf.rb`
25
+ Then the exit status should be 0
@@ -0,0 +1,38 @@
1
+ Feature: convert a verilog 1364-2001 format to ruby.
2
+
3
+ Scenario: Parameterized ports, not externally changeable
4
+ Given a file named "leaf.v" with:
5
+ """
6
+ module leaf
7
+ #( localparam IN1_MSB = 5,
8
+ localparam IN1_LSB = 3,
9
+ localparam IN2_MSB = 7,
10
+ IN2_LSB = 0,
11
+ localparam OUT1_MSB = 31,
12
+ OUT1_LSB = 0,
13
+ OUT2_MSB = 8,
14
+ OUT2_LSB = 3 )
15
+ (
16
+ input [IN1_MSB:IN1_LSB] in1,
17
+ input [IN2_MSB:IN2_LSB] in2,
18
+ output [OUT1_MSB:OUT1_LSB] out1,
19
+ output [OUT2_MSB:OUT2_LSB] out2
20
+ );
21
+ endmodule
22
+ """
23
+ And a file named "expect.rb" with:
24
+ """
25
+ class Leaf < VerilogGen::HdlModule
26
+ set_proxy true
27
+ set_file_name "leaf.v"
28
+ set_module_name "leaf"
29
+ add_port "in1", direction: "input", packed: "[5:3]", type: "wire"
30
+ add_port "in2", direction: "input", packed: "[7:0]", type: "wire"
31
+ add_port "out1", direction: "output", packed: "[31:0]", type: "wire"
32
+ add_port "out2", direction: "output", packed: "[8:3]", type: "wire"
33
+ end
34
+ """
35
+ When I run `csh -c '../../bin/vscan leaf.v > leaf.rb'`
36
+ Then a file named "leaf.rb" should exist
37
+ When I run `hdl_equal expect.rb leaf.rb`
38
+ Then the exit status should be 0
@@ -0,0 +1,24 @@
1
+ Feature: convert a verilog 1364-2001 format to ruby.
2
+
3
+ Scenario: Parameters in verilog file not specified
4
+ Given a file named "leaf.v" with:
5
+ """
6
+ module leaf
7
+ #( parameter IN1_MSB = 5,
8
+ parameter IN1_LSB = 3,
9
+ parameter IN2_MSB = 7,
10
+ parameter OUT1_MSB = 31,
11
+ OUT1_LSB = 0)
12
+ (
13
+ input [IN1_MSB:IN1_LSB] in1,
14
+ input [IN2_MSB:IN2_LSB] in2,
15
+ output [OUT1_MSB:OUT1_LSB] out1,
16
+ output [OUT2_MSB:OUT2_LSB] out2
17
+ );
18
+ endmodule
19
+ """
20
+ When I run `csh -c '../../bin/vscan leaf.v > leaf.rb'`
21
+ Then it should fail with:
22
+ """
23
+ error: I/O declaration using undefined parameter.
24
+ """
@@ -0,0 +1,9 @@
1
+ Feature: Hello World
2
+
3
+ Scenario: print banner
4
+ When I run `csh -c '../../bin/vscan -class trunk -class leaf leaf.v > leaf.rb'`
5
+ Then it should fail with:
6
+ """
7
+ error: you can't specify more than one class overide.
8
+
9
+ """
@@ -0,0 +1,64 @@
1
+ Feature: convert a verilog 1364-2001 format to ruby.
2
+
3
+ Scenario: Parameterized ports, with class override into multiple flavors
4
+ Given a file named "leaf.v" with:
5
+ """
6
+ module leaf
7
+ #( parameter IN1_MSB = 5,
8
+ parameter IN1_LSB = 3,
9
+ parameter IN2_MSB = 7,
10
+ IN2_LSB = 0,
11
+ parameter OUT1_MSB = 31,
12
+ OUT1_LSB = 0,
13
+ OUT2_MSB = 8,
14
+ OUT2_LSB = 3,
15
+ parameter DEPTH = 7,
16
+ WIDTH = 128 )
17
+ (
18
+ input [IN1_MSB:IN1_LSB] in1,
19
+ input [IN2_MSB:IN2_LSB] in2,
20
+ output [OUT1_MSB:OUT1_LSB] out1,
21
+ output [OUT2_MSB:OUT2_LSB] out2
22
+ );
23
+ endmodule
24
+ """
25
+ And a file named "expect_wide.rb" with:
26
+ """
27
+ class Leaf_wide < VerilogGen::HdlModule
28
+ set_proxy true
29
+ set_file_name "leaf.v"
30
+ set_module_name "leaf"
31
+
32
+ set_parameter OUT2_MSB: 10
33
+ set_parameter OUT2_LSB: 5
34
+ set_parameter WIDTH: 256
35
+
36
+ add_port "in1", direction: "input", packed: "[5:3]", type: "wire"
37
+ add_port "in2", direction: "input", packed: "[7:0]", type: "wire"
38
+ add_port "out1", direction: "output", packed: "[31:0]", type: "wire"
39
+ add_port "out2", direction: "output", packed: "[10:5]", type: "wire"
40
+ end
41
+ """
42
+ And a file named "expect_narrow.rb" with:
43
+ """
44
+ class Leaf_narrow < VerilogGen::HdlModule
45
+ set_proxy true
46
+ set_file_name "leaf.v"
47
+ set_module_name "leaf"
48
+ set_parameter OUT1_MSB: 4
49
+ set_parameter OUT1_LSB: 2
50
+ set_parameter WIDTH: 32
51
+ add_port "in1", direction: "input", packed: "[5:3]", type: "wire"
52
+ add_port "in2", direction: "input", packed: "[7:0]", type: "wire"
53
+ add_port "out1", direction: "output", packed: "[4:2]", type: "wire"
54
+ add_port "out2", direction: "output", packed: "[8:3]", type: "wire"
55
+ end
56
+ """
57
+ When I run `csh -c '../../bin/vscan OUT2_MSB=10 OUT2_LSB=5 WIDTH=256 -class leaf_wide leaf.v > leaf_wide.rb'`
58
+ And I run `csh -c '../../bin/vscan OUT1_MSB=4 OUT1_LSB=2 WIDTH=32 -class leaf_narrow leaf.v > leaf_narrow.rb'`
59
+ Then a file named "leaf_wide.rb" should exist
60
+ And a file named "leaf_narrow.rb" should exist
61
+ When I run `hdl_equal expect_wide.rb leaf_wide.rb`
62
+ Then the exit status should be 0
63
+ When I run `hdl_equal expect_narrow.rb leaf_narrow.rb`
64
+ Then the exit status should be 0
@@ -0,0 +1,60 @@
1
+ Feature: Check that module name and file name match
2
+ Scenario: Mismatched names
3
+ Given a file named "leaf.v" with:
4
+ """
5
+ module mod_a (
6
+ input in_a,
7
+ output out_a
8
+ );
9
+ mod_c mod_c (
10
+ .in ( in_a ),
11
+ .out ( out_a ),
12
+ );
13
+ endmodule
14
+
15
+ module mod_b (
16
+ input in_b,
17
+ output out_b
18
+ );
19
+ mod_c mod_c (
20
+ .in ( in_b ),
21
+ .out ( out_b ),
22
+ );
23
+ endmodule
24
+
25
+ module mod_c (
26
+ input in,
27
+ output out
28
+ );
29
+ assign out = in;
30
+ endmodule
31
+
32
+ """
33
+ And a file named "expect.rb" with:
34
+ """
35
+ class Mod_a < VerilogGen::HdlModule
36
+ set_proxy true
37
+ set_file_name "leaf.v"
38
+ set_module_name "mod_a"
39
+ add_port "in_a", direction: "input", type: "wire"
40
+ add_port "out_a", direction: "output", type: "wire"
41
+ end
42
+ class Mod_b < VerilogGen::HdlModule
43
+ set_proxy true
44
+ set_file_name "leaf.v"
45
+ set_module_name "mod_b"
46
+ add_port "in_b", direction: "input", type: "wire"
47
+ add_port "out_b", direction: "output", type: "wire"
48
+ end
49
+ class Mod_c < VerilogGen::HdlModule
50
+ set_proxy true
51
+ set_file_name "leaf.v"
52
+ set_module_name "mod_c"
53
+ add_port "in_c", direction: "input", type: "wire"
54
+ add_port "out_c", direction: "output", type: "wire"
55
+ end
56
+ """
57
+ When I run `csh -c '../../bin/vscan leaf.v > leaf.rb'`
58
+ Then a file named "leaf.rb" should exist
59
+ When I run `hdl_equal expect.rb leaf.rb`
60
+ Then the exit status should be 0
@@ -0,0 +1,24 @@
1
+ Feature: Check that module name and file name match
2
+
3
+ Scenario: Mismatched names
4
+ Given a file named "leaf.v" with:
5
+ """
6
+ module trunk(in, out);
7
+ input in;
8
+ output out;
9
+ endmodule
10
+ """
11
+ And a file named "expect.rb" with:
12
+ """
13
+ class Trunk < VerilogGen::HdlModule
14
+ set_proxy true
15
+ set_file_name "leaf.v"
16
+ set_module_name "trunk"
17
+ add_port "in", direction: "input", type: "wire"
18
+ add_port "out", direction: "output", type: "wire"
19
+ end
20
+ """
21
+ When I run `csh -c '../../bin/vscan leaf.v > leaf.rb'`
22
+ Then a file named "leaf.rb" should exist
23
+ When I run `hdl_equal expect.rb leaf.rb`
24
+ Then the exit status should be 0
@@ -0,0 +1,67 @@
1
+ Feature: convert a verilog 1364-2001 format to ruby.
2
+
3
+ Scenario: Port list contains inout types
4
+ Given a file named "leaf.v" with:
5
+ """
6
+ module leaf (
7
+ input reg i_reg,
8
+ input logic i_logic,
9
+ input bit i_bit,
10
+ input byte i_byte,
11
+ input shortint i_shortint,
12
+ input int i_int,
13
+ input longint i_longint,
14
+ input time i_time,
15
+ input realtime i_realtime,
16
+ input shortreal i_shortreal,
17
+ input real i_real,
18
+ input wand i_wand,
19
+ input wor i_wor,
20
+ input tri i_tri,
21
+ input triand i_triand,
22
+ input trior i_trior,
23
+ input tri0 i_tri0,
24
+ input tri1 i_tri1,
25
+ input supply0 i_supply0,
26
+ input supply1 i_supply1,
27
+ input trireg i_trireg,
28
+ input wire i_wire,
29
+ input i_implicit_wire
30
+ );
31
+ endmodule
32
+ """
33
+ And a file named "expect.rb" with:
34
+ """
35
+ class Leaf < VerilogGen::HdlModule
36
+ set_proxy true
37
+ set_file_name "leaf.v"
38
+ set_module_name "leaf"
39
+ add_port "i_reg", direction: "input", type: "reg"
40
+ add_port "i_logic", direction: "input", type: "logic"
41
+ add_port "i_bit", direction: "input", type: "bit"
42
+ add_port "i_byte", direction: "input", type: "byte"
43
+ add_port "i_shortint", direction: "input", type: "shortint"
44
+ add_port "i_int", direction: "input", type: "int"
45
+ add_port "i_longint", direction: "input", type: "longint"
46
+ add_port "i_time", direction: "input", type: "time"
47
+ add_port "i_realtime", direction: "input", type: "realtime"
48
+ add_port "i_shortreal", direction: "input", type: "shortreal"
49
+ add_port "i_real", direction: "input", type: "real"
50
+ add_port "i_wand", direction: "input", type: "wire"
51
+ add_port "i_wor", direction: "input", type: "wire"
52
+ add_port "i_tri", direction: "input", type: "wire"
53
+ add_port "i_triand", direction: "input", type: "wire"
54
+ add_port "i_trior", direction: "input", type: "wire"
55
+ add_port "i_tri0", direction: "input", type: "wire"
56
+ add_port "i_tri1", direction: "input", type: "wire"
57
+ add_port "i_supply0", direction: "input", type: "wire"
58
+ add_port "i_supply1", direction: "input", type: "wire"
59
+ add_port "i_trireg", direction: "input", type: "wire"
60
+ add_port "i_wire", direction: "input", type: "wire"
61
+ add_port "i_implicit_wire", direction: "input", type: "wire"
62
+ end
63
+ """
64
+ When I run `csh -c '../../bin/vscan leaf.v > leaf.rb'`
65
+ Then a file named "leaf.rb" should exist
66
+ When I run `hdl_equal expect.rb leaf.rb`
67
+ Then the exit status should be 0