rggen 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -2
  3. data/lib/rggen.rb +0 -1
  4. data/lib/rggen/default.rb +7 -0
  5. data/lib/rggen/default_setup_file.rb +1 -2
  6. data/lib/rggen/version.rb +1 -3
  7. metadata +25 -81
  8. data/lib/rggen/built_in.rb +0 -57
  9. data/lib/rggen/built_in/bit_field/bit_assignment.rb +0 -114
  10. data/lib/rggen/built_in/bit_field/comment.rb +0 -18
  11. data/lib/rggen/built_in/bit_field/initial_value.rb +0 -75
  12. data/lib/rggen/built_in/bit_field/name.rb +0 -41
  13. data/lib/rggen/built_in/bit_field/reference.rb +0 -139
  14. data/lib/rggen/built_in/bit_field/sv_rtl_top.rb +0 -89
  15. data/lib/rggen/built_in/bit_field/type.rb +0 -245
  16. data/lib/rggen/built_in/bit_field/type/rc_w0c_w1c.erb +0 -15
  17. data/lib/rggen/built_in/bit_field/type/rc_w0c_w1c.rb +0 -59
  18. data/lib/rggen/built_in/bit_field/type/reserved.erb +0 -3
  19. data/lib/rggen/built_in/bit_field/type/reserved.rb +0 -16
  20. data/lib/rggen/built_in/bit_field/type/ro.erb +0 -6
  21. data/lib/rggen/built_in/bit_field/type/ro.rb +0 -31
  22. data/lib/rggen/built_in/bit_field/type/rof.erb +0 -6
  23. data/lib/rggen/built_in/bit_field/type/rof.rb +0 -17
  24. data/lib/rggen/built_in/bit_field/type/rs_w0s_w1s.erb +0 -13
  25. data/lib/rggen/built_in/bit_field/type/rs_w0s_w1s.rb +0 -46
  26. data/lib/rggen/built_in/bit_field/type/rw_wo.erb +0 -9
  27. data/lib/rggen/built_in/bit_field/type/rw_wo.rb +0 -30
  28. data/lib/rggen/built_in/bit_field/type/rwc_rwe_rwl.erb +0 -16
  29. data/lib/rggen/built_in/bit_field/type/rwc_rwe_rwl.rb +0 -92
  30. data/lib/rggen/built_in/bit_field/type/w0trg_w1trg.erb +0 -9
  31. data/lib/rggen/built_in/bit_field/type/w0trg_w1trg.rb +0 -29
  32. data/lib/rggen/built_in/global/address_width.rb +0 -34
  33. data/lib/rggen/built_in/global/array_port_format.rb +0 -19
  34. data/lib/rggen/built_in/global/bus_width.rb +0 -35
  35. data/lib/rggen/built_in/global/fold_sv_interface_port.rb +0 -24
  36. data/lib/rggen/built_in/register/markdown.erb +0 -11
  37. data/lib/rggen/built_in/register/markdown.rb +0 -26
  38. data/lib/rggen/built_in/register/name.rb +0 -36
  39. data/lib/rggen/built_in/register/offset_address.rb +0 -106
  40. data/lib/rggen/built_in/register/size.rb +0 -95
  41. data/lib/rggen/built_in/register/sv_rtl_top.rb +0 -82
  42. data/lib/rggen/built_in/register/type.rb +0 -344
  43. data/lib/rggen/built_in/register/type/default_sv_ral.erb +0 -8
  44. data/lib/rggen/built_in/register/type/default_sv_rtl.erb +0 -15
  45. data/lib/rggen/built_in/register/type/external.erb +0 -11
  46. data/lib/rggen/built_in/register/type/external.rb +0 -128
  47. data/lib/rggen/built_in/register/type/indirect.rb +0 -327
  48. data/lib/rggen/built_in/register/type/indirect_sv_ral.erb +0 -13
  49. data/lib/rggen/built_in/register/type/indirect_sv_rtl.erb +0 -17
  50. data/lib/rggen/built_in/register_block/byte_size.rb +0 -61
  51. data/lib/rggen/built_in/register_block/markdown.erb +0 -8
  52. data/lib/rggen/built_in/register_block/markdown.rb +0 -36
  53. data/lib/rggen/built_in/register_block/name.rb +0 -38
  54. data/lib/rggen/built_in/register_block/protocol.rb +0 -100
  55. data/lib/rggen/built_in/register_block/protocol/apb.erb +0 -10
  56. data/lib/rggen/built_in/register_block/protocol/apb.rb +0 -89
  57. data/lib/rggen/built_in/register_block/protocol/axi4lite.erb +0 -11
  58. data/lib/rggen/built_in/register_block/protocol/axi4lite.rb +0 -125
  59. data/lib/rggen/built_in/register_block/sv_ral_block_model.erb +0 -11
  60. data/lib/rggen/built_in/register_block/sv_ral_package.rb +0 -65
  61. data/lib/rggen/built_in/register_block/sv_rtl_macros.erb +0 -9
  62. data/lib/rggen/built_in/register_block/sv_rtl_top.rb +0 -86
  63. data/lib/rggen/built_in/version.rb +0 -7
  64. data/lib/rggen/setup/default.rb +0 -30
  65. data/sample/block_0.md +0 -155
  66. data/sample/block_0.rb +0 -90
  67. data/sample/block_0.sv +0 -678
  68. data/sample/block_0.xlsx +0 -0
  69. data/sample/block_0.yml +0 -99
  70. data/sample/block_0_ral_pkg.sv +0 -184
  71. data/sample/block_1.md +0 -39
  72. data/sample/block_1.rb +0 -22
  73. data/sample/block_1.sv +0 -136
  74. data/sample/block_1.xlsx +0 -0
  75. data/sample/block_1.yml +0 -26
  76. data/sample/block_1_ral_pkg.sv +0 -68
  77. data/sample/config.json +0 -5
  78. data/sample/config.yml +0 -3
@@ -1,11 +0,0 @@
1
- function new(string name);
2
- super.new(name);
3
- endfunction
4
- function void build();
5
- <% reg_model_constructors.each do |constructor| %>
6
- <%= constructor %>
7
- <% end %>
8
- endfunction
9
- function uvm_reg_map create_default_map();
10
- return create_map("default_map", 0, <%= byte_width %>, UVM_LITTLE_ENDIAN, 1);
11
- endfunction
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RgGen.define_simple_feature(:register_block, :sv_ral_package) do
4
- sv_ral do
5
- write_file '<%= package_name %>.sv' do |file|
6
- file.body do
7
- package_definition(package_name) do |package|
8
- package.package_imports packages
9
- package.include_files include_files
10
- package.body do |code|
11
- register_block.generate_code(:ral_package, :bottom_up, code)
12
- end
13
- end
14
- end
15
- end
16
-
17
- main_code :ral_package do
18
- class_definition(model_name) do |sv_class|
19
- sv_class.base 'rggen_ral_block'
20
- sv_class.parameters parameters
21
- sv_class.variables variables
22
- sv_class.body do
23
- process_template(File.join(__dir__, 'sv_ral_block_model.erb'))
24
- end
25
- end
26
- end
27
-
28
- private
29
-
30
- def package_name
31
- "#{register_block.name}_ral_pkg"
32
- end
33
-
34
- def packages
35
- [
36
- 'uvm_pkg', 'rggen_ral_pkg',
37
- *register_block.package_imports(:ral_package)
38
- ]
39
- end
40
-
41
- def include_files
42
- ['uvm_macros.svh', 'rggen_ral_macros.svh']
43
- end
44
-
45
- def model_name
46
- "#{register_block.name}_block_model"
47
- end
48
-
49
- def parameters
50
- register_block.declarations(:register_block, :parameter)
51
- end
52
-
53
- def variables
54
- register_block.declarations(:register_block, :variable)
55
- end
56
-
57
- def reg_model_constructors
58
- register_block.registers.flat_map(&:constructors)
59
- end
60
-
61
- def byte_width
62
- configuration.byte_width
63
- end
64
- end
65
- end
@@ -1,9 +0,0 @@
1
- `ifndef rggen_connect_bit_field_if
2
- `define rggen_connect_bit_field_if(RIF, FIF, LSB, WIDTH) \
3
- assign FIF.valid = RIF.valid; \
4
- assign FIF.read_mask = RIF.read_mask[LSB+:WIDTH]; \
5
- assign FIF.write_mask = RIF.write_mask[LSB+:WIDTH]; \
6
- assign FIF.write_data = RIF.write_data[LSB+:WIDTH]; \
7
- assign RIF.read_data[LSB+:WIDTH] = FIF.read_data; \
8
- assign RIF.value[LSB+:WIDTH] = FIF.value;
9
- `endif
@@ -1,86 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RgGen.define_simple_feature(:register_block, :sv_rtl_top) do
4
- sv_rtl do
5
- export :total_registers
6
-
7
- build do
8
- input :register_block, :clock, {
9
- name: 'i_clk', data_type: :logic, width: 1
10
- }
11
- input :register_block, :reset, {
12
- name: 'i_rst_n', data_type: :logic, width: 1
13
- }
14
- interface :register_block, :register_if, {
15
- name: 'register_if', interface_type: 'rggen_register_if',
16
- parameter_values: [address_width, bus_width, value_width],
17
- array_size: [total_registers],
18
- variables: ['value']
19
- }
20
- end
21
-
22
- write_file '<%= register_block.name %>.sv' do |file|
23
- file.body(&method(:body_code))
24
- end
25
-
26
- def total_registers
27
- register_block
28
- .registers
29
- .map(&:count)
30
- .inject(:+)
31
- end
32
-
33
- private
34
-
35
- def address_width
36
- register_block.local_address_width
37
- end
38
-
39
- def bus_width
40
- configuration.bus_width
41
- end
42
-
43
- def value_width
44
- register_block.registers.map(&:width).max
45
- end
46
-
47
- def body_code(code)
48
- macro_definition(code)
49
- sv_module_definition(code)
50
- end
51
-
52
- def macro_definition(code)
53
- code << process_template(File.join(__dir__, 'sv_rtl_macros.erb'))
54
- end
55
-
56
- def sv_module_definition(code)
57
- code << module_definition(register_block.name) do |sv_module|
58
- sv_module.package_imports packages
59
- sv_module.parameters parameters
60
- sv_module.ports ports
61
- sv_module.variables variables
62
- sv_module.body(&method(:sv_module_body))
63
- end
64
- end
65
-
66
- def packages
67
- ['rggen_rtl_pkg', *register_block.package_imports(:register_block)]
68
- end
69
-
70
- def parameters
71
- register_block.declarations(:register_block, :parameter)
72
- end
73
-
74
- def ports
75
- register_block.declarations(:register_block, :port)
76
- end
77
-
78
- def variables
79
- register_block.declarations(:register_block, :variable)
80
- end
81
-
82
- def sv_module_body(code)
83
- register_block.generate_code(:register_block, :top_down, code)
84
- end
85
- end
86
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RgGen
4
- module BuiltIn
5
- VERSION = '0.12.0'
6
- end
7
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rggen/built_in'
4
- require 'rggen/spreadsheet_loader'
5
-
6
- RgGen.enable :global, [
7
- :bus_width, :address_width, :array_port_format, :fold_sv_interface_port
8
- ]
9
-
10
- RgGen.enable :register_block, [:name, :byte_size]
11
- RgGen.enable :register, [:name, :offset_address, :size, :type]
12
- RgGen.enable :register, :type, [:external, :indirect]
13
- RgGen.enable :bit_field, [
14
- :name, :bit_assignment, :type, :initial_value, :reference, :comment
15
- ]
16
- RgGen.enable :bit_field, :type, [
17
- :rc, :reserved, :ro, :rof, :rs,
18
- :rw, :rwc, :rwe, :rwl, :w0c, :w1c, :w0s, :w1s,
19
- :w0trg, :w1trg, :wo
20
- ]
21
-
22
- RgGen.enable :register_block, [:sv_rtl_top, :protocol]
23
- RgGen.enable :register_block, :protocol, [:apb, :axi4lite]
24
- RgGen.enable :register, [:sv_rtl_top]
25
- RgGen.enable :bit_field, [:sv_rtl_top]
26
-
27
- RgGen.enable :register_block, [:sv_ral_package]
28
-
29
- RgGen.enable :register_block, [:markdown]
30
- RgGen.enable :register, [:markdown]
@@ -1,155 +0,0 @@
1
- ## block_0
2
-
3
- * name
4
- * block_0
5
- * byte_size
6
- * 256
7
-
8
- |name|offset_address|
9
- |:--|:--|
10
- |[register_0](#block_0-register_0)|0x00 - 0x03|
11
- |[register_1](#block_0-register_1)|0x04 - 0x07|
12
- |[register_2](#block_0-register_2)|0x04 - 0x07|
13
- |[register_3](#block_0-register_3)|0x08 - 0x0b|
14
- |[register_4](#block_0-register_4)|0x0c - 0x0f|
15
- |[register_5](#block_0-register_5)|0x10 - 0x13|
16
- |[register_6](#block_0-register_6)|0x20 - 0x3f|
17
- |[register_7](#block_0-register_7)|0x40 - 0x47|
18
- |[register_8](#block_0-register_8)|0x80 - 0xff|
19
-
20
- ### <div id="block_0-register_0"></div>register_0
21
-
22
- * name
23
- * register_0
24
- * offset_address
25
- * 0x00 - 0x03
26
- * array_size
27
- * NA
28
-
29
- |name|bit_assignments|type|initial_value|comment|
30
- |:--|:--|:--|:--|:--|
31
- |bit_field_0|[3:0]|rw|0x0||
32
- |bit_field_1|[7:4]|rw|0x0||
33
- |bit_field_2|[8]|rw|0x0||
34
-
35
- ### <div id="block_0-register_1"></div>register_1
36
-
37
- * name
38
- * register_1
39
- * offset_address
40
- * 0x04 - 0x07
41
- * array_size
42
- * NA
43
-
44
- |name|bit_assignments|type|initial_value|comment|
45
- |:--|:--|:--|:--|:--|
46
- |bit_field_0|[3:0]|ro|||
47
- |bit_field_1|[11:8]|ro|||
48
- |bit_field_2|[23:16]|rof|0xab||
49
- |bit_field_3|[31:24]|reserved|||
50
-
51
- ### <div id="block_0-register_2"></div>register_2
52
-
53
- * name
54
- * register_2
55
- * offset_address
56
- * 0x04 - 0x07
57
- * array_size
58
- * NA
59
-
60
- |name|bit_assignments|type|initial_value|comment|
61
- |:--|:--|:--|:--|:--|
62
- |bit_field_0|[3:0]|wo|0x0||
63
- |bit_field_1|[11:8]|w0trg|||
64
- |bit_field_2|[19:16]|w1trg|||
65
-
66
- ### <div id="block_0-register_3"></div>register_3
67
-
68
- * name
69
- * register_3
70
- * offset_address
71
- * 0x08 - 0x0b
72
- * array_size
73
- * NA
74
-
75
- |name|bit_assignments|type|initial_value|comment|
76
- |:--|:--|:--|:--|:--|
77
- |bit_field_0|[3:0]|rc|0x0||
78
- |bit_field_1|[11:8]|rc|0x0||
79
- |bit_field_2|[15:12]|ro|||
80
- |bit_field_3|[19:16]|rs|0x0||
81
-
82
- ### <div id="block_0-register_4"></div>register_4
83
-
84
- * name
85
- * register_4
86
- * offset_address
87
- * 0x0c - 0x0f
88
- * array_size
89
- * NA
90
-
91
- |name|bit_assignments|type|initial_value|comment|
92
- |:--|:--|:--|:--|:--|
93
- |bit_field_0|[3:0]|rwc|0x0||
94
- |bit_field_1|[7:4]|rwc|0x0||
95
- |bit_field_2|[11:8]|rwe|0x0||
96
- |bit_field_3|[15:12]|rwe|0x0||
97
- |bit_field_4|[19:16]|rwl|0x0||
98
- |bit_field_5|[23:20]|rwl|0x0||
99
-
100
- ### <div id="block_0-register_5"></div>register_5
101
-
102
- * name
103
- * register_5
104
- * offset_address
105
- * 0x10 - 0x13
106
- * array_size
107
- * NA
108
-
109
- |name|bit_assignments|type|initial_value|comment|
110
- |:--|:--|:--|:--|:--|
111
- |bit_field_0|[3:0]|w0c|0x0||
112
- |bit_field_1|[7:4]|w0c|0x0||
113
- |bit_field_2|[11:8]|ro|||
114
- |bit_field_3|[15:12]|w1c|0x0||
115
- |bit_field_4|[19:16]|w1c|0x0||
116
- |bit_field_5|[23:20]|ro|||
117
- |bit_field_6|[27:24]|w0s|0x0||
118
- |bit_field_7|[31:28]|w1s|0x0||
119
-
120
- ### <div id="block_0-register_6"></div>register_6
121
-
122
- * name
123
- * register_6
124
- * offset_address
125
- * 0x20 - 0x3f
126
- * array_size
127
- * [4]
128
-
129
- |name|bit_assignments|type|initial_value|comment|
130
- |:--|:--|:--|:--|:--|
131
- |bit_field_0|[7:0]<br>[23:16]<br>[39:32]<br>[55:48]|rw|0x00||
132
- |bit_field_1|[15:8]<br>[31:24]<br>[47:40]<br>[63:56]|rw|0x00||
133
-
134
- ### <div id="block_0-register_7"></div>register_7
135
-
136
- * name
137
- * register_7
138
- * offset_address
139
- * 0x40 - 0x47
140
- * array_size
141
- * [2, 4]
142
-
143
- |name|bit_assignments|type|initial_value|comment|
144
- |:--|:--|:--|:--|:--|
145
- |bit_field_0|[7:0]<br>[23:16]<br>[39:32]<br>[55:48]|rw|0x00||
146
- |bit_field_1|[15:8]<br>[31:24]<br>[47:40]<br>[63:56]|rw|0x00||
147
-
148
- ### <div id="block_0-register_8"></div>register_8
149
-
150
- * name
151
- * register_8
152
- * offset_address
153
- * 0x80 - 0xff
154
- * array_size
155
- * NA
@@ -1,90 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- register_block {
4
- name 'block_0'
5
- byte_size 256
6
-
7
- register {
8
- name 'register_0'
9
- offset_address 0x00
10
- bit_field { name 'bit_field_0'; bit_assignment lsb: 0 , width: 4; type :rw; initial_value 0 }
11
- bit_field { name 'bit_field_1'; bit_assignment lsb: 4 , width: 4; type :rw; initial_value 0 }
12
- bit_field { name 'bit_field_2'; bit_assignment lsb: 8 , width: 1; type :rw; initial_value 0 }
13
- }
14
-
15
- register {
16
- name 'register_1'
17
- offset_address 0x04
18
- bit_field { name 'bit_field_0'; bit_assignment lsb: 0 , width: 4; type :ro }
19
- bit_field { name 'bit_field_1'; bit_assignment lsb: 8 , width: 4; type :ro }
20
- bit_field { name 'bit_field_2'; bit_assignment lsb: 16, width: 8; type :rof; initial_value 0xab }
21
- bit_field { name 'bit_field_3'; bit_assignment lsb: 24, width: 8; type :reserved }
22
- }
23
-
24
- register {
25
- name 'register_2'
26
- offset_address 0x04
27
- bit_field { name 'bit_field_0'; bit_assignment lsb: 0 , width: 4; type :wo; initial_value 0 }
28
- bit_field { name 'bit_field_1'; bit_assignment lsb: 8 , width: 4; type :w0trg }
29
- bit_field { name 'bit_field_2'; bit_assignment lsb: 16, width: 4; type :w1trg }
30
- }
31
-
32
- register {
33
- name 'register_3'
34
- offset_address 0x08
35
- bit_field { name 'bit_field_0'; bit_assignment lsb: 0 , width: 4; type :rc; initial_value 0 }
36
- bit_field { name 'bit_field_1'; bit_assignment lsb: 8 , width: 4; type :rc; initial_value 0; reference 'register_0.bit_field_0' }
37
- bit_field { name 'bit_field_2'; bit_assignment lsb: 12, width: 4; type :ro; reference 'register_3.bit_field_1' }
38
- bit_field { name 'bit_field_3'; bit_assignment lsb: 16, width: 4; type :rs; initial_value 0 }
39
- }
40
-
41
- register {
42
- name 'register_4'
43
- offset_address 0x0C
44
- bit_field { name 'bit_field_0'; bit_assignment lsb: 0 , width: 4; type :rwc; initial_value 0 }
45
- bit_field { name 'bit_field_1'; bit_assignment lsb: 4 , width: 4; type :rwc; initial_value 0; reference 'register_2.bit_field_1' }
46
- bit_field { name 'bit_field_2'; bit_assignment lsb: 8 , width: 4; type :rwe; initial_value 0 }
47
- bit_field { name 'bit_field_3'; bit_assignment lsb: 12, width: 4; type :rwe; initial_value 0; reference 'register_0.bit_field_2' }
48
- bit_field { name 'bit_field_4'; bit_assignment lsb: 16, width: 4; type :rwl; initial_value 0 }
49
- bit_field { name 'bit_field_5'; bit_assignment lsb: 20, width: 4; type :rwl; initial_value 0; reference 'register_0.bit_field_2' }
50
- }
51
-
52
- register {
53
- name 'register_5'
54
- offset_address 0x10
55
- bit_field { name 'bit_field_0'; bit_assignment lsb: 0 , width: 4; type :w0c; initial_value 0 }
56
- bit_field { name 'bit_field_1'; bit_assignment lsb: 4 , width: 4; type :w0c; initial_value 0; reference 'register_0.bit_field_0' }
57
- bit_field { name 'bit_field_2'; bit_assignment lsb: 8 , width: 4; type :ro ; reference 'register_5.bit_field_1' }
58
- bit_field { name 'bit_field_3'; bit_assignment lsb: 12, width: 4; type :w1c; initial_value 0 }
59
- bit_field { name 'bit_field_4'; bit_assignment lsb: 16, width: 4; type :w1c; initial_value 0; reference 'register_0.bit_field_0' }
60
- bit_field { name 'bit_field_5'; bit_assignment lsb: 20, width: 4; type :ro ; reference 'register_5.bit_field_4' }
61
- bit_field { name 'bit_field_6'; bit_assignment lsb: 24, width: 4; type :w0s; initial_value 0 }
62
- bit_field { name 'bit_field_7'; bit_assignment lsb: 28, width: 4; type :w1s; initial_value 0 }
63
- }
64
-
65
- register {
66
- name 'register_6'
67
- offset_address 0x20
68
- size 4
69
- # bit assignments: [7:0] [23:16] [39:32] [55:48]
70
- bit_field { name 'bit_field_0'; bit_assignment lsb: 0, width: 8, sequence_size: 4, step: 16; type :rw; initial_value 0 }
71
- # bit assignments: [15:8] [31:24] [47:40] [63:56]
72
- bit_field { name 'bit_field_1'; bit_assignment lsb: 8, width: 8, sequence_size: 4, step: 16; type :rw; initial_value 0 }
73
- }
74
-
75
- register {
76
- name 'register_7'
77
- offset_address 0x40
78
- size [2, 4]
79
- type [:indirect, 'register_0.bit_field_0', 'register_0.bit_field_1', ['register_0.bit_field_2', 1]]
80
- bit_field { name 'bit_field_0'; bit_assignment lsb: 0, width: 8, sequence_size: 4, step: 16; type :rw; initial_value 0 }
81
- bit_field { name 'bit_field_1'; bit_assignment lsb: 8, width: 8, sequence_size: 4, step: 16; type :rw; initial_value 0 }
82
- }
83
-
84
- register {
85
- name 'register_8'
86
- offset_address 0x80
87
- size 32
88
- type :external
89
- }
90
- }