diff --git a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/hdllib.cfg b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/hdllib.cfg index 1cbac2db809fa171ba5b9c9e2beae88e219b7423..ce325a8640b28889f50e934fefcf74aa69123c93 100644 --- a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/hdllib.cfg +++ b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/hdllib.cfg @@ -27,13 +27,13 @@ quartus_qsf_files = $RADIOHDL_WORK/boards/uniboard2b/libraries/unb2c_board/quartus/unb2c_board.qsf quartus_sdc_pre_files = - quartus/lofar_unb2b_adc_full.sdc + ../../quartus/lofar_unb2b_adc.sdc quartus_sdc_files = $RADIOHDL_WORK/boards/uniboard2b/libraries/unb2b_board/quartus/unb2b_board.sdc quartus_tcl_files = - quartus/lofar_unb2b_adc_full_pins.tcl + ../../quartus/lofar_unb2b_adc_pins.tcl quartus_vhdl_files = diff --git a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/lofar2_unb2b_adc_full.vhd b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/lofar2_unb2b_adc_full.vhd index 77466af45d601b07b3f7e0074d1b31488882866f..bc8c1b2659eb059828ddea1ef213dbdac28a72fc 100644 --- a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/lofar2_unb2b_adc_full.vhd +++ b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/lofar2_unb2b_adc_full.vhd @@ -85,7 +85,7 @@ ARCHITECTURE str OF lofar2_unb2b_adc_full IS BEGIN - u_revision : ENTITY unb2b_test_lib.unb2b_test + u_revision : ENTITY lofar2_unb2b_adc_lib.lofar2_unb2b_adc GENERIC MAP ( g_design_name => g_design_name, g_design_note => g_design_note, diff --git a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/quartus/lofar2_unb2b_adc_full.sdc b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/quartus/lofar2_unb2b_adc_full.sdc deleted file mode 100644 index e0a8d1b58168ab6b944a51e297c8478e8c28fac5..0000000000000000000000000000000000000000 --- a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/quartus/lofar2_unb2b_adc_full.sdc +++ /dev/null @@ -1 +0,0 @@ -#Placeholder diff --git a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/quartus/lofar2_unb2b_adc_full_pins.tcl b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/quartus/lofar2_unb2b_adc_full_pins.tcl deleted file mode 100644 index da85c19f6523141cbbe5eb02ad1bd1dc0e4f2fdb..0000000000000000000000000000000000000000 --- a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_full/quartus/lofar2_unb2b_adc_full_pins.tcl +++ /dev/null @@ -1,23 +0,0 @@ -############################################################################### -# -# Copyright (C) 2014 -# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> -# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################### - -source $::env(RADIOHDL_WORK)/boards/uniboard2b/libraries/unb2b_board/quartus/pinning/unb2b_minimal_pins.tcl -source $::env(RADIOHDL_WORK)/boards/uniboard2b/libraries/unb2b_board/quartus/pinning/unb2b_jesd204b_pins.tcl diff --git a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/hdllib.cfg b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/hdllib.cfg index 1e583673e1db63634efb7ee8e899b50a8d86d692..dcd8780a7d0c17e763c318730cb1a481f4dddf0b 100644 --- a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/hdllib.cfg +++ b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/hdllib.cfg @@ -13,7 +13,6 @@ test_bench_files = [modelsim_project_file] modelsim_copy_files = -# Pinning design only intended for synthesis [quartus_project_file] @@ -27,13 +26,13 @@ quartus_qsf_files = $RADIOHDL_WORK/boards/uniboard2b/libraries/unb2c_board/quartus/unb2c_board.qsf quartus_sdc_pre_files = - quartus/lofar_unb2b_adc_one_node.sdc + ../../quartus/lofar_unb2b_adc.sdc quartus_sdc_files = $RADIOHDL_WORK/boards/uniboard2b/libraries/unb2b_board/quartus/unb2b_board.sdc quartus_tcl_files = - quartus/lofar_unb2b_adc_one_node_pins.tcl + ../../quartus/lofar_unb2b_adc_pins.tcl quartus_vhdl_files = diff --git a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/lofar2_unb2b_adc_one_node.vhd b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/lofar2_unb2b_adc_one_node.vhd index f7211d878f3475d8df92cbfe5fae691ba0ffc651..cab09b0a1b6ea73fe7d35ae4f9e326581b304004 100644 --- a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/lofar2_unb2b_adc_one_node.vhd +++ b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/lofar2_unb2b_adc_one_node.vhd @@ -85,7 +85,7 @@ ARCHITECTURE str OF lofar2_unb2b_adc_one_node IS BEGIN - u_revision : ENTITY unb2b_test_lib.unb2b_test + u_revision : ENTITY lofar2_unb2b_adc_lib.lofar2_unb2b_adc GENERIC MAP ( g_design_name => g_design_name, g_design_note => g_design_note, diff --git a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/quartus/lofar2_unb2b_adc_one_node.sdc b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/quartus/lofar2_unb2b_adc_one_node.sdc deleted file mode 100644 index e0a8d1b58168ab6b944a51e297c8478e8c28fac5..0000000000000000000000000000000000000000 --- a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/quartus/lofar2_unb2b_adc_one_node.sdc +++ /dev/null @@ -1 +0,0 @@ -#Placeholder diff --git a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/quartus/lofar2_unb2b_adc_one_node_pins.tcl b/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/quartus/lofar2_unb2b_adc_one_node_pins.tcl deleted file mode 100644 index da85c19f6523141cbbe5eb02ad1bd1dc0e4f2fdb..0000000000000000000000000000000000000000 --- a/applications/lofar2/designs/lofar2_unb2b_adc/revisions/lofar2_unb2b_adc_one_node/quartus/lofar2_unb2b_adc_one_node_pins.tcl +++ /dev/null @@ -1,23 +0,0 @@ -############################################################################### -# -# Copyright (C) 2014 -# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> -# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################### - -source $::env(RADIOHDL_WORK)/boards/uniboard2b/libraries/unb2b_board/quartus/pinning/unb2b_minimal_pins.tcl -source $::env(RADIOHDL_WORK)/boards/uniboard2b/libraries/unb2b_board/quartus/pinning/unb2b_jesd204b_pins.tcl diff --git a/applications/lofar2/designs/lofar2_unb2b_adc/src/vhdl/lofar2_unb2b_adc.vhd b/applications/lofar2/designs/lofar2_unb2b_adc/src/vhdl/lofar2_unb2b_adc.vhd index 48e1837197707f466cf4ae87c49a5acaae4fd0e2..d7abb42f889e48e217abf26f9e563291771cf8b4 100644 --- a/applications/lofar2/designs/lofar2_unb2b_adc/src/vhdl/lofar2_unb2b_adc.vhd +++ b/applications/lofar2/designs/lofar2_unb2b_adc/src/vhdl/lofar2_unb2b_adc.vhd @@ -87,11 +87,25 @@ END lofar2_unb2b_adc; ARCHITECTURE str OF lofar2_unb2b_adc IS + -- Revision parameters + CONSTANT c_revision_select : t_lofar2_unb2b_adc_config := func_sel_revision_rec(g_design_name); + CONSTANT c_nof_streams_jesd204b : NATURAL := c_revision_select.nof_streams_jesd204b; + CONSTANT c_nof_streams_db : NATURAL := c_revision_select.nof_streams_db; + CONSTANT c_nof_streams_input : NATURAL := c_revision_select.nof_streams_input; + -- Firmware version x.y CONSTANT c_fw_version : t_unb2b_board_fw_version := (1, 1); CONSTANT c_mm_clk_freq : NATURAL := c_unb2b_board_mm_clk_freq_100M; - CONSTANT c_nof_streams_jesd204b : NATURAL := 12; - CONSTANT c_nof_streams_db : NATURAL := 2; + CONSTANT c_lofar2_sample_clk_freq : NATURAL := 200 * 10**6; -- alternate 160MHz. TODO: Use to check PPS + + -- Waveform Generator + CONSTANT c_wg_buf_directory : STRING := "data/"; + CONSTANT c_wg_buf_dat_w : NATURAL := c_unb2b_board_peripherals_mm_reg_default.ram_diag_wg_dat_w; + CONSTANT c_wg_buf_addr_w : NATURAL := c_unb2b_board_peripherals_mm_reg_default.ram_diag_wg_adr_w; + SIGNAL wg_sosi_arr : t_dp_sosi_arr(0 TO c_nof_streams_input-1); + SIGNAL mux_sosi_arr : t_dp_sosi_arr(0 TO c_nof_streams_input-1); + SIGNAL nxt_mux_sosi_arr : t_dp_sosi_arr(0 TO c_nof_streams_input-1); + -- System SIGNAL cs_sim : STD_LOGIC; @@ -216,11 +230,11 @@ BEGIN mm_clk => mm_clk, mm_rst => mm_rst, - dp_rst => st_rst, - dp_clk => st_clk, + dp_rst => dp_rst, + dp_clk => dp_clk, -- Can be external 200MHz, or PLL generated dp_pps => st_pps, dp_rst_in => st_rst, - dp_clk_in => st_clk, + dp_clk_in => jesd204b_frame_clk, -- Toggle WDI pout_wdi => pout_wdi, @@ -391,6 +405,11 @@ BEGIN jesd204b_miso => jesd204b_miso ); + + ----------------------------------------------------------------------------- + -- JESD204B IP (ADC Handler) + ----------------------------------------------------------------------------- + u_jesd204b: ENTITY tech_jesd204b_lib.tech_jesd204b GENERIC MAP( g_sim => g_sim, @@ -427,6 +446,10 @@ BEGIN END GENERATE; + ----------------------------------------------------------------------------- + -- Diagnostic Data Buffer (Records 8192 raw ADC samples after the PPS) + ----------------------------------------------------------------------------- + u_diag_data_buffer : ENTITY diag_lib.mms_diag_data_buffer GENERIC MAP ( g_technology => g_technology, @@ -451,6 +474,79 @@ BEGIN in_sync => st_pps ); + ----------------------------------------------------------------------------- + -- WG (Test Signal Generator) + ----------------------------------------------------------------------------- + + gen_wg : FOR I IN 0 TO c_nof_streams_input-1 GENERATE + u_sp : ENTITY diag_lib.mms_diag_wg_wideband + GENERIC MAP ( + g_cross_clock_domain => TRUE, + g_buf_dir => c_wg_buf_directory, + + -- Wideband parameters + g_wideband_factor => 1, + + -- Basic WG parameters, see diag_wg.vhd for their meaning + g_buf_dat_w => c_wg_buf_dat_w, + g_buf_addr_w => c_wg_buf_addr_w, + g_calc_support => TRUE, + g_calc_gain_w => 1, + g_calc_dat_w => c_wg_buf_dat_w + ) + PORT MAP ( + -- Memory-mapped clock domain + mm_rst => mm_rst, + mm_clk => mm_clk, + + reg_mosi => reg_wg_mosi_arr(I), + reg_miso => reg_wg_miso_arr(I), + + buf_mosi => ram_wg_mosi_arr(I), + buf_miso => ram_wg_miso_arr(I), + + -- Streaming clock domain + st_rst => dp_rst, + st_clk => jesd204b_frame_clk, + st_restart => st_pps, + + out_ovr => wg_sosi_arr(I).err, + out_val => wg_sosi_arr(I).valid, + out_dat => wg_sosi_arr(I).data(c_wg_buf_dat_w-1 downto 0), + out_sync => wg_sosi_arr(I).sync + ); + + END GENERATE; + + + + ----------------------------------------------------------------------------- + -- ADC/WG Mux (Input Select) + ----------------------------------------------------------------------------- + + gen_mux : FOR I IN 0 TO c_nof_streams_input-1 GENERATE + p_sosi : PROCESS(jesd204b_rx_src_out_arr, wg_sosi_arr) + BEGIN + -- Valid is forced to '1' here for dp_shiftram. + nxt_mux_sosi_arr(I).valid <= '1'; + + -- Default use the ADUH data + nxt_mux_sosi_arr(I).data <= jesd204b_rx_src_out_arr(I).data; + IF wg_sosi_arr(I).valid='1' THEN + -- Valid WG data overrules ADUH data + nxt_mux_sosi_arr(I).data <= wg_sosi_arr(I).data; + END IF; + END PROCESS; + END GENERATE; + + p_reg_mux : PROCESS(st_rst, jesd204b_frame_clk) + BEGIN + IF st_rst='1' THEN + mux_sosi_arr <= (OTHERS=>c_dp_sosi_rst); + ELSIF rising_edge(jesd204b_frame_clk) THEN + mux_sosi_arr <= nxt_mux_sosi_arr; + END IF; + END PROCESS; END str; diff --git a/applications/lofar2/designs/lofar2_unb2b_adc/src/vhdl/lofar2_unb2b_adc_pkg.vhd b/applications/lofar2/designs/lofar2_unb2b_adc/src/vhdl/lofar2_unb2b_adc_pkg.vhd index 585c81182085039db557a8a29c382777fbc29adc..c85fc15e4e5398ebce75981102da6390c6d30ec0 100644 --- a/applications/lofar2/designs/lofar2_unb2b_adc/src/vhdl/lofar2_unb2b_adc_pkg.vhd +++ b/applications/lofar2/designs/lofar2_unb2b_adc/src/vhdl/lofar2_unb2b_adc_pkg.vhd @@ -24,37 +24,39 @@ USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.numeric_std.ALL; USE common_lib.common_pkg.ALL; -PACKAGE lofar2_unb2b_adc IS +PACKAGE lofar2_unb2b_adc_pkg IS ----------------------------------------------------------------------------- -- Revision control ----------------------------------------------------------------------------- TYPE t_lofar2_unb2b_adc_config IS RECORD - nof_adc_input_streams : BOOLEAN; + nof_streams_jesd204b : NATURAL; + nof_streams_db : NATURAL; + nof_streams_input : NATURAL; END RECORD; - -- nof inputs - CONSTANT c_one_node : t_lofar2_unb2b_adc_config := ( 1 ); - CONSTANT c_full : t_lofar2_unb2b_adc_config := ( 12); + -- nofjesd, nofdb, nofinput + CONSTANT c_one_node : t_lofar2_unb2b_adc_config := ( 12, 2, 1 ); + CONSTANT c_full : t_lofar2_unb2b_adc_config := ( 12, 2, 12 ); -- Function to select the revision configuration. FUNCTION func_sel_revision_rec(g_design_name : STRING) RETURN t_lofar2_unb2b_adc_config; -END lofar2_unb2b_adc; +END lofar2_unb2b_adc_pkg; -PACKAGE BODY lofar2_unb2b_adc IS +PACKAGE BODY lofar2_unb2b_adc_pkg IS FUNCTION func_sel_revision_rec(g_design_name : STRING) RETURN t_lofar2_unb2b_adc_config IS BEGIN - IF g_design_name = "lofar2_unb2b_adc_one_node" THEN RETURN c_one_node; - ELSIF g_design_name = "lofar2_unb2b_adc_full" THEN RETURN c_full; + IF g_design_name = "lofar2_unb2b_adc_one_node" THEN RETURN c_one_node; + IF g_design_name = "lofar2_unb2b_adc_full" THEN RETURN c_full; ELSE RETURN c_one_node; END IF; END; -END lofar2_unb2b_adc; +END lofar2_unb2b_adc_pkg;