Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Platform-independent core collection
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
14
Issues
14
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Platform-independent core collection
Commits
75d51c0b
Commit
75d51c0b
authored
Dec 13, 2019
by
Dimitris Lampridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[common] add VHDL functions to upper/lower case characters and strings
parent
be61ce73
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
CHANGELOG.md
CHANGELOG.md
+2
-0
gencores_pkg.vhd
modules/common/gencores_pkg.vhd
+48
-0
No files found.
CHANGELOG.md
View file @
75d51c0b
...
...
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[
Semantic Versioning
](
https://semver.org/spec/v2.0.0.html
)
.
## [Unreleased]
### Added
-
VHDL functions to convert characters and strings to upper/lower case.
## [1.0.0] - 2019-10-21
### Added
...
...
modules/common/gencores_pkg.vhd
View file @
75d51c0b
...
...
@@ -726,6 +726,12 @@ package gencores_pkg is
function
f_pick
(
cond
:
std_logic
;
if_1
:
std_logic_vector
;
if_0
:
std_logic_vector
)
return
std_logic_vector
;
-- Functions to convert characters and strings to upper/lower case
function
to_upper
(
c
:
character
)
return
character
;
function
to_lower
(
c
:
character
)
return
character
;
function
to_upper
(
s
:
string
)
return
string
;
function
to_lower
(
s
:
string
)
return
string
;
end
package
;
package
body
gencores_pkg
is
...
...
@@ -954,4 +960,46 @@ package body gencores_pkg is
return
f_pick
(
f_to_std_logic
(
cond
),
if_1
,
if_0
);
end
function
f_pick
;
------------------------------------------------------------------------------
-- Functions to convert characters and strings to upper/lower case
------------------------------------------------------------------------------
function
to_upper
(
c
:
character
)
return
character
is
variable
i
:
integer
;
begin
i
:
=
character
'pos
(
c
);
if
(
i
>
96
and
i
<
123
)
then
i
:
=
i
-
32
;
end
if
;
return
character
'val
(
i
);
end
function
to_upper
;
function
to_lower
(
c
:
character
)
return
character
is
variable
i
:
integer
;
begin
i
:
=
character
'pos
(
c
);
if
(
i
>
64
and
i
<
91
)
then
i
:
=
i
+
32
;
end
if
;
return
character
'val
(
i
);
end
function
to_lower
;
function
to_upper
(
s
:
string
)
return
string
is
variable
uppercase
:
string
(
s
'range
);
begin
for
i
in
s
'range
loop
uppercase
(
i
)
:
=
to_upper
(
s
(
i
));
end
loop
;
return
uppercase
;
end
to_upper
;
function
to_lower
(
s
:
string
)
return
string
is
variable
lowercase
:
string
(
s
'range
);
begin
for
i
in
s
'range
loop
lowercase
(
i
)
:
=
to_lower
(
s
(
i
));
end
loop
;
return
lowercase
;
end
to_lower
;
end
gencores_pkg
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment