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

Subversion Repositories ccsds_rxtxsoc

[/] [ccsds_rxtxsoc/] [trunk/] [ccsds_tx_randomizer.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_randomizer
4
---- Version: 1.0.0
5
---- Description:
6
---- Randomize input data with LFSR output sequence
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 randomizer inputs and outputs
24
--=============================================================================
25
entity ccsds_tx_randomizer is
26
  generic(
27
    constant CCSDS_TX_RANDOMIZER_DATA_BUS_SIZE: integer -- in bits
28
  );
29
  port(
30
    -- inputs
31
    clk_i: in std_logic;
32
    dat_i: in std_logic_vector(CCSDS_TX_RANDOMIZER_DATA_BUS_SIZE-1 downto 0);
33
    dat_val_i: in std_logic;
34
    rst_i: in std_logic;
35
    -- outputs
36
    dat_o: out std_logic_vector(CCSDS_TX_RANDOMIZER_DATA_BUS_SIZE-1 downto 0);
37
    dat_val_o: out std_logic
38
  );
39
end ccsds_tx_randomizer;
40
 
41
--=============================================================================
42
-- architecture declaration / internal components and connections
43
--=============================================================================
44
architecture structure of ccsds_tx_randomizer is
45
  component ccsds_rxtx_lfsr is
46
    generic(
47
      CCSDS_RXTX_LFSR_DATA_BUS_SIZE: integer
48
    );
49
    port(
50
      clk_i: in std_logic;
51
      rst_i: in std_logic;
52
      dat_o: out std_logic_vector(CCSDS_RXTX_LFSR_DATA_BUS_SIZE-1 downto 0);
53
      dat_val_o: out std_logic
54
    );
55
  end component;
56
-- internal constants
57
-- internal variable signals
58
  signal randomizer_sequence: std_logic_vector(CCSDS_TX_RANDOMIZER_DATA_BUS_SIZE-1 downto 0);
59
  signal wire_lfsr_valid: std_logic;
60
-- components instanciation and mapping
61
  begin
62
  tx_randomizer_lfsr: ccsds_rxtx_lfsr
63
    generic map(
64
      CCSDS_RXTX_LFSR_DATA_BUS_SIZE => CCSDS_TX_RANDOMIZER_DATA_BUS_SIZE
65
    )
66
    port map(
67
      clk_i => clk_i,
68
      rst_i => rst_i,
69
      dat_val_o => wire_lfsr_valid,
70
      dat_o => randomizer_sequence
71
    );
72
 
73
-- presynthesis checks
74
-- internal processing
75
    --=============================================================================
76
    -- Begin of randp
77
    -- Randomize data using LFSR register
78
    --=============================================================================
79
    -- read: rst_i, dat_val_i, dat_i, randomizer_sequence, wire_lfsr_valid
80
    -- write: dat_o, dat_val_o
81
    -- r/w: 
82
    RANDP: process (clk_i)
83
    variable data_randomized: std_logic := '0';
84
    begin
85
      -- on each clock rising edge
86
      if rising_edge(clk_i) then
87
        -- reset signal received
88
        if (rst_i = '1') then
89
          dat_o <= (others => '0');
90
          data_randomized := '0';
91
          dat_val_o <= '0';
92
        else
93
          if (dat_val_i = '1') and (wire_lfsr_valid = '1') then
94
            dat_val_o <= '1';
95
            dat_o <= dat_i xor randomizer_sequence;
96
            data_randomized := '1';
97
          else
98
            dat_val_o <= '0';
99
            if (data_randomized = '0') then
100
              dat_o <= (others => '0');
101
            end if;
102
          end if;
103
        end if;
104
      end if;
105
    end process;
106
end structure;

powered by: WebSVN 2.1.0

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