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

Subversion Repositories viterbi_decoder_axi4s

[/] [viterbi_decoder_axi4s/] [trunk/] [packages/] [pkg_param_derived.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  Derived parameters
9
--! @author Markus Fehrenz
10
--! @date   2011/07/04
11
--!
12
--! @details This constants are derived from constants defined in pkg_param.
13
--!          In order to prevent errors, there is no user choice for these parameters.
14
--!
15
 
16
library ieee;
17
use ieee.std_logic_1164.all;
18
use ieee.numeric_std.all;
19
 
20
library dec_viterbi;
21
use dec_viterbi.pkg_param.all;
22
use dec_viterbi.pkg_helper.all;
23
 
24
 
25
package pkg_param_derived is
26
 
27
        -- Calculation of constraint length.
28
        function calc_constraint_length return natural;
29
 
30
        -- Memory depth of the encoder shift register.
31 4 mfehrenz
        constant ENCODER_MEMORY_DEPTH : natural;
32 2 mfehrenz
 
33
        -- Number of trellis states corresponds to the nubmer of ACS units.
34 4 mfehrenz
        constant NUMBER_TRELLIS_STATES : natural;
35 2 mfehrenz
 
36
        -- Number of branch units for a single polynomial set
37 4 mfehrenz
        constant NUMBER_BRANCH_UNITS : natural;
38 2 mfehrenz
 
39
        -- Bitwidth constants are needed for type conversions
40 4 mfehrenz
        constant BW_TRELLIS_STATES    : natural;
41
        constant BW_MAX_WINDOW_LENGTH : natural;
42
        constant BW_BRANCH_RESULT     : natural;
43
        constant BW_MAX_PROBABILITY   : natural;
44 2 mfehrenz
 
45
end package pkg_param_derived;
46
 
47
 
48
package body pkg_param_derived is
49
 
50
        function calc_constraint_length return natural is
51
                variable v_maximum : natural := 0;
52
        begin
53
 
54
                -- Find the position of the leftmost bit in the polynomials.
55
                for i in NUMBER_PARITY_BITS - 1 downto 0 loop
56
                        v_maximum := max(v_maximum, no_bits_natural(PARITY_POLYNOMIALS(i)));
57
                end loop;
58
                v_maximum := max(v_maximum, no_bits_natural(FEEDBACK_POLYNOMIAL));
59
                return v_maximum;
60
        end function calc_constraint_length;
61
 
62 4 mfehrenz
 
63
        constant ENCODER_MEMORY_DEPTH : natural := calc_constraint_length - 1;
64
 
65
        constant NUMBER_TRELLIS_STATES : natural := 2 ** ENCODER_MEMORY_DEPTH;
66
 
67
        constant NUMBER_BRANCH_UNITS : natural := 2 ** NUMBER_PARITY_BITS;
68
 
69
        constant BW_TRELLIS_STATES    : natural := no_bits_natural(NUMBER_TRELLIS_STATES - 1);
70
        constant BW_MAX_WINDOW_LENGTH : natural := no_bits_natural(MAX_WINDOW_LENGTH - 1);
71
        constant BW_BRANCH_RESULT     : natural := no_bits_natural((2 ** (BW_LLR_INPUT - 1)) * NUMBER_PARITY_BITS) + 1;
72
        constant BW_MAX_PROBABILITY   : natural := no_bits_natural(((2 ** (BW_LLR_INPUT - 1)) * NUMBER_PARITY_BITS) * 4 * ENCODER_MEMORY_DEPTH);
73 2 mfehrenz
end package body pkg_param_derived;

powered by: WebSVN 2.1.0

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