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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 465d7d46de470aa8c5e35b6edb64d887b24c508ad8bcfd4b330da00c69aacef3
4
- data.tar.gz: 0bcf8d36d15285a08a854de69b4807aa69edccc67b70351f29e0ff68474d1ea1
3
+ metadata.gz: 1d7d3f47df5783ad1f2671fcdf202591a2e002a39da7cf15a342281cebfae865
4
+ data.tar.gz: b3f47d55468996118bc2d9af949eeb0a690f32c19d5d8998950f3ad781bb4454
5
5
  SHA512:
6
- metadata.gz: 7f49bd6b328af1b484fc37f11fa614492889a826a32c94970853232aebfec52f3fbc8531ec1e03ea8b77169a18b870ef5c28a13b3de5627c6d45c03c4121fb0b
7
- data.tar.gz: 685fe218240b22443c2b48d9b5a656dd40868baf26c9954f491ca860a820db883e3bbcff1d74c8f0d4b11420bfd09a5fbdb1c46fa99abbf3821df2c62a1570ae
6
+ metadata.gz: 4d995db860c4f4d521ff75803bef3601a57b0b08a1eb47875193e05e4441f16ebcbddcc9258f968b8a8325106cca441b64580d173b811837f2897ed79688396d
7
+ data.tar.gz: 623ba730bad1ac76a8a037c79e968bd230ebd5bd1080644cba657a3c0814680ed113a359e5875cb14945eb3c9e46f593517a4040ad9293654653316c997bf686
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/rggen.svg)](https://badge.fury.io/rb/rggen)
2
- [![Build Status](https://travis-ci.org/rggen/rggen.svg?branch=master)](https://travis-ci.org/rggen/rggen)
2
+ [![Build Status](https://travis-ci.com/rggen/rggen.svg?branch=master)](https://travis-ci.com/rggen/rggen)
3
3
  [![Maintainability](https://api.codeclimate.com/v1/badges/5ee2248300ec0517e597/maintainability)](https://codeclimate.com/github/rggen/rggen/maintainability)
4
4
  [![codecov](https://codecov.io/gh/rggen/rggen/branch/master/graph/badge.svg)](https://codecov.io/gh/rggen/rggen)
5
5
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=rggen_rggen&metric=alert_status)](https://sonarcloud.io/dashboard?id=rggen_rggen)
@@ -32,7 +32,15 @@ RgGen is written in the [Ruby](https://www.ruby-lang.org/en/about/) programing l
32
32
 
33
33
  ### Installatin Command
34
34
 
35
- RgGen depends on [RgGen::Core](https://github.com/rggen/rggen-core), [RgGen::SystemVerilog](https://github.com/rggen/rggen-systemverilog), [RgGen::SpreadsheetLoader](https://github.com/rggen/rggen-spreadsheet-loader) and other Ruby libraries. To install RgGen and dependencies, use the command below:
35
+ RgGen depends on following sub components and other Ruby libraries.
36
+
37
+ * [rggen-core](https://github.com/rggen/rggen-core)
38
+ * [rggen-default-register-map](https://github.com/rggen/rggen-default-register-map)
39
+ * [rggen-systemverilog](https://github.com/rggen/rggen-systemverilog)
40
+ * [rggen-markdown](https://github.com/rggen/rggen-markdown)
41
+ * [rggen-spreadsheet-loader](https://github.com/rggen/rggen-spreadsheet-loader)
42
+
43
+ To install RgGen and the dependencies, use the command below:
36
44
 
37
45
  ```
38
46
  $ gem install rggen
@@ -72,9 +80,12 @@ Feedbacks, bug reports, questions and etc. are wellcome! You can post them by us
72
80
  ## See Also
73
81
 
74
82
  * https://github.com/rggen/rggen-core
83
+ * https://github.com/rggen/rggen-default-register-map
75
84
  * https://github.com/rggen/rggen-systemverilog
85
+ * https://github.com/rggen/rggen-markdown
76
86
  * https://github.com/rggen/rggen-spreadsheet-loader
77
87
 
88
+
78
89
  ## Copyright & License
79
90
 
80
91
  Copyright © 2019 Taichi Ishitani. RgGen is licensed unther the [MIT License](https://opensource.org/licenses/MIT), see [LICENSE](LICENSE) for futher detils.
@@ -2,4 +2,3 @@
2
2
 
3
3
  require_relative 'rggen/version'
4
4
  require_relative 'rggen/default_setup_file'
5
- require_relative 'rggen/built_in'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rggen/default_register_map/setup'
4
+ require 'rggen/systemverilog/rtl/setup'
5
+ require 'rggen/systemverilog/ral/setup'
6
+ require 'rggen/markdown/setup'
7
+ require 'rggen/spreadsheet_loader/setup'
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RgGen
4
- DEFAULT_SETUP_FILE =
5
- File.expand_path('setup/default.rb', __dir__).freeze
4
+ DEFAULT_SETUP_FILE = File.join(__dir__, 'default.rb').freeze
6
5
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'built_in/version'
4
-
5
3
  module RgGen
6
- VERSION = BuiltIn::VERSION
4
+ VERSION = '0.13.0'
7
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rggen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taichi Ishitani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-19 00:00:00.000000000 Z
11
+ date: 2019-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rggen-core
@@ -16,56 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.12'
19
+ version: '0.13'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.12'
26
+ version: '0.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rggen-default-register-map
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.13'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.13'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rggen-markdown
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '0.12'
47
+ version: '0.13'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '0.12'
54
+ version: '0.13'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rggen-spreadsheet-loader
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0.10'
61
+ version: '0.13'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0.10'
68
+ version: '0.13'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rggen-systemverilog
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0.11'
75
+ version: '0.13'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0.11'
82
+ version: '0.13'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -94,79 +108,9 @@ files:
94
108
  - LICENSE
95
109
  - README.md
96
110
  - lib/rggen.rb
97
- - lib/rggen/built_in.rb
98
- - lib/rggen/built_in/bit_field/bit_assignment.rb
99
- - lib/rggen/built_in/bit_field/comment.rb
100
- - lib/rggen/built_in/bit_field/initial_value.rb
101
- - lib/rggen/built_in/bit_field/name.rb
102
- - lib/rggen/built_in/bit_field/reference.rb
103
- - lib/rggen/built_in/bit_field/sv_rtl_top.rb
104
- - lib/rggen/built_in/bit_field/type.rb
105
- - lib/rggen/built_in/bit_field/type/rc_w0c_w1c.erb
106
- - lib/rggen/built_in/bit_field/type/rc_w0c_w1c.rb
107
- - lib/rggen/built_in/bit_field/type/reserved.erb
108
- - lib/rggen/built_in/bit_field/type/reserved.rb
109
- - lib/rggen/built_in/bit_field/type/ro.erb
110
- - lib/rggen/built_in/bit_field/type/ro.rb
111
- - lib/rggen/built_in/bit_field/type/rof.erb
112
- - lib/rggen/built_in/bit_field/type/rof.rb
113
- - lib/rggen/built_in/bit_field/type/rs_w0s_w1s.erb
114
- - lib/rggen/built_in/bit_field/type/rs_w0s_w1s.rb
115
- - lib/rggen/built_in/bit_field/type/rw_wo.erb
116
- - lib/rggen/built_in/bit_field/type/rw_wo.rb
117
- - lib/rggen/built_in/bit_field/type/rwc_rwe_rwl.erb
118
- - lib/rggen/built_in/bit_field/type/rwc_rwe_rwl.rb
119
- - lib/rggen/built_in/bit_field/type/w0trg_w1trg.erb
120
- - lib/rggen/built_in/bit_field/type/w0trg_w1trg.rb
121
- - lib/rggen/built_in/global/address_width.rb
122
- - lib/rggen/built_in/global/array_port_format.rb
123
- - lib/rggen/built_in/global/bus_width.rb
124
- - lib/rggen/built_in/global/fold_sv_interface_port.rb
125
- - lib/rggen/built_in/register/markdown.erb
126
- - lib/rggen/built_in/register/markdown.rb
127
- - lib/rggen/built_in/register/name.rb
128
- - lib/rggen/built_in/register/offset_address.rb
129
- - lib/rggen/built_in/register/size.rb
130
- - lib/rggen/built_in/register/sv_rtl_top.rb
131
- - lib/rggen/built_in/register/type.rb
132
- - lib/rggen/built_in/register/type/default_sv_ral.erb
133
- - lib/rggen/built_in/register/type/default_sv_rtl.erb
134
- - lib/rggen/built_in/register/type/external.erb
135
- - lib/rggen/built_in/register/type/external.rb
136
- - lib/rggen/built_in/register/type/indirect.rb
137
- - lib/rggen/built_in/register/type/indirect_sv_ral.erb
138
- - lib/rggen/built_in/register/type/indirect_sv_rtl.erb
139
- - lib/rggen/built_in/register_block/byte_size.rb
140
- - lib/rggen/built_in/register_block/markdown.erb
141
- - lib/rggen/built_in/register_block/markdown.rb
142
- - lib/rggen/built_in/register_block/name.rb
143
- - lib/rggen/built_in/register_block/protocol.rb
144
- - lib/rggen/built_in/register_block/protocol/apb.erb
145
- - lib/rggen/built_in/register_block/protocol/apb.rb
146
- - lib/rggen/built_in/register_block/protocol/axi4lite.erb
147
- - lib/rggen/built_in/register_block/protocol/axi4lite.rb
148
- - lib/rggen/built_in/register_block/sv_ral_block_model.erb
149
- - lib/rggen/built_in/register_block/sv_ral_package.rb
150
- - lib/rggen/built_in/register_block/sv_rtl_macros.erb
151
- - lib/rggen/built_in/register_block/sv_rtl_top.rb
152
- - lib/rggen/built_in/version.rb
111
+ - lib/rggen/default.rb
153
112
  - lib/rggen/default_setup_file.rb
154
- - lib/rggen/setup/default.rb
155
113
  - lib/rggen/version.rb
156
- - sample/block_0.md
157
- - sample/block_0.rb
158
- - sample/block_0.sv
159
- - sample/block_0.xlsx
160
- - sample/block_0.yml
161
- - sample/block_0_ral_pkg.sv
162
- - sample/block_1.md
163
- - sample/block_1.rb
164
- - sample/block_1.sv
165
- - sample/block_1.xlsx
166
- - sample/block_1.yml
167
- - sample/block_1_ral_pkg.sv
168
- - sample/config.json
169
- - sample/config.yml
170
114
  homepage: https://github.com/rggen/rggen
171
115
  licenses:
172
116
  - MIT
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rggen/systemverilog'
4
- require 'rggen/markdown'
5
- require_relative 'built_in/version'
6
-
7
- module RgGen
8
- module BuiltIn
9
- BUILT_IN_FILES = [
10
- 'built_in/global/address_width',
11
- 'built_in/global/array_port_format',
12
- 'built_in/global/bus_width',
13
- 'built_in/global/fold_sv_interface_port',
14
- 'built_in/register_block/byte_size',
15
- 'built_in/register_block/markdown',
16
- 'built_in/register_block/name',
17
- 'built_in/register_block/protocol',
18
- 'built_in/register_block/protocol/apb',
19
- 'built_in/register_block/protocol/axi4lite',
20
- 'built_in/register_block/sv_ral_package',
21
- 'built_in/register_block/sv_rtl_top',
22
- 'built_in/register/markdown',
23
- 'built_in/register/name',
24
- 'built_in/register/offset_address',
25
- 'built_in/register/size',
26
- 'built_in/register/sv_rtl_top',
27
- 'built_in/register/type',
28
- 'built_in/register/type/external',
29
- 'built_in/register/type/indirect',
30
- 'built_in/bit_field/bit_assignment',
31
- 'built_in/bit_field/comment',
32
- 'built_in/bit_field/initial_value',
33
- 'built_in/bit_field/name',
34
- 'built_in/bit_field/reference',
35
- 'built_in/bit_field/sv_rtl_top',
36
- 'built_in/bit_field/type',
37
- 'built_in/bit_field/type/rc_w0c_w1c',
38
- 'built_in/bit_field/type/reserved',
39
- 'built_in/bit_field/type/ro',
40
- 'built_in/bit_field/type/rof',
41
- 'built_in/bit_field/type/rs_w0s_w1s',
42
- 'built_in/bit_field/type/rw_wo',
43
- 'built_in/bit_field/type/rwc_rwe_rwl',
44
- 'built_in/bit_field/type/w0trg_w1trg'
45
- ].freeze
46
-
47
- def self.load_built_in
48
- BUILT_IN_FILES.each { |file| require_relative file }
49
- end
50
-
51
- def self.setup(_builder)
52
- load_built_in
53
- end
54
- end
55
-
56
- setup :'built-in', BuiltIn
57
- end
@@ -1,114 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RgGen.define_simple_feature(:bit_field, :bit_assignment) do
4
- register_map do
5
- property :lsb, body: ->(index = 0) { msb_lsb_bit(index, @lsb) }
6
- property :msb, body: ->(index = 0) { msb_lsb_bit(index, @lsb + width - 1) }
7
- property :width, body: -> { @width || 1 }
8
- property :sequence_size
9
- property :step, body: -> { @step || width }
10
- property :sequential?, body: -> { !@sequence_size.nil? }
11
- property :bit_map, body: -> { @bit_map ||= calc_bit_map }
12
-
13
- input_pattern /#{integer}(?::#{integer}){0,3}/,
14
- match_automatically: false
15
-
16
- build do |value|
17
- input_value = preprocess(value)
18
- @lsb, @width, @sequence_size, @step =
19
- KEYS.map { |key| parse_value(input_value, key) }
20
- end
21
-
22
- verify(:feature) do
23
- error_condition { [@lsb, @width, @sequence_size, @step].none? }
24
- message { 'no bit assignment is given' }
25
- end
26
-
27
- verify(:feature) do
28
- error_condition { !@lsb }
29
- message { 'no lsb is given' }
30
- end
31
-
32
- verify(:feature) do
33
- error_condition { lsb.negative? }
34
- message { "lsb is less than 0: #{lsb}" }
35
- end
36
-
37
- verify(:feature) do
38
- error_condition { width < 1 }
39
- message { "width is less than 1: #{width}" }
40
- end
41
-
42
- verify(:feature) do
43
- error_condition { sequential? && sequence_size < 1 }
44
- message { "sequence size is less than 1: #{sequence_size}" }
45
- end
46
-
47
- verify(:feature) do
48
- error_condition { sequential? && step < 1 }
49
- message { "step is less than 1: #{step}" }
50
- end
51
-
52
- verify(:feature) do
53
- error_condition { overlap? }
54
- message { 'overlap with existing bit field(s)' }
55
- end
56
-
57
- printable(:bit_assignments) do
58
- Array.new(@sequence_size || 1) do |i|
59
- width > 1 && "[#{msb(i)}:#{lsb(i)}]" || "[#{lsb(i)}]"
60
- end
61
- end
62
-
63
- private
64
-
65
- KEYS = [:lsb, :width, :sequence_size, :step].freeze
66
-
67
- def preprocess(value)
68
- if value.is_a?(Hash)
69
- value
70
- elsif match_pattern(value)
71
- split_match_data(match_data)
72
- else
73
- error "illegal input value for bit assignment: #{value.inspect}"
74
- end
75
- end
76
-
77
- def split_match_data(match_data)
78
- match_data
79
- .to_s
80
- .split(':')
81
- .map.with_index { |value, i| [KEYS[i], value] }
82
- .to_h
83
- end
84
-
85
- def parse_value(input_value, key)
86
- (input_value.key?(key) && Integer(input_value[key])) || nil
87
- rescue ArgumentError, TypeError
88
- error "cannot convert #{input_value[key].inspect} into " \
89
- "bit assignment(#{key.to_s.tr('_', ' ')})"
90
- end
91
-
92
- def msb_lsb_bit(index, base)
93
- calc_bit_position((sequential? && index) || 0, base)
94
- end
95
-
96
- def calc_bit_position(index, base)
97
- if index.is_a?(Integer)
98
- base + step * index
99
- else
100
- "#{base}+#{step}*#{index}"
101
- end
102
- end
103
-
104
- def calc_bit_map
105
- Array.new(sequence_size || 1) { |i| (2**width - 1) << lsb(i) }.inject(:|)
106
- end
107
-
108
- def overlap?
109
- register
110
- .bit_fields
111
- .any? { |bit_field| (bit_field.bit_map & bit_map).positive? }
112
- end
113
- end
114
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RgGen.define_simple_feature(:bit_field, :comment) do
4
- register_map do
5
- property :comment, body: -> { @comment ||= '' }
6
-
7
- build do |value|
8
- @comment =
9
- if value.is_a?(Array)
10
- value.join("\n")
11
- else
12
- value.to_s
13
- end
14
- end
15
-
16
- printable :comment
17
- end
18
- end