rggen-systemverilog 0.33.1 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +1 -1
  4. data/lib/rggen/systemverilog/common/feature.rb +5 -5
  5. data/lib/rggen/systemverilog/common/utility/data_object.rb +1 -1
  6. data/lib/rggen/systemverilog/common/utility/structure_definition.rb +2 -2
  7. data/lib/rggen/systemverilog/common/utility.rb +2 -2
  8. data/lib/rggen/systemverilog/ral/bit_field/type.rb +5 -5
  9. data/lib/rggen/systemverilog/ral/feature.rb +4 -6
  10. data/lib/rggen/systemverilog/ral/register_block/sv_ral_model.rb +1 -1
  11. data/lib/rggen/systemverilog/ral/register_file/sv_ral_model.rb +1 -1
  12. data/lib/rggen/systemverilog/ral.rb +5 -0
  13. data/lib/rggen/systemverilog/register_map/keyword_checker.rb +62 -0
  14. data/lib/rggen/systemverilog/register_map/name.rb +9 -0
  15. data/lib/rggen/systemverilog/rtl/bit_field/type/custom.rb +13 -13
  16. data/lib/rggen/systemverilog/rtl/bit_field/type/rc_w0c_w1c_wc_woc.rb +6 -6
  17. data/lib/rggen/systemverilog/rtl/bit_field/type/ro_rotrg.rb +3 -3
  18. data/lib/rggen/systemverilog/rtl/bit_field/type/rohw.rb +5 -5
  19. data/lib/rggen/systemverilog/rtl/bit_field/type/row0trg_row1trg.rb +4 -4
  20. data/lib/rggen/systemverilog/rtl/bit_field/type/rowo_rowotrg.rb +6 -6
  21. data/lib/rggen/systemverilog/rtl/bit_field/type/rs_w0s_w1s_ws_wos.rb +4 -4
  22. data/lib/rggen/systemverilog/rtl/bit_field/type/rw_rwtrg_w1.rb +4 -4
  23. data/lib/rggen/systemverilog/rtl/bit_field/type/rwc.rb +3 -3
  24. data/lib/rggen/systemverilog/rtl/bit_field/type/rwe_rwl.rb +3 -3
  25. data/lib/rggen/systemverilog/rtl/bit_field/type/rwhw.rb +5 -5
  26. data/lib/rggen/systemverilog/rtl/bit_field/type/rws.rb +3 -3
  27. data/lib/rggen/systemverilog/rtl/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc.rb +2 -2
  28. data/lib/rggen/systemverilog/rtl/bit_field/type/w0t_w1t.rb +2 -2
  29. data/lib/rggen/systemverilog/rtl/bit_field/type/w0trg_w1trg.rb +2 -2
  30. data/lib/rggen/systemverilog/rtl/bit_field/type/wo_wo1_wotrg.rb +3 -3
  31. data/lib/rggen/systemverilog/rtl/bit_field/type/wrc_wrs.rb +2 -2
  32. data/lib/rggen/systemverilog/rtl/feature.rb +11 -15
  33. data/lib/rggen/systemverilog/rtl/register/type/external.rb +1 -1
  34. data/lib/rggen/systemverilog/rtl/register_block/protocol/apb.rb +11 -5
  35. data/lib/rggen/systemverilog/rtl/register_block/protocol/axi4lite.rb +6 -3
  36. data/lib/rggen/systemverilog/rtl/register_block/protocol/native.erb +18 -0
  37. data/lib/rggen/systemverilog/rtl/register_block/protocol/native.rb +16 -0
  38. data/lib/rggen/systemverilog/rtl/register_block/protocol/wishbone.rb +7 -4
  39. data/lib/rggen/systemverilog/rtl/register_block/protocol.rb +45 -26
  40. data/lib/rggen/systemverilog/rtl/register_block/sv_rtl_top.rb +1 -1
  41. data/lib/rggen/systemverilog/rtl/register_type.rb +1 -1
  42. data/lib/rggen/systemverilog/rtl.rb +6 -0
  43. data/lib/rggen/systemverilog/rtl_package/feature.rb +3 -3
  44. data/lib/rggen/systemverilog/rtl_package/register/sv_rtl_package.rb +2 -2
  45. data/lib/rggen/systemverilog/version.rb +1 -1
  46. metadata +9 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3d95e17a462a9401886ea4a6923921ad4ba9aa698c2bd9133f7b513110c120b
4
- data.tar.gz: 4d80681f90d4cb38ca782821fe9820fa6e9c4cbcc3b723c63a1ec75d87c2d35d
3
+ metadata.gz: 8cc342768f025e2052c86e0933fcf41ad2e61089992b0513fd36d05937745aea
4
+ data.tar.gz: 3f9528a85fe70ec52d5e4237cdff2f498a4712082a5939a0caa379884f3f48e7
5
5
  SHA512:
6
- metadata.gz: 38bf92bf7e6f0d27cb99ed6a6d2e3753f3bf60ff199fc876e8f99875bbdbf0da665b5f2c0dae40c44510acee6555487c56a1381ac3264f00ce6ae4f2731e34a4
7
- data.tar.gz: d7f396a29d716c6f854bbeb2fb5c331eb67ffb85143f764b9e62a3c8f89c388367a56ef54c6a31311129229859f37452b5bee51457a76db4272360898f744ff7
6
+ metadata.gz: 917f2b1026e1cd5bc124827ac04a2389b6466b92af6197022ba8b376c8eae568b1cb6fb55f605a3480430c6714d83ab3465f180f9b67dfce91ab8657d8f9ecb0
7
+ data.tar.gz: 96cac8545993b73e14290d3bb950dd62912c514d9ff907e5f9315aa774644e7d1a833406b88c8462fedc69eb66f7d0d5008badca0f7086500047b5172c6d3a5f
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019-2024 Taichi Ishitani
3
+ Copyright (c) 2019-2025 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
@@ -34,7 +34,7 @@ Feedbacks, bug reports, questions and etc. are wellcome! You can post them by us
34
34
 
35
35
  ## Copyright & License
36
36
 
37
- Copyright © 2019-2024 Taichi Ishitani. RgGen::SystemVerilog is licensed under the [MIT License](https://opensource.org/licenses/MIT), see [LICENSE](LICENSE) for futher details.
37
+ Copyright © 2019-2025 Taichi Ishitani. RgGen::SystemVerilog is licensed under the [MIT License](https://opensource.org/licenses/MIT), see [LICENSE](LICENSE) for futher details.
38
38
 
39
39
  ## Code of Conduct
40
40
 
@@ -38,9 +38,9 @@ module RgGen
38
38
  @package_imports = Hash.new { |h, k| h[k] = [] }
39
39
  end
40
40
 
41
- def define_entity(context, name, args, &block)
41
+ def define_entity(context, name, args, &)
42
42
  layer, attributes = parse_entity_arguments(args)
43
- entity = create_entity(context, name, attributes, &block)
43
+ entity = create_entity(context, name, attributes, &)
44
44
  add_entity(context, entity, name, layer)
45
45
  end
46
46
 
@@ -56,9 +56,9 @@ module RgGen
56
56
  end
57
57
  end
58
58
 
59
- def create_entity(context, name, attributes, &block)
60
- merged_attributes = { name: name }.merge(Hash(attributes))
61
- __send__(context.method_name, context.entity_type, merged_attributes, &block)
59
+ def create_entity(context, name, attributes, &)
60
+ merged_attributes = { name: }.merge(Hash(attributes))
61
+ __send__(context.method_name, context.entity_type, merged_attributes, &)
62
62
  end
63
63
 
64
64
  def add_entity(context, entity, name, layer)
@@ -86,7 +86,7 @@ module RgGen
86
86
  end
87
87
 
88
88
  def serialized_array_size
89
- size = [(width || 1), *array_size]
89
+ size = [width || 1, *array_size]
90
90
  if size.all? { |s| s.is_a?(Integer) }
91
91
  [size.inject(&:*)]
92
92
  else
@@ -7,9 +7,9 @@ module RgGen
7
7
  class StructureDefinition < Core::Utility::CodeUtility::StructureDefinition
8
8
  include Core::Utility::AttributeSetter
9
9
 
10
- def initialize(default_attributes = {}, &block)
10
+ def initialize(default_attributes = {}, &)
11
11
  apply_attributes(**default_attributes)
12
- super(&block)
12
+ super(&)
13
13
  end
14
14
 
15
15
  private
@@ -92,7 +92,7 @@ module RgGen
92
92
  end
93
93
 
94
94
  def argument(name, attribute = {})
95
- DataObject.new(:argument, attribute.merge(name: name)).declaration
95
+ DataObject.new(:argument, attribute.merge(name:)).declaration
96
96
  end
97
97
 
98
98
  {
@@ -103,7 +103,7 @@ module RgGen
103
103
  package_definition: PackageDefinition
104
104
  }.each do |method_name, definition|
105
105
  define_method(method_name) do |name, attributes = {}, &block|
106
- definition.new(attributes.merge(name: name), &block).to_code
106
+ definition.new(attributes.merge(name:), &block).to_code
107
107
  end
108
108
  end
109
109
  end
@@ -4,12 +4,12 @@ RgGen.define_list_feature(:bit_field, :type) do
4
4
  sv_ral do
5
5
  base_feature do
6
6
  define_helpers do
7
- def access(access_type = nil, &block)
8
- attribute_accessor('@access', access_type, &block)
7
+ def access(access_type = nil, &)
8
+ attribute_accessor('@access', access_type, &)
9
9
  end
10
10
 
11
- def model_name(name = nil, &block)
12
- attribute_accessor('@model_name', name, &block)
11
+ def model_name(name = nil, &)
12
+ attribute_accessor('@model_name', name, &)
13
13
  end
14
14
 
15
15
  private
@@ -28,7 +28,7 @@ RgGen.define_list_feature(:bit_field, :type) do
28
28
  build do
29
29
  variable :ral_model, {
30
30
  name: bit_field.name, data_type: model_name,
31
- array_size: array_size, random: true
31
+ array_size:, random: true
32
32
  }
33
33
  end
34
34
 
@@ -6,14 +6,12 @@ module RgGen
6
6
  class Feature < Common::Feature
7
7
  private
8
8
 
9
- def create_variable(_, attributes, &block)
10
- DataObject.new(
11
- :variable, attributes.merge(array_format: :unpacked), &block
12
- )
9
+ def create_variable(_, attributes, &)
10
+ DataObject.new(:variable, attributes.merge(array_format: :unpacked), &)
13
11
  end
14
12
 
15
- def create_parameter(_, attributes, &block)
16
- DataObject.new(:parameter, attributes, &block)
13
+ def create_parameter(_, attributes, &)
14
+ DataObject.new(:parameter, attributes, &)
17
15
  end
18
16
 
19
17
  define_entity :variable, :create_variable, :variable, -> { component.parent }
@@ -26,7 +26,7 @@ RgGen.define_simple_feature(:register_block, :sv_ral_model) do
26
26
  end
27
27
 
28
28
  def byte_width
29
- configuration.byte_width
29
+ register_block.byte_width
30
30
  end
31
31
 
32
32
  def child_model_constructors
@@ -47,7 +47,7 @@ RgGen.define_simple_feature(:register_file, :sv_ral_model) do
47
47
  end
48
48
 
49
49
  def byte_width
50
- configuration.byte_width
50
+ register_block.byte_width
51
51
  end
52
52
 
53
53
  def child_model_constructors
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'common'
4
+ require_relative 'register_map/keyword_checker'
4
5
  require_relative 'ral/feature'
5
6
  require_relative 'ral/register_common'
6
7
 
@@ -30,4 +31,8 @@ RgGen.setup_plugin :'rggen-sv-ral' do |plugin|
30
31
  'ral/bit_field/type/rwc_rwhw_rws',
31
32
  'ral/bit_field/type/rwe_rwl'
32
33
  ]
34
+
35
+ plugin.files [
36
+ 'register_map/name'
37
+ ]
33
38
  end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RgGen
4
+ module SystemVerilog
5
+ module RegisterMap
6
+ module KeywordChecker
7
+ SYSTEMVERILOG_KEYWORDS = [
8
+ 'accept_on', 'alias', 'always', 'always_comb', 'always_ff', 'always_latch',
9
+ 'and', 'assert', 'assign', 'assume', 'automatic', 'before', 'begin', 'bind',
10
+ 'bins', 'binsof', 'bit', 'break', 'buf', 'bufif0', 'bufif1', 'byte', 'case',
11
+ 'casex', 'casez', 'cell', 'chandle', 'checker', 'class', 'clocking', 'cmos',
12
+ 'config', 'const', 'constraint', 'context', 'continue', 'cover', 'covergroup',
13
+ 'coverpoint', 'cross', 'deassign', 'default', 'defparam', 'design', 'disable',
14
+ 'dist', 'do', 'edge', 'else', 'end', 'endcase', 'endchecker', 'endclass',
15
+ 'endclocking', 'endconfig', 'endfunction', 'endgenerate', 'endgroup',
16
+ 'endinterface', 'endmodule', 'endpackage', 'endprimitive', 'endprogram',
17
+ 'endproperty', 'endspecify', 'endsequence', 'endtable', 'endtask', 'enum',
18
+ 'event', 'eventually', 'expect', 'export', 'extends', 'extern', 'final',
19
+ 'first_match', 'for', 'force', 'foreach', 'forever', 'fork', 'forkjoin',
20
+ 'function', 'generate', 'genvar', 'global', 'highz0', 'highz1', 'if', 'iff',
21
+ 'ifnone', 'ignore_bins', 'illegal_bins', 'implements', 'implies', 'import',
22
+ 'incdir', 'include', 'initial', 'inout', 'input', 'inside', 'instance', 'int',
23
+ 'integer', 'interconnect', 'interface', 'intersect', 'join', 'join_any',
24
+ 'join_none', 'large', 'let', 'liblist', 'library', 'local', 'localparam',
25
+ 'logic', 'longint', 'macromodule', 'matches', 'medium', 'modport', 'module',
26
+ 'nand', 'negedge', 'nettype', 'new', 'nexttime', 'nmos', 'nor',
27
+ 'noshowcancelled', 'not', 'notif0', 'notif1', 'null', 'or', 'output', 'package',
28
+ 'packed', 'parameter', 'pmos', 'posedge', 'primitive', 'priority', 'program',
29
+ 'property', 'protected', 'pull0', 'pull1', 'pulldown', 'pullup',
30
+ 'pulsestyle_ondetect', 'pulsestyle_onevent', 'pure', 'rand', 'randc',
31
+ 'randcase', 'randsequence', 'rcmos', 'real', 'realtime', 'ref', 'reg',
32
+ 'reject_on', 'release', 'repeat', 'restrict', 'return', 'rnmos', 'rpmos',
33
+ 'rtran', 'rtranif0', 'rtranif1', 's_always', 's_eventually', 's_nexttime',
34
+ 's_until', 's_until_with', 'scalared', 'sequence', 'shortint', 'shortreal',
35
+ 'showcancelled', 'signed', 'small', 'soft', 'solve', 'specify', 'specparam',
36
+ 'static', 'string', 'strong', 'strong0', 'strong1', 'struct', 'super',
37
+ 'supply0', 'supply1', 'sync_accept_on', 'sync_reject_on', 'table', 'tagged',
38
+ 'task', 'this', 'throughout', 'time', 'timeprecision', 'timeunit', 'tran',
39
+ 'tranif0', 'tranif1', 'tri', 'tri0', 'tri1', 'triand', 'trior', 'trireg',
40
+ 'type', 'typedef', 'union', 'unique', 'unique0', 'unsigned', 'until',
41
+ 'until_with', 'untyped', 'use', 'uwire', 'var', 'vectored', 'virtual',
42
+ 'void', 'wait', 'wait_order', 'wand', 'weak', 'weak0', 'weak1', 'while',
43
+ 'wildcard', 'wire', 'with', 'within', 'wor', 'xnor', 'xor'
44
+ ].freeze
45
+
46
+ def self.included(klass)
47
+ klass.class_eval do
48
+ verify(:feature, prepend: true) do
49
+ error_condition do
50
+ @name && SYSTEMVERILOG_KEYWORDS.include?(@name)
51
+ end
52
+ message do
53
+ layer_name = component.layer.to_s.sub('_', ' ')
54
+ "systemverilog keyword is not allowed for #{layer_name} name: #{@name}"
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ [:register_block, :register_file, :register, :bit_field].each do |layer|
4
+ RgGen.modify_simple_feature(layer, :name) do
5
+ register_map do
6
+ include RgGen::SystemVerilog::RegisterMap::KeywordChecker
7
+ end
8
+ end
9
+ end
@@ -5,47 +5,47 @@ RgGen.define_list_item_feature(:bit_field, :type, :custom) do
5
5
  build do
6
6
  if external_read_data?
7
7
  input :value_in, {
8
- name: "i_#{full_name}", width: width,
9
- array_size: array_size, array_format: array_port_format
8
+ name: "i_#{full_name}", width:,
9
+ array_size:, array_format: array_port_format
10
10
  }
11
11
  else
12
12
  output :value_out, {
13
- name: "o_#{full_name}", width: width,
14
- array_size: array_size, array_format: array_port_format
13
+ name: "o_#{full_name}", width:,
14
+ array_size:, array_format: array_port_format
15
15
  }
16
16
  end
17
17
  if bit_field.hw_write?
18
18
  input :hw_write_enable, {
19
19
  name: "i_#{full_name}_hw_write_enable", width: 1,
20
- array_size: array_size, array_format: array_port_format
20
+ array_size:, array_format: array_port_format
21
21
  }
22
22
  input :hw_write_data, {
23
- name: "i_#{full_name}_hw_write_data", width: width,
24
- array_size: array_size, array_format: array_port_format
23
+ name: "i_#{full_name}_hw_write_data", width:,
24
+ array_size:, array_format: array_port_format
25
25
  }
26
26
  end
27
27
  if bit_field.hw_set?
28
28
  input :hw_set, {
29
- name: "i_#{full_name}_hw_set", width: width,
30
- array_size: array_size, array_format: array_port_format
29
+ name: "i_#{full_name}_hw_set", width:,
30
+ array_size:, array_format: array_port_format
31
31
  }
32
32
  end
33
33
  if bit_field.hw_clear?
34
34
  input :hw_clear, {
35
- name: "i_#{full_name}_hw_clear", width: width,
36
- array_size: array_size, array_format: array_port_format
35
+ name: "i_#{full_name}_hw_clear", width:,
36
+ array_size:, array_format: array_port_format
37
37
  }
38
38
  end
39
39
  if bit_field.write_trigger?
40
40
  output :write_trigger, {
41
41
  name: "o_#{full_name}_write_trigger", width: 1,
42
- array_size: array_size, array_format: array_port_format
42
+ array_size:, array_format: array_port_format
43
43
  }
44
44
  end
45
45
  if bit_field.read_trigger?
46
46
  output :read_trigger, {
47
47
  name: "o_#{full_name}_read_trigger", width: 1,
48
- array_size: array_size, array_format: array_port_format
48
+ array_size:, array_format: array_port_format
49
49
  }
50
50
  end
51
51
  end
@@ -4,17 +4,17 @@ RgGen.define_list_item_feature(:bit_field, :type, [:rc, :w0c, :w1c, :wc, :woc])
4
4
  sv_rtl do
5
5
  build do
6
6
  input :set, {
7
- name: "i_#{full_name}_set", width: width,
8
- array_size: array_size, array_format: array_port_format
7
+ name: "i_#{full_name}_set", width:,
8
+ array_size:, array_format: array_port_format
9
9
  }
10
10
  output :value_out, {
11
- name: "o_#{full_name}", width: width,
12
- array_size: array_size, array_format: array_port_format
11
+ name: "o_#{full_name}", width:,
12
+ array_size:, array_format: array_port_format
13
13
  }
14
14
  if bit_field.reference?
15
15
  output :value_unmasked, {
16
- name: "o_#{full_name}_unmasked", width: width,
17
- array_size: array_size, array_format: array_port_format
16
+ name: "o_#{full_name}_unmasked", width:,
17
+ array_size:, array_format: array_port_format
18
18
  }
19
19
  end
20
20
  end
@@ -5,14 +5,14 @@ RgGen.define_list_item_feature(:bit_field, :type, [:ro, :rotrg]) do
5
5
  build do
6
6
  unless bit_field.reference?
7
7
  input :value_in, {
8
- name: "i_#{full_name}", width: width,
9
- array_size: array_size, array_format: array_port_format
8
+ name: "i_#{full_name}", width:,
9
+ array_size:, array_format: array_port_format
10
10
  }
11
11
  end
12
12
  if rotrg?
13
13
  output :read_trigger, {
14
14
  name: "o_#{full_name}_read_trigger", width: 1,
15
- array_size: array_size, array_format: array_port_format
15
+ array_size:, array_format: array_port_format
16
16
  }
17
17
  end
18
18
  end
@@ -6,16 +6,16 @@ RgGen.define_list_item_feature(:bit_field, :type, :rohw) do
6
6
  unless bit_field.reference?
7
7
  input :valid, {
8
8
  name: "i_#{full_name}_valid", width: 1,
9
- array_size: array_size, array_format: array_port_format
9
+ array_size:, array_format: array_port_format
10
10
  }
11
11
  end
12
12
  input :value_in, {
13
- name: "i_#{full_name}", width: width,
14
- array_size: array_size, array_format: array_port_format
13
+ name: "i_#{full_name}", width:,
14
+ array_size:, array_format: array_port_format
15
15
  }
16
16
  output :value_out, {
17
- name: "o_#{full_name}", width: width,
18
- array_size: array_size, array_format: array_port_format
17
+ name: "o_#{full_name}", width:,
18
+ array_size:, array_format: array_port_format
19
19
  }
20
20
  end
21
21
 
@@ -5,13 +5,13 @@ RgGen.define_list_item_feature(:bit_field, :type, [:row0trg, :row1trg]) do
5
5
  build do
6
6
  unless bit_field.reference?
7
7
  input :value_in, {
8
- name: "i_#{full_name}", width: width,
9
- array_size: array_size, array_format: array_port_format
8
+ name: "i_#{full_name}", width:,
9
+ array_size:, array_format: array_port_format
10
10
  }
11
11
  end
12
12
  output :trigger, {
13
- name: "o_#{full_name}_trigger", width: width,
14
- array_size: array_size, array_format: array_port_format
13
+ name: "o_#{full_name}_trigger", width:,
14
+ array_size:, array_format: array_port_format
15
15
  }
16
16
  end
17
17
 
@@ -4,23 +4,23 @@ RgGen.define_list_item_feature(:bit_field, :type, [:rowo, :rowotrg]) do
4
4
  sv_rtl do
5
5
  build do
6
6
  output :value_out, {
7
- name: "o_#{full_name}", width: width,
8
- array_size: array_size, array_format: array_port_format
7
+ name: "o_#{full_name}", width:,
8
+ array_size:, array_format: array_port_format
9
9
  }
10
10
  unless bit_field.reference?
11
11
  input :value_in, {
12
- name: "i_#{full_name}", width: width,
13
- array_size: array_size, array_format: array_port_format
12
+ name: "i_#{full_name}", width:,
13
+ array_size:, array_format: array_port_format
14
14
  }
15
15
  end
16
16
  if rowotrg?
17
17
  output :write_trigger, {
18
18
  name: "o_#{full_name}_write_trigger", width: 1,
19
- array_size: array_size, array_format: array_port_format
19
+ array_size:, array_format: array_port_format
20
20
  }
21
21
  output :read_trigger, {
22
22
  name: "o_#{full_name}_read_trigger", width: 1,
23
- array_size: array_size, array_format: array_port_format
23
+ array_size:, array_format: array_port_format
24
24
  }
25
25
  end
26
26
  end
@@ -4,12 +4,12 @@ RgGen.define_list_item_feature(:bit_field, :type, [:rs, :w0s, :w1s, :ws, :wos])
4
4
  sv_rtl do
5
5
  build do
6
6
  input :clear, {
7
- name: "i_#{full_name}_clear", width: width,
8
- array_size: array_size, array_format: array_port_format
7
+ name: "i_#{full_name}_clear", width:,
8
+ array_size:, array_format: array_port_format
9
9
  }
10
10
  output :value_out, {
11
- name: "o_#{full_name}", width: width,
12
- array_size: array_size, array_format: array_port_format
11
+ name: "o_#{full_name}", width:,
12
+ array_size:, array_format: array_port_format
13
13
  }
14
14
  end
15
15
 
@@ -4,17 +4,17 @@ RgGen.define_list_item_feature(:bit_field, :type, [:rw, :rwtrg, :w1]) do
4
4
  sv_rtl do
5
5
  build do
6
6
  output :value_out, {
7
- name: "o_#{full_name}", width: width,
8
- array_size: array_size, array_format: array_port_format
7
+ name: "o_#{full_name}", width:,
8
+ array_size:, array_format: array_port_format
9
9
  }
10
10
  if rwtrg?
11
11
  output :write_trigger, {
12
12
  name: "o_#{full_name}_write_trigger", width: 1,
13
- array_size: array_size, array_format: array_port_format
13
+ array_size:, array_format: array_port_format
14
14
  }
15
15
  output :read_trigger, {
16
16
  name: "o_#{full_name}_read_trigger", width: 1,
17
- array_size: array_size, array_format: array_port_format
17
+ array_size:, array_format: array_port_format
18
18
  }
19
19
  end
20
20
  end
@@ -6,12 +6,12 @@ RgGen.define_list_item_feature(:bit_field, :type, :rwc) do
6
6
  unless bit_field.reference?
7
7
  input :clear, {
8
8
  name: "i_#{full_name}_clear", width: 1,
9
- array_size: array_size, array_format: array_port_format
9
+ array_size:, array_format: array_port_format
10
10
  }
11
11
  end
12
12
  output :value_out, {
13
- name: "o_#{full_name}", width: width,
14
- array_size: array_size, array_format: array_port_format
13
+ name: "o_#{full_name}", width:,
14
+ array_size:, array_format: array_port_format
15
15
  }
16
16
  end
17
17
 
@@ -6,12 +6,12 @@ RgGen.define_list_item_feature(:bit_field, :type, [:rwe, :rwl]) do
6
6
  unless bit_field.reference?
7
7
  input :control, {
8
8
  name: "i_#{full_name}_#{enable_or_lock}", width: 1,
9
- array_size: array_size, array_format: array_port_format
9
+ array_size:, array_format: array_port_format
10
10
  }
11
11
  end
12
12
  output :value_out, {
13
- name: "o_#{full_name}", width: width,
14
- array_size: array_size, array_format: array_port_format
13
+ name: "o_#{full_name}", width:,
14
+ array_size:, array_format: array_port_format
15
15
  }
16
16
  end
17
17
 
@@ -6,16 +6,16 @@ RgGen.define_list_item_feature(:bit_field, :type, :rwhw) do
6
6
  unless bit_field.reference?
7
7
  input :valid, {
8
8
  name: "i_#{full_name}_valid", width: 1,
9
- array_size: array_size, array_format: array_port_format
9
+ array_size:, array_format: array_port_format
10
10
  }
11
11
  end
12
12
  input :value_in, {
13
- name: "i_#{full_name}", width: width,
14
- array_size: array_size, array_format: array_port_format
13
+ name: "i_#{full_name}", width:,
14
+ array_size:, array_format: array_port_format
15
15
  }
16
16
  output :value_out, {
17
- name: "o_#{full_name}", width: width,
18
- array_size: array_size, array_format: array_port_format
17
+ name: "o_#{full_name}", width:,
18
+ array_size:, array_format: array_port_format
19
19
  }
20
20
  end
21
21
 
@@ -6,12 +6,12 @@ RgGen.define_list_item_feature(:bit_field, :type, :rws) do
6
6
  unless bit_field.reference?
7
7
  input :set, {
8
8
  name: "i_#{full_name}_set", width: 1,
9
- array_size: array_size, array_format: array_port_format
9
+ array_size:, array_format: array_port_format
10
10
  }
11
11
  end
12
12
  output :value_out, {
13
- name: "o_#{full_name}", width: width,
14
- array_size: array_size, array_format: array_port_format
13
+ name: "o_#{full_name}", width:,
14
+ array_size:, array_format: array_port_format
15
15
  }
16
16
  end
17
17
 
@@ -6,8 +6,8 @@ RgGen.define_list_item_feature(
6
6
  sv_rtl do
7
7
  build do
8
8
  output :value_out, {
9
- name: "o_#{full_name}", width: width,
10
- array_size: array_size, array_format: array_port_format
9
+ name: "o_#{full_name}", width:,
10
+ array_size:, array_format: array_port_format
11
11
  }
12
12
  end
13
13
 
@@ -4,8 +4,8 @@ RgGen.define_list_item_feature(:bit_field, :type, [:w0t, :w1t]) do
4
4
  sv_rtl do
5
5
  build do
6
6
  output :value_out, {
7
- name: "o_#{full_name}", width: width,
8
- array_size: array_size, array_format: array_port_format
7
+ name: "o_#{full_name}", width:,
8
+ array_size:, array_format: array_port_format
9
9
  }
10
10
  end
11
11
 
@@ -4,8 +4,8 @@ RgGen.define_list_item_feature(:bit_field, :type, [:w0trg, :w1trg]) do
4
4
  sv_rtl do
5
5
  build do
6
6
  output :trigger, {
7
- name: "o_#{full_name}_trigger", width: width,
8
- array_size: array_size, array_format: array_port_format
7
+ name: "o_#{full_name}_trigger", width:,
8
+ array_size:, array_format: array_port_format
9
9
  }
10
10
  end
11
11
 
@@ -4,13 +4,13 @@ RgGen.define_list_item_feature(:bit_field, :type, [:wo, :wo1, :wotrg]) do
4
4
  sv_rtl do
5
5
  build do
6
6
  output :value_out, {
7
- name: "o_#{full_name}", width: width,
8
- array_size: array_size, array_format: array_port_format
7
+ name: "o_#{full_name}", width:,
8
+ array_size:, array_format: array_port_format
9
9
  }
10
10
  if wotrg?
11
11
  output :write_trigger, {
12
12
  name: "o_#{full_name}_write_trigger", width: 1,
13
- array_size: array_size, array_format: array_port_format
13
+ array_size:, array_format: array_port_format
14
14
  }
15
15
  end
16
16
  end
@@ -4,8 +4,8 @@ RgGen.define_list_item_feature(:bit_field, :type, [:wrc, :wrs]) do
4
4
  sv_rtl do
5
5
  build do
6
6
  output :value_out, {
7
- name: "o_#{full_name}", width: width,
8
- array_size: array_size, array_format: array_port_format
7
+ name: "o_#{full_name}", width:,
8
+ array_size:, array_format: array_port_format
9
9
  }
10
10
  end
11
11
 
@@ -6,32 +6,28 @@ module RgGen
6
6
  class Feature < Common::Feature
7
7
  private
8
8
 
9
- def create_variable(data_type, attributes, &block)
10
- DataObject.new(
11
- :variable, attributes.merge(data_type: data_type), &block
12
- )
9
+ def create_variable(data_type, attributes, &)
10
+ DataObject.new(:variable, attributes.merge(data_type:), &)
13
11
  end
14
12
 
15
- def create_if_instance(_, attributes, &block)
16
- InterfaceInstance.new(attributes, &block)
13
+ def create_if_instance(_, attributes, &)
14
+ InterfaceInstance.new(attributes, &)
17
15
  end
18
16
 
19
- def create_port(direction, attributes, &block)
17
+ def create_port(direction, attributes, &)
20
18
  attributes =
21
19
  { data_type: 'logic' }
22
20
  .merge(attributes)
23
- .merge(direction: direction)
24
- DataObject.new(:argument, attributes, &block)
21
+ .merge(direction:)
22
+ DataObject.new(:argument, attributes, &)
25
23
  end
26
24
 
27
- def create_if_port(_, attributes, &block)
28
- InterfacePort.new(attributes, &block)
25
+ def create_if_port(_, attributes, &)
26
+ InterfacePort.new(attributes, &)
29
27
  end
30
28
 
31
- def create_parameter(parameter_type, attributes, &block)
32
- DataObject.new(
33
- :parameter, attributes.merge(parameter_type: parameter_type), &block
34
- )
29
+ def create_parameter(parameter_type, attributes, &)
30
+ DataObject.new(:parameter, attributes.merge(parameter_type:), &)
35
31
  end
36
32
 
37
33
  define_entity :logic, :create_variable, :variable, -> { component }
@@ -5,7 +5,7 @@ RgGen.define_list_item_feature(:register, :type, :external) do
5
5
  build do
6
6
  parameter :strobe_width, {
7
7
  name: "#{register.name}_strobe_width".upcase,
8
- data_type: :int, default: configuration.bus_width / 8
8
+ data_type: :int, default: bus_width / 8
9
9
  }
10
10
  interface_port :bus_if, {
11
11
  name: "#{register.name}_bus_if",
@@ -1,21 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RgGen.define_list_item_feature(:register_block, :protocol, :apb) do
4
- configuration do
4
+ register_map do
5
5
  verify(:component) do
6
- error_condition { configuration.bus_width > 32 }
6
+ error_condition { register_block.bus_width > 32 }
7
7
  message do
8
- 'bus width over 32 bit is not supported: ' \
9
- "#{configuration.bus_width}"
8
+ 'bus width over 32 bits is not supported: ' \
9
+ "#{register_block.bus_width}"
10
+ end
11
+ position do
12
+ register_block.feature(:bus_width).position
10
13
  end
11
14
  end
12
15
 
13
16
  verify(:component) do
14
17
  error_condition { configuration.address_width > 32 }
15
18
  message do
16
- 'address width over 32 bit is not supported: ' \
19
+ 'address width over 32 bits is not supported: ' \
17
20
  "#{configuration.address_width}"
18
21
  end
22
+ position do
23
+ configuration.feature(:address_width).position
24
+ end
19
25
  end
20
26
  end
21
27
 
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RgGen.define_list_item_feature(:register_block, :protocol, :axi4lite) do
4
- configuration do
4
+ register_map do
5
5
  verify(:component) do
6
- error_condition { ![32, 64].include?(configuration.bus_width) }
6
+ error_condition { ![32, 64].include?(register_block.bus_width) }
7
7
  message do
8
8
  'bus width either 32 bit or 64 bit is only supported: ' \
9
- "#{configuration.bus_width}"
9
+ "#{register_block.bus_width}"
10
+ end
11
+ position do
12
+ register_block.feature(:bus_width).position
10
13
  end
11
14
  end
12
15
  end
@@ -0,0 +1,18 @@
1
+ rggen_native_adapter #(
2
+ .ADDRESS_WIDTH (<%= address_width %>),
3
+ .LOCAL_ADDRESS_WIDTH (<%= local_address_width %>),
4
+ .BUS_WIDTH (<%= bus_width %>),
5
+ .STROBE_WIDTH (<%= strobe_width %>),
6
+ .REGISTERS (<%= total_registers %>),
7
+ .PRE_DECODE (<%= pre_decode %>),
8
+ .BASE_ADDRESS (<%= base_address %>),
9
+ .BYTE_SIZE (<%= byte_size %>),
10
+ .ERROR_STATUS (<%= error_status %>),
11
+ .DEFAULT_READ_DATA (<%= default_read_data %>),
12
+ .INSERT_SLICER (<%= insert_slicer %>)
13
+ ) u_adapter (
14
+ .i_clk (<%= clock %>),
15
+ .i_rst_n (<%= reset %>),
16
+ .csrbus_if (<%= csrbus_if %>),
17
+ .register_if (<%= register_if %>)
18
+ );
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:register_block, :protocol, :native) do
4
+ sv_rtl do
5
+ build do
6
+ parameter :strobe_width, {
7
+ name: 'STROBE_WIDTH', data_type: :int, default: bus_width / 8
8
+ }
9
+ interface_port :csrbus_if, {
10
+ name: 'csrbus_if', interface_type: 'rggen_bus_if', modport: 'slave'
11
+ }
12
+ end
13
+
14
+ main_code :register_block, from_template: true
15
+ end
16
+ end
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RgGen.define_list_item_feature(:register_block, :protocol, :wishbone) do
4
- configuration do
4
+ register_map do
5
5
  verify(:component) do
6
- error_condition { configuration.bus_width > 64 }
6
+ error_condition { register_block.bus_width > 64 }
7
7
  message do
8
- 'bus width over 64 bit is not supported: ' \
9
- "#{configuration.bus_width}"
8
+ 'bus width over 64 bits is not supported: ' \
9
+ "#{register_block.bus_width}"
10
+ end
11
+ position do
12
+ register_block.feature(:bus_width).position
10
13
  end
11
14
  end
12
15
  end
@@ -6,57 +6,76 @@ RgGen.define_list_feature(:register_block, :protocol) do
6
6
  feature_registries << registry
7
7
  end
8
8
 
9
+ def default_protocol
10
+ available_protocols.first
11
+ end
12
+
13
+ def find_protocol(value)
14
+ available_protocols
15
+ .find { value.to_sym.casecmp?(_1) }
16
+ end
17
+
18
+ private
19
+
20
+ def feature_registries
21
+ @feature_registries ||= []
22
+ end
23
+
9
24
  def available_protocols
10
25
  feature_registries
11
26
  .map { |registry| registry.enabled_features(:protocol) }
12
27
  .inject(:&)
13
28
  end
29
+ end
14
30
 
15
- private
31
+ [:configuration, :register_map].each do |component_type|
32
+ component(component_type) do
33
+ base_feature do
34
+ build { |protocol| @protocol = protocol }
35
+ end
16
36
 
17
- def feature_registries
18
- @feature_registries ||= []
37
+ default_feature do
38
+ end
39
+
40
+ factory do
41
+ convert_value do |value, position|
42
+ shared_context.find_protocol(value) ||
43
+ (error "unknown protocol: #{value.inspect}", position)
44
+ end
45
+ end
19
46
  end
20
47
  end
21
48
 
22
49
  configuration do
23
50
  base_feature do
24
51
  property :protocol
25
- build { |protocol| @protocol = protocol }
26
52
  printable :protocol
27
53
  end
28
54
 
29
- default_feature do
30
- end
31
-
32
55
  factory do
33
- convert_value do |value, position|
34
- protocol = find_protocol(value)
35
- protocol ||
36
- (error "unknown protocol: #{value.inspect}", position)
37
- end
38
-
39
56
  default_value do |position|
40
- default_protocol ||
57
+ shared_context.default_protocol ||
41
58
  (error 'no protocols are available', position)
42
59
  end
43
60
 
44
61
  def target_feature_key(data)
45
62
  data.value
46
63
  end
64
+ end
65
+ end
47
66
 
48
- private
49
-
50
- def find_protocol(value)
51
- available_protocols.find(&value.to_sym.method(:casecmp?))
52
- end
67
+ register_map do
68
+ base_feature do
69
+ property :protocol, default: -> { configuration.protocol }
53
70
 
54
- def default_protocol
55
- available_protocols.first
71
+ def position
72
+ super || configuration.feature(:protocol).position
56
73
  end
74
+ end
57
75
 
58
- def available_protocols
59
- @available_protocols ||= shared_context.available_protocols
76
+ factory do
77
+ def target_feature_key(configuration, data)
78
+ data&.value || configuration.protocol
60
79
  end
61
80
  end
62
81
  end
@@ -91,7 +110,7 @@ RgGen.define_list_feature(:register_block, :protocol) do
91
110
  private
92
111
 
93
112
  def bus_width
94
- configuration.bus_width
113
+ register_block.bus_width
95
114
  end
96
115
 
97
116
  def local_address_width
@@ -120,8 +139,8 @@ RgGen.define_list_feature(:register_block, :protocol) do
120
139
  end
121
140
 
122
141
  factory do
123
- def target_feature_key(configuration, _register_block)
124
- configuration.protocol
142
+ def target_feature_key(_configuration, register_block)
143
+ register_block.protocol
125
144
  end
126
145
  end
127
146
  end
@@ -34,7 +34,7 @@ RgGen.define_simple_feature(:register_block, :sv_rtl_top) do
34
34
  end
35
35
 
36
36
  def bus_width
37
- configuration.bus_width
37
+ register_block.bus_width
38
38
  end
39
39
 
40
40
  def body_code(code)
@@ -21,7 +21,7 @@ module RgGen
21
21
  end
22
22
 
23
23
  def bus_width
24
- configuration.bus_width
24
+ register_block.bus_width
25
25
  end
26
26
 
27
27
  def value_width
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'common'
4
+ require_relative 'register_map/keyword_checker'
4
5
  require_relative 'rtl/feature'
5
6
  require_relative 'rtl/partial_sum'
6
7
  require_relative 'rtl/register_index'
@@ -26,6 +27,7 @@ RgGen.setup_plugin :'rggen-sv-rtl' do |plugin|
26
27
  'rtl/register_block/protocol/apb',
27
28
  'rtl/register_block/protocol/axi4lite',
28
29
  'rtl/register_block/protocol/wishbone',
30
+ 'rtl/register_block/protocol/native',
29
31
  'rtl/register_file/sv_rtl_top',
30
32
  'rtl/register/sv_rtl_top',
31
33
  'rtl/register/type',
@@ -66,4 +68,8 @@ RgGen.setup_plugin :'rggen-sv-rtl' do |plugin|
66
68
  'rtl_package/register/sv_rtl_package',
67
69
  'rtl_package/register_block/sv_rtl_package'
68
70
  ]
71
+
72
+ plugin.files [
73
+ 'register_map/name'
74
+ ]
69
75
  end
@@ -10,14 +10,14 @@ module RgGen
10
10
  component.full_name(separator)
11
11
  end
12
12
 
13
- def create_parameter(parameter_type, attributes, &block)
13
+ def create_parameter(parameter_type, attributes, &)
14
14
  attributes =
15
15
  attributes.merge(
16
- parameter_type: parameter_type, array_format: :unpacked,
16
+ parameter_type:, array_format: :unpacked,
17
17
  name: attributes[:name].upcase
18
18
  )
19
19
  DataObject.new(
20
- :parameter, attributes, &block
20
+ :parameter, attributes, &
21
21
  )
22
22
  end
23
23
 
@@ -41,7 +41,7 @@ RgGen.define_simple_feature(:register, :sv_rtl_package) do
41
41
  value_list = group_address_list(address_list, size_list).first
42
42
  localparam :__offset, {
43
43
  name: "#{full_name}_byte_offset",
44
- data_type: :bit, width: width, array_size: size_list, default: value_list
44
+ data_type: :bit, width:, array_size: size_list, default: value_list
45
45
  }
46
46
  end
47
47
 
@@ -68,7 +68,7 @@ RgGen.define_simple_feature(:register, :sv_rtl_package) do
68
68
  value = address_list.first
69
69
  localparam :__offset, {
70
70
  name: "#{full_name}_byte_offset",
71
- data_type: :bit, width: width, default: value
71
+ data_type: :bit, width:, default: value
72
72
  }
73
73
  end
74
74
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RgGen
4
4
  module SystemVerilog
5
- VERSION = '0.33.1'
5
+ VERSION = '0.34.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rggen-systemverilog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.33.1
4
+ version: 0.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taichi Ishitani
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-28 00:00:00.000000000 Z
10
+ date: 2025-01-23 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: 'SystemVerilog RTL and UVM RAL model generators for RgGen.
14
13
 
@@ -60,6 +59,8 @@ files:
60
59
  - lib/rggen/systemverilog/ral/register_common.rb
61
60
  - lib/rggen/systemverilog/ral/register_file/sv_ral_model.erb
62
61
  - lib/rggen/systemverilog/ral/register_file/sv_ral_model.rb
62
+ - lib/rggen/systemverilog/register_map/keyword_checker.rb
63
+ - lib/rggen/systemverilog/register_map/name.rb
63
64
  - lib/rggen/systemverilog/rtl.rb
64
65
  - lib/rggen/systemverilog/rtl/bit_field/sv_rtl_top.rb
65
66
  - lib/rggen/systemverilog/rtl/bit_field/type.rb
@@ -118,6 +119,8 @@ files:
118
119
  - lib/rggen/systemverilog/rtl/register_block/protocol/apb.rb
119
120
  - lib/rggen/systemverilog/rtl/register_block/protocol/axi4lite.erb
120
121
  - lib/rggen/systemverilog/rtl/register_block/protocol/axi4lite.rb
122
+ - lib/rggen/systemverilog/rtl/register_block/protocol/native.erb
123
+ - lib/rggen/systemverilog/rtl/register_block/protocol/native.rb
121
124
  - lib/rggen/systemverilog/rtl/register_block/protocol/wishbone.erb
122
125
  - lib/rggen/systemverilog/rtl/register_block/protocol/wishbone.rb
123
126
  - lib/rggen/systemverilog/rtl/register_block/sv_rtl_macros.erb
@@ -139,7 +142,6 @@ metadata:
139
142
  rubygems_mfa_required: 'true'
140
143
  source_code_uri: https://github.com/rggen/rggen-systemverilog
141
144
  wiki_uri: https://github.com/rggen/rggen/wiki
142
- post_install_message:
143
145
  rdoc_options: []
144
146
  require_paths:
145
147
  - lib
@@ -147,15 +149,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
149
  requirements:
148
150
  - - ">="
149
151
  - !ruby/object:Gem::Version
150
- version: '3.0'
152
+ version: '3.1'
151
153
  required_rubygems_version: !ruby/object:Gem::Requirement
152
154
  requirements:
153
155
  - - ">="
154
156
  - !ruby/object:Gem::Version
155
157
  version: '0'
156
158
  requirements: []
157
- rubygems_version: 3.5.16
158
- signing_key:
159
+ rubygems_version: 3.6.2
159
160
  specification_version: 4
160
- summary: rggen-systemverilog-0.33.1
161
+ summary: rggen-systemverilog-0.34.0
161
162
  test_files: []