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

Subversion Repositories ccsds_rxtxsoc

[/] [ccsds_rxtxsoc/] [trunk/] [ccsds_tx_mapper_bits_symbols.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_bits_symbols
4
---- Version: 1.0.0
5
---- Description:
6
---- Map input bits to complex I&Q symbols depending on modulation type
7
-------------------------------
8
---- Author(s):
9
---- Guillaume REMBERT
10
-------------------------------
11
---- Licence:
12
---- MIT
13
-------------------------------
14
---- Changes list:
15
---- 2016/11/05: initial release
16
-------------------------------
17
 
18
-- libraries used
19
library ieee;
20
use ieee.std_logic_1164.all;
21
 
22
--=============================================================================
23
-- Entity declaration for ccsds_tx / unitary tx bits to symbols mapper inputs and outputs
24
--=============================================================================
25
entity ccsds_tx_mapper_bits_symbols is
26
  generic(
27
    constant CCSDS_TX_MAPPER_BITS_PER_SYMBOL: integer := 1; -- For QAM - 1 bit/symbol <=> QPSK/4-QAM - 2 bits/symbol <=> 16-QAM - 3 bits/symbol <=> 64-QAM - ... - N bits/symbol <=> 2^(N*2)-QAM
28
    constant CCSDS_TX_MAPPER_GRAY_CODER: std_logic := '1'; -- Gray coder activation
29
    constant CCSDS_TX_MAPPER_MODULATION_TYPE: integer := 1; -- 1=QPSK/QAM - 2=BPSK
30
    constant CCSDS_TX_MAPPER_DATA_BUS_SIZE: integer -- in bits
31
  );
32
  port(
33
    -- inputs
34
    clk_i: in std_logic;
35
    dat_i: in std_logic_vector(CCSDS_TX_MAPPER_DATA_BUS_SIZE-1 downto 0);
36
    dat_val_i: in std_logic;
37
    rst_i: in std_logic;
38
    -- outputs
39
    sym_val_o: out std_logic;
40
    sym_i_o: out std_logic_vector(CCSDS_TX_MAPPER_BITS_PER_SYMBOL-1 downto 0);
41
    sym_q_o: out std_logic_vector(CCSDS_TX_MAPPER_BITS_PER_SYMBOL-1 downto 0)
42
  );
43
end ccsds_tx_mapper_bits_symbols;
44
 
45
--=============================================================================
46
-- architecture declaration / internal components and connections
47
--=============================================================================
48
architecture rtl of ccsds_tx_mapper_bits_symbols is
49
-- internal constants
50
  constant MAPPER_SYMBOL_NUMBER_PER_CHANNEL: integer := CCSDS_TX_MAPPER_DATA_BUS_SIZE*CCSDS_TX_MAPPER_MODULATION_TYPE/(2*CCSDS_TX_MAPPER_BITS_PER_SYMBOL);
51
-- internal variable signals
52
-- components instanciation and mapping
53
  begin
54
-- presynthesis checks
55
     CHKMAPPERP0 : if (CCSDS_TX_MAPPER_DATA_BUS_SIZE mod (CCSDS_TX_MAPPER_BITS_PER_SYMBOL*2*CCSDS_TX_MAPPER_MODULATION_TYPE) /= 0) generate
56
      process
57
      begin
58
        report "ERROR: DATA BUS SIZE HAS TO BE A MULTIPLE OF 2*BITS PER SYMBOLS (EXCEPT FOR BPSK MODULATION)" severity failure;
59
              wait;
60
      end process;
61
    end generate CHKMAPPERP0;
62
     CHKMAPPERP1: if (CCSDS_TX_MAPPER_BITS_PER_SYMBOL /= 1) and (CCSDS_TX_MAPPER_MODULATION_TYPE = 2) generate
63
      process
64
      begin
65
        report "ERROR: BPSK MODULATION REQUIRES 1 BIT PER SYMBOL" severity failure;
66
              wait;
67
      end process;
68
    end generate CHKMAPPERP1;
69
     CHKMAPPERP2 : if (CCSDS_TX_MAPPER_MODULATION_TYPE /= 1) and (CCSDS_TX_MAPPER_MODULATION_TYPE /= 2) generate
70
      process
71
      begin
72
        report "ERROR: UNKNOWN MODULATION TYPE - 1=QPSK/QAM / 2=BPSK" severity failure;
73
              wait;
74
      end process;
75
    end generate CHKMAPPERP2;
76
-- internal processing
77
    --=============================================================================
78
    -- Begin of mapperp
79
    -- Map bits to symbols
80
    --=============================================================================
81
    -- read: rst_i, dat_i, dat_val_i
82
    -- write: sym_i_o, sym_q_o, sym_val_o
83
    -- r/w:
84
    MAPPERP: process (clk_i)
85
    variable symbol_counter: integer range 1 to MAPPER_SYMBOL_NUMBER_PER_CHANNEL := MAPPER_SYMBOL_NUMBER_PER_CHANNEL;
86
    begin
87
      -- on each clock rising edge
88
      if rising_edge(clk_i) then
89
        -- reset signal received
90
        if (rst_i = '1') then
91
          sym_i_o <= (others => '0');
92
          sym_q_o <= (others => '0');
93
          symbol_counter := MAPPER_SYMBOL_NUMBER_PER_CHANNEL;
94
          sym_val_o <= '0';
95
        else
96
          if (dat_val_i = '1') then
97
            sym_val_o <= '1';
98
            -- BPSK mapping
99
            if (CCSDS_TX_MAPPER_BITS_PER_SYMBOL = 1) and (CCSDS_TX_MAPPER_MODULATION_TYPE = 2) then
100
              sym_q_o(0) <= '0';
101
              sym_i_o(0) <= dat_i(symbol_counter-1);
102
            -- QPSK/QAM mapping
103
            else
104
              sym_i_o <= dat_i(symbol_counter*CCSDS_TX_MAPPER_BITS_PER_SYMBOL*2-1 downto symbol_counter*2*CCSDS_TX_MAPPER_BITS_PER_SYMBOL-CCSDS_TX_MAPPER_BITS_PER_SYMBOL);
105
              sym_q_o <= dat_i(symbol_counter*2*CCSDS_TX_MAPPER_BITS_PER_SYMBOL-CCSDS_TX_MAPPER_BITS_PER_SYMBOL-1 downto symbol_counter*2*CCSDS_TX_MAPPER_BITS_PER_SYMBOL-2*CCSDS_TX_MAPPER_BITS_PER_SYMBOL);
106
            end if;
107
            if (symbol_counter = 1) then
108
              symbol_counter := MAPPER_SYMBOL_NUMBER_PER_CHANNEL;
109
            else
110
              symbol_counter := symbol_counter - 1;
111
            end if;
112
          else
113
            sym_val_o <= '0';
114
          end if;
115
        end if;
116
      end if;
117
    end process;
118
end rtl;

powered by: WebSVN 2.1.0

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