1 |
2 |
danv |
-------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
3 |
danv |
-- Copyright 2020
|
4 |
2 |
danv |
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
|
5 |
|
|
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
|
6 |
3 |
danv |
--
|
7 |
|
|
-- Licensed under the Apache License, Version 2.0 (the "License");
|
8 |
|
|
-- you may not use this file except in compliance with the License.
|
9 |
|
|
-- You may obtain a copy of the License at
|
10 |
|
|
--
|
11 |
|
|
-- http://www.apache.org/licenses/LICENSE-2.0
|
12 |
|
|
--
|
13 |
|
|
-- Unless required by applicable law or agreed to in writing, software
|
14 |
|
|
-- distributed under the License is distributed on an "AS IS" BASIS,
|
15 |
|
|
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16 |
|
|
-- See the License for the specific language governing permissions and
|
17 |
|
|
-- limitations under the License.
|
18 |
2 |
danv |
--
|
19 |
|
|
-------------------------------------------------------------------------------
|
20 |
|
|
|
21 |
|
|
-- Purpose: Scope component to show the concateneated DP in_data at the SCLK
|
22 |
|
|
-- sample rate in the Wave Window
|
23 |
|
|
-- Description:
|
24 |
|
|
-- . See dp_wideband_sp_arr_scope (for g_nof_streams=1)
|
25 |
|
|
-- . The wideband in_data has g_wideband_factor nof samples per word. For
|
26 |
|
|
-- g_wideband_big_endian=TRUE sthe first sample is in the MS symbol.
|
27 |
|
|
-- Remark:
|
28 |
|
|
-- . Only for simulation.
|
29 |
|
|
-- . When g_use_sclk=TRUE then the input SCLK is used. Else the SCLK is derived
|
30 |
|
|
-- from the DCLK so that it does not have to be applied via an input. This
|
31 |
|
|
-- eases the use of this scope within a design.
|
32 |
|
|
|
33 |
|
|
LIBRARY IEEE, common_pkg_lib;
|
34 |
|
|
USE IEEE.STD_LOGIC_1164.ALL;
|
35 |
|
|
USE common_pkg_lib.common_pkg.ALL;
|
36 |
|
|
|
37 |
|
|
ENTITY common_wideband_data_scope IS
|
38 |
|
|
GENERIC (
|
39 |
|
|
g_sim : BOOLEAN := FALSE;
|
40 |
|
|
g_use_sclk : BOOLEAN := TRUE;
|
41 |
|
|
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
|
42 |
|
|
g_wideband_big_endian : BOOLEAN := TRUE; -- When true in_data[3:0] = sample[t0,t1,t2,t3], else when false : in_data[3:0] = sample[t3,t2,t1,t0]
|
43 |
|
|
g_dat_w : NATURAL := 8 -- Actual width of the data samples
|
44 |
|
|
);
|
45 |
|
|
PORT (
|
46 |
|
|
-- Digital processing clk
|
47 |
|
|
DCLK : IN STD_LOGIC := '0';
|
48 |
|
|
|
49 |
|
|
-- Sampling clk, for simulation only
|
50 |
|
|
SCLK : IN STD_LOGIC := '0'; -- SCLK rate = g_wideband_factor * DCLK rate
|
51 |
|
|
|
52 |
|
|
-- Streaming input data
|
53 |
|
|
in_data : IN STD_LOGIC_VECTOR(g_wideband_factor*g_dat_w-1 DOWNTO 0);
|
54 |
|
|
in_val : IN STD_LOGIC;
|
55 |
|
|
|
56 |
|
|
-- Scope output samples
|
57 |
|
|
out_dat : OUT STD_LOGIC_VECTOR(g_dat_w-1 DOWNTO 0);
|
58 |
|
|
out_int : OUT INTEGER;
|
59 |
|
|
out_val : OUT STD_LOGIC
|
60 |
|
|
);
|
61 |
|
|
END common_wideband_data_scope;
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
ARCHITECTURE beh OF common_wideband_data_scope IS
|
65 |
|
|
|
66 |
|
|
SIGNAL SCLKi : STD_LOGIC; -- sampling clk, for simulation only
|
67 |
|
|
SIGNAL scope_cnt : NATURAL;
|
68 |
|
|
SIGNAL scope_dat : STD_LOGIC_VECTOR(g_dat_w-1 DOWNTO 0);
|
69 |
|
|
|
70 |
|
|
BEGIN
|
71 |
|
|
|
72 |
|
|
sim_only : IF g_sim=TRUE GENERATE
|
73 |
|
|
use_sclk : IF g_use_sclk=TRUE GENERATE
|
74 |
|
|
SCLKi <= SCLK; -- no worry about the delta cycle delay from SCLK to SCLKi
|
75 |
|
|
END GENERATE;
|
76 |
|
|
gen_sclk : IF g_use_sclk=FALSE GENERATE
|
77 |
|
|
proc_common_dclk_generate_sclk(g_wideband_factor, DCLK, SCLKi);
|
78 |
|
|
END GENERATE;
|
79 |
|
|
|
80 |
|
|
-- View in_data at the sample rate using out_dat
|
81 |
|
|
p_scope_dat : PROCESS(SCLKi)
|
82 |
|
|
VARIABLE vI : NATURAL;
|
83 |
|
|
BEGIN
|
84 |
|
|
IF rising_edge(SCLKi) THEN
|
85 |
|
|
IF g_wideband_big_endian=TRUE THEN
|
86 |
|
|
vI := g_wideband_factor-1-scope_cnt;
|
87 |
|
|
ELSE
|
88 |
|
|
vI := scope_cnt;
|
89 |
|
|
END IF;
|
90 |
|
|
scope_cnt <= 0;
|
91 |
|
|
IF in_val='1' AND scope_cnt < g_wideband_factor-1 THEN
|
92 |
|
|
scope_cnt <= scope_cnt + 1;
|
93 |
|
|
END IF;
|
94 |
|
|
scope_dat <= in_data((vI+1)*g_dat_w-1 DOWNTO vI*g_dat_w);
|
95 |
|
|
out_val <= in_val;
|
96 |
|
|
END IF;
|
97 |
|
|
END PROCESS;
|
98 |
|
|
|
99 |
|
|
out_dat <= scope_dat;
|
100 |
|
|
out_int <= TO_SINT(scope_dat);
|
101 |
|
|
END GENERATE;
|
102 |
|
|
|
103 |
|
|
END beh;
|