rggen-vhdl 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE +21 -0
- data/README.md +74 -0
- data/lib/rggen/vhdl.rb +50 -0
- data/lib/rggen/vhdl/bit_field/type.rb +85 -0
- data/lib/rggen/vhdl/bit_field/type/rc_w0c_w1c_wc_woc.erb +27 -0
- data/lib/rggen/vhdl/bit_field/type/rc_w0c_w1c_wc_woc.rb +51 -0
- data/lib/rggen/vhdl/bit_field/type/ro.erb +24 -0
- data/lib/rggen/vhdl/bit_field/type/ro.rb +21 -0
- data/lib/rggen/vhdl/bit_field/type/rof.erb +24 -0
- data/lib/rggen/vhdl/bit_field/type/rof.rb +7 -0
- data/lib/rggen/vhdl/bit_field/type/rs_w0s_w1s_ws_wos.erb +27 -0
- data/lib/rggen/vhdl/bit_field/type/rs_w0s_w1s_ws_wos.rb +42 -0
- data/lib/rggen/vhdl/bit_field/type/rw_w1_wo_wo1.erb +26 -0
- data/lib/rggen/vhdl/bit_field/type/rw_w1_wo_wo1.rb +23 -0
- data/lib/rggen/vhdl/bit_field/type/rwc.erb +25 -0
- data/lib/rggen/vhdl/bit_field/type/rwc.rb +24 -0
- data/lib/rggen/vhdl/bit_field/type/rwe_rwl.erb +25 -0
- data/lib/rggen/vhdl/bit_field/type/rwe_rwl.rb +33 -0
- data/lib/rggen/vhdl/bit_field/type/rws.erb +24 -0
- data/lib/rggen/vhdl/bit_field/type/rws.rb +27 -0
- data/lib/rggen/vhdl/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc.erb +26 -0
- data/lib/rggen/vhdl/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc.rb +36 -0
- data/lib/rggen/vhdl/bit_field/type/w0t_w1t.erb +25 -0
- data/lib/rggen/vhdl/bit_field/type/w0t_w1t.rb +22 -0
- data/lib/rggen/vhdl/bit_field/type/w0trg_w1trg.erb +17 -0
- data/lib/rggen/vhdl/bit_field/type/w0trg_w1trg.rb +19 -0
- data/lib/rggen/vhdl/bit_field/type/wrc_wrs.erb +25 -0
- data/lib/rggen/vhdl/bit_field/type/wrc_wrs.rb +22 -0
- data/lib/rggen/vhdl/bit_field/vhdl_top.rb +93 -0
- data/lib/rggen/vhdl/component.rb +7 -0
- data/lib/rggen/vhdl/factories.rb +11 -0
- data/lib/rggen/vhdl/feature.rb +31 -0
- data/lib/rggen/vhdl/register/default.erb +29 -0
- data/lib/rggen/vhdl/register/type.rb +109 -0
- data/lib/rggen/vhdl/register/type/default.erb +31 -0
- data/lib/rggen/vhdl/register/type/external.erb +29 -0
- data/lib/rggen/vhdl/register/type/external.rb +44 -0
- data/lib/rggen/vhdl/register/type/indirect.erb +35 -0
- data/lib/rggen/vhdl/register/type/indirect.rb +34 -0
- data/lib/rggen/vhdl/register/vhdl_top.rb +40 -0
- data/lib/rggen/vhdl/register_block/protocol.rb +48 -0
- data/lib/rggen/vhdl/register_block/protocol/apb.erb +34 -0
- data/lib/rggen/vhdl/register_block/protocol/apb.rb +20 -0
- data/lib/rggen/vhdl/register_block/protocol/axi4lite.erb +49 -0
- data/lib/rggen/vhdl/register_block/protocol/axi4lite.rb +42 -0
- data/lib/rggen/vhdl/register_block/vhdl_top.erb +26 -0
- data/lib/rggen/vhdl/register_block/vhdl_top.rb +103 -0
- data/lib/rggen/vhdl/register_file/vhdl_top.rb +25 -0
- data/lib/rggen/vhdl/setup.rb +11 -0
- data/lib/rggen/vhdl/utility.rb +28 -0
- data/lib/rggen/vhdl/utility/data_object.rb +91 -0
- data/lib/rggen/vhdl/utility/identifier.rb +38 -0
- data/lib/rggen/vhdl/utility/local_scope.rb +66 -0
- data/lib/rggen/vhdl/version.rb +7 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 06a1c6755b2a8f179607870c8d2d5a24b770008fce59619c3cdad8364da46161
|
4
|
+
data.tar.gz: 42961741bd866c5e5ed2e4d3e99026214e6dfa499919abda73c3f882b55196f7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 97ea8805f99296c3cabd602164a3c919d54fbb7b19d66685884ce7da31987d14001d944f2e1856216bd059e1d3fa09945532b357e27f7fd22378f8f6633c9c63
|
7
|
+
data.tar.gz: 1cccbac061bd475c8a2af1f9c569c59269274ff91b41da806e77ccc94429c113bdd169f7a668777409e1a127e934bcc76fcdb1689f75b6388c75840eb833f589
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at taichi730@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 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
|
+
[![Gem Version](https://badge.fury.io/rb/rggen-vhdl.svg)](https://badge.fury.io/rb/rggen-vhdl)
|
2
|
+
[![CI](https://github.com/rggen/rggen-vhdl/actions/workflows/ci.yml/badge.svg)](https://github.com/rggen/rggen-vhdl/actions/workflows/ci.yml)
|
3
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/d30b2c06ae3d7c0f254a/maintainability)](https://codeclimate.com/github/rggen/rggen-vhdl/maintainability)
|
4
|
+
[![codecov](https://codecov.io/gh/rggen/rggen-vhdl/branch/master/graph/badge.svg?token=cyo9R4xCje)](https://codecov.io/gh/rggen/rggen-vhdl)
|
5
|
+
[![Gitter](https://badges.gitter.im/rggen/rggen.svg)](https://gitter.im/rggen/rggen?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
6
|
+
|
7
|
+
# RgGen::VHDL
|
8
|
+
|
9
|
+
RgGen::VHDL is a RgGen plugin to generate RTL written in VHDL.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
To install RgGen::VHDL, use the following command:
|
14
|
+
|
15
|
+
```
|
16
|
+
$ gem install rggen-vhdl
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
You need to tell RgGen to load RgGen::VHDL plugin. There are two ways.
|
22
|
+
|
23
|
+
### Using `--plugin` runtime option
|
24
|
+
|
25
|
+
```
|
26
|
+
$ rggen --plugin rggen-vhdl your_register_map.yml
|
27
|
+
```
|
28
|
+
|
29
|
+
### Using `RGGEN_PLUGINS` environment variable
|
30
|
+
|
31
|
+
```
|
32
|
+
$ export RGGEN_PLUGINS=${RGGEN_PLUGINS}:rggen-vhdl
|
33
|
+
$ rggen your_register_map.yml
|
34
|
+
```
|
35
|
+
|
36
|
+
## Using Generated RTL
|
37
|
+
|
38
|
+
Generated RTL modules are constructed by using common VHDL modules.
|
39
|
+
You need to get them from the GitHub repository and set an envirnment variable to show their location.
|
40
|
+
|
41
|
+
* GitHub repository
|
42
|
+
* https://github.com/rggen/rggen-vhdl-rtl.git
|
43
|
+
* Environment variable
|
44
|
+
* RGGEN_VHDL_RTL_ROOT
|
45
|
+
|
46
|
+
```
|
47
|
+
$ git clone https://github.com/rggen/rggen-vhdl-rtl.git
|
48
|
+
$ export RGGEN_VHDL_RTL_ROOT=`pwd`/rggen-vhdl-rtl
|
49
|
+
```
|
50
|
+
|
51
|
+
Then, you can use generated RTL modules with your design. This is an example command.
|
52
|
+
|
53
|
+
```
|
54
|
+
$ simulator \
|
55
|
+
-f ${RGGEN_VHDL_RTL_ROOT}/compile.f
|
56
|
+
your_csr_0.vhd your_csr_1.vhd your_design.vhd
|
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-vhdl/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 © 2021 Taichi Ishitani. RgGen::VHDL 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::VHDL project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rggen/rggen-vhdl/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/rggen/vhdl.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rggen/systemverilog'
|
4
|
+
require_relative 'vhdl/version'
|
5
|
+
require_relative 'vhdl/utility/identifier'
|
6
|
+
require_relative 'vhdl/utility/data_object'
|
7
|
+
require_relative 'vhdl/utility/local_scope'
|
8
|
+
require_relative 'vhdl/utility'
|
9
|
+
require_relative 'vhdl/component'
|
10
|
+
require_relative 'vhdl/feature'
|
11
|
+
require_relative 'vhdl/factories'
|
12
|
+
|
13
|
+
module RgGen
|
14
|
+
module VHDL
|
15
|
+
extend Core::Plugin
|
16
|
+
|
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',
|
27
|
+
'vhdl/bit_field/type/rof',
|
28
|
+
'vhdl/bit_field/type/rs_w0s_w1s_ws_wos',
|
29
|
+
'vhdl/bit_field/type/rw_w1_wo_wo1',
|
30
|
+
'vhdl/bit_field/type/rwc',
|
31
|
+
'vhdl/bit_field/type/rwe_rwl',
|
32
|
+
'vhdl/bit_field/type/rws',
|
33
|
+
'vhdl/bit_field/type/w0crs_w0src_w1crs_w1src_wcrs_wsrc',
|
34
|
+
'vhdl/bit_field/type/w0t_w1t',
|
35
|
+
'vhdl/bit_field/type/w0trg_w1trg',
|
36
|
+
'vhdl/bit_field/type/wrc_wrs',
|
37
|
+
'vhdl/bit_field/vhdl_top',
|
38
|
+
'vhdl/register/type',
|
39
|
+
'vhdl/register/type/external',
|
40
|
+
'vhdl/register/type/indirect',
|
41
|
+
'vhdl/register/vhdl_top',
|
42
|
+
'vhdl/register_block/protocol',
|
43
|
+
'vhdl/register_block/protocol/apb',
|
44
|
+
'vhdl/register_block/protocol/axi4lite',
|
45
|
+
'vhdl/register_block/vhdl_top',
|
46
|
+
'vhdl/register_file/vhdl_top'
|
47
|
+
]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_list_feature(:bit_field, :type) do
|
4
|
+
vhdl 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
|
+
"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 || "(others => '1')"
|
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,27 @@
|
|
1
|
+
u_bit_field: entity work.rggen_bit_field
|
2
|
+
generic map (
|
3
|
+
WIDTH => <%= width %>,
|
4
|
+
INITIAL_VALUE => <%= initial_value %>,
|
5
|
+
SW_READ_ACTION => <%= read_action %>,
|
6
|
+
SW_WRITE_ACTION => <%= write_action %>,
|
7
|
+
HW_SET_WIDTH => <%= width %>
|
8
|
+
)
|
9
|
+
port map (
|
10
|
+
i_clk => <%= clock %>,
|
11
|
+
i_rst_n => <%= reset %>,
|
12
|
+
i_sw_valid => <%= bit_field_valid %>,
|
13
|
+
i_sw_read_mask => <%= bit_field_read_mask %>,
|
14
|
+
i_sw_write_enable => <%= write_enable %>,
|
15
|
+
i_sw_write_mask => <%= bit_field_write_mask %>,
|
16
|
+
i_sw_write_data => <%= bit_field_write_data %>,
|
17
|
+
o_sw_read_data => <%= bit_field_read_data %>,
|
18
|
+
o_sw_value => <%= bit_field_value %>,
|
19
|
+
i_hw_write_enable => "0",
|
20
|
+
i_hw_write_data => (others => '0'),
|
21
|
+
i_hw_set => <%= set[loop_variables] %>,
|
22
|
+
i_hw_clear => (others => '0'),
|
23
|
+
i_value => (others => '0'),
|
24
|
+
i_mask => <%= mask %>,
|
25
|
+
o_value => <%= value_out[loop_variables] %>,
|
26
|
+
o_value_unmasked => <%= value_out_unmasked %>
|
27
|
+
);
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_list_item_feature(:bit_field, :type, [:rc, :w0c, :w1c, :wc, :woc]) do
|
4
|
+
vhdl 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 read_action
|
24
|
+
{
|
25
|
+
rc: 'RGGEN_READ_CLEAR',
|
26
|
+
w0c: 'RGGEN_READ_DEFAULT',
|
27
|
+
w1c: 'RGGEN_READ_DEFAULT',
|
28
|
+
wc: 'RGGEN_READ_DEFAULT',
|
29
|
+
woc: 'RGGEN_READ_NONE'
|
30
|
+
}[bit_field.type]
|
31
|
+
end
|
32
|
+
|
33
|
+
def write_action
|
34
|
+
{
|
35
|
+
rc: 'RGGEN_WRITE_NONE',
|
36
|
+
w0c: 'RGGEN_WRITE_0_CLEAR',
|
37
|
+
w1c: 'RGGEN_WRITE_1_CLEAR',
|
38
|
+
wc: 'RGGEN_WRITE_CLEAR',
|
39
|
+
woc: 'RGGEN_WRITE_CLEAR'
|
40
|
+
}[bit_field.type]
|
41
|
+
end
|
42
|
+
|
43
|
+
def write_enable
|
44
|
+
bit_field.writable? && bin(1, 1) || bin(0, 1)
|
45
|
+
end
|
46
|
+
|
47
|
+
def value_out_unmasked
|
48
|
+
bit_field.reference? && value_unmasked[loop_variables] || 'open'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
u_bit_field: entity work.rggen_bit_field
|
2
|
+
generic map (
|
3
|
+
WIDTH => <%= width %>,
|
4
|
+
STORAGE => false
|
5
|
+
)
|
6
|
+
port map (
|
7
|
+
i_clk => '0',
|
8
|
+
i_rst_n => '0',
|
9
|
+
i_sw_valid => <%= bit_field_valid %>,
|
10
|
+
i_sw_read_mask => <%= bit_field_read_mask %>,
|
11
|
+
i_sw_write_enable => "0",
|
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_hw_write_enable => "0",
|
17
|
+
i_hw_write_data => (others => '0'),
|
18
|
+
i_hw_set => (others => '0'),
|
19
|
+
i_hw_clear => (others => '0'),
|
20
|
+
i_value => <%= reference_or_value_in %>,
|
21
|
+
i_mask => (others => '1'),
|
22
|
+
o_value => open,
|
23
|
+
o_value_unmasked => open
|
24
|
+
);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RgGen.define_list_item_feature(:bit_field, :type, :ro) 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
|
+
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
|