rggen 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -17
  3. data/lib/rggen/base/component.rb +5 -1
  4. data/lib/rggen/base/component_factory.rb +12 -5
  5. data/lib/rggen/base/item.rb +19 -9
  6. data/lib/rggen/base/item_factory.rb +9 -5
  7. data/lib/rggen/builtins.rb +12 -15
  8. data/lib/rggen/builtins/bit_field/{field_model_creation.rb → field_model.rb} +12 -3
  9. data/lib/rggen/builtins/register/accessibility.rb +3 -3
  10. data/lib/rggen/builtins/register/address_decoder.rb +1 -1
  11. data/lib/rggen/builtins/register/array.rb +30 -28
  12. data/lib/rggen/builtins/register/bus_exporter.erb +28 -0
  13. data/lib/rggen/builtins/register/bus_exporter.rb +44 -0
  14. data/lib/rggen/builtins/register/{reg_model_constructor.rb → constructor.rb} +1 -1
  15. data/lib/rggen/builtins/register/external.rb +42 -0
  16. data/lib/rggen/builtins/register/field_model_creator.rb +5 -1
  17. data/lib/rggen/builtins/register/read_data.rb +4 -0
  18. data/lib/rggen/builtins/register/reg_model.rb +92 -0
  19. data/lib/rggen/builtins/register/shadow_index_configurator.rb +5 -1
  20. data/lib/rggen/builtins/register/sub_block_model.rb +34 -0
  21. data/lib/rggen/builtins/register_block/apb.erb +1 -0
  22. data/lib/rggen/builtins/register_block/axi4lite.erb +1 -0
  23. data/lib/rggen/builtins/register_block/{block_model_definition.rb → block_model.rb} +4 -2
  24. data/lib/rggen/builtins/register_block/{block_model_constructor.rb → constructor.rb} +1 -1
  25. data/lib/rggen/builtins/register_block/{block_model_default_map_creator.rb → default_map_creator.rb} +1 -1
  26. data/lib/rggen/builtins/register_block/host_if.rb +1 -0
  27. data/lib/rggen/builtins/register_block/{ral_package_definition.rb → ral_package.rb} +1 -1
  28. data/lib/rggen/builtins/register_block/response_mux.erb +15 -11
  29. data/lib/rggen/builtins/register_block/response_mux.rb +35 -4
  30. data/lib/rggen/builtins/register_block/sub_model_creator.rb +14 -0
  31. data/lib/rggen/builtins/register_block/top_module.rb +16 -0
  32. data/lib/rggen/core_components.rb +2 -0
  33. data/lib/rggen/core_components/configuration/item_factory.rb +1 -1
  34. data/lib/rggen/core_components/ral/component.rb +24 -0
  35. data/lib/rggen/core_components/ral/item.rb +50 -5
  36. data/lib/rggen/core_components/ral/setup.rb +1 -1
  37. data/lib/rggen/core_components/register_map/bit_field_factory.rb +1 -1
  38. data/lib/rggen/core_components/register_map/component.rb +4 -1
  39. data/lib/rggen/core_components/register_map/component_factory.rb +9 -0
  40. data/lib/rggen/core_components/register_map/item.rb +9 -7
  41. data/lib/rggen/core_components/register_map/item_factory.rb +2 -2
  42. data/lib/rggen/core_components/register_map/register_block_factory.rb +1 -1
  43. data/lib/rggen/core_components/register_map/register_factory.rb +1 -1
  44. data/lib/rggen/core_components/register_map/register_map_factory.rb +1 -1
  45. data/lib/rggen/core_components/rtl/item.rb +1 -1
  46. data/lib/rggen/input_base/component.rb +9 -0
  47. data/lib/rggen/output_base/code_utility.rb +6 -0
  48. data/lib/rggen/output_base/component.rb +1 -0
  49. data/lib/rggen/output_base/item_factory.rb +3 -0
  50. data/lib/rggen/output_base/verilog_utility/class_definition.rb +35 -0
  51. data/lib/rggen/output_base/verilog_utility/declaration.rb +11 -4
  52. data/lib/rggen/output_base/verilog_utility/identifier.rb +1 -1
  53. data/lib/rggen/output_base/verilog_utility/module_definition.rb +33 -7
  54. data/lib/rggen/version.rb +2 -2
  55. data/ral/rggen_ral_block.svh +3 -8
  56. data/ral/rggen_ral_macros.svh +9 -2
  57. data/rtl/register/rggen_bus_exporter.sv +96 -0
  58. data/rtl/register_block/rggen_host_if_apb.sv +2 -0
  59. data/rtl/register_block/rggen_host_if_axi4lite.sv +7 -1
  60. data/rtl/register_block/rggen_response_mux.sv +53 -23
  61. data/sample/sample.csv +15 -14
  62. data/sample/sample.xls +0 -0
  63. data/sample/sample.xlsx +0 -0
  64. data/sample/sample_0.sv +77 -14
  65. data/sample/sample_0_ral_pkg.sv +6 -2
  66. data/sample/sample_1.sv +17 -11
  67. data/sample/sample_1_ral_pkg.sv +1 -1
  68. data/sample/sample_setup.rb +6 -6
  69. data/setup/default.rb +6 -6
  70. metadata +20 -19
  71. data/lib/rggen/builtins/bit_field/field_model_declaration.rb +0 -9
  72. data/lib/rggen/builtins/register/field_model_declarations.rb +0 -7
  73. data/lib/rggen/builtins/register/reg_model_creation.rb +0 -64
  74. data/lib/rggen/builtins/register/reg_model_declaration.rb +0 -13
  75. data/lib/rggen/builtins/register/reg_model_definition.rb +0 -22
  76. data/lib/rggen/builtins/register_block/module_definition.rb +0 -13
  77. data/lib/rggen/builtins/register_block/reg_model_creator.rb +0 -14
  78. data/lib/rggen/builtins/register_block/reg_model_declarations.rb +0 -7
  79. data/lib/rggen/builtins/register_block/signal_declarations.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78e4a09b9a969654a984d332dd8a275f9a77a554
4
- data.tar.gz: 4880ac0a2c985415276dc82ad19bebdf95126dc3
3
+ metadata.gz: 33c2428ac880c98ecf68e103721e0decec844892
4
+ data.tar.gz: e2c208ee59c2c860aeadcde867e69a95336c78b7
5
5
  SHA512:
6
- metadata.gz: 1de6c549f3e86452ebbd36f9cad45f2c05722f538d58f41448adecf41f764986a6ce936c929a6c1ab377f7deaac713e487136cd94edb0ab9fd2a5e185aa42032
7
- data.tar.gz: 497e9ac09db980509796b0e341a116769f7183aead238866f46f0fc4b049a14e37c18465e8e66e6feee8fa568c374b3bbfc857b2dcd46a9704bdbff88b2f7cf6
6
+ metadata.gz: bf5a199dd488d76174bc36d3b758d4df1af53ded4bd5513c8c0d00f297e4c8f183ef9364c9a23663385c82c6466483ee3803aa654fe96ee2f9d0d7d116e810f5
7
+ data.tar.gz: 6acdf0c8e0e223c69ee547a15db390221622c4c29e8d1d5ac0efc3589f8e483b4ea8ee79f4c2be02588997913ad630c99594677175d9552c0c54e46909989cfc
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/rggen.svg)](https://badge.fury.io/rb/rggen)
2
2
  [![Build Status](https://travis-ci.org/taichi-ishitani/rggen.svg?branch=master)](https://travis-ci.org/taichi-ishitani/rggen)
3
3
  [![Code Climate](https://codeclimate.com/github/taichi-ishitani/rggen/badges/gpa.svg)](https://codeclimate.com/github/taichi-ishitani/rggen)
4
- [![Test Coverage](https://codeclimate.com/github/taichi-ishitani/rggen/badges/coverage.svg)](https://codeclimate.com/github/taichi-ishitani/rggen/coverage)
4
+ [![Test Coverage](https://codeclimate.com/github/taichi-ishitani/rggen/badges/coverage.svg)](https://codeclimate.com/github/taichi-ishitani/rggen/coverage)
5
+ [![Join the chat at https://gitter.im/taichi-ishitani/rggen](https://badges.gitter.im/taichi-ishitani/rggen.svg)](https://gitter.im/taichi-ishitani/rggen?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
6
 
6
7
  # RgGen
7
8
 
@@ -58,18 +59,19 @@ In addition, if you use default values for all of attributes, you don't need to
58
59
  RgGen allows to use a spreadsheet to input the register map of your design so you can directly input your register map document to RgGen.
59
60
  To do this, you need to write your register map document according to below table format.
60
61
 
61
- | |A |B |C |D |E |F |G |H |I |
62
- |:---|:---|:-------------|:------------|:--------------|:--------------------------------|:-------------|:---------|:---|:-----------|
63
- |1 | |Block Name |block_0 | | | | | | |
64
- |2 | |Byte Size |256 | | | | | | |
65
- |3 | | | | | | | | | |
66
- |4 | |Offset Address|Register Name|Array Dimension|Shadow Index |Bit Assignment|Field Name|Type|Iitial Value|
67
- |5 | |0x00 |register_0 | | |[31:16] |field_0_0 |rw |0 |
68
- |6 | | | | | |[15:0] |field_0_1 |rw |0 |
69
- |7 | |0x04 |register_1 | | |[16] |field_1_0 |rw |0 |
70
- |8 | | | | | |[0] |field_1_1 |ro | |
71
- |9 | |0x10 - 0x1F |register_2 |[4] | |[7:0] |field_2_0 |rw |0 |
72
- |10 | |0x20 |register_3 |[2, 4] |field_1_0:1, field_0_0, field_0_1|[7:0] |field_3_0 |rw |0 |
62
+ | |A |B |C |D |E |F |G |H |I |J |
63
+ |:---|:---|:-------------|:------------|:--------------|:--------------------------------|:-------|:-------------|:---------|:---|:-----------|
64
+ |1 | |Block Name |block_0 | | | | | | | |
65
+ |2 | |Byte Size |256 | | | | | | | |
66
+ |3 | | | | | | | | | | |
67
+ |4 | |Offset Address|Register Name|Array Dimension|Shadow Index |External|Bit Assignment|Field Name|Type|Iitial Value|
68
+ |5 | |0x00 |register_0 | | | |[31:16] |field_0_0 |rw |0 |
69
+ |6 | | | | | | |[15:0] |field_0_1 |rw |0 |
70
+ |7 | |0x04 |register_1 | | | |[16] |field_1_0 |rw |0 |
71
+ |8 | | | | | | |[0] |field_1_1 |ro | |
72
+ |9 | |0x10 - 0x1F |register_2 |[4] | | |[7:0] |field_2_0 |rw |0 |
73
+ |10 | |0x20 - 0x3F |register_3 | | |true | | | | |
74
+ |11 | |0x40 |register_4 |[2, 4] |field_1_0:1, field_0_0, field_0_1| |[7:0] |field_4_0 |rw |0 |
73
75
 
74
76
  By default, RgGen supports CSV, ODS, XLS and XLSX sparedsheet file types.
75
77
 
@@ -93,7 +95,7 @@ In addition, file name of generated files is accoding to below rule.
93
95
  ### Compiling Your Design
94
96
 
95
97
  RgGen has base RTL modules and RAL model package (the base library) to build generated RTL and UVM RAL models.
96
- Therefore, To compile your design with the base library, you need followins steps:
98
+ Therefore, to compile your design with the base library, you need followins steps:
97
99
 
98
100
  1. Set the RGGEN_HOME environment variable
99
101
  2. Link the base library with you design
@@ -124,12 +126,20 @@ Also you can change these by customizing RgGen.
124
126
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
125
127
 
126
128
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
127
-
129
+
130
+ ## Contact
131
+
132
+ If you have any questions, problems, ideas or somethings, you can post them on the following ways:
133
+
134
+ 1. [Issue tracker](https://github.com/taichi-ishitani/rggen/issues)
135
+ 2. [Chat room](https://gitter.im/taichi-ishitani/rggen)
136
+ 3. [Mail](mailto:taichi730@gmail.com)
137
+
128
138
  ## Contributing
129
139
 
130
140
  Bug reports and pull requests are welcome on GitHub at https://github.com/taichi-ishitani/rggen. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
131
141
 
132
142
  ## License
133
143
 
134
- Copyright © 2015-2016 [Taichi Ishitani](mailto:taichi730@gmail.com).
135
- RgGen is available as open source under the terms of the [MIT License](LICENSE.txt).
144
+ Copyright © 2015-2016 Taichi Ishitani.
145
+ RgGen is available as open source under the terms of [the MIT License](LICENSE.txt).
@@ -15,8 +15,12 @@ module RgGen
15
15
  attr_reader :level
16
16
  attr_reader :items
17
17
 
18
+ def need_children?
19
+ @need_children
20
+ end
21
+
18
22
  def add_child(child)
19
- @children << child
23
+ @children << child if need_children?
20
24
  end
21
25
 
22
26
  def add_item(item)
@@ -13,9 +13,9 @@ module RgGen
13
13
  parent = (child_factory? && args.shift) || nil
14
14
  sources = args
15
15
  create_component(parent, *sources).tap do |component|
16
- create_items(component, *sources) if @item_factories
17
- parent.add_child(component) unless @root_factory
18
- create_children(component, *sources) if @child_factory
16
+ create_items(component, *sources) if create_items?
17
+ parent.add_child(component) if child_factory?
18
+ create_children(component, *sources) if create_children?(component)
19
19
  end
20
20
  end
21
21
 
@@ -29,13 +29,20 @@ module RgGen
29
29
  !@root_factory
30
30
  end
31
31
 
32
+ def create_items?
33
+ @item_factories.not_nil?
34
+ end
35
+
36
+ def create_children?(component)
37
+ @child_factory.not_nil? && component.need_children?
38
+ end
39
+
32
40
  def create_component(parent, *_sources)
33
41
  @target_component.new(parent)
34
42
  end
35
43
 
36
44
  def create_item(item_factory, component, *sources)
37
- item = item_factory.create(component, *sources)
38
- component.add_item(item)
45
+ item_factory.create(component, *sources)
39
46
  end
40
47
 
41
48
  def create_child(component, *sources)
@@ -3,21 +3,31 @@ module RgGen
3
3
  class Item
4
4
  extend Forwardable
5
5
 
6
+ class << self
7
+ def define_helpers(&body)
8
+ singleton_class.class_exec(&body) if block_given?
9
+ end
10
+
11
+ def available?(&body)
12
+ define_method(:available?, &body)
13
+ end
14
+
15
+ def inherit_class_instance_variable(variable_name, klass, &block)
16
+ return unless klass.instance_variable_defined?(variable_name)
17
+ v = klass.instance_variable_get(variable_name)
18
+ v = block.call(v) if block_given?
19
+ instance_variable_set(variable_name, v)
20
+ end
21
+ end
22
+
6
23
  def initialize(owner)
7
24
  @owner = owner
8
25
  end
9
26
 
10
27
  attr_reader :owner
11
28
 
12
- def self.define_helpers(&body)
13
- singleton_class.class_exec(&body) if block_given?
14
- end
15
-
16
- def self.inherit_class_instance_variable(variable_name, parent_class, &block)
17
- return unless parent_class.instance_variable_defined?(variable_name)
18
- v = parent_class.instance_variable_get(variable_name)
19
- v = block.call(v) if block_given?
20
- instance_variable_set(variable_name, v)
29
+ def available?
30
+ true
21
31
  end
22
32
  end
23
33
  end
@@ -4,13 +4,17 @@ module RgGen
4
4
  attr_writer :target_items
5
5
  attr_writer :target_item
6
6
 
7
- def create(owner, *args)
8
- create_item(owner, *args)
9
- end
10
-
11
7
  private
12
8
 
13
- def create_item(owner, *args)
9
+ def create_item(owner, *args, &block)
10
+ item = create_item_object(owner, *args)
11
+ if item.available?
12
+ block.call(item) if block_given?
13
+ owner.add_item(item)
14
+ end
15
+ end
16
+
17
+ def create_item_object(owner, *args)
14
18
  klass ||= @target_items && select_target_item(*args)
15
19
  klass ||= @target_item
16
20
  klass.new(owner)
@@ -8,8 +8,7 @@ require_relative 'builtins/global/address_width'
8
8
  require_relative 'builtins/global/data_width'
9
9
 
10
10
  require_relative 'builtins/bit_field/bit_assignment'
11
- require_relative 'builtins/bit_field/field_model_creation'
12
- require_relative 'builtins/bit_field/field_model_declaration'
11
+ require_relative 'builtins/bit_field/field_model'
13
12
  require_relative 'builtins/bit_field/initial_value'
14
13
  require_relative 'builtins/bit_field/name'
15
14
  require_relative 'builtins/bit_field/reference'
@@ -22,32 +21,30 @@ require_relative 'builtins/bit_field/reserved'
22
21
  require_relative 'builtins/register/accessibility'
23
22
  require_relative 'builtins/register/address_decoder'
24
23
  require_relative 'builtins/register/array'
24
+ require_relative 'builtins/register/bus_exporter'
25
+ require_relative 'builtins/register/constructor'
26
+ require_relative 'builtins/register/external'
25
27
  require_relative 'builtins/register/field_model_creator'
26
- require_relative 'builtins/register/field_model_declarations'
27
28
  require_relative 'builtins/register/offset_address'
28
29
  require_relative 'builtins/register/name'
29
30
  require_relative 'builtins/register/read_data'
30
- require_relative 'builtins/register/reg_model_constructor'
31
- require_relative 'builtins/register/reg_model_creation'
32
- require_relative 'builtins/register/reg_model_declaration'
33
- require_relative 'builtins/register/reg_model_definition'
31
+ require_relative 'builtins/register/reg_model'
34
32
  require_relative 'builtins/register/shadow'
35
33
  require_relative 'builtins/register/shadow_index_configurator'
34
+ require_relative 'builtins/register/sub_block_model'
36
35
  require_relative 'builtins/register/uniqueness_validator'
37
36
 
38
37
  require_relative 'builtins/register_block/base_address'
39
- require_relative 'builtins/register_block/block_model_constructor'
40
- require_relative 'builtins/register_block/block_model_default_map_creator'
41
- require_relative 'builtins/register_block/block_model_definition'
38
+ require_relative 'builtins/register_block/block_model'
42
39
  require_relative 'builtins/register_block/byte_size'
43
40
  require_relative 'builtins/register_block/clock_reset'
41
+ require_relative 'builtins/register_block/constructor'
42
+ require_relative 'builtins/register_block/default_map_creator'
44
43
  require_relative 'builtins/register_block/host_if'
45
44
  require_relative 'builtins/register_block/apb'
46
45
  require_relative 'builtins/register_block/axi4lite'
47
- require_relative 'builtins/register_block/module_definition'
48
46
  require_relative 'builtins/register_block/name'
49
- require_relative 'builtins/register_block/ral_package_definition'
50
- require_relative 'builtins/register_block/reg_model_creator'
51
- require_relative 'builtins/register_block/reg_model_declarations'
47
+ require_relative 'builtins/register_block/ral_package'
52
48
  require_relative 'builtins/register_block/response_mux'
53
- require_relative 'builtins/register_block/signal_declarations'
49
+ require_relative 'builtins/register_block/sub_model_creator'
50
+ require_relative 'builtins/register_block/top_module'
@@ -1,9 +1,18 @@
1
- simple_item :bit_field, :field_model_creation do
1
+ simple_item :bit_field, :field_model do
2
2
  ral do
3
+ export :model_creation
4
+
3
5
  delegate [:name, :width, :lsb, :access] => :bit_field
4
6
 
5
- generate_code :field_model_creation do
6
- "`rggen_ral_create_field_model(#{arguments.join(', ')})\n"
7
+ build do
8
+ variable :reg_model, :field_model,
9
+ data_type: :rggen_ral_field,
10
+ name: name,
11
+ random: true
12
+ end
13
+
14
+ def model_creation(code)
15
+ code << "`rggen_ral_create_field_model(#{arguments.join(', ')})" << nl
7
16
  end
8
17
 
9
18
  def arguments
@@ -1,11 +1,11 @@
1
1
  simple_item :register, :accessibility do
2
2
  register_map do
3
3
  field :readable? do
4
- register.bit_fields.any?(&:readable?)
4
+ register.external? || register.bit_fields.any?(&:readable?)
5
5
  end
6
6
 
7
7
  field :writable? do
8
- register.bit_fields.any?(&:writable?)
8
+ register.external? || register.bit_fields.any?(&:writable?)
9
9
  end
10
10
 
11
11
  field :read_only? do
@@ -17,7 +17,7 @@ simple_item :register, :accessibility do
17
17
  end
18
18
 
19
19
  field :reserved? do
20
- register.bit_fields.all?(&:reserved?)
20
+ !register.external? && register.bit_fields.all?(&:reserved?)
21
21
  end
22
22
  end
23
23
  end
@@ -61,7 +61,7 @@ simple_item :register, :address_decoder do
61
61
 
62
62
  def shadow_index_width
63
63
  return 1 unless shadow?
64
- shadow_index_fields.map(&:width).sum(0)
64
+ shadow_index_fields.sum(0, &:width)
65
65
  end
66
66
 
67
67
  def shadow_index_value
@@ -51,27 +51,43 @@ simple_item :register, :array do
51
51
  end
52
52
 
53
53
  rtl do
54
+ delegate [:array?, :dimensions] => :register
55
+
54
56
  export :index
55
57
  export :local_index
56
58
  export :loop_variables
57
59
  export :loop_variable
58
60
 
61
+ generate_pre_code :module_item do |code|
62
+ if array?
63
+ generate_header(code)
64
+ generate_for_headers(code)
65
+ end
66
+ end
67
+
68
+ generate_post_code :module_item do |code|
69
+ if array?
70
+ generate_for_footers(code)
71
+ generate_footer(code)
72
+ end
73
+ end
74
+
59
75
  def index
60
- (register.array? && "#{base_index}+#{local_index}") || base_index
76
+ (array? && "#{base_index}+#{local_index}") || base_index
61
77
  end
62
78
 
63
79
  def local_index
64
- return nil unless register.array?
80
+ return nil unless array?
65
81
  local_index_terms(0).join('+')
66
82
  end
67
83
 
68
84
  def loop_variables
69
- return nil unless register.array?
70
- Array.new(register.dimensions.size) { |l| loop_variable(l) }
85
+ return nil unless array?
86
+ Array.new(dimensions.size) { |l| loop_variable(l) }
71
87
  end
72
88
 
73
89
  def loop_variable(level)
74
- return nil unless register.array? && level < register.dimensions.size
90
+ return nil unless array? && level < dimensions.size
75
91
  @loop_variables ||= Hash.new do |h, l|
76
92
  h[l] = create_identifier("g_#{loop_index(l)}")
77
93
  end
@@ -79,12 +95,16 @@ simple_item :register, :array do
79
95
  end
80
96
 
81
97
  def base_index
82
- previous_registers.map(&:count).sum(0)
98
+ former_registers.sum(0, &:count)
99
+ end
100
+
101
+ def former_registers
102
+ register_block.registers.take_while { |r| !register.equal?(r) }
83
103
  end
84
104
 
85
105
  def local_index_terms(level)
86
- if level < (register.dimensions.size - 1)
87
- partial_count = register.dimensions[(level + 1)..-1].inject(:*)
106
+ if level < (dimensions.size - 1)
107
+ partial_count = dimensions[(level + 1)..-1].inject(:*)
88
108
  term = [partial_count, '*', loop_variable(level)].join
89
109
  local_index_terms(level + 1).unshift(term)
90
110
  else
@@ -92,24 +112,6 @@ simple_item :register, :array do
92
112
  end
93
113
  end
94
114
 
95
- def previous_registers
96
- register_block.registers.take_while { |r| !register.equal?(r) }
97
- end
98
-
99
- generate_pre_code :module_item do |code|
100
- if register.array?
101
- generate_header(code)
102
- generate_for_headers(code)
103
- end
104
- end
105
-
106
- generate_post_code :module_item do |code|
107
- if register.array?
108
- generate_for_footers(code)
109
- generate_footer(code)
110
- end
111
- end
112
-
113
115
  def generate_header(code)
114
116
  code << "generate if (1) begin : g_#{register.name}" << nl
115
117
  code.indent += 2
@@ -117,7 +119,7 @@ simple_item :register, :array do
117
119
  end
118
120
 
119
121
  def generate_for_headers(code)
120
- register.dimensions.each_with_index do |dimension, level|
122
+ dimensions.each_with_index do |dimension, level|
121
123
  code << generate_for_header(dimension, level) << nl
122
124
  code.indent += 2
123
125
  end
@@ -129,7 +131,7 @@ simple_item :register, :array do
129
131
  end
130
132
 
131
133
  def generate_for_footers(code)
132
- register.dimensions.size.times do
134
+ dimensions.size.times do
133
135
  code.indent -= 2
134
136
  code << :end << nl
135
137
  end
@@ -0,0 +1,28 @@
1
+ rggen_bus_exporter #(
2
+ .DATA_WIDTH (<%= configuration.data_width %>),
3
+ .LOCAL_ADDRESS_WIDTH (<%= register_block.local_address_width %>),
4
+ .EXTERNAL_ADDRESS_WIDTH (<%= address_width %>),
5
+ .START_ADDRESS (<%= start_address %>)
6
+ ) u_<%= name %>_bus_exporter (
7
+ .clk (<%= register_block.clock %>),
8
+ .rst_n (<%= register_block.reset %>),
9
+ .i_valid (<%= register_block.host_if.command_valid %>),
10
+ .i_select (<%= register_block.register_select[index] %>),
11
+ .i_write (<%= register_block.host_if.write %>),
12
+ .i_read (<%= register_block.host_if.read %>),
13
+ .i_address (<%= register_block.host_if.address %>),
14
+ .i_strobe (<%= register_block.host_if.strobe %>),
15
+ .i_write_data (<%= register_block.host_if.write_data %>),
16
+ .o_ready (<%= register_block.external_register_ready[external_index] %>),
17
+ .o_read_data (<%= register_block.register_read_data[index] %>),
18
+ .o_status (<%= register_block.external_register_status[external_index] %>),
19
+ .o_valid (<%= valid %>),
20
+ .o_write (<%= write %>),
21
+ .o_read (<%= read %>),
22
+ .o_address (<%= address %>),
23
+ .o_strobe (<%= strobe %>),
24
+ .o_write_data (<%= write_data %>),
25
+ .i_ready (<%= ready %>),
26
+ .i_read_data (<%= read_data %>),
27
+ .i_status (<%= status %>)
28
+ );