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

Subversion Repositories ccsds_rxtxsoc

[/] [ccsds_rxtxsoc/] [trunk/] [ccsds_tx_mapper_symbols_samples.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 zguig52
-------------------------------
2
---- Project: EurySPACE CCSDS RX/TX with wishbone interface
3
---- Design Name: ccsds_tx_mapper_symbols_samples
4
---- Version: 1.0.0
5
---- Description:
6
---- Map symbols to their sample value depending on quantization depth
7
-------------------------------
8
---- Author(s):
9
---- Guillaume REMBERT
10
-------------------------------
11
---- Licence:
12
---- MIT
13
-------------------------------
14
---- Changes list:
15
---- 2016/11/18: initial release
16
-------------------------------
17
 
18
-- libraries used
19
library ieee;
20
use ieee.std_logic_1164.all;
21
use ieee.numeric_std.all;
22
 
23
--=============================================================================
24
-- Entity declaration for ccsds_tx / unitary tx bits to symbols mapper inputs and outputs
25
--=============================================================================
26
entity ccsds_tx_mapper_symbols_samples is
27
  generic(
28
    constant CCSDS_TX_MAPPER_TARGET_SNR: real; -- in dB
29
    constant CCSDS_TX_MAPPER_BITS_PER_SYMBOL: integer; -- in bits
30
    constant CCSDS_TX_MAPPER_QUANTIZATION_DEPTH: integer -- in bits
31
  );
32
  port(
33
    -- inputs
34
    clk_i: in std_logic;
35
    rst_i: in std_logic;
36
    sym_i: in std_logic_vector(CCSDS_TX_MAPPER_BITS_PER_SYMBOL-1 downto 0);
37
    sym_val_i: in std_logic;
38
    -- outputs
39
    sam_val_o: out std_logic;
40
    sam_o: out std_logic_vector(CCSDS_TX_MAPPER_QUANTIZATION_DEPTH-1 downto 0)
41
  );
42
end ccsds_tx_mapper_symbols_samples;
43
 
44
--=============================================================================
45
-- architecture declaration / internal components and connections
46
--=============================================================================
47
architecture rtl of ccsds_tx_mapper_symbols_samples is
48
-- internal constants
49
  constant QUANTIZATION_SNR: real := 6.02*real(CCSDS_TX_MAPPER_QUANTIZATION_DEPTH);
50
  constant REQUIRED_SNR: real := real(2 + 2*CCSDS_TX_MAPPER_BITS_PER_SYMBOL) + CCSDS_TX_MAPPER_TARGET_SNR;
51
  constant SYMBOL_STEP: real := 2.0**(CCSDS_TX_MAPPER_QUANTIZATION_DEPTH) / real(CCSDS_TX_MAPPER_BITS_PER_SYMBOL+1);
52
-- internal variable signals
53
  type samples_array is array(2**(CCSDS_TX_MAPPER_BITS_PER_SYMBOL)-1 downto 0) of std_logic_vector(CCSDS_TX_MAPPER_QUANTIZATION_DEPTH-1 downto 0);
54
  signal symbols_values: samples_array;
55
-- components instanciation and mapping
56
  begin
57
    SYMBOLS_VALUES_GENERATOR: for symbol_counter in 0 to 2**(CCSDS_TX_MAPPER_BITS_PER_SYMBOL-1)-1 generate
58
      symbols_values(2**(CCSDS_TX_MAPPER_BITS_PER_SYMBOL-1)+symbol_counter) <= std_logic_vector(to_signed(integer(2.0**(CCSDS_TX_MAPPER_QUANTIZATION_DEPTH-1) - 1.0 - real(symbol_counter) * SYMBOL_STEP),CCSDS_TX_MAPPER_QUANTIZATION_DEPTH));
59
      symbols_values(2**(CCSDS_TX_MAPPER_BITS_PER_SYMBOL-1)-symbol_counter-1) <= std_logic_vector(to_signed(integer(-(2.0**(CCSDS_TX_MAPPER_QUANTIZATION_DEPTH-1)) + 1.0 + real(symbol_counter) * SYMBOL_STEP),CCSDS_TX_MAPPER_QUANTIZATION_DEPTH));
60
    end generate SYMBOLS_VALUES_GENERATOR;
61
-- presynthesis checks
62
  -- Check SNR level requested is respected
63
  -- Signal SNR > crest factor modulated signal + SNR requested from configuration
64
  -- QAMCrestFactor, dB # 2 + 2 * NumberOfBitsPerSymbol
65
  -- QuantizedSignal SNR, dB # 6.02 * QuantizationDepth
66
     CHKMAPPERP0 : if (QUANTIZATION_SNR < REQUIRED_SNR) generate
67
      process
68
      begin
69
        report "ERROR: INCREASE QUANTIZATION DEPTH - QUANTIZATION SNR = " & real'image(QUANTIZATION_SNR) & " dB - REQUIRED SNR = " & real'image(REQUIRED_SNR) severity failure;
70
              wait;
71
      end process;
72
    end generate CHKMAPPERP0;
73
-- internal processing
74
    --=============================================================================
75
    -- Begin of mapperp
76
    -- Map symbols to samples
77
    --=============================================================================
78
    -- read: rst_i, sym_i, sym_val_i
79
    -- write: sam_val_o, sam_o
80
    -- r/w:
81
    MAPPERP: process (clk_i)
82
    begin
83
      -- on each clock rising edge
84
      if rising_edge(clk_i) then
85
        -- reset signal received
86
        if (rst_i = '1') then
87
          sam_o <= (others => '0');
88
          sam_val_o <= '0';
89
        else
90
          if (sym_val_i = '1') then
91
            sam_o <= symbols_values(to_integer(unsigned(sym_i)));
92
            sam_val_o <= '1';
93
          else
94
            sam_val_o <= '0';
95
          end if;
96
        end if;
97
      end if;
98
    end process;
99
end rtl;

powered by: WebSVN 2.1.0

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