rggen-duh 0.2.0 → 0.3.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: d22b0dc17bcbcc805b0a645107a78aa4d80554f11112d0690e37cde1c4a6dcd7
4
- data.tar.gz: 8638fefb8ae9f698b836c431c959ad2e36dacba4a77a61dc6364976d00909853
3
+ metadata.gz: e46b2c450351b313867d6c21f413f15b07f8ccdfa956702a24ab5f428374e33f
4
+ data.tar.gz: 798646f78b08e3fe38408f0728450bce7841e8972da87dd7d994a3d9df4bd04a
5
5
  SHA512:
6
- metadata.gz: 14588567b6340bbf8bcc9ce223d320d171ecc13c20f9b85f18bca3054fca27a5e4ef1b9ecb166dd8d39b61abe933445e33936ff9b49ee05a9ae900b32d342865
7
- data.tar.gz: b98bdef9b548c0bfaf359f22e02c22c19e4e5c01792ecd8290def85392ba1a84ac14e3a8bd85ec167ce2fe3a3f21480a4bb58eeda41fc4478f6bc993c3a2e11e
6
+ metadata.gz: d22def9cb80e2595d4861c68cb5c788be3d27180d46dcae04726524d13443b8d5e46491d519cae0a991a7ca9581e12170bd190f80df0a02a17df2639ce207b4b
7
+ data.tar.gz: f076c8afcf40012c93710400d981cd5d628590b5d4a60b82a08ca52f0612790278f4157890dc8b82b302a4292b6a57c2bbfcc00496b36d46947d34a40ccdb017
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Taichi Ishitani
3
+ Copyright (c) 2020-2021 Taichi Ishitani
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -4,7 +4,6 @@
4
4
  [![codecov](https://codecov.io/gh/rggen/rggen-duh/branch/master/graph/badge.svg)](https://codecov.io/gh/rggen/rggen-duh)
5
5
  [![Gitter](https://badges.gitter.im/rggen/rggen.svg)](https://gitter.im/rggen/rggen?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
6
6
 
7
-
8
7
  # RgGen::DUH
9
8
 
10
9
  RgGen::DUH adds ability to load register map documents written in [DUH](https://github.com/sifive/duh) format.
@@ -83,7 +82,7 @@ Feedbacks, bug reports, questions and etc. are wellcome! You can post them by us
83
82
 
84
83
  ## Copyright & License
85
84
 
86
- Copyright © 2020 Taichi Ishitani. RgGen::DUH is licensed under the [MIT License](https://opensource.org/licenses/MIT), see [LICENSE](LICENSE) for futher details.
85
+ Copyright © 2020-2021 Taichi Ishitani. RgGen::DUH is licensed under the [MIT License](https://opensource.org/licenses/MIT), see [LICENSE](LICENSE) for futher details.
87
86
 
88
87
  ## Notice
89
88
 
@@ -92,4 +91,4 @@ See [lib/rggen/duh/duh-schema/README.md](lib/rggen/duh/duh-schema/README.md) for
92
91
 
93
92
  ## Code of Conduct
94
93
 
95
- Everyone interacting in the Rggen::Duh project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rggen/rggen-duh/blob/master/CODE_OF_CONDUCT.md).
94
+ Everyone interacting in the RgGen::Duh project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rggen/rggen-duh/blob/master/CODE_OF_CONDUCT.md).
@@ -11,25 +11,15 @@ require_relative 'duh/loader'
11
11
 
12
12
  module RgGen
13
13
  module DUH
14
- PLUGIN_NAME = :'rggen-duh'
14
+ extend Core::Plugin
15
15
 
16
- EXTRACTORS = [
17
- 'duh/extractor/bit_assignment',
18
- 'duh/extractor/simple_extractors',
19
- 'duh/extractor/type'
20
- ].freeze
21
-
22
- def self.register_loader(builder)
23
- builder.register_loader(:register_map, :duh, Loader)
24
- end
25
-
26
- def self.load_extractors
27
- EXTRACTORS.each { |file| require_relative(file) }
28
- end
29
-
30
- def self.default_setup(builder)
31
- register_loader(builder)
32
- load_extractors
16
+ setup_plugin :'rggen-duh' do |plugin|
17
+ plugin.register_loader :register_map, :duh, Loader
18
+ plugin.files [
19
+ 'duh/extractor/bit_assignment',
20
+ 'duh/extractor/simple_extractors',
21
+ 'duh/extractor/type'
22
+ ]
33
23
  end
34
24
  end
35
25
  end
@@ -3,9 +3,6 @@
3
3
  module RgGen
4
4
  module DUH
5
5
  class ParseError < RgGen::Core::LoadError
6
- def initialize(message, file_name, reason)
7
- super(message, file_name, reason)
8
- end
9
6
  end
10
7
 
11
8
  class ValidationError < RgGen::Core::LoadError
@@ -5,107 +5,109 @@ RgGen.define_value_extractor(:register_map, :duh, :bit_field, :type) do
5
5
 
6
6
  private
7
7
 
8
- TYPE_MAP = {
9
- rw: {
10
- access: 'read-write', modified_write_value: 'default',
11
- read_action: 'default', reserved: false
12
- },
13
- ro: {
14
- access: 'read-only', read_action: 'default', reserved: false
15
- },
16
- wo: {
17
- access: 'write-only', modified_write_value: 'default', reserved: false
18
- },
19
- wrc: {
20
- access: 'read-write', modified_write_value: 'default',
21
- read_action: 'clear', reserved: false
22
- },
23
- wrs: {
24
- access: 'read-write', modified_write_value: 'default',
25
- read_action: 'set', reserved: false
26
- },
27
- rc: {
28
- access: 'read-only', read_action: 'clear', reserved: false
29
- },
30
- w0c: {
31
- access: 'read-write', modified_write_value: 'zeroToClear',
32
- read_action: 'default', reserved: false
33
- },
34
- w1c: {
35
- access: 'read-write', modified_write_value: 'oneToClear',
36
- read_action: 'default', reserved: false
37
- },
38
- wc: {
39
- access: 'read-write', modified_write_value: 'clear',
40
- read_action: 'default', reserved: false
41
- },
42
- woc: {
43
- access: 'write-only', modified_write_value: 'clear', reserved: false
44
- },
45
- rs: {
46
- access: 'read-only', read_action: 'set', reserved: false
47
- },
48
- w0s: {
49
- access: 'read-write', modified_write_value: 'zeroToSet',
50
- read_action: 'default', reserved: false
51
- },
52
- w1s: {
53
- access: 'read-write', modified_write_value: 'oneToSet',
54
- read_action: 'default', reserved: false
55
- },
56
- ws: {
57
- access: 'read-write', modified_write_value: 'set',
58
- read_action: 'default', reserved: false
59
- },
60
- wos: {
61
- access: 'write-only', modified_write_value: 'set', reserved: false
62
- },
63
- w0t: {
64
- access: 'read-write', modified_write_value: 'zeroToToggle',
65
- read_action: 'default', reserved: false
66
- },
67
- w1t: {
68
- access: 'read-write', modified_write_value: 'oneToToggle',
69
- read_action: 'default', reserved: false
70
- },
71
- w0crs: {
72
- access: 'read-write', modified_write_value: 'zeroToClear',
73
- read_action: 'set', reserved: false
74
- },
75
- w1crs: {
76
- access: 'read-write', modified_write_value: 'oneToClear',
77
- read_action: 'set', reserved: false
78
- },
79
- wcrs: {
80
- access: 'read-write', modified_write_value: 'clear',
81
- read_action: 'set', reserved: false
82
- },
83
- w0src: {
84
- access: 'read-write', modified_write_value: 'zeroToSet',
85
- read_action: 'clear', reserved: false
86
- },
87
- w1src: {
88
- access: 'read-write', modified_write_value: 'oneToSet',
89
- read_action: 'clear', reserved: false
90
- },
91
- wsrc: {
92
- access: 'read-write', modified_write_value: 'set',
93
- read_action: 'clear', reserved: false
94
- },
95
- w1: {
96
- access: 'read-writeOnce', modified_write_value: 'default',
97
- read_action: 'default', reserved: false
98
- },
99
- wo1: {
100
- access: 'writeOnce', modified_write_value: 'default', reserved: false
101
- },
102
- reserved: {
103
- reserved: true
104
- }
105
- }.freeze
106
-
107
8
  def find_type(duh)
108
- TYPE_MAP.find { |_, properties| match_properties?(duh, properties) }&.first
9
+ type_map.find { |_, properties| match_properties?(duh, properties) }&.first
10
+ end
11
+
12
+ def type_map
13
+ @type_map ||= {
14
+ rw: {
15
+ access: 'read-write', modified_write_value: 'default',
16
+ read_action: 'default', reserved: false
17
+ },
18
+ ro: {
19
+ access: 'read-only', read_action: 'default', reserved: false
20
+ },
21
+ wo: {
22
+ access: 'write-only', modified_write_value: 'default', reserved: false
23
+ },
24
+ wrc: {
25
+ access: 'read-write', modified_write_value: 'default',
26
+ read_action: 'clear', reserved: false
27
+ },
28
+ wrs: {
29
+ access: 'read-write', modified_write_value: 'default',
30
+ read_action: 'set', reserved: false
31
+ },
32
+ rc: {
33
+ access: 'read-only', read_action: 'clear', reserved: false
34
+ },
35
+ w0c: {
36
+ access: 'read-write', modified_write_value: 'zeroToClear',
37
+ read_action: 'default', reserved: false
38
+ },
39
+ w1c: {
40
+ access: 'read-write', modified_write_value: 'oneToClear',
41
+ read_action: 'default', reserved: false
42
+ },
43
+ wc: {
44
+ access: 'read-write', modified_write_value: 'clear',
45
+ read_action: 'default', reserved: false
46
+ },
47
+ woc: {
48
+ access: 'write-only', modified_write_value: 'clear', reserved: false
49
+ },
50
+ rs: {
51
+ access: 'read-only', read_action: 'set', reserved: false
52
+ },
53
+ w0s: {
54
+ access: 'read-write', modified_write_value: 'zeroToSet',
55
+ read_action: 'default', reserved: false
56
+ },
57
+ w1s: {
58
+ access: 'read-write', modified_write_value: 'oneToSet',
59
+ read_action: 'default', reserved: false
60
+ },
61
+ ws: {
62
+ access: 'read-write', modified_write_value: 'set',
63
+ read_action: 'default', reserved: false
64
+ },
65
+ wos: {
66
+ access: 'write-only', modified_write_value: 'set', reserved: false
67
+ },
68
+ w0t: {
69
+ access: 'read-write', modified_write_value: 'zeroToToggle',
70
+ read_action: 'default', reserved: false
71
+ },
72
+ w1t: {
73
+ access: 'read-write', modified_write_value: 'oneToToggle',
74
+ read_action: 'default', reserved: false
75
+ },
76
+ w0crs: {
77
+ access: 'read-write', modified_write_value: 'zeroToClear',
78
+ read_action: 'set', reserved: false
79
+ },
80
+ w1crs: {
81
+ access: 'read-write', modified_write_value: 'oneToClear',
82
+ read_action: 'set', reserved: false
83
+ },
84
+ wcrs: {
85
+ access: 'read-write', modified_write_value: 'clear',
86
+ read_action: 'set', reserved: false
87
+ },
88
+ w0src: {
89
+ access: 'read-write', modified_write_value: 'zeroToSet',
90
+ read_action: 'clear', reserved: false
91
+ },
92
+ w1src: {
93
+ access: 'read-write', modified_write_value: 'oneToSet',
94
+ read_action: 'clear', reserved: false
95
+ },
96
+ wsrc: {
97
+ access: 'read-write', modified_write_value: 'set',
98
+ read_action: 'clear', reserved: false
99
+ },
100
+ w1: {
101
+ access: 'read-writeOnce', modified_write_value: 'default',
102
+ read_action: 'default', reserved: false
103
+ },
104
+ wo1: {
105
+ access: 'writeOnce', modified_write_value: 'default', reserved: false
106
+ },
107
+ reserved: {
108
+ reserved: true
109
+ }
110
+ }.freeze
109
111
  end
110
112
 
111
113
  def match_properties?(duh, properties)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rggen/duh'
4
- RgGen.setup RgGen::DUH
4
+ RgGen.register_plugin RgGen::DUH
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RgGen
4
4
  module DUH
5
- VERSION = '0.2.0'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rggen-duh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.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: 2020-08-25 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_refs
@@ -111,8 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
- rubygems_version: 3.1.2
114
+ rubygems_version: 3.2.3
115
115
  signing_key:
116
116
  specification_version: 4
117
- summary: rggen-dut-0.2.0
117
+ summary: rggen-dut-0.3.0
118
118
  test_files: []