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

Subversion Repositories gigabit_udp_mac

[/] [gigabit_udp_mac/] [trunk/] [MAC/] [LFSR11C.VHD] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 boa_a_m
----------------------------------------------
2
-- MSS copyright 2001-2005
3
-- Filename: LFSR11C.VHD
4
-- Inheritance: LFSR11.VHD rev 4 and  LFSR11B.VHD rev 4
5
-- Edit date: 9/28/05
6
-- Revision: 1
7
-- Description:
8
--              pseudo random bit generation. based on 11-bit linear feedback
9
--      shift register. A synchronous reset is provided to reset
10
--              the PN sequence at frame boundaries.
11
--              Includes seed initialization.
12
---------------------------------------------
13
library IEEE;
14
use IEEE.STD_LOGIC_1164.ALL;
15
use IEEE.STD_LOGIC_ARITH.ALL;
16
use IEEE.STD_LOGIC_UNSIGNED.ALL;
17
 
18
entity LFSR11C is
19
  port (
20
        ASYNC_RESET: in std_logic;
21
                -- asynchronous reset, active high
22
        CLK: in  std_logic;
23
                -- clock synchronous
24
        BIT_CLK_REQ: in std_logic;
25
                -- request for output bit,
26
                -- read output bit at rising_edge of CLK and BIT_CLK_REQ_D = '1'
27
        SYNC_RESET: in std_logic;
28
                -- synchronous reset for linear feedback shift register.
29
                -- 1 CLK wide pulse aligned with BIT_CLK_REQ.
30
        SEED: in std_logic_vector(10 downto 0);
31
                -- linear feedback shift register initialization at reset
32
                -- (asynchronous and synchronous).
33
 
34
        LFSR_BIT: out std_logic;
35
                -- Linear feedback shift register output. Read at rising edge of CLK
36
                -- when BIT_CLK_OUT = '1'
37
        BIT_CLK_OUT: out std_logic;
38
                -- one CLK wide pulse indicating that the LFSR_BIT is ready.
39
                -- Latency w.r.t. BIT_CLK_REQ is one CLK.
40
        SOF_OUT: out std_logic;
41
                -- one CLK wide pulse indicating start of frame
42
                -- (i.e. '1' when LFSR register matches the SEED).
43
                -- aligned with BIT_CLK_OUT.
44
        LFSR_REG_OUT: out std_logic_vector(10 downto 0)
45
 
46
    );
47
end entity;
48
 
49
architecture behavior of LFSR11C is
50
-----------------------------------------------------------------
51
-- SIGNALS
52
-----------------------------------------------------------------
53
signal LFSR_REG     : std_logic_vector(10 downto 0);
54
 
55
-----------------------------------------------------------------
56
-- IMPLEMENTATION
57
-----------------------------------------------------------------
58
begin
59
 
60
-- linear feedback shift register
61
LSFR_GEN: process(ASYNC_RESET, CLK, SEED)
62
begin
63
if (ASYNC_RESET = '1') then
64
        LFSR_REG     <= SEED;
65
   LFSR_BIT <= '0';
66
        SOF_OUT <= '0';
67
elsif rising_edge(CLK) then
68
        BIT_CLK_OUT <= BIT_CLK_REQ;
69
 
70
        if(SYNC_RESET = '1') then
71
                -- synchronous reset
72
                LFSR_REG     <= SEED;
73
           LFSR_BIT <= '0';
74
                SOF_OUT <= '0';
75
        elsif(BIT_CLK_REQ = '1') then
76
                -- prepare next bit; used Xilinx XAP 052 Table 3 for taps
77
                LFSR_REG(10 downto 1) <= LFSR_REG(9 downto 0);
78
                LFSR_REG(0)  <= not (LFSR_REG(10) xor LFSR_REG(8));
79
                LFSR_BIT <= LFSR_REG(10);
80
                if(LFSR_REG = SEED) then
81
                        SOF_OUT <= '1';
82
                else
83
                        SOF_OUT <= '0';
84
                end if;
85
        else
86
                -- sample clocks are one CLK wide pulses.
87
                SOF_OUT <= '0';
88
        end if;
89
end if;
90
end process;
91
 
92
LFSR_REG_OUT <= LFSR_REG;
93
 
94
end behavior;
95
 

powered by: WebSVN 2.1.0

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