rggen-verilog 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/LICENSE +21 -0
- data/README.md +74 -0
- data/lib/rggen/verilog.rb +64 -0
- data/lib/rggen/verilog/bit_field/type.rb +85 -0
- data/lib/rggen/verilog/bit_field/type/rc_w0c_w1c_wc_woc.erb +21 -0
- data/lib/rggen/verilog/bit_field/type/rc_w0c_w1c_wc_woc.rb +40 -0
- data/lib/rggen/verilog/bit_field/type/reserved.erb +10 -0
- data/lib/rggen/verilog/bit_field/type/reserved.rb +7 -0
- data/lib/rggen/verilog/bit_field/type/ro.erb +11 -0
- data/lib/rggen/verilog/bit_field/type/ro.rb +21 -0
- data/lib/rggen/verilog/bit_field/type/rof.erb +11 -0
- data/lib/rggen/verilog/bit_field/type/rof.rb +7 -0
- data/lib/rggen/verilog/bit_field/type/rs_w0s_w1s_ws_wos.erb +19 -0
- data/lib/rggen/verilog/bit_field/type/rs_w0s_w1s_ws_wos.rb +31 -0
- data/lib/rggen/verilog/bit_field/type/rw_w1_wo_wo1.erb +16 -0
- data/lib/rggen/verilog/bit_field/type/rw_w1_wo_wo1.rb +23 -0
- data/lib/rggen/verilog/bit_field/type/rwc.erb +15 -0
- data/lib/rggen/verilog/bit_field/type/rwc.rb +24 -0
- data/lib/rggen/verilog/bit_field/type/rwe.erb +15 -0
- data/lib/rggen/verilog/bit_field/type/rwe.rb +24 -0
- data/lib/rggen/verilog/bit_field/type/rwl.erb +15 -0
- data/lib/rggen/verilog/bit_field/type/rwl.rb +24 -0
- data/lib/rggen/verilog/bit_field/type/rws.erb +16 -0
- data/lib/rggen/verilog/bit_field/type/rws.rb +27 -0
- data/lib/rggen/verilog/bit_field/type/w0crs_w1crs_wcrs.erb +15 -0
- data/lib/rggen/verilog/bit_field/type/w0crs_w1crs_wcrs.rb +20 -0
- data/lib/rggen/verilog/bit_field/type/w0src_w1src_wsrc.erb +15 -0
- data/lib/rggen/verilog/bit_field/type/w0src_w1src_wsrc.rb +20 -0
- data/lib/rggen/verilog/bit_field/type/w0t_w1t.erb +15 -0
- data/lib/rggen/verilog/bit_field/type/w0t_w1t.rb +19 -0
- data/lib/rggen/verilog/bit_field/type/w0trg_w1trg.erb +14 -0
- data/lib/rggen/verilog/bit_field/type/w0trg_w1trg.rb +19 -0
- data/lib/rggen/verilog/bit_field/type/wrc_wrs.erb +14 -0
- data/lib/rggen/verilog/bit_field/type/wrc_wrs.rb +13 -0
- data/lib/rggen/verilog/bit_field/verilog_top.rb +89 -0
- data/lib/rggen/verilog/component.rb +7 -0
- data/lib/rggen/verilog/factories.rb +11 -0
- data/lib/rggen/verilog/feature.rb +35 -0
- data/lib/rggen/verilog/register/type.rb +101 -0
- data/lib/rggen/verilog/register/type/default.erb +29 -0
- data/lib/rggen/verilog/register/type/external.erb +27 -0
- data/lib/rggen/verilog/register/type/external.rb +45 -0
- data/lib/rggen/verilog/register/type/indirect.erb +31 -0
- data/lib/rggen/verilog/register/type/indirect.rb +18 -0
- data/lib/rggen/verilog/register/verilog_top.rb +58 -0
- data/lib/rggen/verilog/register_block/protocol.rb +51 -0
- data/lib/rggen/verilog/register_block/protocol/apb.erb +33 -0
- data/lib/rggen/verilog/register_block/protocol/apb.rb +40 -0
- data/lib/rggen/verilog/register_block/protocol/axi4lite.erb +48 -0
- data/lib/rggen/verilog/register_block/protocol/axi4lite.rb +92 -0
- data/lib/rggen/verilog/register_block/verilog_macros.erb +4 -0
- data/lib/rggen/verilog/register_block/verilog_top.rb +104 -0
- data/lib/rggen/verilog/register_file/verilog_top.rb +30 -0
- data/lib/rggen/verilog/setup.rb +11 -0
- data/lib/rggen/verilog/utility.rb +13 -0
- data/lib/rggen/verilog/utility/local_scope.rb +15 -0
- data/lib/rggen/verilog/version.rb +7 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7878131f03a9ff76e36b48e957c86b859c5ae3b7834689728c893d8105ff4be1
|
4
|
+
data.tar.gz: 13af428dc61822e225f563b15ca498605599791e06727bf591cbe977ac796a2c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: df8e7976ebea90a57a0c0214bcf5e0e584fa42a6c45bb4ded678170320c6ecf01b346a1114960358ce179e36f25524b704d317d3ac75124ab2a2fa50a617b104
|
7
|
+
data.tar.gz: c6373a81a9a1affe34d8c2b7c1f933d34d9e4a88df93937bc735cb91df44625eaf456cf9c130888641173942afa52c27d62edcdb3342d8efe2fc241ce4b46af8
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at taichi730@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Taichi Ishitani
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
[](https://badge.fury.io/rb/rggen-verilog)
|
2
|
+
[](https://github.com/rggen/rggen-verilog/actions?query=workflow%3ACI)
|
3
|
+
[](https://codeclimate.com/github/rggen/rggen-verilog/maintainability)
|
4
|
+
[](https://codecov.io/gh/rggen/rggen-verilog)
|
5
|
+
[](https://gitter.im/rggen/rggen?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
6
|
+
|
7
|
+
# RgGen::Verilog
|
8
|
+
|
9
|
+
RgGen::Verilog is a RgGen plugin to generate RTL written in Verilog.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
To install RgGen::Verilog, use the following command:
|
14
|
+
|
15
|
+
```
|
16
|
+
$ gem install rggen-verilog
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
You need to tell RgGen to load RgGen::Verilog plugin. There are two ways.
|
22
|
+
|
23
|
+
### Using `--plugin` runtime option
|
24
|
+
|
25
|
+
```
|
26
|
+
$ rggen --plugin rggen-verilog your_register_map.yml
|
27
|
+
```
|
28
|
+
|
29
|
+
### Using `RGGEN_PLUGINS` environment variable
|
30
|
+
|
31
|
+
```
|
32
|
+
$ export RGGEN_PLUGINS=${RGGEN_PLUGINS}:rggen-verilog
|
33
|
+
$ rggen your_register_map.yml
|
34
|
+
```
|
35
|
+
|
36
|
+
## Using Generated RTL
|
37
|
+
|
38
|
+
Generated RTL files are constructed by using common Verilog modules.
|
39
|
+
You need to get them from GitHub repository and set an environment variable to show their location.
|
40
|
+
|
41
|
+
* GitHub repository
|
42
|
+
* https://github.com/rggen/rggen-verilog-rtl.git
|
43
|
+
* Environment Variable
|
44
|
+
* RGGEN_VERILOG_RTL_ROOT
|
45
|
+
|
46
|
+
```
|
47
|
+
$ git clone https://github.com/rggen/rggen-verilog-rtl.git
|
48
|
+
$ export RGGEN_VERILOG_RTL_ROOT=`pwd`/rggen-verilog-rtl
|
49
|
+
```
|
50
|
+
|
51
|
+
Then, you can use generated RTL files with your deisgn. This is an example command.
|
52
|
+
|
53
|
+
```
|
54
|
+
$ simulator \
|
55
|
+
-f ${RGGEN_VERILOG_RTL_ROOT}/compile.f
|
56
|
+
your_csr_0.v your_csr_1.v your_design.v
|
57
|
+
```
|
58
|
+
|
59
|
+
## Contact
|
60
|
+
|
61
|
+
Feedbacks, bus reports, questions and etc. are welcome! You can post them bu using following ways:
|
62
|
+
|
63
|
+
* [GitHub Issue Tracker](https://github.com/rggen/rggen-verilog/issues)
|
64
|
+
* [Chat Room](https://gitter.im/rggen/rggen)
|
65
|
+
* [Mailing List](https://groups.google.com/d/forum/rggen)
|
66
|
+
* [Mail](mailto:rggen@googlegroups.com)
|
67
|
+
|
68
|
+
## Copyright & License
|
69
|
+
|
70
|
+
Copyright © 2020 Taichi Ishitani. RgGen::Verilog is licensed under the [MIT License](https://opensource.org/licenses/MIT), see [LICENSE](LICENSE) for futher details.
|
71
|
+
|
72
|
+
## Code of Conduct
|
73
|
+
|
74
|
+
Everyone interacting in the RgGen::Verilog project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rggen/rggen-verilog/blob/master/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rggen/systemverilog/rtl'
|
4
|
+
require_relative 'verilog/version'
|
5
|
+
require_relative 'verilog/utility/local_scope'
|
6
|
+
require_relative 'verilog/utility'
|
7
|
+
require_relative 'verilog/component'
|
8
|
+
require_relative 'verilog/feature'
|
9
|
+
require_relative 'verilog/factories'
|
10
|
+
|
11
|
+
module RgGen
|
12
|
+
module Verilog
|
13
|
+
PLUGIN_NAME = :'rggen-verilog'
|
14
|
+
|
15
|
+
FEATURES = [
|
16
|
+
'verilog/bit_field/type',
|
17
|
+
'verilog/bit_field/type/rc_w0c_w1c_wc_woc',
|
18
|
+
'verilog/bit_field/type/reserved',
|
19
|
+
'verilog/bit_field/type/ro',
|
20
|
+
'verilog/bit_field/type/rof',
|
21
|
+
'verilog/bit_field/type/rs_w0s_w1s_ws_wos',
|
22
|
+
'verilog/bit_field/type/rw_w1_wo_wo1',
|
23
|
+
'verilog/bit_field/type/rwc',
|
24
|
+
'verilog/bit_field/type/rwe',
|
25
|
+
'verilog/bit_field/type/rwl',
|
26
|
+
'verilog/bit_field/type/rws',
|
27
|
+
'verilog/bit_field/type/w0crs_w1crs_wcrs',
|
28
|
+
'verilog/bit_field/type/w0src_w1src_wsrc',
|
29
|
+
'verilog/bit_field/type/w0t_w1t',
|
30
|
+
'verilog/bit_field/type/w0trg_w1trg',
|
31
|
+
'verilog/bit_field/type/wrc_wrs',
|
32
|
+
'verilog/bit_field/verilog_top',
|
33
|
+
'verilog/register/type',
|
34
|
+
'verilog/register/type/external',
|
35
|
+
'verilog/register/type/indirect',
|
36
|
+
'verilog/register/verilog_top',
|
37
|
+
'verilog/register_block/protocol',
|
38
|
+
'verilog/register_block/protocol/apb',
|
39
|
+
'verilog/register_block/protocol/axi4lite',
|
40
|
+
'verilog/register_block/verilog_top',
|
41
|
+
'verilog/register_file/verilog_top'
|
42
|
+
].freeze
|
43
|
+
|
44
|
+
def self.register_component(builder)
|
45
|
+
builder.output_component_registry(:verilog) do
|
46
|
+
register_component [
|
47
|
+
:root, :register_block, :register_file, :register, :bit_field
|
48
|
+
] do |layer|
|
49
|
+
component Component, ComponentFactory
|
50
|
+
feature Feature, FeatureFactory if layer != :root
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.load_features
|
56
|
+
FEATURES.each { |feature| require_relative feature }
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.default_setup(builder)
|
60
|
+
register_component(builder)
|
61
|
+
load_features
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_list_feature(:bit_field, :type) do
|
4
|
+
verilog do
|
5
|
+
base_feature do
|
6
|
+
private
|
7
|
+
|
8
|
+
def full_name
|
9
|
+
bit_field.full_name('_')
|
10
|
+
end
|
11
|
+
|
12
|
+
def lsb
|
13
|
+
bit_field.lsb(bit_field.local_index)
|
14
|
+
end
|
15
|
+
|
16
|
+
def width
|
17
|
+
bit_field.width
|
18
|
+
end
|
19
|
+
|
20
|
+
def array_size
|
21
|
+
bit_field.array_size
|
22
|
+
end
|
23
|
+
|
24
|
+
def initial_value
|
25
|
+
index = bit_field.initial_value_array? && bit_field.local_index || 0
|
26
|
+
macro_call('rggen_slice', [bit_field.initial_value, width, index])
|
27
|
+
end
|
28
|
+
|
29
|
+
def clock
|
30
|
+
register_block.clock
|
31
|
+
end
|
32
|
+
|
33
|
+
def reset
|
34
|
+
register_block.reset
|
35
|
+
end
|
36
|
+
|
37
|
+
def bit_field_valid
|
38
|
+
register.bit_field_valid
|
39
|
+
end
|
40
|
+
|
41
|
+
def bit_field_read_mask
|
42
|
+
register.bit_field_read_mask[lsb, width]
|
43
|
+
end
|
44
|
+
|
45
|
+
def bit_field_write_mask
|
46
|
+
register.bit_field_write_mask[lsb, width]
|
47
|
+
end
|
48
|
+
|
49
|
+
def bit_field_write_data
|
50
|
+
register.bit_field_write_data[lsb, width]
|
51
|
+
end
|
52
|
+
|
53
|
+
def bit_field_read_data
|
54
|
+
register.bit_field_read_data[lsb, width]
|
55
|
+
end
|
56
|
+
|
57
|
+
def bit_field_value
|
58
|
+
register.bit_field_value[lsb, width]
|
59
|
+
end
|
60
|
+
|
61
|
+
def mask
|
62
|
+
reference_bit_field || hex(2**width - 1, width)
|
63
|
+
end
|
64
|
+
|
65
|
+
def reference_bit_field
|
66
|
+
bit_field.reference? &&
|
67
|
+
bit_field
|
68
|
+
.find_reference(register_block.bit_fields)
|
69
|
+
.value(bit_field.local_indices, bit_field.reference_width)
|
70
|
+
end
|
71
|
+
|
72
|
+
def loop_variables
|
73
|
+
bit_field.loop_variables
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
factory do
|
78
|
+
def target_feature_key(_configuration, bit_field)
|
79
|
+
type = bit_field.type
|
80
|
+
target_features.key?(type) && type ||
|
81
|
+
(error "code generator for #{type} bit field type is not implemented")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= module_name %> #(
|
2
|
+
<% if bit_field.type != :rc %>
|
3
|
+
.CLEAR_VALUE (<%= clear_value %>),
|
4
|
+
.WRITE_ONLY (<%= write_only %>),
|
5
|
+
<% end %>
|
6
|
+
.WIDTH (<%= width %>),
|
7
|
+
.INITIAL_VALUE (<%= initial_value %>)
|
8
|
+
) u_bit_field (
|
9
|
+
.i_clk (<%= clock %>),
|
10
|
+
.i_rst_n (<%= reset%>),
|
11
|
+
.i_bit_field_valid (<%= bit_field_valid %>),
|
12
|
+
.i_bit_field_read_mask (<%= bit_field_read_mask %>),
|
13
|
+
.i_bit_field_write_mask (<%= bit_field_write_mask %>),
|
14
|
+
.i_bit_field_write_data (<%= bit_field_write_data %>),
|
15
|
+
.o_bit_field_read_data (<%= bit_field_read_data %>),
|
16
|
+
.o_bit_field_value (<%= bit_field_value %>),
|
17
|
+
.i_set (<%= set[loop_variables] %>),
|
18
|
+
.i_mask (<%= mask %>),
|
19
|
+
.o_value (<%= value_out[loop_variables] %>),
|
20
|
+
.o_value_unmasked (<%= value_out_unmasked %>)
|
21
|
+
);
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_list_item_feature(:bit_field, :type, [:rc, :w0c, :w1c, :wc, :woc]) do
|
4
|
+
verilog do
|
5
|
+
build do
|
6
|
+
input :set, {
|
7
|
+
name: "i_#{full_name}_set", width: width, array_size: array_size
|
8
|
+
}
|
9
|
+
output :value_out, {
|
10
|
+
name: "o_#{full_name}", width: width, array_size: array_size
|
11
|
+
}
|
12
|
+
if bit_field.reference?
|
13
|
+
output :value_unmasked, {
|
14
|
+
name: "o_#{full_name}_unmasked", width: width, array_size: array_size
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
main_code :bit_field, from_template: true
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def module_name
|
24
|
+
bit_field.type == :rc && 'rggen_bit_field_rc' || 'rggen_bit_field_w01c_wc_woc'
|
25
|
+
end
|
26
|
+
|
27
|
+
def clear_value
|
28
|
+
value = { w0c: 0b00, w1c: 0b01, wc: 0b10, woc: 0b10 }[bit_field.type]
|
29
|
+
bin(value, 2)
|
30
|
+
end
|
31
|
+
|
32
|
+
def write_only
|
33
|
+
bit_field.write_only? && 1 || 0
|
34
|
+
end
|
35
|
+
|
36
|
+
def value_out_unmasked
|
37
|
+
(bit_field.reference? || nil) && value_unmasked[loop_variables]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
rggen_bit_field_reserved #(
|
2
|
+
.WIDTH (<%= width %>)
|
3
|
+
) u_bit_field (
|
4
|
+
.i_bit_field_valid (<%= bit_field_valid %>),
|
5
|
+
.i_bit_field_read_mask (<%= bit_field_read_mask %>),
|
6
|
+
.i_bit_field_write_mask (<%= bit_field_write_mask %>),
|
7
|
+
.i_bit_field_write_data (<%= bit_field_write_data %>),
|
8
|
+
.o_bit_field_read_data (<%= bit_field_read_data %>),
|
9
|
+
.o_bit_field_value (<%= bit_field_value %>)
|
10
|
+
);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
rggen_bit_field_ro #(
|
2
|
+
.WIDTH (<%= width %>)
|
3
|
+
) u_bit_field (
|
4
|
+
.i_bit_field_valid (<%= bit_field_valid %>),
|
5
|
+
.i_bit_field_read_mask (<%= bit_field_read_mask %>),
|
6
|
+
.i_bit_field_write_mask (<%= bit_field_write_mask %>),
|
7
|
+
.i_bit_field_write_data (<%= bit_field_write_data %>),
|
8
|
+
.o_bit_field_read_data (<%= bit_field_read_data %>),
|
9
|
+
.o_bit_field_value (<%= bit_field_value %>),
|
10
|
+
.i_value (<%= reference_or_value_in %>)
|
11
|
+
);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_list_item_feature(:bit_field, :type, :ro) do
|
4
|
+
verilog 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
|
+
end
|
12
|
+
|
13
|
+
main_code :bit_field, from_template: true
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def reference_or_value_in
|
18
|
+
bit_field.reference? && reference_bit_field || value_in[loop_variables]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|