rggen-systemverilog 0.25.1 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +3 -2
  4. data/lib/rggen/systemverilog/common/utility/identifier.rb +1 -1
  5. data/lib/rggen/systemverilog/ral/bit_field/type/rotrg_rwtrg_wotrg.rb +9 -0
  6. data/lib/rggen/systemverilog/ral/bit_field/type/row0trg_row1trg.rb +5 -0
  7. data/lib/rggen/systemverilog/ral/bit_field/type/rowo_rowotrg.rb +8 -0
  8. data/lib/rggen/systemverilog/ral/bit_field/type.rb +19 -6
  9. data/lib/rggen/systemverilog/ral/register_common.rb +1 -1
  10. data/lib/rggen/systemverilog/ral.rb +24 -27
  11. data/lib/rggen/systemverilog/rtl/bit_field/sv_rtl_top.rb +0 -16
  12. data/lib/rggen/systemverilog/rtl/bit_field/type/rc_w0c_w1c_wc_woc.erb +2 -0
  13. data/lib/rggen/systemverilog/rtl/bit_field/type/{ro.erb → ro_rotrg.erb} +8 -4
  14. data/lib/rggen/systemverilog/rtl/bit_field/type/ro_rotrg.rb +40 -0
  15. data/lib/rggen/systemverilog/rtl/bit_field/type/rof.erb +5 -2
  16. data/lib/rggen/systemverilog/rtl/bit_field/type/row0trg_row1trg.erb +10 -0
  17. data/lib/rggen/systemverilog/rtl/bit_field/type/{ro.rb → row0trg_row1trg.rb} +10 -2
  18. data/lib/rggen/systemverilog/rtl/bit_field/type/rowo_rowotrg.erb +21 -0
  19. data/lib/rggen/systemverilog/rtl/bit_field/type/rowo_rowotrg.rb +52 -0
  20. data/lib/rggen/systemverilog/rtl/bit_field/type/rs_w0s_w1s_ws_wos.erb +2 -0
  21. data/lib/rggen/systemverilog/rtl/bit_field/type/{rw_w1_wo_wo1.erb → rw_rwtrg_w1.erb} +4 -2
  22. data/lib/rggen/systemverilog/rtl/bit_field/type/rw_rwtrg_w1.rb +46 -0
  23. data/lib/rggen/systemverilog/rtl/bit_field/type/rwc.erb +2 -0
  24. data/lib/rggen/systemverilog/rtl/bit_field/type/rwe_rwl.erb +2 -0
  25. data/lib/rggen/systemverilog/rtl/bit_field/type/rws.erb +2 -0
  26. data/lib/rggen/systemverilog/rtl/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc.erb +2 -0
  27. data/lib/rggen/systemverilog/rtl/bit_field/type/w0t_w1t.erb +2 -0
  28. data/lib/rggen/systemverilog/rtl/bit_field/type/w0trg_w1trg.erb +1 -0
  29. data/lib/rggen/systemverilog/rtl/bit_field/type/wo_wo1_wotrg.erb +22 -0
  30. data/lib/rggen/systemverilog/rtl/bit_field/type/wo_wo1_wotrg.rb +38 -0
  31. data/lib/rggen/systemverilog/rtl/bit_field/type/wrc_wrs.erb +2 -0
  32. data/lib/rggen/systemverilog/rtl/bit_field/type.rb +15 -0
  33. data/lib/rggen/systemverilog/rtl/register/type/default.erb +0 -1
  34. data/lib/rggen/systemverilog/rtl/register/type/external.rb +5 -54
  35. data/lib/rggen/systemverilog/rtl/register/type/indirect.erb +0 -1
  36. data/lib/rggen/systemverilog/rtl/register/type.rb +12 -0
  37. data/lib/rggen/systemverilog/rtl/register_block/protocol/apb.rb +3 -60
  38. data/lib/rggen/systemverilog/rtl/register_block/protocol/axi4lite.rb +4 -118
  39. data/lib/rggen/systemverilog/rtl/register_block/protocol/wishbone.erb +17 -0
  40. data/lib/rggen/systemverilog/rtl/register_block/protocol/wishbone.rb +26 -0
  41. data/lib/rggen/systemverilog/rtl/register_block/protocol.rb +2 -1
  42. data/lib/rggen/systemverilog/rtl/register_block/sv_rtl_macros.erb +12 -0
  43. data/lib/rggen/systemverilog/rtl.rb +38 -41
  44. data/lib/rggen/systemverilog/version.rb +1 -1
  45. metadata +22 -13
  46. data/lib/rggen/systemverilog/ral/setup.rb +0 -8
  47. data/lib/rggen/systemverilog/rtl/bit_field/type/rw_w1_wo_wo1.rb +0 -24
  48. data/lib/rggen/systemverilog/rtl/global/fold_sv_interface_port.rb +0 -28
  49. data/lib/rggen/systemverilog/rtl/setup.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4618b040c5d3d57ec1277788e3cfa5cc4363df8c2ddaa2d3d18bec10ed4a203d
4
- data.tar.gz: b8af85fb8a83278de85ab9b6bdbe927f5c2e6d62143f7ef7b31088e03d52dccf
3
+ metadata.gz: e21904c762e6894ce703b9786419aad14e0a8be86ace5d6ee098499ef57eeb06
4
+ data.tar.gz: a8c2b427a10ef057d2220b049f733561f1b0fd16052ef7166309b1bd3e58fd72
5
5
  SHA512:
6
- metadata.gz: '092893bb2e1429821c3455575f4eadcbc3ddb2e956e77f1e7bee3ad97b4e97738141d350aa8976b9c0dad1d276af1ddcd51a8c9539d562de8b59bded9be8f934'
7
- data.tar.gz: a4b4824e9056ab2acf190869e90dcbe426ef367f267b95259a588e7d66a6c9237b1737caca8c84fd2f9b8afa97a2ba007203823223e8d685e9595d5908153f05
6
+ metadata.gz: 6b146bfee049359f9e8296684d1beb785dbf1567cc2d3ac75effcb26bce7a9068b0371904af583ab58e19562a332727731d277c51e117c056d68bba87e9b6bc2
7
+ data.tar.gz: 63eaedf2f45061b5af697700a3b577298c470cb078e45ae59e7dd41cf552f1607e9c5a553ecede94f1b3e49b96b386f0af6326fcdd0715b6a187a4c1aad954fa
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019-2021 Taichi Ishitani
3
+ Copyright (c) 2019-2022 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
@@ -27,14 +27,15 @@ $ gem isntall rggen-systemverilog
27
27
 
28
28
  Feedbacks, bug reports, questions and etc. are wellcome! You can post them by using following ways:
29
29
 
30
- * [GitHub Issue Tracker](https://github.com/rggen/rggen-systemverilog/issues)
30
+ * [GitHub Issue Tracker](https://github.com/rggen/rggen/issues)
31
+ * [GitHub Discussions](https://github.com/rggen/rggen/discussions)
31
32
  * [Chat Room](https://gitter.im/rggen/rggen)
32
33
  * [Mailing List](https://groups.google.com/d/forum/rggen)
33
34
  * [Mail](mailto:rggen@googlegroups.com)
34
35
 
35
36
  ## Copyright & License
36
37
 
37
- Copyright © 2019-2021 Taichi Ishitani. RgGen::SystemVerilog is licensed under the [MIT License](https://opensource.org/licenses/MIT), see [LICENSE](LICENSE) for futher details.
38
+ Copyright © 2019-2022 Taichi Ishitani. RgGen::SystemVerilog is licensed under the [MIT License](https://opensource.org/licenses/MIT), see [LICENSE](LICENSE) for futher details.
38
39
 
39
40
  ## Code of Conduct
40
41
 
@@ -96,7 +96,7 @@ module RgGen
96
96
 
97
97
  def __index_factors__
98
98
  Array.new(@array_size.size) do |i|
99
- i.zero? ? nil : __reduce_array__(@array_size[-i..-1], :*, 1)
99
+ i.zero? ? nil : __reduce_array__(@array_size[-i..], :*, 1)
100
100
  end
101
101
  end
102
102
 
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:bit_field, :type, [:rotrg, :rwtrg, :wotrg]) do
4
+ sv_ral do
5
+ access do
6
+ { rotrg: :ro, rwtrg: :rw, wotrg: :wo }[bit_field.type]
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:bit_field, :type, [:row0trg, :row1trg]) do
4
+ sv_ral { access 'RO' }
5
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:bit_field, :type, [:rowo, :rowotrg]) do
4
+ sv_ral do
5
+ access 'rowo'
6
+ model_name { 'rggen_ral_rowo_field' }
7
+ end
8
+ end
@@ -4,11 +4,20 @@ RgGen.define_list_feature(:bit_field, :type) do
4
4
  sv_ral do
5
5
  base_feature do
6
6
  define_helpers do
7
- attr_setter :access
7
+ def access(access_type = nil, &block)
8
+ attribute_accessor('@access', access_type, &block)
9
+ end
8
10
 
9
11
  def model_name(name = nil, &block)
10
- @model_name = name || block || @model_name
11
- @model_name
12
+ attribute_accessor('@model_name', name, &block)
13
+ end
14
+
15
+ private
16
+
17
+ def attribute_accessor(variable_name, value, &block)
18
+ (new_value = value || block) &&
19
+ instance_variable_set(variable_name, new_value)
20
+ instance_variable_get(variable_name)
12
21
  end
13
22
  end
14
23
 
@@ -24,12 +33,11 @@ RgGen.define_list_feature(:bit_field, :type) do
24
33
  end
25
34
 
26
35
  def access
27
- (helper.access || bit_field.type).to_s.upcase
36
+ eval_attribute(:access, bit_field.type).to_s.upcase
28
37
  end
29
38
 
30
39
  def model_name
31
- name = helper.model_name
32
- name.is_a?(Proc) && instance_eval(&name) || name || 'rggen_ral_field'
40
+ eval_attribute(:model_name, 'rggen_ral_field')
33
41
  end
34
42
 
35
43
  def constructors
@@ -73,6 +81,11 @@ RgGen.define_list_feature(:bit_field, :type) do
73
81
  ''
74
82
  end
75
83
  end
84
+
85
+ def eval_attribute(attribute, default_value)
86
+ value = helper.__send__(attribute)
87
+ value.is_a?(Proc) && instance_eval(&value) || value || default_value
88
+ end
76
89
  end
77
90
 
78
91
  default_feature do
@@ -9,7 +9,7 @@ module RgGen
9
9
  def array_indices
10
10
  if component.array?
11
11
  index_table = component.array_size.map { |size| (0...size).to_a }
12
- index_table[0].product(*index_table[1..-1])
12
+ index_table[0].product(*index_table[1..])
13
13
  else
14
14
  [nil]
15
15
  end
@@ -4,33 +4,30 @@ require_relative 'common'
4
4
  require_relative 'ral/feature'
5
5
  require_relative 'ral/register_common'
6
6
 
7
- module RgGen
8
- module SystemVerilog
9
- module RAL
10
- extend Core::Plugin
7
+ RgGen.setup_plugin :'rggen-sv-ral' do |plugin|
8
+ plugin.version RgGen::SystemVerilog::VERSION
11
9
 
12
- setup_plugin :'rggen-sv-ral' do |plugin|
13
- plugin.version SystemVerilog::VERSION
14
-
15
- plugin.register_component :sv_ral do
16
- component Common::Component, Common::ComponentFactory
17
- feature Feature, Common::FeatureFactory
18
- end
19
-
20
- plugin.files [
21
- 'ral/bit_field/type',
22
- 'ral/bit_field/type/rof',
23
- 'ral/bit_field/type/rwc_rws',
24
- 'ral/bit_field/type/rwe_rwl',
25
- 'ral/bit_field/type/w0trg_w1trg',
26
- 'ral/register/type',
27
- 'ral/register/type/external',
28
- 'ral/register/type/indirect',
29
- 'ral/register_block/sv_ral_model',
30
- 'ral/register_block/sv_ral_package',
31
- 'ral/register_file/sv_ral_model'
32
- ]
33
- end
34
- end
10
+ plugin.register_component :sv_ral do
11
+ component RgGen::SystemVerilog::Common::Component,
12
+ RgGen::SystemVerilog::Common::ComponentFactory
13
+ feature RgGen::SystemVerilog::RAL::Feature,
14
+ RgGen::SystemVerilog::Common::FeatureFactory
35
15
  end
16
+
17
+ plugin.files [
18
+ 'ral/register_block/sv_ral_package',
19
+ 'ral/register_block/sv_ral_model',
20
+ 'ral/register_file/sv_ral_model',
21
+ 'ral/register/type',
22
+ 'ral/register/type/external',
23
+ 'ral/register/type/indirect',
24
+ 'ral/bit_field/type',
25
+ 'ral/bit_field/type/rof',
26
+ 'ral/bit_field/type/rotrg_rwtrg_wotrg',
27
+ 'ral/bit_field/type/row0trg_row1trg',
28
+ 'ral/bit_field/type/rowo_rowotrg',
29
+ 'ral/bit_field/type/rwc_rws',
30
+ 'ral/bit_field/type/rwe_rwl',
31
+ 'ral/bit_field/type/w0trg_w1trg'
32
+ ]
36
33
  end
@@ -36,10 +36,6 @@ RgGen.define_simple_feature(:bit_field, :sv_rtl_top) do
36
36
  end
37
37
  end
38
38
 
39
- pre_code :bit_field do |code|
40
- code << bit_field_if_connection << nl
41
- end
42
-
43
39
  def value(offsets = nil, width = nil)
44
40
  value_lsb = bit_field.lsb(offsets&.last || local_index)
45
41
  value_width = width || bit_field.width
@@ -113,17 +109,5 @@ RgGen.define_simple_feature(:bit_field, :sv_rtl_top) do
113
109
  def body_code(code)
114
110
  bit_field.generate_code(code, :bit_field, :top_down)
115
111
  end
116
-
117
- def bit_field_if_connection
118
- macro_call(
119
- 'rggen_connect_bit_field_if',
120
- [
121
- register.bit_field_if,
122
- bit_field.bit_field_sub_if,
123
- bit_field.lsb(local_index),
124
- bit_field.width
125
- ]
126
- )
127
- end
128
112
  end
129
113
  end
@@ -7,6 +7,8 @@ rggen_bit_field #(
7
7
  .i_clk (<%= clock %>),
8
8
  .i_rst_n (<%= reset %>),
9
9
  .bit_field_if (<%= bit_field_if %>),
10
+ .o_write_trigger (),
11
+ .o_read_trigger (),
10
12
  .i_sw_write_enable (<%= write_enable %>),
11
13
  .i_hw_write_enable ('0),
12
14
  .i_hw_write_data ('0),
@@ -1,10 +1,14 @@
1
1
  rggen_bit_field #(
2
- .WIDTH (<%= width %>),
3
- .STORAGE (0)
2
+ .WIDTH (<%= width %>),
3
+ .STORAGE (0),
4
+ .EXTERNAL_READ_DATA (1),
5
+ .TRIGGER (<%= trigger %>)
4
6
  ) u_bit_field (
5
- .i_clk ('0),
6
- .i_rst_n ('0),
7
+ .i_clk (<%= clock %>),
8
+ .i_rst_n (<%= reset %>),
7
9
  .bit_field_if (<%= bit_field_if %>),
10
+ .o_write_trigger (),
11
+ .o_read_trigger (<%= read_trigger_signal %>),
8
12
  .i_sw_write_enable ('0),
9
13
  .i_hw_write_enable ('0),
10
14
  .i_hw_write_data ('0),
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:bit_field, :type, [:ro, :rotrg]) do
4
+ sv_rtl do
5
+ build do
6
+ unless bit_field.reference?
7
+ input :value_in, {
8
+ name: "i_#{full_name}", width: width,
9
+ array_size: array_size, array_format: array_port_format
10
+ }
11
+ end
12
+ if rotrg?
13
+ output :read_trigger, {
14
+ name: "o_#{full_name}_read_trigger", width: 1,
15
+ array_size: array_size, array_format: array_port_format
16
+ }
17
+ end
18
+ end
19
+
20
+ main_code :bit_field, from_template: true
21
+
22
+ private
23
+
24
+ def rotrg?
25
+ bit_field.type == :rotrg
26
+ end
27
+
28
+ def trigger
29
+ rotrg? && 1 || 0
30
+ end
31
+
32
+ def read_trigger_signal
33
+ rotrg? && read_trigger[loop_variables] || nil
34
+ end
35
+
36
+ def reference_or_value_in
37
+ reference_bit_field || value_in[loop_variables]
38
+ end
39
+ end
40
+ end
@@ -1,10 +1,13 @@
1
1
  rggen_bit_field #(
2
- .WIDTH (<%= width %>),
3
- .STORAGE (0)
2
+ .WIDTH (<%= width %>),
3
+ .STORAGE (0),
4
+ .EXTERNAL_READ_DATA (1)
4
5
  ) u_bit_field (
5
6
  .i_clk ('0),
6
7
  .i_rst_n ('0),
7
8
  .bit_field_if (<%= bit_field_if %>),
9
+ .o_write_trigger (),
10
+ .o_read_trigger (),
8
11
  .i_sw_write_enable ('0),
9
12
  .i_hw_write_enable ('0),
10
13
  .i_hw_write_data ('0),
@@ -0,0 +1,10 @@
1
+ rggen_bit_field_w01trg #(
2
+ .TRIGGER_VALUE (<%= trigger_value %>),
3
+ .WIDTH (<%= width %>)
4
+ ) u_bit_field (
5
+ .i_clk (<%= clock %>),
6
+ .i_rst_n (<%= reset %>),
7
+ .bit_field_if (<%= bit_field_if %>),
8
+ .i_value (<%= reference_or_value_in %>),
9
+ .o_trigger (<%= trigger[loop_variables] %>)
10
+ );
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RgGen.define_list_item_feature(:bit_field, :type, :ro) do
3
+ RgGen.define_list_item_feature(:bit_field, :type, [:row0trg, :row1trg]) do
4
4
  sv_rtl do
5
5
  build do
6
6
  unless bit_field.reference?
@@ -9,14 +9,22 @@ RgGen.define_list_item_feature(:bit_field, :type, :ro) do
9
9
  array_size: array_size, array_format: array_port_format
10
10
  }
11
11
  end
12
+ output :trigger, {
13
+ name: "o_#{full_name}_trigger", width: width,
14
+ array_size: array_size, array_format: array_port_format
15
+ }
12
16
  end
13
17
 
14
18
  main_code :bit_field, from_template: true
15
19
 
16
20
  private
17
21
 
22
+ def trigger_value
23
+ bin({ row0trg: 0, row1trg: 1 }[bit_field.type], 1)
24
+ end
25
+
18
26
  def reference_or_value_in
19
- bit_field.reference? && reference_bit_field || value_in[loop_variables]
27
+ reference_bit_field || value_in[loop_variables]
20
28
  end
21
29
  end
22
30
  end
@@ -0,0 +1,21 @@
1
+ rggen_bit_field #(
2
+ .WIDTH (<%= width %>),
3
+ .INITIAL_VALUE (<%= initial_value %>),
4
+ .EXTERNAL_READ_DATA (1),
5
+ .TRIGGER (<%= trigger %>)
6
+ ) u_bit_field (
7
+ .i_clk (<%= clock %>),
8
+ .i_rst_n (<%= reset %>),
9
+ .bit_field_if (<%= bit_field_if %>),
10
+ .o_write_trigger (<%= write_trigger_signal %>),
11
+ .o_read_trigger (<%= read_trigger_signal %>),
12
+ .i_sw_write_enable ('1),
13
+ .i_hw_write_enable ('0),
14
+ .i_hw_write_data ('0),
15
+ .i_hw_set ('0),
16
+ .i_hw_clear ('0),
17
+ .i_value (<%= reference_or_value_in %>),
18
+ .i_mask ('1),
19
+ .o_value (<%= value_out[loop_variables] %>),
20
+ .o_value_unmasked ()
21
+ );
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:bit_field, :type, [:rowo, :rowotrg]) do
4
+ sv_rtl do
5
+ build do
6
+ output :value_out, {
7
+ name: "o_#{full_name}", width: width,
8
+ array_size: array_size, array_format: array_port_format
9
+ }
10
+ unless bit_field.reference?
11
+ input :value_in, {
12
+ name: "i_#{full_name}", width: width,
13
+ array_size: array_size, array_format: array_port_format
14
+ }
15
+ end
16
+ if rowotrg?
17
+ output :write_trigger, {
18
+ name: "o_#{full_name}_write_trigger", width: 1,
19
+ array_size: array_size, array_format: array_port_format
20
+ }
21
+ output :read_trigger, {
22
+ name: "o_#{full_name}_read_trigger", width: 1,
23
+ array_size: array_size, array_format: array_port_format
24
+ }
25
+ end
26
+ end
27
+
28
+ main_code :bit_field, from_template: true
29
+
30
+ private
31
+
32
+ def rowotrg?
33
+ bit_field.type == :rowotrg
34
+ end
35
+
36
+ def trigger
37
+ rowotrg? && 1 || 0
38
+ end
39
+
40
+ def write_trigger_signal
41
+ rowotrg? && write_trigger[loop_variables] || nil
42
+ end
43
+
44
+ def read_trigger_signal
45
+ rowotrg? && read_trigger[loop_variables] || nil
46
+ end
47
+
48
+ def reference_or_value_in
49
+ reference_bit_field || value_in[loop_variables]
50
+ end
51
+ end
52
+ end
@@ -7,6 +7,8 @@ rggen_bit_field #(
7
7
  .i_clk (<%= clock %>),
8
8
  .i_rst_n (<%= reset %>),
9
9
  .bit_field_if (<%= bit_field_if %>),
10
+ .o_write_trigger (),
11
+ .o_read_trigger (),
10
12
  .i_sw_write_enable (<%= write_enable %>),
11
13
  .i_hw_write_enable ('0),
12
14
  .i_hw_write_data ('0),
@@ -1,12 +1,14 @@
1
1
  rggen_bit_field #(
2
2
  .WIDTH (<%= width %>),
3
3
  .INITIAL_VALUE (<%= initial_value %>),
4
- .SW_READ_ACTION (<%= read_action %>),
5
- .SW_WRITE_ONCE (<%= write_once %>)
4
+ .SW_WRITE_ONCE (<%= write_once %>),
5
+ .TRIGGER (<%= trigger %>)
6
6
  ) u_bit_field (
7
7
  .i_clk (<%= clock %>),
8
8
  .i_rst_n (<%= reset %>),
9
9
  .bit_field_if (<%= bit_field_if %>),
10
+ .o_write_trigger (<%= write_trigger_signal %>),
11
+ .o_read_trigger (<%= read_trigger_signal %>),
10
12
  .i_sw_write_enable ('1),
11
13
  .i_hw_write_enable ('0),
12
14
  .i_hw_write_data ('0),
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:bit_field, :type, [:rw, :rwtrg, :w1]) do
4
+ sv_rtl do
5
+ build do
6
+ output :value_out, {
7
+ name: "o_#{full_name}", width: width,
8
+ array_size: array_size, array_format: array_port_format
9
+ }
10
+ if rwtrg?
11
+ output :write_trigger, {
12
+ name: "o_#{full_name}_write_trigger", width: 1,
13
+ array_size: array_size, array_format: array_port_format
14
+ }
15
+ output :read_trigger, {
16
+ name: "o_#{full_name}_read_trigger", width: 1,
17
+ array_size: array_size, array_format: array_port_format
18
+ }
19
+ end
20
+ end
21
+
22
+ main_code :bit_field, from_template: true
23
+
24
+ private
25
+
26
+ def rwtrg?
27
+ bit_field.type == :rwtrg
28
+ end
29
+
30
+ def trigger
31
+ rwtrg? && 1 || 0
32
+ end
33
+
34
+ def write_trigger_signal
35
+ rwtrg? && write_trigger[loop_variables] || nil
36
+ end
37
+
38
+ def read_trigger_signal
39
+ rwtrg? && read_trigger[loop_variables] || nil
40
+ end
41
+
42
+ def write_once
43
+ bit_field.type == :w1 && 1 || 0
44
+ end
45
+ end
46
+ end
@@ -6,6 +6,8 @@ rggen_bit_field #(
6
6
  .i_clk (<%= clock %>),
7
7
  .i_rst_n (<%= reset %>),
8
8
  .bit_field_if (<%= bit_field_if %>),
9
+ .o_write_trigger (),
10
+ .o_read_trigger (),
9
11
  .i_sw_write_enable ('1),
10
12
  .i_hw_write_enable ('0),
11
13
  .i_hw_write_data ('0),
@@ -6,6 +6,8 @@ rggen_bit_field #(
6
6
  .i_clk (<%= clock %>),
7
7
  .i_rst_n (<%= reset %>),
8
8
  .bit_field_if (<%= bit_field_if %>),
9
+ .o_write_trigger (),
10
+ .o_read_trigger (),
9
11
  .i_sw_write_enable (<%= control_signal %>),
10
12
  .i_hw_write_enable ('0),
11
13
  .i_hw_write_data ('0),
@@ -5,6 +5,8 @@ rggen_bit_field #(
5
5
  .i_clk (<%= clock %>),
6
6
  .i_rst_n (<%= reset %>),
7
7
  .bit_field_if (<%= bit_field_if %>),
8
+ .o_write_trigger (),
9
+ .o_read_trigger (),
8
10
  .i_sw_write_enable ('1),
9
11
  .i_hw_write_enable (<%= set_signal %>),
10
12
  .i_hw_write_data (<%= value_in[loop_variables] %>),
@@ -7,6 +7,8 @@ rggen_bit_field #(
7
7
  .i_clk (<%= clock %>),
8
8
  .i_rst_n (<%= reset %>),
9
9
  .bit_field_if (<%= bit_field_if %>),
10
+ .o_write_trigger (),
11
+ .o_read_trigger (),
10
12
  .i_sw_write_enable ('1),
11
13
  .i_hw_write_enable ('0),
12
14
  .i_hw_write_data ('0),
@@ -6,6 +6,8 @@ rggen_bit_field #(
6
6
  .i_clk (<%= clock %>),
7
7
  .i_rst_n (<%= reset %>),
8
8
  .bit_field_if (<%= bit_field_if %>),
9
+ .o_write_trigger (),
10
+ .o_read_trigger (),
9
11
  .i_sw_write_enable ('1),
10
12
  .i_hw_write_enable ('0),
11
13
  .i_hw_write_data ('0),
@@ -5,5 +5,6 @@ rggen_bit_field_w01trg #(
5
5
  .i_clk (<%= clock %>),
6
6
  .i_rst_n (<%= reset %>),
7
7
  .bit_field_if (<%= bit_field_if %>),
8
+ .i_value ('0),
8
9
  .o_trigger (<%= trigger[loop_variables] %>)
9
10
  );
@@ -0,0 +1,22 @@
1
+ rggen_bit_field #(
2
+ .WIDTH (<%= width %>),
3
+ .INITIAL_VALUE (<%= initial_value %>),
4
+ .SW_READ_ACTION (RGGEN_READ_NONE),
5
+ .SW_WRITE_ONCE (<%= write_once %>),
6
+ .TRIGGER (<%= trigger %>)
7
+ ) u_bit_field (
8
+ .i_clk (<%= clock %>),
9
+ .i_rst_n (<%= reset %>),
10
+ .bit_field_if (<%= bit_field_if %>),
11
+ .o_write_trigger (<%= write_trigger_signal %>),
12
+ .o_read_trigger (),
13
+ .i_sw_write_enable ('1),
14
+ .i_hw_write_enable ('0),
15
+ .i_hw_write_data ('0),
16
+ .i_hw_set ('0),
17
+ .i_hw_clear ('0),
18
+ .i_value ('0),
19
+ .i_mask ('1),
20
+ .o_value (<%= value_out[loop_variables] %>),
21
+ .o_value_unmasked ()
22
+ );
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:bit_field, :type, [:wo, :wo1, :wotrg]) do
4
+ sv_rtl do
5
+ build do
6
+ output :value_out, {
7
+ name: "o_#{full_name}", width: width,
8
+ array_size: array_size, array_format: array_port_format
9
+ }
10
+ if wotrg?
11
+ output :write_trigger, {
12
+ name: "o_#{full_name}_write_trigger", width: 1,
13
+ array_size: array_size, array_format: array_port_format
14
+ }
15
+ end
16
+ end
17
+
18
+ main_code :bit_field, from_template: true
19
+
20
+ private
21
+
22
+ def wotrg?
23
+ bit_field.type == :wotrg
24
+ end
25
+
26
+ def trigger
27
+ wotrg? && 1 || 0
28
+ end
29
+
30
+ def write_trigger_signal
31
+ wotrg? && write_trigger[loop_variables] || nil
32
+ end
33
+
34
+ def write_once
35
+ bit_field.type == :wo1 && 1 || 0
36
+ end
37
+ end
38
+ end
@@ -6,6 +6,8 @@ rggen_bit_field #(
6
6
  .i_clk (<%= clock %>),
7
7
  .i_rst_n (<%= reset %>),
8
8
  .bit_field_if (<%= bit_field_if %>),
9
+ .o_write_trigger (),
10
+ .o_read_trigger (),
9
11
  .i_sw_write_enable ('1),
10
12
  .i_hw_write_enable ('0),
11
13
  .i_hw_write_data ('0),