rggen-vhdl 0.2.1 → 0.4.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: c74cc68ef729bcf49af9fbfb49184006e2f145408fa67d77adf96cd85ab07510
4
- data.tar.gz: e113dc0c84be1b6646ae0d876e4f0cb920680c0bba12d71d434fbd6d168e6f42
3
+ metadata.gz: aa8c8c46d699ebd0a2fb1e9f6e2b3ef54f4ad73102fce9a5e354de923d7b7d1e
4
+ data.tar.gz: ac14f9c1a8c9889a7b242e4d13d074f543d297241475198293ce36271f92e2e9
5
5
  SHA512:
6
- metadata.gz: fc44aaaafada6892281fc6f608af510e051bfb46aa00331dd4f1ac727c551d49d27dff01fd5f775cf5dc998c552553b1d30c682764e730696306c4ccf6ee2901
7
- data.tar.gz: d378636891636a4609d1a40a4878ffd4a2edde73c5c30335d9e2a45265203de768db5f34d42a2dbbc8cea9b46e6b2f82416d9f43d2d185dc5d7c9d9204f7513b
6
+ metadata.gz: bd6cc0cf02deba72a1cfbe5a8bb9d095c6c2b1e8020c4add4f3c7ecd30a959f0a4c90422381fa36d10cdd0438fa70a74f8b79b5a128356dfadcec95035c0e0bf
7
+ data.tar.gz: b90261ea9057b8dfef7d73f774a54d7a409ac7ab6741a04e646d60195fe1d9cef2342c4feef9c89524ad690328bcb6c43280feaaf1c8c8b7087ea0be800c2564
data/README.md CHANGED
@@ -60,7 +60,8 @@ $ simulator \
60
60
 
61
61
  Feedbacks, bus reports, questions and etc. are welcome! You can post them bu using following ways:
62
62
 
63
- * [GitHub Issue Tracker](https://github.com/rggen/rggen-vhdl/issues)
63
+ * [GitHub Issue Tracker](https://github.com/rggen/rggen/issues)
64
+ * [GitHub Discussions](https://github.com/rggen/rggen/discussions)
64
65
  * [Chat Room](https://gitter.im/rggen/rggen)
65
66
  * [Mailing List](https://groups.google.com/d/forum/rggen)
66
67
  * [Mail](mailto:rggen@googlegroups.com)
@@ -0,0 +1,34 @@
1
+ u_bit_field: entity work.rggen_bit_field
2
+ generic map (
3
+ WIDTH => <%= width %>,
4
+ INITIAL_VALUE => <%= initial_value %>,
5
+ SW_READ_ACTION => <%= sw_read_action %>,
6
+ SW_WRITE_ACTION => <%= sw_write_action %>,
7
+ SW_WRITE_ONCE => <%= bit_field.sw_write_once? %>,
8
+ HW_SET_WIDTH => <%= width %>,
9
+ HW_CLEAR_WIDTH => <%= width %>,
10
+ STORAGE => <%= storage? %>,
11
+ EXTERNAL_READ_DATA => <%= external_read_data? %>,
12
+ TRIGGER => <%= trigger? %>
13
+ )
14
+ port map (
15
+ i_clk => <%= clock %>,
16
+ i_rst_n => <%= reset %>,
17
+ i_sw_valid => <%= bit_field_valid %>,
18
+ i_sw_read_mask => <%= bit_field_read_mask %>,
19
+ i_sw_write_enable => "1",
20
+ i_sw_write_mask => <%= bit_field_write_mask %>,
21
+ i_sw_write_data => <%= bit_field_write_data %>,
22
+ o_sw_read_data => <%= bit_field_read_data %>,
23
+ o_sw_value => <%= bit_field_value %>,
24
+ o_write_trigger => <%= output_port(:write_trigger) %>,
25
+ o_read_trigger => <%= output_port(:read_trigger) %>,
26
+ i_hw_write_enable => <%= input_port(:hw_write_enable, '"0"') %>,
27
+ i_hw_write_data => <%= input_port(:hw_write_data) %>,
28
+ i_hw_set => <%= input_port(:hw_set) %>,
29
+ i_hw_clear => <%= input_port(:hw_clear) %>,
30
+ i_value => <%= input_port(:value_in) %>,
31
+ i_mask => (others => '1'),
32
+ o_value => <%= output_port(:value_out) %>,
33
+ o_value_unmasked => open
34
+ );
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:bit_field, :type, :custom) do
4
+ vhdl do
5
+ build do
6
+ if external_read_data?
7
+ input :value_in, {
8
+ name: "i_#{full_name}", width: width, array_size: array_size
9
+ }
10
+ else
11
+ output :value_out, {
12
+ name: "o_#{full_name}", width: width, array_size: array_size
13
+ }
14
+ end
15
+ if bit_field.hw_write?
16
+ input :hw_write_enable, {
17
+ name: "i_#{full_name}_hw_write_enable", width: 1, array_size: array_size
18
+ }
19
+ input :hw_write_data, {
20
+ name: "i_#{full_name}_hw_write_data", width: width, array_size: array_size
21
+ }
22
+ end
23
+ if bit_field.hw_set?
24
+ input :hw_set, {
25
+ name: "i_#{full_name}_hw_set", width: width, array_size: array_size
26
+ }
27
+ end
28
+ if bit_field.hw_clear?
29
+ input :hw_clear, {
30
+ name: "i_#{full_name}_hw_clear", width: width, array_size: array_size
31
+ }
32
+ end
33
+ if bit_field.write_trigger?
34
+ output :write_trigger, {
35
+ name: "o_#{full_name}_write_trigger", width: 1, array_size: array_size
36
+ }
37
+ end
38
+ if bit_field.read_trigger?
39
+ output :read_trigger, {
40
+ name: "o_#{full_name}_read_trigger", width: 1, array_size: array_size
41
+ }
42
+ end
43
+ end
44
+
45
+ main_code :bit_field, from_template: true
46
+
47
+ private
48
+
49
+ def external_read_data?
50
+ !bit_field.sw_update? && !bit_field.hw_update?
51
+ end
52
+
53
+ def initial_value
54
+ external_read_data? && default_initial_value || super
55
+ end
56
+
57
+ def default_initial_value
58
+ value = hex(0, width)
59
+ "slice(#{value}, #{width}, 0)"
60
+ end
61
+
62
+ def sw_read_action
63
+ {
64
+ none: 'RGGEN_READ_NONE',
65
+ default: 'RGGEN_READ_DEFAULT',
66
+ set: 'RGGEN_READ_SET',
67
+ clear: 'RGGEN_READ_CLEAR'
68
+ }[bit_field.sw_read]
69
+ end
70
+
71
+ def sw_write_action
72
+ {
73
+ none: 'RGGEN_WRITE_NONE',
74
+ default: 'RGGEN_WRITE_DEFAULT',
75
+ clear_0: 'RGGEN_WRITE_0_CLEAR',
76
+ clear_1: 'RGGEN_WRITE_1_CLEAR',
77
+ clear: 'RGGEN_WRITE_CLEAR',
78
+ set_0: 'RGGEN_WRITE_0_SET',
79
+ set_1: 'RGGEN_WRITE_1_SET',
80
+ set: 'RGGEN_WRITE_SET',
81
+ toggle_0: 'RGGEN_WRITE_0_TOGGLE',
82
+ toggle_1: 'RGGEN_WRITE_1_TOGGLE'
83
+ }[bit_field.sw_write]
84
+ end
85
+
86
+ def storage?
87
+ !external_read_data?
88
+ end
89
+
90
+ def trigger?
91
+ bit_field.write_trigger? || bit_field.read_trigger?
92
+ end
93
+
94
+ def input_port(name, default = nil)
95
+ find_port(name, default || '(others => \'0\')')
96
+ end
97
+
98
+ def output_port(name)
99
+ find_port(name, 'open')
100
+ end
101
+
102
+ def find_port(name, default_value)
103
+ respond_to?(name) && __send__(name)[loop_variables] || default_value
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,27 @@
1
+ u_bit_field: entity work.rggen_bit_field
2
+ generic map (
3
+ WIDTH => <%= width %>,
4
+ INITIAL_VALUE => <%= initial_value %>,
5
+ SW_WRITE_ACTION => RGGEN_WRITE_NONE
6
+ )
7
+ port map (
8
+ i_clk => <%= clock %>,
9
+ i_rst_n => <%= reset %>,
10
+ i_sw_valid => <%= bit_field_valid %>,
11
+ i_sw_read_mask => <%= bit_field_read_mask %>,
12
+ i_sw_write_enable => "1",
13
+ i_sw_write_mask => <%= bit_field_write_mask %>,
14
+ i_sw_write_data => <%= bit_field_write_data %>,
15
+ o_sw_read_data => <%= bit_field_read_data %>,
16
+ o_sw_value => <%= bit_field_value %>,
17
+ o_write_trigger => open,
18
+ o_read_trigger => open,
19
+ i_hw_write_enable => <%= latch_signal %>,
20
+ i_hw_write_data => <%= value_in[loop_variables] %>,
21
+ i_hw_set => (others => '0'),
22
+ i_hw_clear => (others => '0'),
23
+ i_value => (others => '0'),
24
+ i_mask => (others => '1'),
25
+ o_value => <%= value_out[loop_variables] %>,
26
+ o_value_unmasked => open
27
+ );
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:bit_field, :type, :rol) do
4
+ vhdl do
5
+ build do
6
+ unless bit_field.reference?
7
+ input :latch, {
8
+ name: "i_#{full_name}_latch", width: 1, array_size: array_size
9
+ }
10
+ end
11
+ input :value_in, {
12
+ name: "i_#{full_name}", width: width, array_size: array_size
13
+ }
14
+ output :value_out, {
15
+ name: "o_#{full_name}", width: width, array_size: array_size
16
+ }
17
+ end
18
+
19
+ main_code :bit_field, from_template: true
20
+
21
+ private
22
+
23
+ def latch_signal
24
+ reference_bit_field || latch[loop_variables]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,18 @@
1
+ u_bit_field: entity work.rggen_bit_field_w01trg
2
+ generic map (
3
+ WRITE_ONE_TRIGGER => <%= write_one_trigger? %>,
4
+ WIDTH => <%= width %>
5
+ )
6
+ port map (
7
+ i_clk => i_clk,
8
+ i_rst_n => i_rst_n,
9
+ i_sw_valid => <%= bit_field_valid %>,
10
+ i_sw_read_mask => <%= bit_field_read_mask %>,
11
+ i_sw_write_enable => "1",
12
+ i_sw_write_mask => <%= bit_field_write_mask %>,
13
+ i_sw_write_data => <%= bit_field_write_data %>,
14
+ o_sw_read_data => <%= bit_field_read_data %>,
15
+ o_sw_value => <%= bit_field_value %>,
16
+ i_value => <%= reference_or_value_in %>,
17
+ o_trigger => <%= trigger[loop_variables] %>
18
+ );
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_list_item_feature(:bit_field, :type, [:row0trg, :row1trg]) do
4
+ vhdl do
5
+ build do
6
+ unless bit_field.reference?
7
+ input :value_in, {
8
+ name: "i_#{full_name}", width: width, array_size: array_size
9
+ }
10
+ end
11
+ output :trigger, {
12
+ name: "o_#{full_name}_trigger", width: width, array_size: array_size
13
+ }
14
+ end
15
+
16
+ main_code :bit_field, from_template: true
17
+
18
+ private
19
+
20
+ def write_one_trigger?
21
+ bit_field.type == :row1trg
22
+ end
23
+
24
+ def reference_or_value_in
25
+ reference_bit_field || value_in[loop_variables]
26
+ end
27
+ end
28
+ end
@@ -19,7 +19,7 @@ RgGen.define_list_item_feature(
19
19
  end
20
20
 
21
21
  def read_set?
22
- [:w0crs, :w1crs, :wcrs].include?(bit_field.type)
22
+ [:w0crs, :w1crs, :wcrs].any? { |type| bit_field.type == type }
23
23
  end
24
24
 
25
25
  def write_action
@@ -13,5 +13,6 @@ u_bit_field: entity work.rggen_bit_field_w01trg
13
13
  i_sw_write_data => <%= bit_field_write_data %>,
14
14
  o_sw_read_data => <%= bit_field_read_data %>,
15
15
  o_sw_value => <%= bit_field_value %>,
16
+ i_value => (others => '0'),
16
17
  o_trigger => <%= trigger[loop_variables] %>
17
18
  );
@@ -61,14 +61,14 @@ RgGen.define_simple_feature(:register_block, :vhdl_top) do
61
61
  def generic_declarations
62
62
  register_block
63
63
  .declarations[:generic]
64
- .yield_self(&method(:add_terminator))
64
+ .then(&method(:add_terminator))
65
65
  end
66
66
 
67
67
  def port_declarations
68
68
  register_block
69
69
  .declarations[:port]
70
- .yield_self(&method(:sort_port_declarations))
71
- .yield_self(&method(:add_terminator))
70
+ .then(&method(:sort_port_declarations))
71
+ .then(&method(:add_terminator))
72
72
  end
73
73
 
74
74
  def signal_declarations
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RgGen
4
4
  module VHDL
5
- VERSION = '0.2.1'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
data/lib/rggen/vhdl.rb CHANGED
@@ -10,44 +10,45 @@ require_relative 'vhdl/component'
10
10
  require_relative 'vhdl/feature'
11
11
  require_relative 'vhdl/factories'
12
12
 
13
- module RgGen
14
- module VHDL
15
- extend Core::Plugin
13
+ RgGen.setup_plugin :'rggen-vhdl' do |plugin|
14
+ plugin.version RgGen::VHDL::VERSION
16
15
 
17
- setup_plugin :'rggen-vhdl' do |plugin|
18
- plugin.register_component :vhdl do
19
- component Component, ComponentFactory
20
- feature Feature, FeatureFactory
21
- end
22
-
23
- plugin.files [
24
- 'vhdl/bit_field/type',
25
- 'vhdl/bit_field/type/rc_w0c_w1c_wc_woc',
26
- 'vhdl/bit_field/type/ro_rotrg',
27
- 'vhdl/bit_field/type/rof',
28
- 'vhdl/bit_field/type/rowo_rowotrg',
29
- 'vhdl/bit_field/type/rs_w0s_w1s_ws_wos',
30
- 'vhdl/bit_field/type/rw_rwtrg_w1',
31
- 'vhdl/bit_field/type/rwc',
32
- 'vhdl/bit_field/type/rwe_rwl',
33
- 'vhdl/bit_field/type/rws',
34
- 'vhdl/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc',
35
- 'vhdl/bit_field/type/w0t_w1t',
36
- 'vhdl/bit_field/type/w0trg_w1trg',
37
- 'vhdl/bit_field/type/wo_wo1_wotrg',
38
- 'vhdl/bit_field/type/wrc_wrs',
39
- 'vhdl/bit_field/vhdl_top',
40
- 'vhdl/register/type',
41
- 'vhdl/register/type/external',
42
- 'vhdl/register/type/indirect',
43
- 'vhdl/register/vhdl_top',
44
- 'vhdl/register_block/protocol',
45
- 'vhdl/register_block/protocol/apb',
46
- 'vhdl/register_block/protocol/axi4lite',
47
- 'vhdl/register_block/protocol/wishbone',
48
- 'vhdl/register_block/vhdl_top',
49
- 'vhdl/register_file/vhdl_top'
50
- ]
51
- end
16
+ plugin.register_component :vhdl do
17
+ component RgGen::VHDL::Component,
18
+ RgGen::VHDL::ComponentFactory
19
+ feature RgGen::VHDL::Feature,
20
+ RgGen::VHDL::FeatureFactory
52
21
  end
22
+
23
+ plugin.files [
24
+ 'vhdl/register_block/vhdl_top',
25
+ 'vhdl/register_block/protocol',
26
+ 'vhdl/register_block/protocol/apb',
27
+ 'vhdl/register_block/protocol/axi4lite',
28
+ 'vhdl/register_block/protocol/wishbone',
29
+ 'vhdl/register_file/vhdl_top',
30
+ 'vhdl/register/vhdl_top',
31
+ 'vhdl/register/type',
32
+ 'vhdl/register/type/external',
33
+ 'vhdl/register/type/indirect',
34
+ 'vhdl/bit_field/vhdl_top',
35
+ 'vhdl/bit_field/type',
36
+ 'vhdl/bit_field/type/custom',
37
+ 'vhdl/bit_field/type/rc_w0c_w1c_wc_woc',
38
+ 'vhdl/bit_field/type/ro_rotrg',
39
+ 'vhdl/bit_field/type/rof',
40
+ 'vhdl/bit_field/type/rol',
41
+ 'vhdl/bit_field/type/row0trg_row1trg',
42
+ 'vhdl/bit_field/type/rowo_rowotrg',
43
+ 'vhdl/bit_field/type/rs_w0s_w1s_ws_wos',
44
+ 'vhdl/bit_field/type/rw_rwtrg_w1',
45
+ 'vhdl/bit_field/type/rwc',
46
+ 'vhdl/bit_field/type/rwe_rwl',
47
+ 'vhdl/bit_field/type/rws',
48
+ 'vhdl/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc',
49
+ 'vhdl/bit_field/type/w0t_w1t',
50
+ 'vhdl/bit_field/type/w0trg_w1trg',
51
+ 'vhdl/bit_field/type/wo_wo1_wotrg',
52
+ 'vhdl/bit_field/type/wrc_wrs'
53
+ ]
53
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rggen-vhdl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.4.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: 2022-06-07 00:00:00.000000000 Z
11
+ date: 2022-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rggen-systemverilog
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.26.0
19
+ version: 0.28.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.26.0
26
+ version: 0.28.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -50,12 +50,18 @@ files:
50
50
  - README.md
51
51
  - lib/rggen/vhdl.rb
52
52
  - lib/rggen/vhdl/bit_field/type.rb
53
+ - lib/rggen/vhdl/bit_field/type/custom.erb
54
+ - lib/rggen/vhdl/bit_field/type/custom.rb
53
55
  - lib/rggen/vhdl/bit_field/type/rc_w0c_w1c_wc_woc.erb
54
56
  - lib/rggen/vhdl/bit_field/type/rc_w0c_w1c_wc_woc.rb
55
57
  - lib/rggen/vhdl/bit_field/type/ro_rotrg.erb
56
58
  - lib/rggen/vhdl/bit_field/type/ro_rotrg.rb
57
59
  - lib/rggen/vhdl/bit_field/type/rof.erb
58
60
  - lib/rggen/vhdl/bit_field/type/rof.rb
61
+ - lib/rggen/vhdl/bit_field/type/rol.erb
62
+ - lib/rggen/vhdl/bit_field/type/rol.rb
63
+ - lib/rggen/vhdl/bit_field/type/row0trg_row1trg.erb
64
+ - lib/rggen/vhdl/bit_field/type/row0trg_row1trg.rb
59
65
  - lib/rggen/vhdl/bit_field/type/rowo_rowotrg.erb
60
66
  - lib/rggen/vhdl/bit_field/type/rowo_rowotrg.rb
61
67
  - lib/rggen/vhdl/bit_field/type/rs_w0s_w1s_ws_wos.erb
@@ -100,7 +106,6 @@ files:
100
106
  - lib/rggen/vhdl/register_block/vhdl_top.erb
101
107
  - lib/rggen/vhdl/register_block/vhdl_top.rb
102
108
  - lib/rggen/vhdl/register_file/vhdl_top.rb
103
- - lib/rggen/vhdl/setup.rb
104
109
  - lib/rggen/vhdl/utility.rb
105
110
  - lib/rggen/vhdl/utility/data_object.rb
106
111
  - lib/rggen/vhdl/utility/identifier.rb
@@ -110,7 +115,7 @@ homepage: https://github.com/rggen/rggen-vhdl
110
115
  licenses:
111
116
  - MIT
112
117
  metadata:
113
- bug_tracker_uri: https://github.com/rggen/rggen-vhdl/issues
118
+ bug_tracker_uri: https://github.com/rggen/rggen/issues
114
119
  mailing_list_uri: https://groups.google.com/d/forum/rggen
115
120
  rubygems_mfa_required: 'true'
116
121
  source_code_uri: https://github.com/rggen/rggen-vhdl
@@ -130,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
135
  - !ruby/object:Gem::Version
131
136
  version: '0'
132
137
  requirements: []
133
- rubygems_version: 3.3.3
138
+ rubygems_version: 3.3.7
134
139
  signing_key:
135
140
  specification_version: 4
136
- summary: rggen-vhdl-0.2.1
141
+ summary: rggen-vhdl-0.4.0
137
142
  test_files: []
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rggen/vhdl'
4
-
5
- RgGen.register_plugin RgGen::VHDL do |builder|
6
- builder.load_plugin 'rggen/systemverilog/rtl/setup'
7
- builder.enable :register_block, [:vhdl_top]
8
- builder.enable :register_file, [:vhdl_top]
9
- builder.enable :register, [:vhdl_top]
10
- builder.enable :bit_field, [:vhdl_top]
11
- end