rggen-default-register-map 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/LICENSE +21 -0
- data/README.md +45 -0
- data/lib/rggen/default_register_map.rb +46 -0
- data/lib/rggen/default_register_map/bit_field/bit_assignment.rb +122 -0
- data/lib/rggen/default_register_map/bit_field/comment.rb +18 -0
- data/lib/rggen/default_register_map/bit_field/initial_value.rb +75 -0
- data/lib/rggen/default_register_map/bit_field/name.rb +37 -0
- data/lib/rggen/default_register_map/bit_field/reference.rb +142 -0
- data/lib/rggen/default_register_map/bit_field/type.rb +117 -0
- data/lib/rggen/default_register_map/bit_field/type/rc.rb +9 -0
- data/lib/rggen/default_register_map/bit_field/type/reserved.rb +8 -0
- data/lib/rggen/default_register_map/bit_field/type/ro.rb +8 -0
- data/lib/rggen/default_register_map/bit_field/type/rof.rb +9 -0
- data/lib/rggen/default_register_map/bit_field/type/rs.rb +8 -0
- data/lib/rggen/default_register_map/bit_field/type/rw.rb +9 -0
- data/lib/rggen/default_register_map/bit_field/type/rwc.rb +9 -0
- data/lib/rggen/default_register_map/bit_field/type/rwe_rwl.rb +10 -0
- data/lib/rggen/default_register_map/bit_field/type/w0c_w1c.rb +9 -0
- data/lib/rggen/default_register_map/bit_field/type/w0s_w1s.rb +8 -0
- data/lib/rggen/default_register_map/bit_field/type/w0trg_w1trg.rb +8 -0
- data/lib/rggen/default_register_map/bit_field/type/wo.rb +9 -0
- data/lib/rggen/default_register_map/global/address_width.rb +34 -0
- data/lib/rggen/default_register_map/global/bus_width.rb +35 -0
- data/lib/rggen/default_register_map/register/name.rb +36 -0
- data/lib/rggen/default_register_map/register/offset_address.rb +106 -0
- data/lib/rggen/default_register_map/register/size.rb +95 -0
- data/lib/rggen/default_register_map/register/type.rb +135 -0
- data/lib/rggen/default_register_map/register/type/external.rb +16 -0
- data/lib/rggen/default_register_map/register/type/indirect.rb +256 -0
- data/lib/rggen/default_register_map/register_block/byte_size.rb +61 -0
- data/lib/rggen/default_register_map/register_block/name.rb +38 -0
- data/lib/rggen/default_register_map/setup.rb +18 -0
- data/lib/rggen/default_register_map/version.rb +7 -0
- metadata +95 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_simple_feature(:register_block, :byte_size) do
|
4
|
+
register_map do
|
5
|
+
property :byte_size
|
6
|
+
property :local_address_width
|
7
|
+
|
8
|
+
build do |value|
|
9
|
+
@byte_size =
|
10
|
+
begin
|
11
|
+
Integer(value)
|
12
|
+
rescue ArgumentError, TypeError
|
13
|
+
error "cannot convert #{value.inspect} into byte size"
|
14
|
+
end
|
15
|
+
@local_address_width = (@byte_size - 1).bit_length
|
16
|
+
end
|
17
|
+
|
18
|
+
verify(:feature) do
|
19
|
+
error_condition { !byte_size }
|
20
|
+
message { 'no byte size is given' }
|
21
|
+
end
|
22
|
+
|
23
|
+
verify(:feature) do
|
24
|
+
error_condition { !byte_size.positive? }
|
25
|
+
message do
|
26
|
+
"non positive value is not allowed for byte size: #{byte_size}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
verify(:feature) do
|
31
|
+
error_condition { byte_size > max_byte_size }
|
32
|
+
message do
|
33
|
+
'input byte size is greater than maximum byte size: ' \
|
34
|
+
"input byte size #{byte_size} maximum byte size #{max_byte_size}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
verify(:feature) do
|
39
|
+
error_condition { (byte_size % byte_width).positive? }
|
40
|
+
message do
|
41
|
+
"byte size is not aligned with bus width(#{bus_width}): #{byte_size}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
printable :byte_size
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def max_byte_size
|
50
|
+
2**configuration.address_width
|
51
|
+
end
|
52
|
+
|
53
|
+
def byte_width
|
54
|
+
configuration.byte_width
|
55
|
+
end
|
56
|
+
|
57
|
+
def bus_width
|
58
|
+
configuration.bus_width
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_simple_feature(:register_block, :name) do
|
4
|
+
register_map do
|
5
|
+
property :name
|
6
|
+
|
7
|
+
input_pattern variable_name
|
8
|
+
|
9
|
+
build do |value|
|
10
|
+
@name =
|
11
|
+
if pattern_matched?
|
12
|
+
match_data.to_s
|
13
|
+
else
|
14
|
+
error "illegal input value for register block name: #{value.inspect}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
verify(:feature) do
|
19
|
+
error_condition { !name }
|
20
|
+
message { 'no register block name is given' }
|
21
|
+
end
|
22
|
+
|
23
|
+
verify(:feature) do
|
24
|
+
error_condition { duplicated_name? }
|
25
|
+
message { "duplicated register block name: #{name}" }
|
26
|
+
end
|
27
|
+
|
28
|
+
printable :name
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def duplicated_name?
|
33
|
+
register_map
|
34
|
+
.register_blocks
|
35
|
+
.any? { |register_block| register_block.name == name }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rggen/default_register_map'
|
4
|
+
|
5
|
+
RgGen.setup :'defualt-register-map', RgGen::DefaultRegisterMap do |builder|
|
6
|
+
builder.enable :global, [:bus_width, :address_width]
|
7
|
+
builder.enable :register_block, [:name, :byte_size]
|
8
|
+
builder.enable :register, [:name, :offset_address, :size, :type]
|
9
|
+
builder.enable :register, :type, [:external, :indirect]
|
10
|
+
builder.enable :bit_field, [
|
11
|
+
:name, :bit_assignment, :type, :initial_value, :reference, :comment
|
12
|
+
]
|
13
|
+
builder.enable :bit_field, :type, [
|
14
|
+
:rc, :reserved, :ro, :rof, :rs,
|
15
|
+
:rw, :rwc, :rwe, :rwl, :w0c, :w0s, :w0trg,
|
16
|
+
:w1c, :w1s, :w1trg, :wo
|
17
|
+
]
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rggen-default-register-map
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.13.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Taichi Ishitani
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-08-28 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'
|
27
|
+
description: Default register map implementation for RgGen
|
28
|
+
email:
|
29
|
+
- rggen@googlegroups.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- CODE_OF_CONDUCT.md
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
37
|
+
- lib/rggen/default_register_map.rb
|
38
|
+
- lib/rggen/default_register_map/bit_field/bit_assignment.rb
|
39
|
+
- lib/rggen/default_register_map/bit_field/comment.rb
|
40
|
+
- lib/rggen/default_register_map/bit_field/initial_value.rb
|
41
|
+
- lib/rggen/default_register_map/bit_field/name.rb
|
42
|
+
- lib/rggen/default_register_map/bit_field/reference.rb
|
43
|
+
- lib/rggen/default_register_map/bit_field/type.rb
|
44
|
+
- lib/rggen/default_register_map/bit_field/type/rc.rb
|
45
|
+
- lib/rggen/default_register_map/bit_field/type/reserved.rb
|
46
|
+
- lib/rggen/default_register_map/bit_field/type/ro.rb
|
47
|
+
- lib/rggen/default_register_map/bit_field/type/rof.rb
|
48
|
+
- lib/rggen/default_register_map/bit_field/type/rs.rb
|
49
|
+
- lib/rggen/default_register_map/bit_field/type/rw.rb
|
50
|
+
- lib/rggen/default_register_map/bit_field/type/rwc.rb
|
51
|
+
- lib/rggen/default_register_map/bit_field/type/rwe_rwl.rb
|
52
|
+
- lib/rggen/default_register_map/bit_field/type/w0c_w1c.rb
|
53
|
+
- lib/rggen/default_register_map/bit_field/type/w0s_w1s.rb
|
54
|
+
- lib/rggen/default_register_map/bit_field/type/w0trg_w1trg.rb
|
55
|
+
- lib/rggen/default_register_map/bit_field/type/wo.rb
|
56
|
+
- lib/rggen/default_register_map/global/address_width.rb
|
57
|
+
- lib/rggen/default_register_map/global/bus_width.rb
|
58
|
+
- lib/rggen/default_register_map/register/name.rb
|
59
|
+
- lib/rggen/default_register_map/register/offset_address.rb
|
60
|
+
- lib/rggen/default_register_map/register/size.rb
|
61
|
+
- lib/rggen/default_register_map/register/type.rb
|
62
|
+
- lib/rggen/default_register_map/register/type/external.rb
|
63
|
+
- lib/rggen/default_register_map/register/type/indirect.rb
|
64
|
+
- lib/rggen/default_register_map/register_block/byte_size.rb
|
65
|
+
- lib/rggen/default_register_map/register_block/name.rb
|
66
|
+
- lib/rggen/default_register_map/setup.rb
|
67
|
+
- lib/rggen/default_register_map/version.rb
|
68
|
+
homepage: https://github.com/rggen/rggen-default-register-map
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata:
|
72
|
+
bug_tracker_uri: https://github.com/rggen/rggen-default-register-map/issues
|
73
|
+
mailing_list_uri: https://groups.google.com/d/forum/rggen
|
74
|
+
source_code_uri: https://github.com/rggen/rggen-default-register-map
|
75
|
+
wiki_uri: https://github.com/rggen/rggen/wiki
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '2.3'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubygems_version: 3.0.3
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: rggen-default-register-map-0.13.0
|
95
|
+
test_files: []
|