rggen-c-header 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dbb6ddb7c867f003e9ba685413ac4d3deb5ae9978ef5e59cca1919de9c51378
4
- data.tar.gz: 34f5d2b0bec9eba0c63bec761ec8927214c118ddf70d3b9a4ae17ca6f9cd5c54
3
+ metadata.gz: f0a75e055ee75d542f00bca4cfddc48a8ed75ced985b5e316ab8e7f065770536
4
+ data.tar.gz: 6b09d1bc77717fb3f2147e33ed4932087d7333b428f878508da0bc47a258ccc7
5
5
  SHA512:
6
- metadata.gz: a862a0468553d95a8bd094ebf309f53d0745c23619109491b30b968d1bf0200df2bb5d014c632791e04bffc54db4d13ae9447496cbd5541ef44f8a8863475b02
7
- data.tar.gz: 7e97c33f3efe07cc93cfb3d09447393b2ddb121de7751cc07a1c1b44fa2d465ac24a20ca96f671544adcac708952050519c1b0a8c6611f1ddea854468b8cd771
6
+ metadata.gz: f2a81c0e88419f1d55671e4cf469ef966b751298d5a2e14c472f28f98b523353fc62cf3fed31d6cf75e6148441fddba98dcec336acb1ce0c2b0b374fce445575
7
+ data.tar.gz: 585d5453b7bf78d6ce6878be337c80a22805148a2439ddccbd984e53e3f5aa276b20570ad5143f1a668daed4007df4ee7fa2aac8ee91e11c7d734009921ea2d1
@@ -6,6 +6,7 @@ RgGen.define_simple_feature(:bit_field, :c_header) do
6
6
  define_macro("#{full_name}_bit_width", width)
7
7
  define_macro("#{full_name}_bit_mask", mask)
8
8
  define_offset_macro
9
+ define_label_macros
9
10
  end
10
11
 
11
12
  private
@@ -27,5 +28,13 @@ RgGen.define_simple_feature(:bit_field, :c_header) do
27
28
  define_macro("#{full_name}_bit_offset", bit_field.lsb)
28
29
  end
29
30
  end
31
+
32
+ def define_label_macros
33
+ bit_field.labels.each do |label|
34
+ name = "#{full_name}_#{label.name}"
35
+ value = hex(label.value, bit_field.width)
36
+ define_macro(name, value)
37
+ end
38
+ end
30
39
  end
31
40
  end
@@ -10,7 +10,7 @@ RgGen.define_simple_feature(:register, :c_header) do
10
10
  end
11
11
 
12
12
  export def declaration
13
- type = "uint#{register.width}_t"
13
+ type = "uint#{entry_width}_t"
14
14
  name = register.name
15
15
  size = !shared_address? && register.size || nil
16
16
  create_declaration(type, name, size)
@@ -23,7 +23,11 @@ RgGen.define_simple_feature(:register, :c_header) do
23
23
  end
24
24
 
25
25
  def byte_size
26
- register.byte_size(hierarchical: true)
26
+ register.total_byte_size(hierarchical: true)
27
+ end
28
+
29
+ def entry_width
30
+ register.entry_byte_size * 8
27
31
  end
28
32
 
29
33
  def array?
@@ -21,7 +21,7 @@ RgGen.define_simple_feature(:register_file, :c_header) do
21
21
  end
22
22
 
23
23
  def byte_size
24
- register_file.byte_size(false)
24
+ register_file.entry_byte_size
25
25
  end
26
26
  end
27
27
  end
@@ -28,9 +28,9 @@ module RgGen
28
28
  def define_struct_member(offset)
29
29
  entries = select_children_by_offset(offset)
30
30
  if entries.size >= 2
31
- [define_shared_union(offset, entries), entries.first.byte_size]
31
+ [define_shared_union(offset, entries), entries.first.total_byte_size]
32
32
  elsif entries.size == 1
33
- [entries.first.declaration, entries.first.byte_size]
33
+ [entries.first.declaration, entries.first.total_byte_size]
34
34
  else
35
35
  [reserved_member(offset), bus_byte_width]
36
36
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RgGen
4
4
  module CHeader
5
- VERSION = '0.3.0'
5
+ VERSION = '0.5.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rggen-c-header
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.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: 2023-01-02 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
11
+ date: 2023-12-28 00:00:00.000000000 Z
12
+ dependencies: []
27
13
  description: C header file writer plugin for RgGen
28
14
  email:
29
15
  - rggen@googlegroups.com
@@ -65,15 +51,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: 2.7.0
54
+ version: 3.0.0
69
55
  required_rubygems_version: !ruby/object:Gem::Requirement
70
56
  requirements:
71
57
  - - ">="
72
58
  - !ruby/object:Gem::Version
73
59
  version: '0'
74
60
  requirements: []
75
- rubygems_version: 3.4.1
61
+ rubygems_version: 3.5.3
76
62
  signing_key:
77
63
  specification_version: 4
78
- summary: rggen-c-header-0.3.0
64
+ summary: rggen-c-header-0.5.0
79
65
  test_files: []