rggen-systemverilog 0.33.0 → 0.33.1

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: 500b504bbd5f37dae70dc17dec068964232f48eb8df22a839730a1bd7ae3127d
4
- data.tar.gz: cc255cc91600d54a8481b733fc80350b9b43a7d5f3dd9ea39cc4679bd9c1b6ab
3
+ metadata.gz: a3d95e17a462a9401886ea4a6923921ad4ba9aa698c2bd9133f7b513110c120b
4
+ data.tar.gz: 4d80681f90d4cb38ca782821fe9820fa6e9c4cbcc3b723c63a1ec75d87c2d35d
5
5
  SHA512:
6
- metadata.gz: 8317e0140621a104ec3290ba2db8380141b9c0fc0727574f0f056fbe2fd318730bbfea2521c61dfdbd92130d4363b8f3258fce187405f3f67340eb872fbfa55c
7
- data.tar.gz: eb80eba307d0d6c3ee3c94f9e45cf2ca9b7dd19709b69868b2616851bfda3ea5848f96291742e990e135397e2e7d170a2fb420712d4ac226231b54a6a447a2dc
6
+ metadata.gz: 38bf92bf7e6f0d27cb99ed6a6d2e3753f3bf60ff199fc876e8f99875bbdbf0da665b5f2c0dae40c44510acee6555487c56a1381ac3264f00ce6ae4f2731e34a4
7
+ data.tar.gz: d7f396a29d716c6f854bbeb2fb5c331eb67ffb85143f764b9e62a3c8f89c388367a56ef54c6a31311129229859f37452b5bee51457a76db4272360898f744ff7
@@ -8,26 +8,55 @@ module RgGen
8
8
 
9
9
  def index_fields
10
10
  @index_fields ||=
11
- register.collect_index_fields(register_block.bit_fields)
11
+ register
12
+ .collect_index_fields(register_block.bit_fields)
12
13
  end
13
14
 
14
- def index_width
15
- @index_width ||= index_fields.sum(&:width)
15
+ def index_match_width
16
+ index_fields.size
16
17
  end
17
18
 
18
19
  def index_values
20
+ @index_values ||= collect_index_values
21
+ end
22
+
23
+ def collect_index_values
19
24
  loop_variables = register.local_loop_variables
20
25
  register.index_entries.zip(index_fields).map do |entry, field|
21
26
  if entry.array_index?
22
- loop_variables.shift[0, field.width]
27
+ array_index_value(loop_variables.shift, field.width)
23
28
  else
24
- hex(entry.value, field.width)
29
+ fixed_index_value(entry.value, field.width)
25
30
  end
26
31
  end
27
32
  end
28
33
 
29
- def indirect_index_assignment
30
- assign(indirect_index, concat(index_fields.map(&:value)))
34
+ def array_index_value(value, width)
35
+ "#{width}'(#{value})"
36
+ end
37
+
38
+ def fixed_index_value(value, width)
39
+ hex(value, width)
40
+ end
41
+
42
+ def indirect_index_matches(code)
43
+ index_fields.each_with_index do |field, i|
44
+ rhs = index_match_rhs(i)
45
+ lhs = index_match_lhs(field.value, index_values[i])
46
+ code << assign(rhs, lhs) << nl
47
+ end
48
+ end
49
+
50
+ def index_match_rhs(index)
51
+ if index_match_width == 1
52
+ indirect_match
53
+ else
54
+ indirect_match[index]
55
+ end
56
+ end
57
+
58
+ def index_match_lhs(field, value)
59
+ "#{field} == #{value}"
31
60
  end
32
61
  end
33
62
  end
@@ -6,12 +6,11 @@ rggen_indirect_register #(
6
6
  .BUS_WIDTH (<%= bus_width %>),
7
7
  .DATA_WIDTH (<%= width %>),
8
8
  .VALUE_WIDTH (<%= value_width %>),
9
- .INDIRECT_INDEX_WIDTH (<%= index_width %>),
10
- .INDIRECT_INDEX_VALUE (<%= concat(index_values) %>)
9
+ .INDIRECT_MATCH_WIDTH (<%= index_match_width %>)
11
10
  ) u_register (
12
11
  .i_clk (<%= register_block.clock %>),
13
12
  .i_rst_n (<%= register_block.reset %>),
14
13
  .register_if (<%= register_if %>),
15
- .i_indirect_index (<%= indirect_index %>),
14
+ .i_indirect_match (<%= indirect_match %>),
16
15
  .bit_field_if (<%= bit_field_if %>)
17
16
  );
@@ -5,11 +5,11 @@ RgGen.define_list_item_feature(:register, :type, :indirect) do
5
5
  include RgGen::SystemVerilog::RTL::IndirectIndex
6
6
 
7
7
  build do
8
- logic :indirect_index, { width: index_width }
8
+ logic :indirect_match, { width: index_match_width }
9
9
  end
10
10
 
11
11
  main_code :register do |code|
12
- code << indirect_index_assignment << nl
12
+ indirect_index_matches(code)
13
13
  code << process_template
14
14
  end
15
15
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RgGen
4
4
  module SystemVerilog
5
- VERSION = '0.33.0'
5
+ VERSION = '0.33.1'
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.33.0
4
+ version: 0.33.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taichi Ishitani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-22 00:00:00.000000000 Z
11
+ date: 2024-11-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'SystemVerilog RTL and UVM RAL model generators for RgGen.
14
14
 
@@ -154,8 +154,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubygems_version: 3.5.3
157
+ rubygems_version: 3.5.16
158
158
  signing_key:
159
159
  specification_version: 4
160
- summary: rggen-systemverilog-0.33.0
160
+ summary: rggen-systemverilog-0.33.1
161
161
  test_files: []