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

Subversion Repositories epc_rfid_transponder

[/] [epc_rfid_transponder/] [trunk/] [pseudoRNG.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 erwing
-------------------------------------------------------------------------------
2
--     Politecnico di Torino                                              
3
--     Dipartimento di Automatica e Informatica             
4
-------------------------------------------------------------------------------
5
-------------------------------------------------------------------------------     
6
--
7
--     Title          : EPC Class1 Gen2 RFID Tag - 16-bit Pseudo-random Number Generator    
8
--
9
--     File name      : pseudoRNG.vhd 
10
--
11
--     Description    : Peudo-random number generator based on 31-bit LFSR.
12
--                      LFSR primitive polynomial: 1 + X^28 + X^31
13
--                      Better performance may be reached using a leap-forward
14
--                      LFSR implementation...!!!
15
--     
16
--     Authors        : Erwing R. Sanchez <erwing.sanchezsanchez@polito.it>
17
--
18
--     Rev. History   : 17 july 06 - First Draft 
19
--                                 
20
-------------------------------------------------------------------------------            
21
-------------------------------------------------------------------------------
22
 
23
library IEEE;
24
use IEEE.STD_LOGIC_1164.all;
25
use IEEE.std_logic_unsigned.all;
26
use IEEE.STD_LOGIC_ARITH.all;
27
 
28
 
29
entity prng is
30
  port (
31
    clk   : in  std_logic;
32
    rst_n : in  std_logic;
33
    init  : in  std_logic;
34
    cin   : in  std_logic_vector(30 downto 0);
35
    ce    : in  std_logic;
36
    cout  : out std_logic_vector(30 downto 0));
37
end prng;
38
 
39
 
40
architecture prng_arch of prng is
41
 
42
  signal lfsr31 : std_logic_vector(30 downto 0);
43
 
44
begin  -- prng16_arch
45
 
46
  LFSR : process (clk, rst_n)
47
  begin  -- process LFSR
48
    if rst_n = '0' then                 -- asynchronous reset (active low)
49
      lfsr31 <= (others => '0');
50
    elsif clk'event and clk = '1' then  -- rising clock edge
51
      if init = '1' then
52
        lfsr31 <= cin;
53
      elsif ce = '1' then               -- shift register;
54
        lfsr31(30 downto 1) <= lfsr31(29 downto 0);
55
        lfsr31(0)           <= lfsr31(30) xor lfsr31(27);
56
      end if;
57
    end if;
58
  end process LFSR;
59
 
60
  cout <= lfsr31;
61
 
62
end prng_arch;

powered by: WebSVN 2.1.0

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