Skip to content
GitLab
Explore
Sign in
Register
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
add79007
Commit
add79007
authored
3 years ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Use exp_subband_power dependend on subband weight and selector setting.
parent
99bfa45f
Branches
Branches containing commit
No related tags found
1 merge request
!198
Clarified reading one WPFB unit into sp_subband_powers_arr2. Updated comments....
Pipeline
#24614
passed
3 years ago
Stage: simulation
Stage: synthesis
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/lofar2_unb2b_sdp_station_fsub/tb_lofar2_unb2b_sdp_station_fsub.vhd
+67
-60
67 additions, 60 deletions
...b2b_sdp_station_fsub/tb_lofar2_unb2b_sdp_station_fsub.vhd
with
67 additions
and
60 deletions
applications/lofar2/designs/lofar2_unb2b_sdp_station/revisions/lofar2_unb2b_sdp_station_fsub/tb_lofar2_unb2b_sdp_station_fsub.vhd
+
67
−
60
View file @
add79007
...
...
@@ -33,7 +33,7 @@
-- 2) Read current BSN from reg_bsn_scheduler_wg and write reg_bsn_scheduler_wg
-- to trigger start of WG at BSN.
--
-- 3) Read subband statistics (SST) via MM and verify with
c_
exp_subband_power at g_subband.
-- 3) Read subband statistics (SST) via MM and verify with exp_subband_power at g_subband.
-- . use weighted subbands (default selected by MM)
--
-- 4) View in wave window
...
...
@@ -127,7 +127,12 @@ ARCHITECTURE tb OF tb_lofar2_unb2b_sdp_station_fsub IS
CONSTANT
c_pol_index
:
NATURAL
:
=
g_sp
MOD
c_sdp_Q_fft
;
CONSTANT
c_pfb_index
:
NATURAL
:
=
g_sp
/
c_sdp_Q_fft
;
-- only read used WPFB unit out of range(c_sdp_P_pfb = 6)
CONSTANT
c_exp_subband_sp_power_ratio
:
REAL
:
=
1
.
0
/
8
.
0
;
-- subband power / SP power, depends on internal WPFB quantization and FIR coefficients
CONSTANT
c_exp_subband_power
:
REAL
:
=
c_exp_wg_power_sp
*
c_exp_subband_sp_power_ratio
;
CONSTANT
c_exp_subband_power_raw
:
REAL
:
=
c_exp_wg_power_sp
*
c_exp_subband_sp_power_ratio
;
CONSTANT
c_exp_subband_power_weighted
:
REAL
:
=
c_exp_subband_power_raw
*
g_subband_gain
**
2
.
0
;
-- . expected limit values, obtained with print_str() for g_subband = 102
CONSTANT
c_exp_subband_power_leakage_snr_dB
:
REAL
:
=
75
.
0
;
-- < 76.372
CONSTANT
c_exp_subband_power_crosstalk_snr_dB
:
REAL
:
=
95
.
0
;
-- < 96.284
TYPE
t_real_arr
IS
ARRAY
(
INTEGER
RANGE
<>
)
OF
REAL
;
TyPE
t_slv_64_subbands_arr
IS
ARRAY
(
INTEGER
RANGE
<>
)
OF
t_slv_64_arr
(
0
TO
c_sdp_N_sub
-1
);
...
...
@@ -136,11 +141,6 @@ ARCHITECTURE tb OF tb_lofar2_unb2b_sdp_station_fsub IS
CONSTANT
c_subband_weight_re
:
INTEGER
:
=
INTEGER
(
g_subband_gain
*
REAL
(
c_sdp_unit_sub_weight
)
*
COS
(
g_subband_phase
*
MATH_2_PI
/
360
.
0
));
CONSTANT
c_subband_weight_im
:
INTEGER
:
=
INTEGER
(
g_subband_gain
*
REAL
(
c_sdp_unit_sub_weight
)
*
SIN
(
g_subband_phase
*
MATH_2_PI
/
360
.
0
));
SIGNAL
sp_subband_weight_re
:
INTEGER
:
=
0
;
SIGNAL
sp_subband_weight_im
:
INTEGER
:
=
0
;
SIGNAL
sp_subband_weight_gain
:
REAL
:
=
0
.
0
;
SIGNAL
sp_subband_weight_phase
:
REAL
:
=
0
.
0
;
-- MM
-- . Address widths of a single MM instance
CONSTANT
c_addr_w_reg_diag_wg
:
NATURAL
:
=
2
;
...
...
@@ -176,13 +176,17 @@ ARCHITECTURE tb OF tb_lofar2_unb2b_sdp_station_fsub IS
SIGNAL
sp_subband_power_crosstalk
:
REAL
:
=
0
.
0
;
SIGNAL
sp_subband_power_crosstalk_snr_dB
:
REAL
:
=
0
.
0
;
-- signal to noise (crosstalk) ration
-- . expected limit values, obtained with print_str() for g_subband = 102
CONSTANT
c_exp_subband_power_leakage_snr_dB
:
REAL
:
=
75
.
0
;
-- < 76.372
CONSTANT
c_exp_subband_power_crosstalk_snr_dB
:
REAL
:
=
95
.
0
;
-- < 96.284
SIGNAL
exp_subband_power
:
REAL
:
=
0
.
0
;
-- . Selector
SIGNAL
sst_offload_weighted_subbands
:
STD_LOGIC
;
-- . Subband equalizer
SIGNAL
sp_subband_weight_re
:
INTEGER
:
=
0
;
SIGNAL
sp_subband_weight_im
:
INTEGER
:
=
0
;
SIGNAL
sp_subband_weight_gain
:
REAL
:
=
0
.
0
;
SIGNAL
sp_subband_weight_phase
:
REAL
:
=
0
.
0
;
-- DUT
SIGNAL
ext_clk
:
STD_LOGIC
:
=
'0'
;
SIGNAL
ext_pps
:
STD_LOGIC
:
=
'0'
;
...
...
@@ -283,6 +287,8 @@ BEGIN
JESD204B_SYNC_N
=>
jesd204b_sync_n
);
exp_subband_power
<=
sel_a_b
(
sst_offload_weighted_subbands
=
'0'
,
c_exp_subband_power_raw
,
c_exp_subband_power_weighted
);
------------------------------------------------------------------------------
-- MM slave accesses via file IO
------------------------------------------------------------------------------
...
...
@@ -292,9 +298,9 @@ BEGIN
VARIABLE
v_bsn
:
NATURAL
;
VARIABLE
v_data_lo
,
v_data_hi
:
STD_LOGIC_VECTOR
(
c_word_w
-1
DOWNTO
0
);
VARIABLE
v_stat_data
:
STD_LOGIC_VECTOR
(
c_longword_w
-1
DOWNTO
0
);
VARIABLE
v_len
,
v_span
,
v_offset
,
v_
A
:
NATURAL
;
-- address ranges, indices
VARIABLE
v_len
,
v_span
,
v_offset
,
v_
addr
:
NATURAL
;
-- address ranges, indices
VARIABLE
v_W
,
v_P
,
v_U
,
v_S
,
v_B
:
NATURAL
;
-- array indicies
VARIABLE
v_re
,
v_im
,
v_
in
t
:
INTEGER
;
VARIABLE
v_re
,
v_im
,
v_
weigh
t
:
INTEGER
;
VARIABLE
v_power
:
REAL
;
BEGIN
-- Wait for DUT power up after reset
...
...
@@ -312,6 +318,9 @@ BEGIN
WAIT
FOR
1
us
;
pps_rst
<=
'0'
;
----------------------------------------------------------------------------
-- Read weighted subband selector
----------------------------------------------------------------------------
mmf_mm_bus_rd
(
c_mm_file_reg_dp_selector
,
0
,
rd_data
,
tb_clk
);
proc_common_wait_some_cycles
(
tb_clk
,
1
);
sst_offload_weighted_subbands
<=
NOT
rd_data
(
0
);
...
...
@@ -344,29 +353,27 @@ BEGIN
----------------------------------------------------------------------------
-- Write subband weight for selected g_sp and g_subband
----------------------------------------------------------------------------
-- . MM format: (cint16)
subband_weights
[S_pn/Q_fft]_[Q_fft][N_sub] = [S_pn][N_sub]
v_
A
:
=
g_sp
*
c_sdp_N_sub
+
g_subband
;
-- . MM format: (cint16)
RAM_EQUALIZER_GAINS
[S_pn/Q_fft]_[Q_fft][N_sub] = [S_pn][N_sub]
v_
addr
:
=
g_sp
*
c_sdp_N_sub
+
g_subband
;
-- . read
mmf_mm_bus_rd
(
c_mm_file_ram_equalizer_gains
,
v_A
,
rd_data
,
tb_clk
);
proc_common_wait_some_cycles
(
tb_clk
,
1
);
v_re
:
=
unpack_complex_re
(
rd_data
,
c_sdp_W_bf_weight
);
v_im
:
=
unpack_complex_im
(
rd_data
,
c_sdp_W_bf_weight
);
mmf_mm_bus_rd
(
c_mm_file_ram_equalizer_gains
,
v_addr
,
rd_data
,
tb_clk
);
v_re
:
=
unpack_complex_re
(
rd_data
,
c_sdp_W_sub_weight
);
v_im
:
=
unpack_complex_im
(
rd_data
,
c_sdp_W_sub_weight
);
sp_subband_weight_re
<=
v_re
;
sp_subband_weight_im
<=
v_im
;
sp_subband_weight_gain
<=
SQRT
(
REAL
(
v_re
)
**
2
.
0
+
REAL
(
v_im
)
**
2
.
0
)
/
REAL
(
c_sdp_unit_sub_weight
);
sp_subband_weight_phase
<=
ARCTAN
(
Y
=>
REAL
(
v_im
),
X
=>
REAL
(
v_re
))
*
360
.
0
/
MATH_2_PI
;
sp_subband_weight_phase
<=
atan2
(
Y
=>
REAL
(
v_im
),
X
=>
REAL
(
v_re
))
*
360
.
0
/
MATH_2_PI
;
-- . write
v_
in
t
:
=
pack_complex
(
c_subband_weight_re
,
c_subband_weight_im
,
c_sdp_W_b
f
_weight
);
-- c_sdp_W_b
f
_weight = 16 bit
mmf_mm_bus_wr
(
c_mm_file_ram_equalizer_gains
,
v_
A
,
v_in
t
,
tb_clk
);
v_
weigh
t
:
=
pack_complex
(
re
=>
c_subband_weight_re
,
im
=>
c_subband_weight_im
,
w
=>
c_sdp_W_
su
b_weight
);
-- c_sdp_W_
su
b_weight = 16 bit
mmf_mm_bus_wr
(
c_mm_file_ram_equalizer_gains
,
v_
addr
,
v_weigh
t
,
tb_clk
);
-- . read back
mmf_mm_bus_rd
(
c_mm_file_ram_equalizer_gains
,
v_A
,
rd_data
,
tb_clk
);
proc_common_wait_some_cycles
(
tb_clk
,
1
);
v_re
:
=
unpack_complex_re
(
rd_data
,
c_sdp_W_bf_weight
);
v_im
:
=
unpack_complex_im
(
rd_data
,
c_sdp_W_bf_weight
);
mmf_mm_bus_rd
(
c_mm_file_ram_equalizer_gains
,
v_addr
,
rd_data
,
tb_clk
);
v_re
:
=
unpack_complex_re
(
rd_data
,
c_sdp_W_sub_weight
);
v_im
:
=
unpack_complex_im
(
rd_data
,
c_sdp_W_sub_weight
);
sp_subband_weight_re
<=
v_re
;
sp_subband_weight_im
<=
v_im
;
sp_subband_weight_gain
<=
SQRT
(
REAL
(
v_re
)
**
2
.
0
+
REAL
(
v_im
)
**
2
.
0
)
/
REAL
(
c_sdp_unit_sub_weight
);
sp_subband_weight_phase
<=
ARCTAN
(
Y
=>
REAL
(
v_im
),
X
=>
REAL
(
v_re
))
*
360
.
0
/
MATH_2_PI
;
sp_subband_weight_phase
<=
atan2
(
Y
=>
REAL
(
v_im
),
X
=>
REAL
(
v_re
))
*
360
.
0
/
MATH_2_PI
;
----------------------------------------------------------------------------
-- Wait for enough WG data and start of sync interval
...
...
@@ -382,7 +389,7 @@ BEGIN
-- . there are c_sdp_S_pn = 12 signal inputs A, B, C, D, E, F, G, H, I, J, K, L
-- . there are c_sdp_N_sub = 512 subbands per signal input (SI, = signal path, SP)
-- . one complex WPFB can process two real inputs A, B, so there are c_sdp_P_pfb = 6 WPFB units,
-- but only read for the 1 WPFB unit of the selected g_sp, to s
peed up simulation
-- but only read for the 1 WPFB unit of the selected g_sp, to s
ave sim time
-- . the outputs for A, B are time multiplexed, c_sdp_Q_fft = 2, assume that they
-- correspond to the c_sdp_N_pol = 2 signal polarizations
-- . the subbands are output alternately so A0 B0 A1 B1 ... A511 B511 for input A, B
...
...
@@ -394,14 +401,14 @@ BEGIN
v_W
:
=
I
MOD
c_stat_data_sz
;
-- 0, 1 per statistics word, word index
v_P
:
=
(
I
/
c_stat_data_sz
)
MOD
c_sdp_N_pol
;
-- 0, 1 per SP pol, polarization index
v_B
:
=
I
/
(
c_sdp_N_pol
*
c_stat_data_sz
);
-- subband index, range(N_sub = 512) per dual pol
v_
A
:
=
I
+
c_pfb_index
*
v_span
;
-- MM address for WPFB unit of selected g_sp
v_
addr
:
=
I
+
c_pfb_index
*
v_span
;
-- MM address for WPFB unit of selected g_sp
IF
v_W
=
0
THEN
-- low part
mmf_mm_bus_rd
(
c_mm_file_ram_st_sst
,
v_
A
,
rd_data
,
tb_clk
);
mmf_mm_bus_rd
(
c_mm_file_ram_st_sst
,
v_
addr
,
rd_data
,
tb_clk
);
v_data_lo
:
=
rd_data
;
ELSE
-- high part
mmf_mm_bus_rd
(
c_mm_file_ram_st_sst
,
v_
A
,
rd_data
,
tb_clk
);
mmf_mm_bus_rd
(
c_mm_file_ram_st_sst
,
v_
addr
,
rd_data
,
tb_clk
);
v_data_hi
:
=
rd_data
;
v_stat_data
:
=
v_data_hi
&
v_data_lo
;
...
...
@@ -444,21 +451,21 @@ BEGIN
proc_common_wait_some_cycles
(
tb_clk
,
1
);
---------------------------------------------------------------------------
--
Print
subband statistics
--
Log
subband statistics
---------------------------------------------------------------------------
--
S
elector
--
Log s
elector
print_str
(
"sst_offload_weighted_subbands = "
&
sl_to_str
(
sst_offload_weighted_subbands
));
--
S
ubband weight
--
Log s
ubband weight
print_str
(
"sp_subband_weight_gain = "
&
real_to_str
(
sp_subband_weight_gain
,
20
,
6
));
print_str
(
"sp_subband_weight_phase = "
&
real_to_str
(
sp_subband_weight_phase
,
20
,
6
));
-- SST
--
Log
SST
print_str
(
"sp_subband_power = "
&
real_to_str
(
sp_subband_power
,
20
,
0
));
print_str
(
"sp_subband_power / exp_subband_power = "
&
real_to_str
(
sp_subband_power
/
exp_subband_power
,
20
,
0
));
-- WPFB details are allready verified in tb of wpfb_unit_dev.vhd, so here
-- quality indicators like leakage and crosstalk are also reported out of
-- interest.
-- Log WPFB details, these are allready verified in tb of wpfb_unit_dev.vhd, so here
-- quality indicators like leakage and crosstalk are also reported out of interest.
print_str
(
"sp_subband_power_leakage = "
&
real_to_str
(
sp_subband_power_leakage
,
20
,
0
));
print_str
(
"sp_subband_power_leakage_snr_dB = "
&
real_to_str
(
sp_subband_power_leakage_snr_dB
,
20
,
3
));
print_str
(
"sp_subband_power_crosstalk = "
&
real_to_str
(
sp_subband_power_crosstalk
,
20
,
0
));
...
...
@@ -468,12 +475,12 @@ BEGIN
-- Verify subband statistics
---------------------------------------------------------------------------
-- verify expected subband power based on WG power
ASSERT
sp_subband_power
>
c_lo_factor
*
c_
exp_subband_power
REPORT
"Wrong subband power for SP
-
"
&
NATURAL
'IMAGE
(
g_sp
)
SEVERITY
ERROR
;
ASSERT
sp_subband_power
<
c_hi_factor
*
c_
exp_subband_power
REPORT
"Wrong subband power for SP
-
"
&
NATURAL
'IMAGE
(
g_sp
)
SEVERITY
ERROR
;
ASSERT
sp_subband_power
>
c_lo_factor
*
exp_subband_power
REPORT
"Wrong subband power for SP
"
&
NATURAL
'IMAGE
(
g_sp
)
SEVERITY
ERROR
;
ASSERT
sp_subband_power
<
c_hi_factor
*
exp_subband_power
REPORT
"Wrong subband power for SP
"
&
NATURAL
'IMAGE
(
g_sp
)
SEVERITY
ERROR
;
-- Verify expected SNR quality measures
ASSERT
sp_subband_power_leakage_snr_dB
>
c_exp_subband_power_leakage_snr_dB
REPORT
"Wrong to much leakage for SP
-
"
&
NATURAL
'IMAGE
(
g_sp
)
SEVERITY
ERROR
;
ASSERT
sp_subband_power_crosstalk_snr_dB
>
c_exp_subband_power_crosstalk_snr_dB
REPORT
"Wrong to much crosstalk for SP
-
"
&
NATURAL
'IMAGE
(
g_sp
)
SEVERITY
ERROR
;
ASSERT
sp_subband_power_leakage_snr_dB
>
c_exp_subband_power_leakage_snr_dB
REPORT
"Wrong to much leakage for SP
"
&
NATURAL
'IMAGE
(
g_sp
)
SEVERITY
ERROR
;
ASSERT
sp_subband_power_crosstalk_snr_dB
>
c_exp_subband_power_crosstalk_snr_dB
REPORT
"Wrong to much crosstalk for SP
"
&
NATURAL
'IMAGE
(
g_sp
)
SEVERITY
ERROR
;
---------------------------------------------------------------------------
-- End Simulation
...
...
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