Skip to content
Snippets Groups Projects
Commit c5fb84fc authored by Daniel van der Schuur's avatar Daniel van der Schuur
Browse files

-Copied dp_stream_player.vhd to RadioHDL.

parent e55fd465
No related branches found
No related tags found
No related merge requests found
...@@ -115,7 +115,7 @@ synth_files = ...@@ -115,7 +115,7 @@ synth_files =
$UNB/Firmware/modules/dp/src/vhdl/dp_shiftram.vhd $UNB/Firmware/modules/dp/src/vhdl/dp_shiftram.vhd
$UNB/Firmware/modules/dp/src/vhdl/dp_src_out_timer.vhd $UNB/Firmware/modules/dp/src/vhdl/dp_src_out_timer.vhd
src/vhdl/dp_sync_checker.vhd src/vhdl/dp_sync_checker.vhd
$UNB/Firmware/modules/dp/tb/vhdl/dp_stream_player.vhd tb/vhdl/dp_stream_player.vhd
$UNB/Firmware/modules/dp/tb/vhdl/dp_stream_recorder.vhd $UNB/Firmware/modules/dp/tb/vhdl/dp_stream_recorder.vhd
$UNB/Firmware/modules/dp/tb/vhdl/dp_stream_rec_play.vhd $UNB/Firmware/modules/dp/tb/vhdl/dp_stream_rec_play.vhd
......
-------------------------------------------------------------------------------
--
-- Copyright (C) 2014
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
-- JIVE (Joint Institute for VLBI in Europe) <http://www.jive.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/>.
--
-------------------------------------------------------------------------------
LIBRARY IEEE, common_lib;
USE IEEE.STD_LOGIC_1164.ALL;
USE common_lib.common_pkg.ALL;
USE common_lib.tb_common_pkg.ALL;
USE work.dp_stream_pkg.ALL;
USE std.textio.ALL;
USE IEEE.std_logic_textio.ALL;
USE common_lib.common_str_pkg.ALL;
-- Purpose:
-- . Play back a stream recorded by dp_stream_recorder.
-- Description:
-- . Playback starts as soon as the connected sink indicates to be ready by
-- asserting both XON and READY.
-- . See dp_stream_recorder.vhd
ENTITY dp_stream_player IS
GENERIC (
g_playback_file : STRING := "dp_stream_recorder.rec"
);
PORT (
dp_clk : IN STD_LOGIC;
src_out : OUT t_dp_sosi;
src_in : IN t_dp_siso
);
END dp_stream_player;
ARCHITECTURE beh OF dp_stream_player IS
CONSTANT c_nof_chars_per_line : NATURAL := 144;
SIGNAL playback_start : BOOLEAN := FALSE;
FILE playback_file : TEXT;
BEGIN
p_playback_start : PROCESS(src_in.xon)
VARIABLE v_open_status : file_open_status;
BEGIN
IF src_in.xon='1' AND playback_start=FALSE THEN
-- Open the playback file
file_open(v_open_status, playback_file, g_playback_file, read_mode);
-- Start playing
playback_start <= TRUE;
END IF;
END PROCESS;
p_playback : PROCESS(dp_clk, src_in)
VARIABLE v_line : LINE;
VARIABLE v_line_str : STRING(1 TO c_nof_chars_per_line);
BEGIN
IF playback_start=TRUE THEN
IF rising_edge(dp_clk) THEN
IF src_in.ready='1' THEN
IF NOT endfile(playback_file) THEN
-- Read line from file
readline(playback_file, v_line);
read(v_line, v_line_str);
-- Assign record fields
src_out.sync <= hex_to_slv(v_line_str( 1 TO 1))(0);
src_out.bsn <= hex_to_slv(v_line_str( 3 TO 18));
src_out.data(255 DOWNTO 0) <= hex_to_slv(v_line_str( 20 TO 83)); --FIXME Should support full width of 768 (new in RadioHDL)
src_out.re <= hex_to_slv(v_line_str( 85 TO 100));
src_out.im <= hex_to_slv(v_line_str(102 TO 117));
src_out.valid <= hex_to_slv(v_line_str(119 TO 119))(0);
src_out.sop <= hex_to_slv(v_line_str(121 TO 121))(0);
src_out.eop <= hex_to_slv(v_line_str(123 TO 123))(0);
src_out.empty(7 DOWNTO 0) <= hex_to_slv(v_line_str(125 TO 126)); -- FIXME Should support full width also.
src_out.channel <= hex_to_slv(v_line_str(128 TO 135));
src_out.err <= hex_to_slv(v_line_str(137 TO 144));
END IF;
END IF;
END IF;
END IF;
END PROCESS;
END beh;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment