| 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: Provide MM access via slave register to diag_tx_seq
|
| 22 |
|
|
-- Description:
|
| 23 |
|
|
--
|
| 24 |
|
|
-- Each DP stream has its own diag_tx_seq, because each stream can have its
|
| 25 |
|
|
-- own flow control. Each DP stream also has its own MM control register to
|
| 26 |
|
|
-- support reading tx_cnt per stream.
|
| 27 |
|
|
--
|
| 28 |
|
|
-- 31 24 23 16 15 8 7 0 wi
|
| 29 |
|
|
-- |-----------------|-----------------|-----------------|-----------------|
|
| 30 |
|
|
-- | diag_dc = [2], diag_sel = [1], diag_en = [0] | 0 RW
|
| 31 |
|
|
-- |-----------------------------------------------------------------------|
|
| 32 |
|
|
-- | diag_init[31:0] | 1 RW
|
| 33 |
|
|
-- |-----------------------------------------------------------------------|
|
| 34 |
|
|
-- | tx_cnt[31:0] | 2 RO
|
| 35 |
|
|
-- |-----------------------------------------------------------------------|
|
| 36 |
|
|
-- | diag_mod[31:0] | 3 RW
|
| 37 |
|
|
-- |-----------------------------------------------------------------------|
|
| 38 |
|
|
--
|
| 39 |
|
|
-- . g_use_usr_input
|
| 40 |
|
|
-- When diag_en='0' then the usr_sosi_arr input is passed on.
|
| 41 |
|
|
-- When diag_en='1' then the the tx_seq data overrules the usr_sosi_arr. Dependent on g_use_usr_input
|
| 42 |
|
|
-- the overule differs:
|
| 43 |
|
|
--
|
| 44 |
|
|
-- 1) When g_use_usr_input=TRUE then usr_sosi_arr().valid sets the pace else
|
| 45 |
|
|
-- 2) when g_use_usr_input=FALSE then tx_src_in_arr().ready sets the pace of the valid output data.
|
| 46 |
|
|
--
|
| 47 |
|
|
-- This scheme allows filling user data with Tx seq data using the user valid or to completely
|
| 48 |
|
|
-- overrule the user by deriving the Tx seq valid directly from the ready.
|
| 49 |
|
|
--
|
| 50 |
|
|
-- g_use_usr_input=FALSE :
|
| 51 |
|
|
--
|
| 52 |
|
|
-- g_nof_streams
|
| 53 |
|
|
-- c_latency=1
|
| 54 |
|
|
-- .
|
| 55 |
|
|
-- .
|
| 56 |
|
|
-- usr_snk_out_arr <-------------------/------------------------------ tx_src_in_arr
|
| 57 |
|
|
-- usr_snk_in_arr --------------------|---------------->|\
|
| 58 |
|
|
-- . | |0|
|
| 59 |
|
|
-- ______ | | |---------> tx_src_out_arr
|
| 60 |
|
|
-- | | |.ready | |
|
| 61 |
|
|
-- |diag |<----/ |1|
|
| 62 |
|
|
-- |tx_seq|---------------------->|/
|
| 63 |
|
|
-- |______| . |
|
| 64 |
|
|
-- __|___ . |
|
| 65 |
|
|
-- |u_reg | tx_seq_src_in_arr |
|
| 66 |
|
|
-- |______| tx_seq_src_out_arr |
|
| 67 |
|
|
-- __|___ |
|
| 68 |
|
|
-- | mux | diag_en_arr
|
| 69 |
|
|
-- |______|
|
| 70 |
|
|
-- |
|
| 71 |
|
|
-- MM =================
|
| 72 |
|
|
--
|
| 73 |
|
|
--
|
| 74 |
|
|
-- g_use_usr_input=TRUE :
|
| 75 |
|
|
-- g_nof_streams
|
| 76 |
|
|
-- c_latency=0
|
| 77 |
|
|
-- .
|
| 78 |
|
|
-- . ____
|
| 79 |
|
|
-- usr_snk_out_arr ------------------------------------------------| |<-- tx_src_in_arr
|
| 80 |
|
|
-- usr_snk_in_arr -----------------------\------------>|\ |dp |
|
| 81 |
|
|
-- . | |0| |pipe|
|
| 82 |
|
|
-- ______ valid | | |------->|line|--> tx_src_out_arr
|
| 83 |
|
|
-- |diag |<-------/ |1| . |arr |
|
| 84 |
|
|
-- |tx_seq|--------------------->|/ . |____|
|
| 85 |
|
|
-- |______| . | .
|
| 86 |
|
|
-- __|___ . | mux_seq_src_in_arr
|
| 87 |
|
|
-- |u_reg | tx_seq_src_in_arr | mux_seq_src_out_arr
|
| 88 |
|
|
-- |______| tx_seq_src_out_arr |
|
| 89 |
|
|
-- __|___ |
|
| 90 |
|
|
-- | mux | diag_en_arr
|
| 91 |
|
|
-- |______|
|
| 92 |
|
|
-- |
|
| 93 |
|
|
-- MM =================
|
| 94 |
|
|
--
|
| 95 |
|
|
--
|
| 96 |
|
|
-- . g_nof_streams
|
| 97 |
|
|
-- The MM control register for stream I in 0:g_nof_streams-1 starts at word
|
| 98 |
|
|
-- index wi = I * 2**c_mm_reg.adr_w.
|
| 99 |
|
|
--
|
| 100 |
|
|
-- . g_mm_broadcast
|
| 101 |
|
|
-- Use default g_mm_broadcast=FALSE for multiplexed individual MM access to
|
| 102 |
|
|
-- each reg_mosi_arr/reg_miso_arr MM port. When g_mm_broadcast=TRUE then a
|
| 103 |
|
|
-- write access to MM port [0] is passed on to all ports and a read access
|
| 104 |
|
|
-- is done from MM port [0]. The other MM array ports cannot be read then.
|
| 105 |
|
|
--
|
| 106 |
|
|
-- . g_seq_dat_w
|
| 107 |
|
|
-- The g_seq_dat_w must be >= 1. The DP streaming data field is
|
| 108 |
|
|
-- c_dp_stream_data_w bits wide and the REPLICATE_DP_DATA() is used to wire
|
| 109 |
|
|
-- the g_seq_dat_w from the u_diag_tx_seq to fill the entire DP data width.
|
| 110 |
|
|
-- The maximum g_seq_dat_w depends on the pseudo random data width of the
|
| 111 |
|
|
-- LFSR sequeces in common_lfsr_sequences_pkg and on whether timing closure
|
| 112 |
|
|
-- can still be achieved for wider g_seq_dat_w. Thanks to the replication a
|
| 113 |
|
|
-- smaller g_seq_dat_w can be used to provide CNTR or LFSR data for the DP
|
| 114 |
|
|
-- data.
|
| 115 |
|
|
--
|
| 116 |
|
|
-- . diag_en
|
| 117 |
|
|
-- '0' = init and disable output sequence
|
| 118 |
|
|
-- '1' = enable output sequence
|
| 119 |
|
|
--
|
| 120 |
|
|
-- . diag_sel
|
| 121 |
|
|
-- '0' = generate PSRG data
|
| 122 |
|
|
-- '1' = generate CNTR data
|
| 123 |
|
|
--
|
| 124 |
|
|
-- . diag_dc
|
| 125 |
|
|
-- '0' = Output sequence data (as selected by diag_sel)
|
| 126 |
|
|
-- '1' = Output constant data (value as set by diag_init)
|
| 127 |
|
|
--
|
| 128 |
|
|
-- . diag_init
|
| 129 |
|
|
-- Note that MM diag_init has c_word_w=32 bits, so if g_seq_dat_w is wider
|
| 130 |
|
|
-- then the MSbits are 0 and if it is smaller, then the MSbits are ignored.
|
| 131 |
|
|
--
|
| 132 |
|
|
-- . tx_cnt
|
| 133 |
|
|
-- Counts the number of valid output data that was transmitted on stream 0
|
| 134 |
|
|
-- since diag_en went active. An incrementing tx_cnt shows that data is
|
| 135 |
|
|
-- being transmitted.
|
| 136 |
|
|
--
|
| 137 |
|
|
-- . diag_mod
|
| 138 |
|
|
-- CNTR counts modulo diag_mod, so diag_mod becomes 0. Use diag_mod = 0
|
| 139 |
|
|
-- for default binary wrap at 2**g_seq_dat_w. For diag_rx_seq choose
|
| 140 |
|
|
-- diag_step = 2**g_seq_dat_w - diag_mod + g_cnt_incr to verify ok as
|
| 141 |
|
|
-- simulated with tb_tb_diag_rx_seq. In this mms_diag_tx_seq g_cnt_incr=1
|
| 142 |
|
|
-- fixed for diag_tx_seq.
|
| 143 |
|
|
-- The default diag_mod=0 is equivalent to diag_mod=2**g_seq_dat_w.
|
| 144 |
|
|
-- Using diag_mod < 2**g_seq_dat_w can be useful to generate tx seq CNTR
|
| 145 |
|
|
-- data that is written to a memory that is larger than 2**g_seq_dat_w
|
| 146 |
|
|
-- addresses. The CNTR values then differ from the memory address values,
|
| 147 |
|
|
-- which can be useful to ensure that reading e.g. address 2**g_seq_dat_w
|
| 148 |
|
|
-- yields a different CNTR value than reading 2**(g_seq_dat_w+1).
|
| 149 |
|
|
|
| 150 |
|
|
|
| 151 |
4 |
danv |
LIBRARY IEEE, common_pkg_lib, dp_pkg_lib, astron_pipeline_lib, astron_ram_lib, astron_mm_lib; -- init value for out_dat when diag_en = '0'
|
| 152 |
2 |
danv |
USE IEEE.std_logic_1164.ALL;
|
| 153 |
|
|
USE common_pkg_lib.common_pkg.ALL;
|
| 154 |
4 |
danv |
USE astron_ram_lib.common_ram_pkg.ALL;
|
| 155 |
|
|
USE astron_mm_lib.common_field_pkg.ALL;
|
| 156 |
2 |
danv |
USE dp_pkg_lib.dp_stream_pkg.ALL;
|
| 157 |
|
|
USE work.diag_pkg.ALL;
|
| 158 |
|
|
|
| 159 |
|
|
ENTITY mms_diag_tx_seq IS
|
| 160 |
|
|
GENERIC (
|
| 161 |
|
|
g_use_usr_input : BOOLEAN := FALSE;
|
| 162 |
|
|
g_mm_broadcast : BOOLEAN := FALSE;
|
| 163 |
|
|
g_nof_streams : NATURAL := 1;
|
| 164 |
|
|
g_seq_dat_w : NATURAL := c_word_w -- >= 1, test sequence data width
|
| 165 |
|
|
);
|
| 166 |
|
|
PORT (
|
| 167 |
|
|
-- Clocks and reset
|
| 168 |
|
|
mm_rst : IN STD_LOGIC; -- reset synchronous with mm_clk
|
| 169 |
|
|
mm_clk : IN STD_LOGIC; -- MM bus clock
|
| 170 |
|
|
dp_rst : IN STD_LOGIC; -- reset synchronous with dp_clk
|
| 171 |
|
|
dp_clk : IN STD_LOGIC; -- DP streaming bus clock
|
| 172 |
|
|
|
| 173 |
|
|
-- MM interface
|
| 174 |
|
|
reg_mosi : IN t_mem_mosi; -- single MM control register applied to all g_nof_streams
|
| 175 |
|
|
reg_miso : OUT t_mem_miso;
|
| 176 |
|
|
|
| 177 |
|
|
-- DP streaming interface
|
| 178 |
|
|
usr_snk_out_arr : OUT t_dp_siso_arr(g_nof_streams-1 DOWNTO 0);
|
| 179 |
|
|
usr_snk_in_arr : IN t_dp_sosi_arr(g_nof_streams-1 DOWNTO 0) := (OTHERS=>c_dp_sosi_rst);
|
| 180 |
|
|
tx_src_out_arr : OUT t_dp_sosi_arr(g_nof_streams-1 DOWNTO 0);
|
| 181 |
|
|
tx_src_in_arr : IN t_dp_siso_arr(g_nof_streams-1 DOWNTO 0) := (OTHERS=>c_dp_siso_rdy) -- Default xon='1';
|
| 182 |
|
|
);
|
| 183 |
|
|
END mms_diag_tx_seq;
|
| 184 |
|
|
|
| 185 |
|
|
|
| 186 |
|
|
ARCHITECTURE str OF mms_diag_tx_seq IS
|
| 187 |
|
|
|
| 188 |
|
|
-- Define MM slave register size
|
| 189 |
|
|
CONSTANT c_mm_reg : t_c_mem := (latency => 1,
|
| 190 |
|
|
adr_w => c_diag_seq_tx_reg_adr_w,
|
| 191 |
|
|
dat_w => c_word_w, -- Use MM bus data width = c_word_w = 32 for all MM registers
|
| 192 |
|
|
nof_dat => c_diag_seq_tx_reg_nof_dat,
|
| 193 |
|
|
init_sl => '0');
|
| 194 |
|
|
|
| 195 |
|
|
-- Define MM slave register fields for Python peripheral using pi_common.py (specify MM register access per word, not per individual bit because mm_fields assumes 1 field per MM word)
|
| 196 |
|
|
CONSTANT c_mm_reg_field_arr : t_common_field_arr(c_mm_reg.nof_dat-1 DOWNTO 0) := ( ( field_name_pad("modulo"), "RW", c_word_w, field_default(0) ),
|
| 197 |
|
|
( field_name_pad("tx_cnt"), "RO", c_word_w, field_default(0) ),
|
| 198 |
|
|
( field_name_pad("init"), "RW", c_word_w, field_default(0) ),
|
| 199 |
|
|
( field_name_pad("control"), "RW", 3, field_default(0) )); -- control[2:0] = diag_dc & diag_sel & diag_en
|
| 200 |
|
|
|
| 201 |
|
|
CONSTANT c_reg_slv_w : NATURAL := c_mm_reg.nof_dat*c_mm_reg.dat_w;
|
| 202 |
|
|
|
| 203 |
|
|
CONSTANT c_latency : NATURAL := sel_a_b(g_use_usr_input, 0, 1); -- default 1 for registered diag_tx_seq out_cnt/dat/val output, use 0 for immediate combinatorial diag_tx_seq out_cnt/dat/val output
|
| 204 |
|
|
|
| 205 |
|
|
TYPE t_reg_slv_arr IS ARRAY (INTEGER RANGE <>) OF STD_LOGIC_VECTOR(c_reg_slv_w-1 DOWNTO 0);
|
| 206 |
|
|
TYPE t_seq_dat_arr IS ARRAY (INTEGER RANGE <>) OF STD_LOGIC_VECTOR(g_seq_dat_w-1 DOWNTO 0);
|
| 207 |
|
|
TYPE t_replicate_arr IS ARRAY (INTEGER RANGE <>) OF STD_LOGIC_VECTOR(c_dp_stream_data_w-1 DOWNTO 0);
|
| 208 |
|
|
|
| 209 |
|
|
SIGNAL reg_mosi_arr : t_mem_mosi_arr(g_nof_streams-1 DOWNTO 0);
|
| 210 |
|
|
SIGNAL reg_miso_arr : t_mem_miso_arr(g_nof_streams-1 DOWNTO 0);
|
| 211 |
|
|
|
| 212 |
|
|
-- Registers in dp_clk domain
|
| 213 |
|
|
SIGNAL ctrl_reg_arr : t_reg_slv_arr(g_nof_streams-1 DOWNTO 0) := (OTHERS=>(OTHERS=>'0'));
|
| 214 |
|
|
SIGNAL stat_reg_arr : t_reg_slv_arr(g_nof_streams-1 DOWNTO 0) := (OTHERS=>(OTHERS=>'0'));
|
| 215 |
|
|
|
| 216 |
|
|
SIGNAL diag_en_arr : STD_LOGIC_VECTOR(g_nof_streams-1 DOWNTO 0);
|
| 217 |
|
|
SIGNAL diag_sel_arr : STD_LOGIC_VECTOR(g_nof_streams-1 DOWNTO 0);
|
| 218 |
|
|
SIGNAL diag_dc_arr : STD_LOGIC_VECTOR(g_nof_streams-1 DOWNTO 0);
|
| 219 |
|
|
|
| 220 |
|
|
SIGNAL diag_init_mm_arr : t_slv_32_arr(g_nof_streams-1 DOWNTO 0) := (OTHERS=>(OTHERS=>'0')); -- can use t_slv_32_arr because c_mm_reg.dat_w = c_word_w = 32 fixed
|
| 221 |
|
|
SIGNAL diag_init_arr : t_seq_dat_arr(g_nof_streams-1 DOWNTO 0) := (OTHERS=>(OTHERS=>'0'));
|
| 222 |
|
|
|
| 223 |
|
|
SIGNAL diag_mod_mm_arr : t_slv_32_arr(g_nof_streams-1 DOWNTO 0) := (OTHERS=>(OTHERS=>'0')); -- can use t_slv_32_arr because c -- init value for out_dat when diag_en = '0'_mm_reg.dat_w = c_word_w = 32 fixed
|
| 224 |
|
|
SIGNAL diag_mod_arr : t_seq_dat_arr(g_nof_streams-1 DOWNTO 0) := (OTHERS=>(OTHERS=>'0'));
|
| 225 |
|
|
|
| 226 |
|
|
SIGNAL tx_cnt_arr : t_slv_32_arr(g_nof_streams-1 DOWNTO 0); -- can use t_slv_32_arr because c_mm_reg.dat_w = c_word_w = 32 fixed
|
| 227 |
|
|
SIGNAL tx_dat_arr : t_seq_dat_arr(g_nof_streams-1 DOWNTO 0);
|
| 228 |
|
|
SIGNAL tx_val_arr : STD_LOGIC_VECTOR(g_nof_streams-1 DOWNTO 0);
|
| 229 |
|
|
SIGNAL tx_req_arr : STD_LOGIC_VECTOR(g_nof_streams-1 DOWNTO 0);
|
| 230 |
|
|
|
| 231 |
|
|
SIGNAL tx_replicate_dat_arr : t_dp_data_slv_arr(g_nof_streams-1 DOWNTO 0);
|
| 232 |
|
|
|
| 233 |
|
|
SIGNAL tx_seq_src_in_arr : t_dp_siso_arr(g_nof_streams-1 DOWNTO 0);
|
| 234 |
|
|
SIGNAL tx_seq_src_out_arr : t_dp_sosi_arr(g_nof_streams-1 DOWNTO 0) := (OTHERS=>c_dp_sosi_rst); -- default set all other fields then data and valid to inactive.
|
| 235 |
|
|
|
| 236 |
|
|
-- Use user input or self generate
|
| 237 |
|
|
SIGNAL mux_seq_src_in_arr : t_dp_siso_arr(g_nof_streams-1 DOWNTO 0); -- multiplex user sosi control with tx_seq data
|
| 238 |
|
|
SIGNAL mux_seq_src_out_arr : t_dp_sosi_arr(g_nof_streams-1 DOWNTO 0);
|
| 239 |
|
|
|
| 240 |
|
|
BEGIN
|
| 241 |
|
|
|
| 242 |
|
|
gen_nof_streams: FOR I IN 0 to g_nof_streams-1 GENERATE
|
| 243 |
|
|
u_diag_tx_seq: ENTITY WORK.diag_tx_seq
|
| 244 |
|
|
GENERIC MAP (
|
| 245 |
|
|
g_latency => c_latency,
|
| 246 |
|
|
g_cnt_w => c_word_w,
|
| 247 |
|
|
g_dat_w => g_seq_dat_w
|
| 248 |
|
|
)
|
| 249 |
|
|
PORT MAP (
|
| 250 |
|
|
rst => dp_rst,
|
| 251 |
|
|
clk => dp_clk,
|
| 252 |
|
|
|
| 253 |
|
|
-- Write and read back registers:
|
| 254 |
|
|
diag_en => diag_en_arr(I),
|
| 255 |
|
|
diag_sel => diag_sel_arr(I),
|
| 256 |
|
|
diag_dc => diag_dc_arr(I),
|
| 257 |
|
|
diag_init => diag_init_arr(I),
|
| 258 |
|
|
diag_mod => diag_mod_arr(I),
|
| 259 |
|
|
|
| 260 |
|
|
-- Streaming
|
| 261 |
|
|
diag_req => tx_req_arr(I),
|
| 262 |
|
|
out_cnt => tx_cnt_arr(I),
|
| 263 |
|
|
out_dat => tx_dat_arr(I),
|
| 264 |
|
|
out_val => tx_val_arr(I)
|
| 265 |
|
|
);
|
| 266 |
|
|
|
| 267 |
|
|
tx_req_arr(I) <= tx_seq_src_in_arr(I).ready;
|
| 268 |
|
|
|
| 269 |
|
|
tx_replicate_dat_arr(I) <= REPLICATE_DP_DATA(tx_dat_arr(I));
|
| 270 |
|
|
|
| 271 |
|
|
-- for some reason the intermediate tx_replicate_dat_arr() signal is needed, otherwise the assignment to the tx_seq_src_out_arr().data field remains void in the Wave window
|
| 272 |
|
|
tx_seq_src_out_arr(I).data <= tx_replicate_dat_arr(I);
|
| 273 |
|
|
tx_seq_src_out_arr(I).valid <= tx_val_arr(I);
|
| 274 |
|
|
|
| 275 |
|
|
-- Register mapping
|
| 276 |
|
|
diag_en_arr(I) <= ctrl_reg_arr(I)( 0); -- address 0, data bit [0]
|
| 277 |
|
|
diag_sel_arr(I) <= ctrl_reg_arr(I)( 1); -- address 0, data bit [1]
|
| 278 |
|
|
diag_dc_arr(I) <= ctrl_reg_arr(I)( 2); -- address 0, data bit [2]
|
| 279 |
|
|
diag_init_mm_arr(I) <= ctrl_reg_arr(I)(2*c_word_w-1 DOWNTO c_word_w); -- address 1, data bits [31:0]
|
| 280 |
|
|
diag_mod_mm_arr(I) <= ctrl_reg_arr(I)(4*c_word_w-1 DOWNTO 3*c_word_w); -- address 3, data bits [31:0]
|
| 281 |
|
|
|
| 282 |
|
|
diag_init_arr(I) <= RESIZE_UVEC(diag_init_mm_arr(I), g_seq_dat_w);
|
| 283 |
|
|
diag_mod_arr(I) <= RESIZE_UVEC(diag_mod_mm_arr(I), g_seq_dat_w);
|
| 284 |
|
|
|
| 285 |
|
|
p_stat_reg : PROCESS(ctrl_reg_arr(I), tx_cnt_arr)
|
| 286 |
|
|
BEGIN
|
| 287 |
|
|
-- Default write / readback:
|
| 288 |
|
|
stat_reg_arr(I) <= ctrl_reg_arr(I); -- address 0, 1: control read back
|
| 289 |
|
|
-- Status read only:
|
| 290 |
|
|
stat_reg_arr(I)(3*c_word_w-1 DOWNTO 2*c_word_w) <= tx_cnt_arr(I); -- address 2: read tx_cnt
|
| 291 |
|
|
END PROCESS;
|
| 292 |
|
|
|
| 293 |
4 |
danv |
u_reg : ENTITY astron_mm_lib.common_reg_r_w_dc
|
| 294 |
2 |
danv |
GENERIC MAP (
|
| 295 |
|
|
g_cross_clock_domain => TRUE,
|
| 296 |
|
|
g_readback => FALSE, -- must use FALSE for write/read or read only register when g_cross_clock_domain=TRUE
|
| 297 |
|
|
g_reg => c_mm_reg
|
| 298 |
|
|
)
|
| 299 |
|
|
PORT MAP (
|
| 300 |
|
|
-- Clocks and reset
|
| 301 |
|
|
mm_rst => mm_rst,
|
| 302 |
|
|
mm_clk => mm_clk,
|
| 303 |
|
|
st_rst => dp_rst,
|
| 304 |
|
|
st_clk => dp_clk,
|
| 305 |
|
|
|
| 306 |
|
|
-- Memory Mapped Slave in mm_clk domain
|
| 307 |
|
|
sla_in => reg_mosi_arr(I),
|
| 308 |
|
|
sla_out => reg_miso_arr(I),
|
| 309 |
|
|
|
| 310 |
|
|
-- MM registers in dp_clk domain
|
| 311 |
|
|
in_reg => stat_reg_arr(I), -- connect out_reg to in_reg for write and readback register
|
| 312 |
|
|
out_reg => ctrl_reg_arr(I)
|
| 313 |
|
|
);
|
| 314 |
|
|
END GENERATE;
|
| 315 |
|
|
|
| 316 |
|
|
-- Combine the internal array of mm interfaces for the bg_data to one array that is connected to the port of the MM bus
|
| 317 |
4 |
danv |
u_mem_mux : ENTITY astron_mm_lib.common_mem_mux
|
| 318 |
2 |
danv |
GENERIC MAP (
|
| 319 |
|
|
g_broadcast => g_mm_broadcast,
|
| 320 |
|
|
g_nof_mosi => g_nof_streams,
|
| 321 |
|
|
g_mult_addr_w => c_mm_reg.adr_w
|
| 322 |
|
|
)
|
| 323 |
|
|
PORT MAP (
|
| 324 |
|
|
mosi => reg_mosi,
|
| 325 |
|
|
miso => reg_miso,
|
| 326 |
|
|
mosi_arr => reg_mosi_arr,
|
| 327 |
|
|
miso_arr => reg_miso_arr
|
| 328 |
|
|
);
|
| 329 |
|
|
|
| 330 |
|
|
ignore_usr_input : IF g_use_usr_input=FALSE GENERATE
|
| 331 |
|
|
-- flow control
|
| 332 |
|
|
usr_snk_out_arr <= tx_src_in_arr;
|
| 333 |
|
|
tx_seq_src_in_arr <= tx_src_in_arr;
|
| 334 |
|
|
|
| 335 |
|
|
-- data
|
| 336 |
|
|
p_tx_src_out_arr : PROCESS (usr_snk_in_arr, tx_seq_src_out_arr, diag_en_arr)
|
| 337 |
|
|
BEGIN
|
| 338 |
|
|
tx_src_out_arr <= usr_snk_in_arr; -- Default pass on the usr data
|
| 339 |
|
|
FOR I IN 0 TO g_nof_streams-1 LOOP
|
| 340 |
|
|
IF diag_en_arr(I)='1' THEN
|
| 341 |
|
|
tx_src_out_arr(I) <= tx_seq_src_out_arr(I); -- When diag is enabled then pass on the Tx seq data
|
| 342 |
|
|
END IF;
|
| 343 |
|
|
END LOOP;
|
| 344 |
|
|
END PROCESS;
|
| 345 |
|
|
END GENERATE;
|
| 346 |
|
|
|
| 347 |
|
|
use_usr_input : IF g_use_usr_input=TRUE GENERATE
|
| 348 |
|
|
-- Request tx_seq data at user data valid rate
|
| 349 |
|
|
p_tx_seq_src_in_arr : PROCESS(usr_snk_in_arr)
|
| 350 |
|
|
BEGIN
|
| 351 |
|
|
FOR I IN 0 TO g_nof_streams-1 LOOP
|
| 352 |
|
|
tx_seq_src_in_arr(I).ready <= usr_snk_in_arr(I).valid;
|
| 353 |
|
|
END LOOP;
|
| 354 |
|
|
END PROCESS;
|
| 355 |
|
|
|
| 356 |
|
|
-- Default output the user input or BG data, else when tx_seq is enabled overrule output with tx_seq data
|
| 357 |
|
|
usr_snk_out_arr <= mux_seq_src_in_arr;
|
| 358 |
|
|
|
| 359 |
|
|
p_mux_seq_src_out_arr : PROCESS (usr_snk_in_arr, tx_seq_src_out_arr, diag_en_arr)
|
| 360 |
|
|
BEGIN
|
| 361 |
|
|
mux_seq_src_out_arr <= usr_snk_in_arr;
|
| 362 |
|
|
FOR I IN 0 TO g_nof_streams-1 LOOP
|
| 363 |
|
|
IF diag_en_arr(I)='1' THEN
|
| 364 |
|
|
mux_seq_src_out_arr(I).data <= tx_seq_src_out_arr(I).data;
|
| 365 |
|
|
END IF;
|
| 366 |
|
|
END LOOP;
|
| 367 |
|
|
END PROCESS;
|
| 368 |
|
|
|
| 369 |
|
|
-- Pipeline the streams by 1 to register the mux_seq_src_out_arr data to ease timing closure given that c_tx_seq_latency=0
|
| 370 |
4 |
danv |
u_dp_pipeline_arr : ENTITY astron_pipeline_lib.dp_pipeline_arr
|
| 371 |
2 |
danv |
GENERIC MAP (
|
| 372 |
|
|
g_nof_streams => g_nof_streams
|
| 373 |
|
|
)
|
| 374 |
|
|
PORT MAP (
|
| 375 |
|
|
rst => dp_rst,
|
| 376 |
|
|
clk => dp_clk,
|
| 377 |
|
|
-- ST sink
|
| 378 |
|
|
snk_out_arr => mux_seq_src_in_arr,
|
| 379 |
|
|
snk_in_arr => mux_seq_src_out_arr,
|
| 380 |
|
|
-- ST source
|
| 381 |
|
|
src_in_arr => tx_src_in_arr,
|
| 382 |
|
|
src_out_arr => tx_src_out_arr
|
| 383 |
|
|
);
|
| 384 |
|
|
END GENERATE;
|
| 385 |
|
|
|
| 386 |
|
|
END str;
|
| 387 |
|
|
|
| 388 |
|
|
|
| 389 |
|
|
|
| 390 |
|
|
|
| 391 |
|
|
|
| 392 |
|
|
|
| 393 |
|
|
|
| 394 |
|
|
|
| 395 |
|
|
|
| 396 |
|
|
|
| 397 |
|
|
|
| 398 |
|
|
|
| 399 |
|
|
|