1 |
2 |
danv |
-------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- Copyright (C) 2013
|
4 |
|
|
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
|
5 |
|
|
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
|
6 |
|
|
--
|
7 |
|
|
-- This program is free software: you can redistribute it and/or modify
|
8 |
|
|
-- it under the terms of the GNU General Public License as published by
|
9 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
10 |
|
|
-- (at your option) any later version.
|
11 |
|
|
--
|
12 |
|
|
-- This program is distributed in the hope that it will be useful,
|
13 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
-- GNU General Public License for more details.
|
16 |
|
|
--
|
17 |
|
|
-- You should have received a copy of the GNU General Public License
|
18 |
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19 |
|
|
--
|
20 |
|
|
-------------------------------------------------------------------------------
|
21 |
|
|
|
22 |
|
|
-- Purpose: Scope component to show the arrayed DP SOSI data at the SCLK
|
23 |
|
|
-- sample rate
|
24 |
|
|
-- Description:
|
25 |
|
|
-- The SCLK rate is g_wideband_factor faster than the DCLK rate. The input
|
26 |
|
|
-- is one wideband stream that is carried by an array of g_wideband_factor
|
27 |
|
|
-- sosi streams at the DCLK rate. The output is a single sosi integer stream
|
28 |
|
|
-- at the SCLK rate.
|
29 |
|
|
-- Remark:
|
30 |
|
|
-- . Only for simulation.
|
31 |
|
|
-- . When g_use_sclk=TRUE then the input SCLK is used. Else the SCLK is derived
|
32 |
|
|
-- from the DCLK so that it does not have to be applied via an input. This
|
33 |
|
|
-- eases the use of this scope within a design.
|
34 |
|
|
-- . In this dp_wideband_wb_arr_scope the input is only one wideband stream
|
35 |
|
|
-- and the input sosi array has size g_wideband_factor, so the wideband
|
36 |
|
|
-- data is carried via the sosi array dimension.
|
37 |
|
|
-- In dp_wideband_sp_arr_scope the input is one or more wideband streams
|
38 |
|
|
-- and the input sosi array has size g_nof_streams, so there the wideband
|
39 |
|
|
-- data is carried by g_wideband_factor concatenated symbols in the data
|
40 |
|
|
-- field or in the (re, im) fields.
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
LIBRARY IEEE, common_pkg_lib, dp_pkg_lib;
|
44 |
|
|
USE IEEE.STD_LOGIC_1164.ALL;
|
45 |
|
|
USE common_pkg_lib.common_pkg.ALL;
|
46 |
|
|
USE dp_pkg_lib.dp_stream_pkg.ALL;
|
47 |
|
|
|
48 |
|
|
ENTITY dp_wideband_wb_arr_scope IS
|
49 |
|
|
GENERIC (
|
50 |
|
|
g_sim : BOOLEAN := FALSE;
|
51 |
|
|
g_use_sclk : BOOLEAN := TRUE;
|
52 |
|
|
g_wideband_factor : NATURAL := 4; -- Wideband rate factor = 4 for dp_clk processing frequency is 200 MHz frequency and SCLK sample frequency Fs is 800 MHz
|
53 |
|
|
g_wideband_big_endian : BOOLEAN := FALSE; -- When true wb_sosi_arr[3:0] = sample[t0,t1,t2,t3], else when false : wb_sosi_arr[3:0] = sample[t3,t2,t1,t0]
|
54 |
|
|
g_dat_w : NATURAL := 8 -- Actual width of the data field or of the re field, im field
|
55 |
|
|
);
|
56 |
|
|
PORT (
|
57 |
|
|
-- Digital processing clk
|
58 |
|
|
DCLK : IN STD_LOGIC := '0';
|
59 |
|
|
|
60 |
|
|
-- Sampling clk, for simulation only
|
61 |
|
|
SCLK : IN STD_LOGIC := '0'; -- SCLK rate = g_wideband_factor * DCLK rate
|
62 |
|
|
|
63 |
|
|
-- Streaming input samples for one stream
|
64 |
|
|
wb_sosi_arr : IN t_dp_sosi_arr(g_wideband_factor-1 DOWNTO 0); -- = [3:0] = Signal Path time samples [t3,t2,t1,t0]
|
65 |
|
|
|
66 |
|
|
-- Scope output samples for one stream
|
67 |
|
|
scope_sosi : OUT t_dp_sosi_integer
|
68 |
|
|
);
|
69 |
|
|
END dp_wideband_wb_arr_scope;
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
ARCHITECTURE beh OF dp_wideband_wb_arr_scope IS
|
73 |
|
|
|
74 |
|
|
SIGNAL SCLKi : STD_LOGIC; -- sampling clk, for simulation only
|
75 |
|
|
SIGNAL sample_cnt : NATURAL RANGE 0 TO g_wideband_factor-1 := 0;
|
76 |
|
|
SIGNAL st_sosi : t_dp_sosi;
|
77 |
|
|
|
78 |
|
|
BEGIN
|
79 |
|
|
|
80 |
|
|
sim_only : IF g_sim=TRUE GENERATE
|
81 |
|
|
use_sclk : IF g_use_sclk=TRUE GENERATE
|
82 |
|
|
SCLKi <= SCLK; -- no worry about the delta cycle delay from SCLK to SCLKi
|
83 |
|
|
END GENERATE;
|
84 |
|
|
gen_sclk : IF g_use_sclk=FALSE GENERATE
|
85 |
|
|
proc_common_dclk_generate_sclk(g_wideband_factor, DCLK, SCLKi);
|
86 |
|
|
END GENERATE;
|
87 |
|
|
|
88 |
|
|
-- View wb_sosi_arr at the sample rate using st_sosi
|
89 |
|
|
p_st_sosi : PROCESS(SCLKi)
|
90 |
|
|
BEGIN
|
91 |
|
|
IF rising_edge(SCLKi) THEN
|
92 |
|
|
IF g_wideband_big_endian=TRUE THEN
|
93 |
|
|
st_sosi <= wb_sosi_arr(g_wideband_factor-1-sample_cnt);
|
94 |
|
|
ELSE
|
95 |
|
|
st_sosi <= wb_sosi_arr(sample_cnt);
|
96 |
|
|
END IF;
|
97 |
|
|
sample_cnt <= 0;
|
98 |
|
|
IF wb_sosi_arr(0).valid='1' AND sample_cnt < g_wideband_factor-1 THEN -- all wb_sosi_arr().valid are the same, so use (0)
|
99 |
|
|
sample_cnt <= sample_cnt + 1;
|
100 |
|
|
END IF;
|
101 |
|
|
END IF;
|
102 |
|
|
END PROCESS;
|
103 |
|
|
|
104 |
|
|
-- Map sosi to SLV of actual g_dat_w to allow observation in Wave Window in analogue format
|
105 |
|
|
scope_sosi <= func_dp_stream_slv_to_integer(st_sosi, g_dat_w);
|
106 |
|
|
END GENERATE;
|
107 |
|
|
|
108 |
|
|
END beh;
|