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

Subversion Repositories galois_lfsr

[/] [galois_lfsr/] [trunk/] [rtl/] [galois-lfsr.vhdl] - Diff between revs 2 and 7

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 7
Line 38... Line 38...
        You should have received a copy of the GNU Lesser General
        You should have received a copy of the GNU Lesser General
        Public License along with this source; if not, download it
        Public License along with this source; if not, download it
        from http://www.opencores.org/lgpl.shtml.
        from http://www.opencores.org/lgpl.shtml.
*/
*/
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all;
library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all;
--use work.types.all;
/* Enable for synthesis; comment out for simulation.
 
        For this design, we just need boolean_vector. This is already included in Questa/ModelSim,
 
        but Quartus doesn't yet support this.
 
*/
 
use work.types.all;
 
 
entity lfsr is generic(
entity lfsr is generic(
                /*
                /*
                 * Tap vector: a TRUE means that position is tapped, otherwise that position is untapped.
                 * Tap vector: a TRUE means that position is tapped, otherwise that position is untapped.
                 */
                 */
Line 73... Line 77...
 
 
 
 
        /* Receives a vector of taps; generates LFSR structure with correct XOR positionings. */
        /* Receives a vector of taps; generates LFSR structure with correct XOR positionings. */
        tapGenr: for i in 0 to taps'high-1 generate
        tapGenr: for i in 0 to taps'high-1 generate
                i_d(i+1)<=x(i) when taps(i) else i_q(i);
                i_d(i+1)<=x(i) when taps(i) else i_q(i);
                x(i)<=i_q(i) xor i_q(taps'high);        -- when nReset else '0';
                x(i)<=i_q(i) xor i_q(taps'high);
        end generate;
        end generate;
 
 
        process(nReset,load,seed,clk) is begin
        process(nReset,load,seed,clk) is begin
                --if nReset='0' or load then i_q<=seed;
 
                if nReset='0' then i_q<=(others=>'0');
                if nReset='0' then i_q<=(others=>'0');
                elsif load then i_q<=seed;
                elsif load then i_q<=seed;
                elsif rising_edge(clk) then
                elsif rising_edge(clk) then
                        i_q<=i_d;
                        i_q<=i_d;
                end if;
                end if;

powered by: WebSVN 2.1.0

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