rggen-systemverilog 0.29.0 → 0.30.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: 7e5fc548cd3c93e80580efc9d2027ce309b9a6e8900078f3f5bf8bb157357e53
4
- data.tar.gz: 4fb5af7f5ad76f4938406a553fe425767e2fc363ce79b79b07213fd292535efb
3
+ metadata.gz: 3485ee878c14865b7457588e96b43fb62e07e7a699204fe5b5f2e4082b143296
4
+ data.tar.gz: e4b82e5b367666fe0f1d9f62dd4d647348363bcee8f6749032010cc1ee20bd53
5
5
  SHA512:
6
- metadata.gz: 34cc65c49e1510303e8ca8ed7d16b941bfd331d66188602ecdf41a61cc9b1b0a627f56d33c3ba6b44b0c2e56ca1c44a896893ad3d82070a72b5cfb913e5a28b5
7
- data.tar.gz: 55600c8bf365ffbbc2d8cc6b020e6cb13c33ebb91f49253d53cef0c5a7a5df86d639a61cc0a1eb2aa5d2a36d86530236e837735721da55def694c2a1c19c9d74
6
+ metadata.gz: 960d4b3469f87ab1d75c74790a56ded92dfc4e12d38a9dadd6a97cb01ea5c4a003cdf9fd347ab998aa9d72d631fc039cfb9a7aa34e76e6445ad11a80e768f231
7
+ data.tar.gz: b27c8a3e1a6ae7c3e10f4031cf486b57654c6d62df379908cb0e72c9d6a2c069ab66009e6f8dc649be9e3f0119ddab79ad26d7993a621c44271548eccf7265bb
@@ -26,7 +26,7 @@ module RgGen
26
26
  end
27
27
 
28
28
  def default_offset_address(index)
29
- component.offset_address + component.byte_size(false) * index
29
+ component.offset_address + component.entry_byte_size * index
30
30
  end
31
31
 
32
32
  def hdl_path(array_index)
@@ -10,7 +10,7 @@ module RgGen
10
10
  operands
11
11
  .chunk(&method(:integer?))
12
12
  .flat_map(&method(:calc_partial_sum))
13
- .reject { |value| integer?(value) && value.zero? }
13
+ .reject(&method(:integer_zero?))
14
14
  .tap { |sums| sums.empty? && (sums << 0) }
15
15
  end
16
16
 
@@ -22,6 +22,10 @@ module RgGen
22
22
  def integer?(value)
23
23
  value.is_a?(Integer)
24
24
  end
25
+
26
+ def integer_zero?(value)
27
+ integer?(value) && value.zero?
28
+ end
25
29
  end
26
30
  end
27
31
  end
@@ -4,8 +4,7 @@ rggen_default_register #(
4
4
  .ADDRESS_WIDTH (<%= address_width %>),
5
5
  .OFFSET_ADDRESS (<%= offset_address %>),
6
6
  .BUS_WIDTH (<%= bus_width %>),
7
- .DATA_WIDTH (<%= width %>),
8
- .REGISTER_INDEX (<%= register_index %>)
7
+ .DATA_WIDTH (<%= width %>)
9
8
  ) u_register (
10
9
  .i_clk (<%= register_block.clock %>),
11
10
  .i_rst_n (<%= register_block.reset %>),
@@ -19,12 +19,11 @@ RgGen.define_list_item_feature(:register, :type, :external) do
19
19
  end
20
20
 
21
21
  def start_address
22
- hex(register.offset_address, address_width)
22
+ hex(register.address_range.begin, address_width)
23
23
  end
24
24
 
25
25
  def end_address
26
- address = register.offset_address + register.byte_size - 1
27
- hex(address, address_width)
26
+ hex(register.address_range.last, address_width)
28
27
  end
29
28
  end
30
29
  end
@@ -7,7 +7,8 @@ rggen_apb_adapter #(
7
7
  .BASE_ADDRESS (<%= base_address %>),
8
8
  .BYTE_SIZE (<%= byte_size %>),
9
9
  .ERROR_STATUS (<%= error_status %>),
10
- .DEFAULT_READ_DATA (<%= default_read_data %>)
10
+ .DEFAULT_READ_DATA (<%= default_read_data %>),
11
+ .INSERT_SLICER (<%= insert_slicer %>)
11
12
  ) u_adapter (
12
13
  .i_clk (<%= clock %>),
13
14
  .i_rst_n (<%= reset %>),
@@ -9,6 +9,7 @@ rggen_axi4lite_adapter #(
9
9
  .BYTE_SIZE (<%= byte_size %>),
10
10
  .ERROR_STATUS (<%= error_status %>),
11
11
  .DEFAULT_READ_DATA (<%= default_read_data %>),
12
+ .INSERT_SLICER (<%= insert_slicer %>),
12
13
  .WRITE_FIRST (<%= write_first %>)
13
14
  ) u_adapter (
14
15
  .i_clk (<%= clock %>),
@@ -8,6 +8,7 @@ rggen_wishbone_adapter #(
8
8
  .BYTE_SIZE (<%= byte_size %>),
9
9
  .ERROR_STATUS (<%= error_status %>),
10
10
  .DEFAULT_READ_DATA (<%= default_read_data %>),
11
+ .INSERT_SLICER (<%= insert_slicer %>),
11
12
  .USE_STALL (<%= use_stall %>)
12
13
  ) u_adapter (
13
14
  .i_clk (<%= clock %>),
@@ -89,6 +89,9 @@ RgGen.define_list_feature(:register_block, :protocol) do
89
89
  name: 'DEFAULT_READ_DATA', data_type: :bit, width: bus_width,
90
90
  default: all_bits_0
91
91
  }
92
+ parameter :insert_slicer, {
93
+ name: 'INSERT_SLICER', data_type: :bit, width: 1, default: 0
94
+ }
92
95
  end
93
96
 
94
97
  private
@@ -102,7 +102,13 @@ module RgGen
102
102
  operands.reduce(:*)
103
103
  elsif operands.first == 1
104
104
  operands.last
105
- elsif need_bracket
105
+ else
106
+ product_expression(operands, need_bracket)
107
+ end
108
+ end
109
+
110
+ def product_expression(operands, need_bracket)
111
+ if need_bracket && /[+\-*\/]/ =~ operands.last
106
112
  "#{operands.first}*(#{operands.last})"
107
113
  else
108
114
  operands.join('*')
@@ -32,15 +32,29 @@ module RgGen
32
32
  end
33
33
 
34
34
  def collect_offsets(component)
35
- if component.register_file? && component.array?
35
+ if need_byte_offset?(component)
36
36
  [component.offset_address, byte_offset(component)]
37
37
  else
38
38
  component.offset_address
39
39
  end
40
40
  end
41
41
 
42
+ def need_byte_offset?(component)
43
+ if component.register_file?
44
+ component.array?
45
+ else
46
+ component.array? && !component.settings[:support_shared_address]
47
+ end
48
+ end
49
+
42
50
  def byte_offset(component)
43
- "#{component.byte_size(false)}*(#{component.local_index})"
51
+ byte_size = component.entry_byte_size
52
+ local_index = component.local_index
53
+ if /[+\-*\/]/ =~ local_index
54
+ "#{byte_size}*(#{local_index})"
55
+ else
56
+ "#{byte_size}*#{local_index}"
57
+ end
44
58
  end
45
59
 
46
60
  def format_offsets(offsets)
@@ -59,10 +73,6 @@ module RgGen
59
73
  bits = register.bit_fields.map(&:bit_map).inject(:|)
60
74
  hex(bits, register.width)
61
75
  end
62
-
63
- def register_index
64
- register.local_index || 0
65
- end
66
76
  end
67
77
  end
68
78
  end
@@ -9,7 +9,7 @@ RgGen.define_simple_feature(:register, :sv_rtl_package) do
9
9
  }
10
10
  localparam :__byte_size, {
11
11
  name: "#{full_name}_byte_size",
12
- data_type: :int, default: register.byte_size(hierarchical: true)
12
+ data_type: :int, default: register.total_byte_size(hierarchical: true)
13
13
  }
14
14
  define_array_size_localparam
15
15
  define_offset_localparams
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RgGen
4
4
  module SystemVerilog
5
- VERSION = '0.29.0'
5
+ VERSION = '0.30.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rggen-systemverilog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.0
4
+ version: 0.30.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
11
+ date: 2023-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -164,8 +164,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  requirements: []
167
- rubygems_version: 3.4.1
167
+ rubygems_version: 3.4.10
168
168
  signing_key:
169
169
  specification_version: 4
170
- summary: rggen-systemverilog-0.29.0
170
+ summary: rggen-systemverilog-0.30.0
171
171
  test_files: []