rggen-verilog 0.5.0 → 0.6.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/verilog/bit_field/type/custom.erb +30 -0
- data/lib/rggen/verilog/bit_field/type/custom.rb +113 -0
- data/lib/rggen/verilog/bit_field/type/rol.erb +25 -0
- data/lib/rggen/verilog/bit_field/type/rol.rb +25 -0
- data/lib/rggen/verilog/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc.rb +1 -1
- data/lib/rggen/verilog/register_block/verilog_top.rb +1 -1
- data/lib/rggen/verilog/version.rb +1 -1
- data/lib/rggen/verilog.rb +2 -0
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2331d0936befbf916933eba253c1c47f0c4550e6bdbdf6e3905b629256e7a3c
|
4
|
+
data.tar.gz: 11c778698a897a4f3362fc8123bda08b77654de08b1ac533915a5f846fad3884
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cf7e45a00cc5c333393ae18a09acacc262dfecebb8c2d3d7a2de6633de1da9f1c71dafca41bae4732097888ca421c16ae43df0563583265f9e641d96251fe2f
|
7
|
+
data.tar.gz: 5a61bd68a631f85e8aaa9ab666a72ac366c1d979479638cad454a6b28ff5de36892c02f1fb37d902cb6aab9a75f606050538c9a5e1001db53e2179e3f0236fe7
|
@@ -0,0 +1,30 @@
|
|
1
|
+
rggen_bit_field #(
|
2
|
+
.WIDTH (<%= width %>),
|
3
|
+
.INITIAL_VALUE (<%= initial_value %>),
|
4
|
+
.SW_READ_ACTION (<%= sw_read_action %>),
|
5
|
+
.SW_WRITE_ACTION (<%= sw_write_action %>),
|
6
|
+
.SW_WRITE_ONCE (<%= write_once %>),
|
7
|
+
.STORAGE (<%= storage %>),
|
8
|
+
.EXTERNAL_READ_DATA (<%= external_read_data %>),
|
9
|
+
.TRIGGER (<%= trigger %>)
|
10
|
+
) u_bit_field (
|
11
|
+
.i_clk (<%= clock %>),
|
12
|
+
.i_rst_n (<%= reset %>),
|
13
|
+
.i_sw_valid (<%= bit_field_valid %>),
|
14
|
+
.i_sw_read_mask (<%= bit_field_read_mask %>),
|
15
|
+
.i_sw_write_enable (1'b1),
|
16
|
+
.i_sw_write_mask (<%= bit_field_write_mask %>),
|
17
|
+
.i_sw_write_data (<%= bit_field_write_data %>),
|
18
|
+
.o_sw_read_data (<%= bit_field_read_data %>),
|
19
|
+
.o_sw_value (<%= bit_field_value %>),
|
20
|
+
.o_write_trigger (<%= output_port(:write_trigger) %>),
|
21
|
+
.o_read_trigger (<%= output_port(:read_trigger) %>),
|
22
|
+
.i_hw_write_enable (<%= input_port(:hw_write_enable, "1'b0") %>),
|
23
|
+
.i_hw_write_data (<%= input_port(:hw_write_data) %>),
|
24
|
+
.i_hw_set (<%= input_port(:hw_set) %>),
|
25
|
+
.i_hw_clear (<%= input_port(:hw_clear) %>),
|
26
|
+
.i_value (<%= input_port(:value_in) %>),
|
27
|
+
.i_mask (<%= fill_1(width) %>),
|
28
|
+
.o_value (<%= output_port(:value_out) %>),
|
29
|
+
.o_value_unmasked ()
|
30
|
+
);
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_list_item_feature(:bit_field, :type, :custom) do
|
4
|
+
verilog 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? && fill_0(width) || super
|
55
|
+
end
|
56
|
+
|
57
|
+
def sw_read_action
|
58
|
+
{
|
59
|
+
none: '`RGGEN_READ_NONE',
|
60
|
+
default: '`RGGEN_READ_DEFAULT',
|
61
|
+
set: '`RGGEN_READ_SET',
|
62
|
+
clear: '`RGGEN_READ_CLEAR'
|
63
|
+
}[bit_field.sw_read]
|
64
|
+
end
|
65
|
+
|
66
|
+
def sw_write_action
|
67
|
+
{
|
68
|
+
none: '`RGGEN_WRITE_NONE',
|
69
|
+
default: '`RGGEN_WRITE_DEFAULT',
|
70
|
+
clear_0: '`RGGEN_WRITE_0_CLEAR',
|
71
|
+
clear_1: '`RGGEN_WRITE_1_CLEAR',
|
72
|
+
clear: '`RGGEN_WRITE_CLEAR',
|
73
|
+
set_0: '`RGGEN_WRITE_0_SET',
|
74
|
+
set_1: '`RGGEN_WRITE_1_SET',
|
75
|
+
set: '`RGGEN_WRITE_SET',
|
76
|
+
toggle_0: '`RGGEN_WRITE_0_TOGGLE',
|
77
|
+
toggle_1: '`RGGEN_WRITE_1_TOGGLE'
|
78
|
+
}[bit_field.sw_write]
|
79
|
+
end
|
80
|
+
|
81
|
+
def write_once
|
82
|
+
bit_field.sw_write_once? && 1 || 0
|
83
|
+
end
|
84
|
+
|
85
|
+
def storage
|
86
|
+
external_read_data? && 0 || 1
|
87
|
+
end
|
88
|
+
|
89
|
+
def external_read_data
|
90
|
+
external_read_data? && 1 || 0
|
91
|
+
end
|
92
|
+
|
93
|
+
def trigger?
|
94
|
+
bit_field.write_trigger? || bit_field.read_trigger?
|
95
|
+
end
|
96
|
+
|
97
|
+
def trigger
|
98
|
+
trigger? && 1 || 0
|
99
|
+
end
|
100
|
+
|
101
|
+
def input_port(name, default = nil)
|
102
|
+
find_port(name, default || fill_0(width))
|
103
|
+
end
|
104
|
+
|
105
|
+
def output_port(name)
|
106
|
+
find_port(name, '')
|
107
|
+
end
|
108
|
+
|
109
|
+
def find_port(name, default_value)
|
110
|
+
respond_to?(name) && __send__(name)[loop_variables] || default_value
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
rggen_bit_field #(
|
2
|
+
.WIDTH (<%= width %>),
|
3
|
+
.INITIAL_VALUE (<%= initial_value %>),
|
4
|
+
.SW_WRITE_ACTION (`RGGEN_WRITE_NONE)
|
5
|
+
) u_bit_field (
|
6
|
+
.i_clk (<%= clock %>),
|
7
|
+
.i_rst_n (<%= reset %>),
|
8
|
+
.i_sw_valid (<%= bit_field_valid %>),
|
9
|
+
.i_sw_read_mask (<%= bit_field_read_mask %>),
|
10
|
+
.i_sw_write_enable (1'b1),
|
11
|
+
.i_sw_write_mask (<%= bit_field_write_mask %>),
|
12
|
+
.i_sw_write_data (<%= bit_field_write_data %>),
|
13
|
+
.o_sw_read_data (<%= bit_field_read_data %>),
|
14
|
+
.o_sw_value (<%= bit_field_value %>),
|
15
|
+
.o_write_trigger (),
|
16
|
+
.o_read_trigger (),
|
17
|
+
.i_hw_write_enable (<%= latch_signal %>),
|
18
|
+
.i_hw_write_data (<%= value_in[loop_variables] %>),
|
19
|
+
.i_hw_set (<%= fill_0(width) %>),
|
20
|
+
.i_hw_clear (<%= fill_0(width) %>),
|
21
|
+
.i_value (<%= fill_0(width) %>),
|
22
|
+
.i_mask (<%= fill_1(width) %>),
|
23
|
+
.o_value (<%= value_out[loop_variables] %>),
|
24
|
+
.o_value_unmasked ()
|
25
|
+
);
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_list_item_feature(:bit_field, :type, :rol) do
|
4
|
+
verilog 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
|
+
def latch_signal
|
22
|
+
reference_bit_field || latch[loop_variables]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -90,7 +90,7 @@ RgGen.define_simple_feature(:register_block, :verilog_top) do
|
|
90
90
|
def ports
|
91
91
|
register_block
|
92
92
|
.declarations[:port]
|
93
|
-
.
|
93
|
+
.then(&method(:sort_port_declarations))
|
94
94
|
end
|
95
95
|
|
96
96
|
def sort_port_declarations(declarations)
|
data/lib/rggen/verilog.rb
CHANGED
@@ -31,9 +31,11 @@ RgGen.setup_plugin :'rggen-verilog' do |plugin|
|
|
31
31
|
'verilog/register/type/indirect',
|
32
32
|
'verilog/bit_field/verilog_top',
|
33
33
|
'verilog/bit_field/type',
|
34
|
+
'verilog/bit_field/type/custom',
|
34
35
|
'verilog/bit_field/type/rc_w0c_w1c_wc_woc',
|
35
36
|
'verilog/bit_field/type/ro_rotrg',
|
36
37
|
'verilog/bit_field/type/rof',
|
38
|
+
'verilog/bit_field/type/rol',
|
37
39
|
'verilog/bit_field/type/row0trg_row1trg',
|
38
40
|
'verilog/bit_field/type/rowo_rowotrg',
|
39
41
|
'verilog/bit_field/type/rs_w0s_w1s_ws_wos',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rggen-verilog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.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-
|
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.
|
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
|
+
version: 0.28.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,12 +50,16 @@ files:
|
|
50
50
|
- README.md
|
51
51
|
- lib/rggen/verilog.rb
|
52
52
|
- lib/rggen/verilog/bit_field/type.rb
|
53
|
+
- lib/rggen/verilog/bit_field/type/custom.erb
|
54
|
+
- lib/rggen/verilog/bit_field/type/custom.rb
|
53
55
|
- lib/rggen/verilog/bit_field/type/rc_w0c_w1c_wc_woc.erb
|
54
56
|
- lib/rggen/verilog/bit_field/type/rc_w0c_w1c_wc_woc.rb
|
55
57
|
- lib/rggen/verilog/bit_field/type/ro_rotrg.erb
|
56
58
|
- lib/rggen/verilog/bit_field/type/ro_rotrg.rb
|
57
59
|
- lib/rggen/verilog/bit_field/type/rof.erb
|
58
60
|
- lib/rggen/verilog/bit_field/type/rof.rb
|
61
|
+
- lib/rggen/verilog/bit_field/type/rol.erb
|
62
|
+
- lib/rggen/verilog/bit_field/type/rol.rb
|
59
63
|
- lib/rggen/verilog/bit_field/type/row0trg_row1trg.erb
|
60
64
|
- lib/rggen/verilog/bit_field/type/row0trg_row1trg.rb
|
61
65
|
- lib/rggen/verilog/bit_field/type/rowo_rowotrg.erb
|
@@ -128,8 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
132
|
- !ruby/object:Gem::Version
|
129
133
|
version: '0'
|
130
134
|
requirements: []
|
131
|
-
rubygems_version: 3.3.
|
135
|
+
rubygems_version: 3.3.7
|
132
136
|
signing_key:
|
133
137
|
specification_version: 4
|
134
|
-
summary: rggen-verilog-0.
|
138
|
+
summary: rggen-verilog-0.6.0
|
135
139
|
test_files: []
|