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
cf4316f9
Commit
cf4316f9
authored
3 years ago
by
Daniel van der Schuur
Browse files
Options
Downloads
Patches
Plain Diff
-Cleaned code.
parent
4fdb66a5
No related branches found
No related tags found
1 merge request
!137
st_histogram updates. Ready for integration in LOFAR2.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/dsp/st/tb/vhdl/tb_st_histogram.vhd
+20
-23
20 additions, 23 deletions
libraries/dsp/st/tb/vhdl/tb_st_histogram.vhd
with
20 additions
and
23 deletions
libraries/dsp/st/tb/vhdl/tb_st_histogram.vhd
+
20
−
23
View file @
cf4316f9
...
...
@@ -80,10 +80,9 @@ ARCHITECTURE tb OF tb_st_histogram IS
-- Constants derived from generics
---------------------------------------------------------------------------
CONSTANT
c_expected_ram_content_counter
:
NATURAL
:
=
g_nof_data_per_sync
/
g_nof_bins
;
CONSTANT
c_nof_levels_per_bin
:
NATURAL
:
=
(
2
**
g_data_w
)
/
g_nof_bins
;
--e.g. 2 values per bin if g_data_w=9 (512 levels) and g_nof_bins=256
CONSTANT
c_ram_dat_w
:
NATURAL
:
=
ceil_log2
(
g_nof_data_per_sync
)
+
1
;
CONSTANT
c_ram_adr_w
:
NATURAL
:
=
ceil_log2
(
g_nof_bins
);
CONSTANT
c_nof_levels_per_bin
:
NATURAL
:
=
(
2
**
g_data_w
)
/
g_nof_bins
;
--e.g. 2 values per bin if g_data_w=9 (512 levels) and g_nof_bins=256
CONSTANT
c_ram_dat_w
:
NATURAL
:
=
ceil_log2
(
g_nof_data_per_sync
)
+
1
;
CONSTANT
c_ram_adr_w
:
NATURAL
:
=
ceil_log2
(
g_nof_bins
);
---------------------------------------------------------------------------
-- Clocks and resets
...
...
@@ -98,21 +97,20 @@ ARCHITECTURE tb OF tb_st_histogram IS
----------------------------------------------------------------------------
-- stimuli
----------------------------------------------------------------------------
CONSTANT
c_sine_amplitude
:
REAL
:
=
real
((
2
**
g_data_w
)
/
2-1
);
CONSTANT
c_sine_amplitude
:
REAL
:
=
real
((
2
**
g_data_w
)
/
2-1
);
CONSTANT
c_sine_nof_periods
:
REAL
:
=
1
.
0
;
CONSTANT
c_sine_nof_samples_per_period
:
REAL
:
=
real
(
g_nof_data_per_sync
)
/
c_sine_nof_periods
;
CONSTANT
c_sine_time_step_denom
:
REAL
:
=
sel_a_b
(
g_lock_sine
,
MATH_2_PI
,
5
.
0
);
-- Use 5 instead of 2 pi to create unlocked, drifting sine wave
CONSTANT
c_sine_time_step
:
REAL
:
=
c_sine_time_step_denom
/
c_sine_nof_samples_per_period
;
SIGNAL
stimuli_en
:
STD_LOGIC
:
=
'1'
;
SIGNAL
stimuli_src_out
:
t_dp_sosi
;
SIGNAL
stimuli_en
:
STD_LOGIC
:
=
'1'
;
SIGNAL
stimuli_src_out
:
t_dp_sosi
;
SIGNAL
nxt_stimuli_src_out
:
t_dp_sosi
;
SIGNAL
stimuli_src_in
:
t_dp_siso
;
SIGNAL
stimuli_count
:
REAL
;
SIGNAL
stimuli_data
:
STD_LOGIC_VECTOR
(
g_data_w
-1
DOWNTO
0
);
--
NOTE This is undefined in the wave window
SIGNAL
stimuli_done
:
STD_LOGIC
;
SIGNAL
stimuli_src_in
:
t_dp_siso
;
SIGNAL
stimuli_count
:
REAL
;
SIGNAL
stimuli_data
:
STD_LOGIC_VECTOR
(
g_data_w
-1
DOWNTO
0
);
--
QuestaSim: Format->Analog, Radix->Decimal
SIGNAL
random_data
:
STD_LOGIC_VECTOR
(
g_data_w
-1
DOWNTO
0
);
SIGNAL
stimuli_done
:
STD_LOGIC
;
----------------------------------------------------------------------------
-- st_histogram
...
...
@@ -131,8 +129,8 @@ ARCHITECTURE tb OF tb_st_histogram IS
SIGNAL
histogram_bin_signed
:
INTEGER
;
-- QuestaSim: Radix->Decimal
SIGNAL
histogram_valid
:
STD_LOGIC
;
SIGNAL
sum_of_bins
:
NATURAL
;
SIGNAL
verification_done
:
STD_LOGIC
;
SIGNAL
sum_of_bins
:
NATURAL
;
SIGNAL
verification_done
:
STD_LOGIC
;
BEGIN
...
...
@@ -188,13 +186,10 @@ BEGIN
nxt_stimuli_src_out
.
valid
<=
'1'
;
stimuli_count
<=
0
.
0
;
FOR
I
IN
0
TO
g_nof_sync
-1
LOOP
-- nxt_stimuli_src_out.data <= (OTHERS=>'0');
-- stimuli_data <= (OTHERS=>'0');
nxt_stimuli_src_out
.
sync
<=
'1'
;
-- cycle 0
WAIT
FOR
5
ns
;
FOR
j
IN
1
TO
g_nof_data_per_sync
-1
LOOP
--cycles 1..g_nof_data_per_sync-1
nxt_stimuli_src_out
.
sync
<=
'0'
;
-- stimuli_data <= TO_SVEC( integer(round( c_sine_amplitude * sin(stimuli_count) )), g_data_w);
nxt_stimuli_src_out
.
data
(
g_data_w
-1
DOWNTO
0
)
<=
TO_SVEC
(
integer
(
round
(
c_sine_amplitude
*
sin
(
stimuli_count
)
)),
g_data_w
);
stimuli_count
<=
stimuli_count
+
c_sine_time_step
;
WAIT
FOR
5
ns
;
...
...
@@ -206,13 +201,13 @@ BEGIN
IF
g_stimuli_mode
=
"random"
THEN
nxt_stimuli_src_out
.
valid
<=
'1'
;
FOR
I
IN
0
TO
g_nof_sync
-1
LOOP
stimuli
_data
<=
(
OTHERS
=>
'0'
);
random
_data
<=
(
OTHERS
=>
'0'
);
nxt_stimuli_src_out
.
sync
<=
'1'
;
-- cycle 0
WAIT
FOR
5
ns
;
FOR
j
IN
1
TO
g_nof_data_per_sync
-1
LOOP
nxt_stimuli_src_out
.
sync
<=
'0'
;
stimuli
_data
<=
func_common_random
(
stimuli
_data
);
nxt_stimuli_src_out
.
data
(
g_data_w
-1
DOWNTO
0
)
<=
stimuli
_data
;
--all g_nof_data_per_sync cycles
random
_data
<=
func_common_random
(
random
_data
);
nxt_stimuli_src_out
.
data
(
g_data_w
-1
DOWNTO
0
)
<=
random
_data
;
--all g_nof_data_per_sync cycles
WAIT
FOR
5
ns
;
END
LOOP
;
END
LOOP
;
...
...
@@ -232,8 +227,10 @@ BEGIN
stimuli_src_out
<=
nxt_stimuli_src_out
;
END
IF
;
END
PROCESS
;
-- nxt_stimuli_src_out.data(g_data_w-1 DOWNTO 0) <= stimuli_data;
-- signal to verify histogram by eye in the wave window
stimuli_data
<=
stimuli_src_out
.
data
(
g_data_w
-1
DOWNTO
0
);
----------------------------------------------------------------------------
-- st_histogram
...
...
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