Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HDL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RTSD
HDL
Commits
3fcf8058
Commit
3fcf8058
authored
8 years ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Added proc_common_dclk_generate_sclk()
parent
02259455
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/base/common/src/vhdl/common_pkg.vhd
+57
-0
57 additions, 0 deletions
libraries/base/common/src/vhdl/common_pkg.vhd
with
57 additions
and
0 deletions
libraries/base/common/src/vhdl/common_pkg.vhd
+
57
−
0
View file @
3fcf8058
...
@@ -429,6 +429,11 @@ PACKAGE common_pkg IS
...
@@ -429,6 +429,11 @@ PACKAGE common_pkg IS
FUNCTION
func_common_reorder2_get_select
(
I
,
J
,
N
:
NATURAL
;
select_arr
:
t_natural_arr
)
RETURN
NATURAL
;
FUNCTION
func_common_reorder2_get_select
(
I
,
J
,
N
:
NATURAL
;
select_arr
:
t_natural_arr
)
RETURN
NATURAL
;
FUNCTION
func_common_reorder2_inverse_select
(
N
:
NATURAL
;
select_arr
:
t_natural_arr
)
RETURN
t_natural_arr
;
FUNCTION
func_common_reorder2_inverse_select
(
N
:
NATURAL
;
select_arr
:
t_natural_arr
)
RETURN
t_natural_arr
;
-- Generate faster sample SCLK from digital DCLK for sim only
PROCEDURE
proc_common_dclk_generate_sclk
(
CONSTANT
Pfactor
:
IN
POSITIVE
;
SIGNAL
dclk
:
IN
STD_LOGIC
;
SIGNAL
sclk
:
INOUT
STD_LOGIC
);
END
common_pkg
;
END
common_pkg
;
PACKAGE
BODY
common_pkg
IS
PACKAGE
BODY
common_pkg
IS
...
@@ -2200,5 +2205,57 @@ PACKAGE BODY common_pkg IS
...
@@ -2200,5 +2205,57 @@ PACKAGE BODY common_pkg IS
RETURN
v_inverse_arr
;
RETURN
v_inverse_arr
;
END
func_common_reorder2_inverse_select
;
END
func_common_reorder2_inverse_select
;
------------------------------------------------------------------------------
-- PROCEDURE: Generate faster sample SCLK from digital DCLK for sim only
-- Description:
-- The SCLK kan be used to serialize Pfactor >= 1 symbols per word and then
-- view them in a scope component that is use internally in the design.
-- The scope component is only instantiated for simulation, to view the
-- serialized symbols, typically with decimal radix and analogue format.
-- The scope component will not be synthesized, because the SCLK can not
-- be synthesized.
--
-- Pfactor = 4
-- _______ _______ _______ _______
-- DCLK ___| |_______| |_______| |_______| |_______
-- ___________________ _ _ _ _ _ _ _ _ _ _ _ _
-- SCLK |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_|
--
-- The rising edges of SCLK occur after the rising edge of DCLK, to ensure
-- that they all apply to the same wide data word that was clocked by the
-- rising edge of the DCLK.
------------------------------------------------------------------------------
PROCEDURE
proc_common_dclk_generate_sclk
(
CONSTANT
Pfactor
:
IN
POSITIVE
;
SIGNAL
dclk
:
IN
STD_LOGIC
;
SIGNAL
sclk
:
INOUT
STD_LOGIC
)
IS
VARIABLE
v_dperiod
:
TIME
;
VARIABLE
v_speriod
:
TIME
;
BEGIN
SCLK
<=
'1'
;
-- Measure DCLK period
WAIT
UNTIL
rising_edge
(
DCLK
);
v_dperiod
:
=
NOW
;
WAIT
UNTIL
rising_edge
(
DCLK
);
v_dperiod
:
=
NOW
-
v_dperiod
;
v_speriod
:
=
v_dperiod
/
Pfactor
;
-- Generate Pfactor SCLK periods per DCLK period
WHILE
TRUE
LOOP
-- Realign at every DCLK
WAIT
UNTIL
rising_edge
(
DCLK
);
-- Create Pfactor SCLK periods within this DCLK period
SCLK
<=
'0'
;
IF
Pfactor
>
1
THEN
FOR
I
IN
0
TO
2
*
Pfactor
-1-2
LOOP
WAIT
FOR
v_speriod
/
2
;
SCLK
<=
NOT
SCLK
;
END
LOOP
;
END
IF
;
WAIT
FOR
v_speriod
/
2
;
SCLK
<=
'1'
;
-- Wait for next DCLK
END
LOOP
;
WAIT
;
END
proc_common_dclk_generate_sclk
;
END
common_pkg
;
END
common_pkg
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment