rggen-systemverilog 0.24.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rggen/systemverilog/common.rb +0 -2
- data/lib/rggen/systemverilog/common/factories.rb +1 -1
- data/lib/rggen/systemverilog/common/feature.rb +1 -1
- data/lib/rggen/systemverilog/common/utility.rb +1 -1
- data/lib/rggen/systemverilog/common/utility/class_definition.rb +12 -4
- data/lib/rggen/systemverilog/common/utility/data_object.rb +1 -2
- data/lib/rggen/systemverilog/common/utility/function_definition.rb +16 -4
- data/lib/rggen/systemverilog/common/utility/identifier.rb +6 -7
- data/lib/rggen/systemverilog/common/utility/local_scope.rb +9 -7
- data/lib/rggen/systemverilog/common/utility/module_definition.rb +12 -4
- data/lib/rggen/systemverilog/common/utility/package_definition.rb +4 -4
- data/lib/rggen/systemverilog/ral.rb +1 -1
- data/lib/rggen/systemverilog/ral/bit_field/type.rb +2 -2
- data/lib/rggen/systemverilog/ral/bit_field/type/rof.rb +5 -0
- data/lib/rggen/systemverilog/rtl.rb +1 -3
- data/lib/rggen/systemverilog/rtl/bit_field/sv_rtl_top.rb +1 -1
- data/lib/rggen/systemverilog/rtl/bit_field/type/rc_w0c_w1c_wc_woc.rb +3 -3
- data/lib/rggen/systemverilog/rtl/bit_field/type/ro.rb +1 -1
- data/lib/rggen/systemverilog/rtl/bit_field/type/rs_w0s_w1s_ws_wos.rb +2 -2
- data/lib/rggen/systemverilog/rtl/bit_field/type/rw_w1_wo_wo1.rb +1 -1
- data/lib/rggen/systemverilog/rtl/bit_field/type/rwc.rb +2 -2
- data/lib/rggen/systemverilog/rtl/bit_field/type/{rwl.erb → rwe_rwl.erb} +2 -2
- data/lib/rggen/systemverilog/rtl/bit_field/type/rwe_rwl.rb +34 -0
- data/lib/rggen/systemverilog/rtl/bit_field/type/rws.rb +3 -3
- data/lib/rggen/systemverilog/rtl/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc.rb +1 -1
- data/lib/rggen/systemverilog/rtl/bit_field/type/w0t_w1t.rb +1 -1
- data/lib/rggen/systemverilog/rtl/bit_field/type/w0trg_w1trg.rb +1 -1
- data/lib/rggen/systemverilog/rtl/bit_field/type/wrc_wrs.rb +1 -1
- data/lib/rggen/systemverilog/rtl/bit_field_index.rb +1 -2
- data/lib/rggen/systemverilog/rtl/feature.rb +8 -6
- data/lib/rggen/systemverilog/rtl/partial_sum.rb +5 -6
- data/lib/rggen/systemverilog/rtl/register/type/external.rb +8 -16
- data/lib/rggen/systemverilog/rtl/register_block/protocol/apb.rb +10 -10
- data/lib/rggen/systemverilog/rtl/register_block/protocol/axi4lite.rb +23 -23
- data/lib/rggen/systemverilog/rtl/register_block/sv_rtl_top.rb +2 -6
- data/lib/rggen/systemverilog/rtl/register_index.rb +13 -11
- data/lib/rggen/systemverilog/rtl/register_type.rb +4 -3
- data/lib/rggen/systemverilog/version.rb +1 -1
- metadata +7 -25
- data/lib/rggen/systemverilog/ral/bit_field/type/reserved_rof.rb +0 -5
- data/lib/rggen/systemverilog/rtl/bit_field/type/reserved.erb +0 -18
- data/lib/rggen/systemverilog/rtl/bit_field/type/reserved.rb +0 -7
- data/lib/rggen/systemverilog/rtl/bit_field/type/rwe.erb +0 -18
- data/lib/rggen/systemverilog/rtl/bit_field/type/rwe.rb +0 -26
- data/lib/rggen/systemverilog/rtl/bit_field/type/rwl.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2fe4d8d918cc5291f84654d19f75670ef8fb49e9405e6b2dba2d2fb418ffacb
|
4
|
+
data.tar.gz: a51b6c2fb4589c9c149132132c4087ed01bbfb6a31feccb5247d2056a90c7ede
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6c24fe9065345f7f8ba93bfa1fa3e481f5852a0025f0cfd20b9728475d96f359f028de870dc2523c145b84b009d4eb2ddbbd82b3cd286ba6217b6bc8a0b68c5
|
7
|
+
data.tar.gz: c6a97f80b046acfbde8882fa85371267ba776d90bec180595c146fa9b44913a42453e348c17979a74253baeb00ed5e70448d10d6ba03a796048bdd42ded9a4b7
|
@@ -13,10 +13,14 @@ module RgGen
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def header_code(code)
|
16
|
-
code
|
16
|
+
class_header_begin(code)
|
17
17
|
parameter_declarations(code)
|
18
18
|
class_inheritance(code)
|
19
|
-
code
|
19
|
+
class_header_end(code)
|
20
|
+
end
|
21
|
+
|
22
|
+
def class_header_begin(code)
|
23
|
+
code << ['class', space, name]
|
20
24
|
end
|
21
25
|
|
22
26
|
def parameter_declarations(code)
|
@@ -28,7 +32,11 @@ module RgGen
|
|
28
32
|
|
29
33
|
def class_inheritance(code)
|
30
34
|
return unless base
|
31
|
-
code << [space,
|
35
|
+
code << [space, 'extends', space, base]
|
36
|
+
end
|
37
|
+
|
38
|
+
def class_header_end(code)
|
39
|
+
code << semicolon
|
32
40
|
end
|
33
41
|
|
34
42
|
def pre_body_code(code)
|
@@ -36,7 +44,7 @@ module RgGen
|
|
36
44
|
end
|
37
45
|
|
38
46
|
def footer_code
|
39
|
-
|
47
|
+
'endclass'
|
40
48
|
end
|
41
49
|
end
|
42
50
|
end
|
@@ -19,11 +19,15 @@ module RgGen
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def header_code(code)
|
22
|
-
code
|
22
|
+
function_header_begin(code)
|
23
23
|
return_type_declaration(code)
|
24
|
-
code
|
24
|
+
function_name(code)
|
25
25
|
argument_declarations(code)
|
26
|
-
code
|
26
|
+
function_header_end(code)
|
27
|
+
end
|
28
|
+
|
29
|
+
def function_header_begin(code)
|
30
|
+
code << 'function'
|
27
31
|
end
|
28
32
|
|
29
33
|
def return_type_declaration(code)
|
@@ -31,14 +35,22 @@ module RgGen
|
|
31
35
|
code << [space, return_type.declaration]
|
32
36
|
end
|
33
37
|
|
38
|
+
def function_name(code)
|
39
|
+
code << space << name
|
40
|
+
end
|
41
|
+
|
34
42
|
def argument_declarations(code)
|
35
43
|
wrap(code, '(', ')') do
|
36
44
|
add_declarations_to_header(code, Array(arguments))
|
37
45
|
end
|
38
46
|
end
|
39
47
|
|
48
|
+
def function_header_end(code)
|
49
|
+
code << semicolon
|
50
|
+
end
|
51
|
+
|
40
52
|
def footer_code
|
41
|
-
|
53
|
+
'endfunction'
|
42
54
|
end
|
43
55
|
end
|
44
56
|
end
|
@@ -80,13 +80,12 @@ module RgGen
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def __serialized_index__(array_index)
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
integer?(index) ? index : "(#{index})"
|
83
|
+
array_index
|
84
|
+
.reverse
|
85
|
+
.zip(__index_factors__)
|
86
|
+
.map { |i, f| __calc_index_value__(i, f) }
|
87
|
+
.yield_self { |values| __reduce_array__(values.reverse, :+, 0) }
|
88
|
+
.yield_self { |index| integer?(index) && index || "(#{index})" }
|
90
89
|
end
|
91
90
|
|
92
91
|
def __index_factors__
|
@@ -17,13 +17,13 @@ module RgGen
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def header_code(code)
|
20
|
-
code << [
|
20
|
+
code << ['generate', space] if @top_scope
|
21
21
|
code << "if (1) begin : #{name}" << nl
|
22
22
|
end
|
23
23
|
|
24
24
|
def footer_code(code)
|
25
|
-
code <<
|
26
|
-
code << [space,
|
25
|
+
code << 'end'
|
26
|
+
code << [space, 'endgenerate'] if @top_scope
|
27
27
|
end
|
28
28
|
|
29
29
|
def pre_body_code(code)
|
@@ -58,10 +58,12 @@ module RgGen
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def post_body_code(code)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
loop_size&.size&.times { generate_for_end(code) }
|
62
|
+
end
|
63
|
+
|
64
|
+
def generate_for_end(code)
|
65
|
+
code.indent -= 2
|
66
|
+
code << 'end' << nl
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
@@ -23,11 +23,15 @@ module RgGen
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def header_code(code)
|
26
|
-
code
|
26
|
+
module_header_begin(code)
|
27
27
|
package_import_declaration(code)
|
28
28
|
parameter_declarations(code)
|
29
29
|
port_declarations(code)
|
30
|
-
code
|
30
|
+
module_header_end(code)
|
31
|
+
end
|
32
|
+
|
33
|
+
def module_header_begin(code)
|
34
|
+
code << 'module' << space << name
|
31
35
|
end
|
32
36
|
|
33
37
|
def package_import_declaration(code)
|
@@ -41,7 +45,7 @@ module RgGen
|
|
41
45
|
def pacakge_import_items
|
42
46
|
Array(@package_imports).map.with_index do |package, i|
|
43
47
|
if i.zero?
|
44
|
-
[
|
48
|
+
['import', "#{package}::*"].join(space)
|
45
49
|
else
|
46
50
|
[space(6), "#{package}::*"].join(space)
|
47
51
|
end
|
@@ -62,12 +66,16 @@ module RgGen
|
|
62
66
|
end
|
63
67
|
end
|
64
68
|
|
69
|
+
def module_header_end(code)
|
70
|
+
code << semicolon
|
71
|
+
end
|
72
|
+
|
65
73
|
def pre_body_code(code)
|
66
74
|
add_declarations_to_body(code, Array(variables))
|
67
75
|
end
|
68
76
|
|
69
77
|
def footer_code
|
70
|
-
|
78
|
+
'endmodule'
|
71
79
|
end
|
72
80
|
end
|
73
81
|
end
|
@@ -30,7 +30,7 @@ module RgGen
|
|
30
30
|
private
|
31
31
|
|
32
32
|
def header_code(code)
|
33
|
-
code << [
|
33
|
+
code << ['package', space, name, semicolon]
|
34
34
|
end
|
35
35
|
|
36
36
|
def pre_body_code(code)
|
@@ -41,18 +41,18 @@ module RgGen
|
|
41
41
|
def package_import_declaration(code)
|
42
42
|
declarations =
|
43
43
|
Array(@package_imports)
|
44
|
-
.map { |package| [
|
44
|
+
.map { |package| ['import', space, package, '::*'] }
|
45
45
|
add_declarations_to_body(code, declarations)
|
46
46
|
end
|
47
47
|
|
48
48
|
def file_include_directives(code)
|
49
49
|
Array(@include_files).each do |file|
|
50
|
-
code << [
|
50
|
+
code << ['`include', space, string(file), nl]
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def footer_code
|
55
|
-
|
55
|
+
'endpackage'
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -29,12 +29,12 @@ RgGen.define_list_feature(:bit_field, :type) do
|
|
29
29
|
|
30
30
|
def model_name
|
31
31
|
name = helper.model_name
|
32
|
-
name.is_a?(Proc) && instance_eval(&name) || name ||
|
32
|
+
name.is_a?(Proc) && instance_eval(&name) || name || 'rggen_ral_field'
|
33
33
|
end
|
34
34
|
|
35
35
|
def constructors
|
36
36
|
(bit_field.sequence_size&.times || [nil]).map do |index|
|
37
|
-
macro_call(
|
37
|
+
macro_call('rggen_ral_create_field', arguments(index))
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -25,14 +25,12 @@ module RgGen
|
|
25
25
|
'rtl/bit_field/sv_rtl_top',
|
26
26
|
'rtl/bit_field/type',
|
27
27
|
'rtl/bit_field/type/rc_w0c_w1c_wc_woc',
|
28
|
-
'rtl/bit_field/type/reserved',
|
29
28
|
'rtl/bit_field/type/ro',
|
30
29
|
'rtl/bit_field/type/rof',
|
31
30
|
'rtl/bit_field/type/rs_w0s_w1s_ws_wos',
|
32
31
|
'rtl/bit_field/type/rw_w1_wo_wo1',
|
33
32
|
'rtl/bit_field/type/rwc',
|
34
|
-
'rtl/bit_field/type/
|
35
|
-
'rtl/bit_field/type/rwl',
|
33
|
+
'rtl/bit_field/type/rwe_rwl',
|
36
34
|
'rtl/bit_field/type/rws',
|
37
35
|
'rtl/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc',
|
38
36
|
'rtl/bit_field/type/w0t_w1t',
|
@@ -4,16 +4,16 @@ RgGen.define_list_item_feature(:bit_field, :type, [:rc, :w0c, :w1c, :wc, :woc])
|
|
4
4
|
sv_rtl do
|
5
5
|
build do
|
6
6
|
input :set, {
|
7
|
-
name: "i_#{full_name}_set",
|
7
|
+
name: "i_#{full_name}_set", width: width,
|
8
8
|
array_size: array_size, array_format: array_port_format
|
9
9
|
}
|
10
10
|
output :value_out, {
|
11
|
-
name: "o_#{full_name}",
|
11
|
+
name: "o_#{full_name}", width: width,
|
12
12
|
array_size: array_size, array_format: array_port_format
|
13
13
|
}
|
14
14
|
if bit_field.reference?
|
15
15
|
output :value_unmasked, {
|
16
|
-
name: "o_#{full_name}_unmasked",
|
16
|
+
name: "o_#{full_name}_unmasked", width: width,
|
17
17
|
array_size: array_size, array_format: array_port_format
|
18
18
|
}
|
19
19
|
end
|
@@ -5,7 +5,7 @@ RgGen.define_list_item_feature(:bit_field, :type, :ro) do
|
|
5
5
|
build do
|
6
6
|
unless bit_field.reference?
|
7
7
|
input :value_in, {
|
8
|
-
name: "i_#{full_name}",
|
8
|
+
name: "i_#{full_name}", width: width,
|
9
9
|
array_size: array_size, array_format: array_port_format
|
10
10
|
}
|
11
11
|
end
|
@@ -4,11 +4,11 @@ RgGen.define_list_item_feature(:bit_field, :type, [:rs, :w0s, :w1s, :ws, :wos])
|
|
4
4
|
sv_rtl do
|
5
5
|
build do
|
6
6
|
input :clear, {
|
7
|
-
name: "i_#{full_name}_clear",
|
7
|
+
name: "i_#{full_name}_clear", width: width,
|
8
8
|
array_size: array_size, array_format: array_port_format
|
9
9
|
}
|
10
10
|
output :value_out, {
|
11
|
-
name: "o_#{full_name}",
|
11
|
+
name: "o_#{full_name}", width: width,
|
12
12
|
array_size: array_size, array_format: array_port_format
|
13
13
|
}
|
14
14
|
end
|
@@ -4,7 +4,7 @@ RgGen.define_list_item_feature(:bit_field, :type, [:rw, :w1, :wo, :wo1]) do
|
|
4
4
|
sv_rtl do
|
5
5
|
build do
|
6
6
|
output :value_out, {
|
7
|
-
name: "o_#{full_name}",
|
7
|
+
name: "o_#{full_name}", width: width,
|
8
8
|
array_size: array_size, array_format: array_port_format
|
9
9
|
}
|
10
10
|
end
|
@@ -5,12 +5,12 @@ RgGen.define_list_item_feature(:bit_field, :type, :rwc) do
|
|
5
5
|
build do
|
6
6
|
unless bit_field.reference?
|
7
7
|
input :clear, {
|
8
|
-
name: "i_#{full_name}_clear",
|
8
|
+
name: "i_#{full_name}_clear", width: 1,
|
9
9
|
array_size: array_size, array_format: array_port_format
|
10
10
|
}
|
11
11
|
end
|
12
12
|
output :value_out, {
|
13
|
-
name: "o_#{full_name}",
|
13
|
+
name: "o_#{full_name}", width: width,
|
14
14
|
array_size: array_size, array_format: array_port_format
|
15
15
|
}
|
16
16
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
rggen_bit_field #(
|
2
2
|
.WIDTH (<%= width %>),
|
3
3
|
.INITIAL_VALUE (<%= initial_value %>),
|
4
|
-
.SW_WRITE_ENABLE_POLARITY (
|
4
|
+
.SW_WRITE_ENABLE_POLARITY (<%= polarity %>)
|
5
5
|
) u_bit_field (
|
6
6
|
.i_clk (<%= clock %>),
|
7
7
|
.i_rst_n (<%= reset %>),
|
8
8
|
.bit_field_if (<%= bit_field_if %>),
|
9
|
-
.i_sw_write_enable (<%=
|
9
|
+
.i_sw_write_enable (<%= control_signal %>),
|
10
10
|
.i_hw_write_enable ('0),
|
11
11
|
.i_hw_write_data ('0),
|
12
12
|
.i_hw_set ('0),
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_list_item_feature(:bit_field, :type, [:rwe, :rwl]) do
|
4
|
+
sv_rtl do
|
5
|
+
build do
|
6
|
+
unless bit_field.reference?
|
7
|
+
input :control, {
|
8
|
+
name: "i_#{full_name}_#{enable_or_lock}", width: 1,
|
9
|
+
array_size: array_size, array_format: array_port_format
|
10
|
+
}
|
11
|
+
end
|
12
|
+
output :value_out, {
|
13
|
+
name: "o_#{full_name}", width: width,
|
14
|
+
array_size: array_size, array_format: array_port_format
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
main_code :bit_field, from_template: true
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def enable_or_lock
|
23
|
+
{ rwe: :enable, rwl: :lock }[bit_field.type]
|
24
|
+
end
|
25
|
+
|
26
|
+
def control_signal
|
27
|
+
reference_bit_field || control[loop_variables]
|
28
|
+
end
|
29
|
+
|
30
|
+
def polarity
|
31
|
+
{ rwe: 'RGGEN_ACTIVE_HIGH', rwl: 'RGGEN_ACTIVE_LOW' }[bit_field.type]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -5,16 +5,16 @@ RgGen.define_list_item_feature(:bit_field, :type, :rws) do
|
|
5
5
|
build do
|
6
6
|
unless bit_field.reference?
|
7
7
|
input :set, {
|
8
|
-
name: "i_#{full_name}_set",
|
8
|
+
name: "i_#{full_name}_set", width: 1,
|
9
9
|
array_size: array_size, array_format: array_port_format
|
10
10
|
}
|
11
11
|
end
|
12
12
|
input :value_in, {
|
13
|
-
name: "i_#{full_name}",
|
13
|
+
name: "i_#{full_name}", width: width,
|
14
14
|
array_size: array_size, array_format: array_port_format
|
15
15
|
}
|
16
16
|
output :value_out, {
|
17
|
-
name: "o_#{full_name}",
|
17
|
+
name: "o_#{full_name}", width: width,
|
18
18
|
array_size: array_size, array_format: array_port_format
|
19
19
|
}
|
20
20
|
end
|
@@ -4,7 +4,7 @@ RgGen.define_list_item_feature(:bit_field, :type, [:w0t, :w1t]) do
|
|
4
4
|
sv_rtl do
|
5
5
|
build do
|
6
6
|
output :value_out, {
|
7
|
-
name: "o_#{full_name}",
|
7
|
+
name: "o_#{full_name}", width: width,
|
8
8
|
array_size: array_size, array_format: array_port_format
|
9
9
|
}
|
10
10
|
end
|
@@ -4,7 +4,7 @@ RgGen.define_list_item_feature(:bit_field, :type, [:w0trg, :w1trg]) do
|
|
4
4
|
sv_rtl do
|
5
5
|
build do
|
6
6
|
output :trigger, {
|
7
|
-
name: "o_#{full_name}_trigger",
|
7
|
+
name: "o_#{full_name}_trigger", width: width,
|
8
8
|
array_size: array_size, array_format: array_port_format
|
9
9
|
}
|
10
10
|
end
|
@@ -4,7 +4,7 @@ RgGen.define_list_item_feature(:bit_field, :type, [:wrc, :wrs]) do
|
|
4
4
|
sv_rtl do
|
5
5
|
build do
|
6
6
|
output :value_out, {
|
7
|
-
name: "o_#{full_name}",
|
7
|
+
name: "o_#{full_name}", width: width,
|
8
8
|
array_size: array_size, array_format: array_port_format
|
9
9
|
}
|
10
10
|
end
|
@@ -16,10 +16,12 @@ module RgGen
|
|
16
16
|
InterfaceInstance.new(attributes, &block)
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
def create_port(direction, attributes, &block)
|
20
|
+
attributes =
|
21
|
+
{ data_type: 'logic' }
|
22
|
+
.merge(attributes)
|
23
|
+
.merge(direction: direction)
|
24
|
+
DataObject.new(:argument, attributes, &block)
|
23
25
|
end
|
24
26
|
|
25
27
|
def create_if_port(_, attributes, &block)
|
@@ -34,8 +36,8 @@ module RgGen
|
|
34
36
|
|
35
37
|
define_entity :logic, :create_variable, :variable, -> { component }
|
36
38
|
define_entity :interface, :create_if_instance, :variable, -> { component }
|
37
|
-
define_entity :input, :
|
38
|
-
define_entity :output, :
|
39
|
+
define_entity :input, :create_port, :port, -> { register_block }
|
40
|
+
define_entity :output, :create_port, :port, -> { register_block }
|
39
41
|
define_entity :interface_port, :create_if_port, :port, -> { register_block }
|
40
42
|
define_entity :parameter, :create_parameter, :parameter, -> { register_block }
|
41
43
|
define_entity :localparam, :create_parameter, :parameter, -> { component }
|
@@ -7,12 +7,11 @@ module RgGen
|
|
7
7
|
private
|
8
8
|
|
9
9
|
def partial_sums(operands)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
sums.empty? && [0] || sums
|
10
|
+
operands
|
11
|
+
.chunk(&method(:integer?))
|
12
|
+
.flat_map(&method(:calc_partial_sum))
|
13
|
+
.reject { |value| integer?(value) && value.zero? }
|
14
|
+
.tap { |sums| sums.empty? && (sums << 0) }
|
16
15
|
end
|
17
16
|
|
18
17
|
def calc_partial_sum(kind_ans_values)
|
@@ -11,36 +11,28 @@ RgGen.define_list_item_feature(:register, :type, :external) do
|
|
11
11
|
}
|
12
12
|
else
|
13
13
|
output :valid, {
|
14
|
-
name: "o_#{register.name}_valid",
|
15
|
-
data_type: :logic, width: 1
|
14
|
+
name: "o_#{register.name}_valid", width: 1
|
16
15
|
}
|
17
16
|
output :access, {
|
18
|
-
name: "o_#{register.name}_access",
|
19
|
-
data_type: :logic, width: '$bits(rggen_access)'
|
17
|
+
name: "o_#{register.name}_access", width: '$bits(rggen_access)'
|
20
18
|
}
|
21
19
|
output :address, {
|
22
|
-
name: "o_#{register.name}_address",
|
23
|
-
data_type: :logic, width: address_width
|
20
|
+
name: "o_#{register.name}_address", width: address_width
|
24
21
|
}
|
25
22
|
output :write_data, {
|
26
|
-
name: "o_#{register.name}_data",
|
27
|
-
data_type: :logic, width: bus_width
|
23
|
+
name: "o_#{register.name}_data", width: bus_width
|
28
24
|
}
|
29
25
|
output :strobe, {
|
30
|
-
name: "o_#{register.name}_strobe",
|
31
|
-
data_type: :logic, width: byte_width
|
26
|
+
name: "o_#{register.name}_strobe", width: byte_width
|
32
27
|
}
|
33
28
|
input :ready, {
|
34
|
-
name: "i_#{register.name}_ready",
|
35
|
-
data_type: :logic, width: 1
|
29
|
+
name: "i_#{register.name}_ready", width: 1
|
36
30
|
}
|
37
31
|
input :status, {
|
38
|
-
name: "i_#{register.name}_status",
|
39
|
-
data_type: :logic, width: 2
|
32
|
+
name: "i_#{register.name}_status", width: 2
|
40
33
|
}
|
41
34
|
input :read_data, {
|
42
|
-
name: "i_#{register.name}_data",
|
43
|
-
data_type: :logic, width: bus_width
|
35
|
+
name: "i_#{register.name}_data", width: bus_width
|
44
36
|
}
|
45
37
|
interface :bus_if, {
|
46
38
|
name: 'bus_if', interface_type: 'rggen_bus_if',
|
@@ -27,34 +27,34 @@ RgGen.define_list_item_feature(:register_block, :protocol, :apb) do
|
|
27
27
|
}
|
28
28
|
else
|
29
29
|
input :psel, {
|
30
|
-
name: 'i_psel',
|
30
|
+
name: 'i_psel', width: 1
|
31
31
|
}
|
32
32
|
input :penable, {
|
33
|
-
name: 'i_penable',
|
33
|
+
name: 'i_penable', width: 1
|
34
34
|
}
|
35
35
|
input :paddr, {
|
36
|
-
name: 'i_paddr',
|
36
|
+
name: 'i_paddr', width: address_width
|
37
37
|
}
|
38
38
|
input :pprot, {
|
39
|
-
name: 'i_pprot',
|
39
|
+
name: 'i_pprot', width: 3
|
40
40
|
}
|
41
41
|
input :pwrite, {
|
42
|
-
name: 'i_pwrite',
|
42
|
+
name: 'i_pwrite', width: 1
|
43
43
|
}
|
44
44
|
input :pstrb, {
|
45
|
-
name: 'i_pstrb',
|
45
|
+
name: 'i_pstrb', width: byte_width
|
46
46
|
}
|
47
47
|
input :pwdata, {
|
48
|
-
name: 'i_pwdata',
|
48
|
+
name: 'i_pwdata', width: bus_width
|
49
49
|
}
|
50
50
|
output :pready, {
|
51
|
-
name: 'o_pready',
|
51
|
+
name: 'o_pready', width: 1
|
52
52
|
}
|
53
53
|
output :prdata, {
|
54
|
-
name: 'o_prdata',
|
54
|
+
name: 'o_prdata', width: bus_width
|
55
55
|
}
|
56
56
|
output :pslverr, {
|
57
|
-
name: 'o_pslverr',
|
57
|
+
name: 'o_pslverr', width: 1
|
58
58
|
}
|
59
59
|
interface :apb_if, {
|
60
60
|
name: 'apb_if', interface_type: 'rggen_apb_if',
|
@@ -26,73 +26,73 @@ RgGen.define_list_item_feature(:register_block, :protocol, :axi4lite) do
|
|
26
26
|
}
|
27
27
|
else
|
28
28
|
input :awvalid, {
|
29
|
-
name: 'i_awvalid',
|
29
|
+
name: 'i_awvalid', width: 1
|
30
30
|
}
|
31
31
|
output :awready, {
|
32
|
-
name: 'o_awready',
|
32
|
+
name: 'o_awready', width: 1
|
33
33
|
}
|
34
34
|
input :awid, {
|
35
|
-
name: 'i_awid',
|
35
|
+
name: 'i_awid', width: id_port_width
|
36
36
|
}
|
37
37
|
input :awaddr, {
|
38
|
-
name: 'i_awaddr',
|
38
|
+
name: 'i_awaddr', width: address_width
|
39
39
|
}
|
40
40
|
input :awprot, {
|
41
|
-
name: 'i_awprot',
|
41
|
+
name: 'i_awprot', width: 3
|
42
42
|
}
|
43
43
|
input :wvalid, {
|
44
|
-
name: 'i_wvalid',
|
44
|
+
name: 'i_wvalid', width: 1
|
45
45
|
}
|
46
46
|
output :wready, {
|
47
|
-
name: 'o_wready',
|
47
|
+
name: 'o_wready', width: 1
|
48
48
|
}
|
49
49
|
input :wdata, {
|
50
|
-
name: 'i_wdata',
|
50
|
+
name: 'i_wdata', width: bus_width
|
51
51
|
}
|
52
52
|
input :wstrb, {
|
53
|
-
name: 'i_wstrb',
|
53
|
+
name: 'i_wstrb', width: byte_width
|
54
54
|
}
|
55
55
|
output :bvalid, {
|
56
|
-
name: 'o_bvalid',
|
56
|
+
name: 'o_bvalid', width: 1
|
57
57
|
}
|
58
58
|
output :bid, {
|
59
|
-
name: 'o_bid',
|
59
|
+
name: 'o_bid', width: id_port_width
|
60
60
|
}
|
61
61
|
input :bready, {
|
62
|
-
name: 'i_bready',
|
62
|
+
name: 'i_bready', width: 1
|
63
63
|
}
|
64
64
|
output :bresp, {
|
65
|
-
name: 'o_bresp',
|
65
|
+
name: 'o_bresp', width: 2
|
66
66
|
}
|
67
67
|
input :arvalid, {
|
68
|
-
name: 'i_arvalid',
|
68
|
+
name: 'i_arvalid', width: 1
|
69
69
|
}
|
70
70
|
output :arready, {
|
71
|
-
name: 'o_arready',
|
71
|
+
name: 'o_arready', width: 1
|
72
72
|
}
|
73
73
|
input :arid, {
|
74
|
-
name: 'i_arid',
|
74
|
+
name: 'i_arid', width: id_port_width
|
75
75
|
}
|
76
76
|
input :araddr, {
|
77
|
-
name: 'i_araddr',
|
77
|
+
name: 'i_araddr', width: address_width
|
78
78
|
}
|
79
79
|
input :arprot, {
|
80
|
-
name: 'i_arprot',
|
80
|
+
name: 'i_arprot', width: 3
|
81
81
|
}
|
82
82
|
output :rvalid, {
|
83
|
-
name: 'o_rvalid',
|
83
|
+
name: 'o_rvalid', width: 1
|
84
84
|
}
|
85
85
|
input :rready, {
|
86
|
-
name: 'i_rready',
|
86
|
+
name: 'i_rready', width: 1
|
87
87
|
}
|
88
88
|
output :rid, {
|
89
|
-
name: 'o_rid',
|
89
|
+
name: 'o_rid', width: id_port_width
|
90
90
|
}
|
91
91
|
output :rdata, {
|
92
|
-
name: 'o_rdata',
|
92
|
+
name: 'o_rdata', width: bus_width
|
93
93
|
}
|
94
94
|
output :rresp, {
|
95
|
-
name: 'o_rresp',
|
95
|
+
name: 'o_rresp', width: 2
|
96
96
|
}
|
97
97
|
interface :axi4lite_if, {
|
98
98
|
name: 'axi4lite_if', interface_type: 'rggen_axi4lite_if',
|
@@ -5,12 +5,8 @@ RgGen.define_simple_feature(:register_block, :sv_rtl_top) do
|
|
5
5
|
export :total_registers
|
6
6
|
|
7
7
|
build do
|
8
|
-
input :clock, {
|
9
|
-
|
10
|
-
}
|
11
|
-
input :reset, {
|
12
|
-
name: 'i_rst_n', data_type: :logic, width: 1
|
13
|
-
}
|
8
|
+
input :clock, { name: 'i_clk', width: 1 }
|
9
|
+
input :reset, { name: 'i_rst_n', width: 1 }
|
14
10
|
interface :register_if, {
|
15
11
|
name: 'register_if', interface_type: 'rggen_register_if',
|
16
12
|
parameter_values: [address_width, bus_width, value_width],
|
@@ -50,13 +50,10 @@ module RgGen
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def index(offset_or_offsets = nil)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
else
|
58
|
-
partial_indices.join('+')
|
59
|
-
end
|
53
|
+
offset_or_offsets
|
54
|
+
.yield_self(&method(:index_operands))
|
55
|
+
.yield_self(&method(:partial_sums))
|
56
|
+
.yield_self(&method(:reduce_indices))
|
60
57
|
end
|
61
58
|
|
62
59
|
def inside_loop?
|
@@ -87,12 +84,17 @@ module RgGen
|
|
87
84
|
]
|
88
85
|
end
|
89
86
|
|
87
|
+
def reduce_indices(indices)
|
88
|
+
if indices.empty? || indices.all?(&method(:integer?))
|
89
|
+
indices.sum
|
90
|
+
else
|
91
|
+
indices.join('+')
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
90
95
|
def local_register_index(offset)
|
91
96
|
(component.array? || nil) &&
|
92
|
-
|
93
|
-
operands = [component.count(false), offset || local_index]
|
94
|
-
product(operands, true)
|
95
|
-
end
|
97
|
+
product([component.count(false), offset || local_index], true)
|
96
98
|
end
|
97
99
|
|
98
100
|
def product(operands, need_bracket)
|
@@ -25,9 +25,10 @@ module RgGen
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def offset_address
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
[*register_files, register]
|
29
|
+
.flat_map(&method(:collect_offsets))
|
30
|
+
.yield_self(&method(:partial_sums))
|
31
|
+
.yield_self(&method(:format_offsets))
|
31
32
|
end
|
32
33
|
|
33
34
|
def collect_offsets(component)
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rggen-systemverilog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.25.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: 2021-
|
11
|
+
date: 2021-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: facets
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '3.0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,7 +55,7 @@ files:
|
|
69
55
|
- lib/rggen/systemverilog/common/utility/structure_definition.rb
|
70
56
|
- lib/rggen/systemverilog/ral.rb
|
71
57
|
- lib/rggen/systemverilog/ral/bit_field/type.rb
|
72
|
-
- lib/rggen/systemverilog/ral/bit_field/type/
|
58
|
+
- lib/rggen/systemverilog/ral/bit_field/type/rof.rb
|
73
59
|
- lib/rggen/systemverilog/ral/bit_field/type/rwc_rws.rb
|
74
60
|
- lib/rggen/systemverilog/ral/bit_field/type/rwe_rwl.rb
|
75
61
|
- lib/rggen/systemverilog/ral/bit_field/type/w0trg_w1trg.rb
|
@@ -91,8 +77,6 @@ files:
|
|
91
77
|
- lib/rggen/systemverilog/rtl/bit_field/type.rb
|
92
78
|
- lib/rggen/systemverilog/rtl/bit_field/type/rc_w0c_w1c_wc_woc.erb
|
93
79
|
- lib/rggen/systemverilog/rtl/bit_field/type/rc_w0c_w1c_wc_woc.rb
|
94
|
-
- lib/rggen/systemverilog/rtl/bit_field/type/reserved.erb
|
95
|
-
- lib/rggen/systemverilog/rtl/bit_field/type/reserved.rb
|
96
80
|
- lib/rggen/systemverilog/rtl/bit_field/type/ro.erb
|
97
81
|
- lib/rggen/systemverilog/rtl/bit_field/type/ro.rb
|
98
82
|
- lib/rggen/systemverilog/rtl/bit_field/type/rof.erb
|
@@ -103,10 +87,8 @@ files:
|
|
103
87
|
- lib/rggen/systemverilog/rtl/bit_field/type/rw_w1_wo_wo1.rb
|
104
88
|
- lib/rggen/systemverilog/rtl/bit_field/type/rwc.erb
|
105
89
|
- lib/rggen/systemverilog/rtl/bit_field/type/rwc.rb
|
106
|
-
- lib/rggen/systemverilog/rtl/bit_field/type/
|
107
|
-
- lib/rggen/systemverilog/rtl/bit_field/type/
|
108
|
-
- lib/rggen/systemverilog/rtl/bit_field/type/rwl.erb
|
109
|
-
- lib/rggen/systemverilog/rtl/bit_field/type/rwl.rb
|
90
|
+
- lib/rggen/systemverilog/rtl/bit_field/type/rwe_rwl.erb
|
91
|
+
- lib/rggen/systemverilog/rtl/bit_field/type/rwe_rwl.rb
|
110
92
|
- lib/rggen/systemverilog/rtl/bit_field/type/rws.erb
|
111
93
|
- lib/rggen/systemverilog/rtl/bit_field/type/rws.rb
|
112
94
|
- lib/rggen/systemverilog/rtl/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc.erb
|
@@ -158,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
140
|
requirements:
|
159
141
|
- - ">="
|
160
142
|
- !ruby/object:Gem::Version
|
161
|
-
version: '2.
|
143
|
+
version: '2.5'
|
162
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
145
|
requirements:
|
164
146
|
- - ">="
|
@@ -168,5 +150,5 @@ requirements: []
|
|
168
150
|
rubygems_version: 3.2.3
|
169
151
|
signing_key:
|
170
152
|
specification_version: 4
|
171
|
-
summary: rggen-systemverilog-0.
|
153
|
+
summary: rggen-systemverilog-0.25.0
|
172
154
|
test_files: []
|
@@ -1,18 +0,0 @@
|
|
1
|
-
rggen_bit_field #(
|
2
|
-
.WIDTH (<%= width %>),
|
3
|
-
.SW_READ_ACTION (RGGEN_READ_NONE),
|
4
|
-
.STORAGE (0)
|
5
|
-
) u_bit_field (
|
6
|
-
.i_clk ('0),
|
7
|
-
.i_rst_n ('0),
|
8
|
-
.bit_field_if (<%= bit_field_if %>),
|
9
|
-
.i_sw_write_enable ('0),
|
10
|
-
.i_hw_write_enable ('0),
|
11
|
-
.i_hw_write_data ('0),
|
12
|
-
.i_hw_set ('0),
|
13
|
-
.i_hw_clear ('0),
|
14
|
-
.i_value ('0),
|
15
|
-
.i_mask ('0),
|
16
|
-
.o_value (),
|
17
|
-
.o_value_unmasked ()
|
18
|
-
);
|
@@ -1,18 +0,0 @@
|
|
1
|
-
rggen_bit_field #(
|
2
|
-
.WIDTH (<%= width %>),
|
3
|
-
.INITIAL_VALUE (<%= initial_value %>),
|
4
|
-
.SW_WRITE_ENABLE_POLARITY (RGGEN_ACTIVE_HIGH)
|
5
|
-
) u_bit_field (
|
6
|
-
.i_clk (<%= clock %>),
|
7
|
-
.i_rst_n (<%= reset %>),
|
8
|
-
.bit_field_if (<%= bit_field_if %>),
|
9
|
-
.i_sw_write_enable (<%= enable_signal %>),
|
10
|
-
.i_hw_write_enable ('0),
|
11
|
-
.i_hw_write_data ('0),
|
12
|
-
.i_hw_set ('0),
|
13
|
-
.i_hw_clear ('0),
|
14
|
-
.i_value ('0),
|
15
|
-
.i_mask ('1),
|
16
|
-
.o_value (<%= value_out[loop_variables] %>),
|
17
|
-
.o_value_unmasked ()
|
18
|
-
);
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RgGen.define_list_item_feature(:bit_field, :type, :rwe) do
|
4
|
-
sv_rtl do
|
5
|
-
build do
|
6
|
-
unless bit_field.reference?
|
7
|
-
input :enable, {
|
8
|
-
name: "i_#{full_name}_enable", data_type: :logic, width: 1,
|
9
|
-
array_size: array_size, array_format: array_port_format
|
10
|
-
}
|
11
|
-
end
|
12
|
-
output :value_out, {
|
13
|
-
name: "o_#{full_name}", data_type: :logic, width: width,
|
14
|
-
array_size: array_size, array_format: array_port_format
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
main_code :bit_field, from_template: true
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def enable_signal
|
23
|
-
reference_bit_field || enable[loop_variables]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RgGen.define_list_item_feature(:bit_field, :type, :rwl) do
|
4
|
-
sv_rtl do
|
5
|
-
build do
|
6
|
-
unless bit_field.reference?
|
7
|
-
input :lock, {
|
8
|
-
name: "i_#{full_name}_lock", data_type: :logic, width: 1,
|
9
|
-
array_size: array_size, array_format: array_port_format
|
10
|
-
}
|
11
|
-
end
|
12
|
-
output :value_out, {
|
13
|
-
name: "o_#{full_name}", data_type: :logic, width: width,
|
14
|
-
array_size: array_size, array_format: array_port_format
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
main_code :bit_field, from_template: true
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def lock_signal
|
23
|
-
reference_bit_field || lock[loop_variables]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|