OpenCores
URL https://opencores.org/ocsvn/viterbi_decoder_axi4s/viterbi_decoder_axi4s/trunk

Subversion Repositories viterbi_decoder_axi4s

[/] [viterbi_decoder_axi4s/] [trunk/] [src/] [traceback.vhd] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mfehrenz
--!
2 6 mfehrenz
--! Copyright (C) 2011 - 2014 Creonic GmbH
3 2 mfehrenz
--!
4
--! This file is part of the Creonic Viterbi Decoder, which is distributed
5
--! under the terms of the GNU General Public License version 2.
6
--!
7
--! @file
8
--! @brief  Traceback unit for a viterbi decoder
9
--! @author Markus Fehrenz
10
--! @date   2011/07/11
11
--!
12
--! @details The traceback unit only processes a data stream.
13
--! There is no knowledge about the decoder configuration.
14
--! The information about acquisition and window lengths is received from ram control.
15
--!
16
 
17
library ieee;
18
use ieee.std_logic_1164.all;
19
use ieee.numeric_std.all;
20
 
21
library dec_viterbi;
22
use dec_viterbi.pkg_param.all;
23
use dec_viterbi.pkg_param_derived.all;
24
 
25
 
26
entity trellis_traceback is
27
        port(
28
                -- general signals
29
                clk : in std_logic;
30
                rst : in std_logic;
31
 
32
                s_axis_input_tvalid       : in  std_logic;
33
                s_axis_input_tdata        : in  std_logic_vector(NUMBER_TRELLIS_STATES - 1 downto 0);
34
                s_axis_input_tlast        : in  std_logic;
35
                s_axis_input_tready       : out std_logic;
36
                s_axis_input_window_tuser : in  std_logic;
37
                s_axis_input_last_tuser   : in  std_logic;
38
 
39
                m_axis_output_tvalid     : out std_logic;
40
                m_axis_output_tdata      : out std_logic;
41
                m_axis_output_tlast      : out std_logic;
42
                m_axis_output_last_tuser : out std_logic;
43
                m_axis_output_tready     : in  std_logic
44
        );
45
end entity trellis_traceback;
46
 
47
 
48
architecture rtl of trellis_traceback is
49
 
50
        signal current_node               : unsigned(BW_TRELLIS_STATES - 1 downto 0);
51
        signal m_axis_output_tvalid_int   : std_logic;
52
        signal s_axis_input_tready_int    : std_logic;
53
 
54
begin
55
        s_axis_input_tready_int <= '1' when m_axis_output_tready = '1' or m_axis_output_tvalid_int = '0' else
56
                                   '0';
57
        s_axis_input_tready <= s_axis_input_tready_int;
58
 
59
        m_axis_output_tvalid <= m_axis_output_tvalid_int;
60
 
61 6 mfehrenz
 
62 2 mfehrenz
        -- Traceback the ACS local path decisions and output the resulting global path.
63
        pr_traceback : process(clk) is
64
        begin
65
        if rising_edge(clk) then
66
                if rst = '1' then
67
                        m_axis_output_tvalid_int   <= '0';
68
                        m_axis_output_tdata        <= '0';
69
                        m_axis_output_tlast        <= '0';
70
                        m_axis_output_last_tuser   <= '0';
71
                        current_node               <= (others => '0');
72
                else
73
 
74 6 mfehrenz
                        if m_axis_output_tready = '1' then
75
                                m_axis_output_tvalid_int <= '0';
76
                        end if;
77
 
78 2 mfehrenz
                        -- calculate the decoded bit with an shift register
79 6 mfehrenz
                        if s_axis_input_tvalid = '1' and s_axis_input_tready_int = '1' then
80
 
81
                                m_axis_output_tlast      <= s_axis_input_tlast;
82
                                m_axis_output_last_tuser <= s_axis_input_last_tuser;
83
 
84
                                -- handle tvalid output signal
85
                                if s_axis_input_window_tuser = '1' then
86
                                        m_axis_output_tvalid_int <= '1';
87
                                        m_axis_output_tdata <= current_node(BW_TRELLIS_STATES - 1);
88
                                end if;
89
 
90
                                -- last value of current window?
91
                                if s_axis_input_last_tuser = '1' then
92
                                        current_node <= to_unsigned(0, BW_TRELLIS_STATES);
93
                                else
94 2 mfehrenz
                                        current_node <= current_node(BW_TRELLIS_STATES - 2 downto 0)
95
                                                        & s_axis_input_tdata(to_integer(current_node(BW_TRELLIS_STATES - 1 downto 0)));
96
                                end if;
97
                        end if;
98
                end if;
99
        end if;
100
        end process pr_traceback;
101
end architecture rtl;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.