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

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [verify/] [lxp32/] [src/] [platform/] [scrambler.vhd] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 ring0_mipt
---------------------------------------------------------------------
2
-- Scrambler
3
--
4
-- Part of the LXP32 test platform
5
--
6
-- Copyright (c) 2016 by Alex I. Kuznetsov
7
--
8
-- Generates a pseudo-random binary sequence using a Linear-Feedback
9
-- Shift Register (LFSR).
10
--
11
-- In order to generate a maximum-length sequence, 1+x^TAP1+x^TAP2
12
-- must be a primitive polynomial. Typical polynomials include:
13
-- (6,7), (9,11), (14,15).
14
--
15
-- Note: regardless of whether this description is synthesizable,
16
-- it was designed exclusively for simulation purposes.
17
---------------------------------------------------------------------
18
 
19
library ieee;
20
use ieee.std_logic_1164.all;
21
 
22
entity scrambler is
23
        generic(
24
                TAP1: integer;
25
                TAP2: integer
26
        );
27
        port(
28
                clk_i: in std_logic;
29
                rst_i: in std_logic;
30
                ce_i: in std_logic;
31
                d_o: out std_logic
32
        );
33
end entity;
34
 
35
architecture rtl of scrambler is
36
 
37
signal reg: std_logic_vector(TAP2 downto 1):=(others=>'1');
38
 
39
begin
40
 
41
process (clk_i) is
42
begin
43
        if rising_edge(clk_i) then
44
                if rst_i='1' then
45
                        reg<=(others=>'1');
46
                elsif ce_i='1' then
47
                        reg<=reg(TAP2-1 downto 1)&(reg(TAP2) xor reg(TAP1));
48
                end if;
49
        end if;
50
end process;
51
 
52
d_o<=reg(1);
53
 
54
end architecture;

powered by: WebSVN 2.1.0

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