------------------------------------------------------------
-- Copyright: 2011 Integrated Sytems Laboratory, ETH Zurich
--            http://www.iis.ee.ethz.ch/~sha3
------------------------------------------------------------
-------------------------------------------------------------------------------
-- Title      : LFSR that generates 64 bit outputs
-- Project    : Shabziger
-------------------------------------------------------------------------------
-- File       : lfsr73.vhd
-- Author     : Frank K. Guerkaynak  
-- Company    : Integrated Systems Laboratory, ETH Zurich
-- Created    : 2011-08-15
-- Last update: 2011-08-15
-- Platform   : ModelSim (simulation), Synopsys (synthesis)
-- Standard   : VHDL'87
-------------------------------------------------------------------------------
-- Description: Simple LFSR to generate the input
-------------------------------------------------------------------------------
-- Copyright (c) 2011 Integrated Systems Laboratory, ETH Zurich
-------------------------------------------------------------------------------
-- Revisions  :
-- Date        Version  Author  Description
-- 2011-08-15  1.0      kgf	Created by lfsrgen, modified to
--                              have serial I/O for initialization
-------------------------------------------------------------------------------


-- Simple LFSR generated by lfsrgen.pl
-- lfsr73x64x1.vhd
-- x^73 + x^{25} + 1
-- calculated output after 64 iterations

-- Primitive polynomial selected from HAC page 161. We need a polynomial
-- with large coefficients. There are several sources where such lists can
-- be found. HAC seems to be a more respected source. See also
-- http://www.jjj.de/mathdata/highbit-normalprimpoly.txt
-- http://www.jjj.de/mathdata/all-trinomial-primpoly.txt
-- actually 71 65 would be much smaller (64 xors) but it is not in the
-- HAC list.. 

library IEEE;
use IEEE.std_logic_1164.all;

entity lfsr73 is 
  port(
        ScanInxTI  : in  std_logic;
        ScanEnxTI  : in  std_logic;
        ScanOutxTO : out std_logic;
        DataOutxDO : out std_logic_vector (63 downto 0);
        ClkxCI     : in  std_logic;
        RstxRBI    : in  std_logic
      );
end lfsr73;

architecture generated of lfsr73 is

   signal DataxDP, DataxDN : std_logic_vector (72 downto 0);
   signal LFSRxD           : std_logic_vector (72 downto 0);
   signal NextDataxD       : std_logic_vector (72 downto 0);

begin

   DataOutxDO <= DataxDP (72 downto 9);

   p_clk: process (ClkxCI, RstxRBI)
          begin
            if RstxRBI='0' then 
               DataxDP <= (others => '1');     -- reset to one always
            elsif ClkxCI'event and ClkxCI= '1' then  -- 'rising clock
               DataxDP <= DataxDN;
            end if;
          end process p_clk;   


   -- LFSR assignments start here
   
   LFSRxD(0) <= DataxDP(11) xor
		DataxDP(59) xor
		DataxDP(34) xor
		DataxDP(9);
   LFSRxD(1) <= DataxDP(12) xor
		DataxDP(60) xor
		DataxDP(35) xor
		DataxDP(10);
   LFSRxD(2) <= DataxDP(13) xor
		DataxDP(61) xor
		DataxDP(36) xor
		DataxDP(11);
   LFSRxD(3) <= DataxDP(14) xor
		DataxDP(62) xor
		DataxDP(37) xor
		DataxDP(12);
   LFSRxD(4) <= DataxDP(15) xor
		DataxDP(63) xor
		DataxDP(38) xor
		DataxDP(13);
   LFSRxD(5) <= DataxDP(16) xor
		DataxDP(64) xor
		DataxDP(39) xor
		DataxDP(14);
   LFSRxD(6) <= DataxDP(17) xor
		DataxDP(65) xor
		DataxDP(40) xor
		DataxDP(15);
   LFSRxD(7) <= DataxDP(18) xor
		DataxDP(66) xor
		DataxDP(41) xor
		DataxDP(16);
   LFSRxD(8) <= DataxDP(19) xor
		DataxDP(67) xor
		DataxDP(42) xor
		DataxDP(17);
   LFSRxD(9) <= DataxDP(20) xor
		DataxDP(68) xor
		DataxDP(43) xor
		DataxDP(18);
   LFSRxD(10) <= DataxDP(21) xor
		DataxDP(69) xor
		DataxDP(44) xor
		DataxDP(19);
   LFSRxD(11) <= DataxDP(22) xor
		DataxDP(70) xor
		DataxDP(45) xor
		DataxDP(20);
   LFSRxD(12) <= DataxDP(23) xor
		DataxDP(71) xor
		DataxDP(46) xor
		DataxDP(21);
   LFSRxD(13) <= DataxDP(24) xor
		DataxDP(72) xor
		DataxDP(47) xor
		DataxDP(22);
   LFSRxD(14) <= DataxDP(0) xor
		DataxDP(48) xor
		DataxDP(23);
   LFSRxD(15) <= DataxDP(1) xor
		DataxDP(49) xor
		DataxDP(24);
   LFSRxD(16) <= DataxDP(2) xor
		DataxDP(50) xor
		DataxDP(25);
   LFSRxD(17) <= DataxDP(3) xor
		DataxDP(51) xor
		DataxDP(26);
   LFSRxD(18) <= DataxDP(4) xor
		DataxDP(52) xor
		DataxDP(27);
   LFSRxD(19) <= DataxDP(5) xor
		DataxDP(53) xor
		DataxDP(28);
   LFSRxD(20) <= DataxDP(6) xor
		DataxDP(54) xor
		DataxDP(29);
   LFSRxD(21) <= DataxDP(7) xor
		DataxDP(55) xor
		DataxDP(30);
   LFSRxD(22) <= DataxDP(8) xor
		DataxDP(56) xor
		DataxDP(31);
   LFSRxD(23) <= DataxDP(9) xor
		DataxDP(57) xor
		DataxDP(32);
   LFSRxD(24) <= DataxDP(10) xor
		DataxDP(58) xor
		DataxDP(33);
   LFSRxD(25) <= DataxDP(11) xor
		DataxDP(59) xor
		DataxDP(34);
   LFSRxD(26) <= DataxDP(12) xor
		DataxDP(60) xor
		DataxDP(35);
   LFSRxD(27) <= DataxDP(13) xor
		DataxDP(61) xor
		DataxDP(36);
   LFSRxD(28) <= DataxDP(14) xor
		DataxDP(62) xor
		DataxDP(37);
   LFSRxD(29) <= DataxDP(15) xor
		DataxDP(63) xor
		DataxDP(38);
   LFSRxD(30) <= DataxDP(16) xor
		DataxDP(64) xor
		DataxDP(39);
   LFSRxD(31) <= DataxDP(17) xor
		DataxDP(65) xor
		DataxDP(40);
   LFSRxD(32) <= DataxDP(18) xor
		DataxDP(66) xor
		DataxDP(41);
   LFSRxD(33) <= DataxDP(19) xor
		DataxDP(67) xor
		DataxDP(42);
   LFSRxD(34) <= DataxDP(20) xor
		DataxDP(68) xor
		DataxDP(43);
   LFSRxD(35) <= DataxDP(21) xor
		DataxDP(69) xor
		DataxDP(44);
   LFSRxD(36) <= DataxDP(22) xor
		DataxDP(70) xor
		DataxDP(45);
   LFSRxD(37) <= DataxDP(23) xor
		DataxDP(71) xor
		DataxDP(46);
   LFSRxD(38) <= DataxDP(24) xor
		DataxDP(72) xor
		DataxDP(47);
   LFSRxD(39) <= DataxDP(0) xor
		DataxDP(48);
   LFSRxD(40) <= DataxDP(1) xor
		DataxDP(49);
   LFSRxD(41) <= DataxDP(2) xor
		DataxDP(50);
   LFSRxD(42) <= DataxDP(3) xor
		DataxDP(51);
   LFSRxD(43) <= DataxDP(4) xor
		DataxDP(52);
   LFSRxD(44) <= DataxDP(5) xor
		DataxDP(53);
   LFSRxD(45) <= DataxDP(6) xor
		DataxDP(54);
   LFSRxD(46) <= DataxDP(7) xor
		DataxDP(55);
   LFSRxD(47) <= DataxDP(8) xor
		DataxDP(56);
   LFSRxD(48) <= DataxDP(9) xor
		DataxDP(57);
   LFSRxD(49) <= DataxDP(10) xor
		DataxDP(58);
   LFSRxD(50) <= DataxDP(11) xor
		DataxDP(59);
   LFSRxD(51) <= DataxDP(12) xor
		DataxDP(60);
   LFSRxD(52) <= DataxDP(13) xor
		DataxDP(61);
   LFSRxD(53) <= DataxDP(14) xor
		DataxDP(62);
   LFSRxD(54) <= DataxDP(15) xor
		DataxDP(63);
   LFSRxD(55) <= DataxDP(16) xor
		DataxDP(64);
   LFSRxD(56) <= DataxDP(17) xor
		DataxDP(65);
   LFSRxD(57) <= DataxDP(18) xor
		DataxDP(66);
   LFSRxD(58) <= DataxDP(19) xor
		DataxDP(67);
   LFSRxD(59) <= DataxDP(20) xor
		DataxDP(68);
   LFSRxD(60) <= DataxDP(21) xor
		DataxDP(69);
   LFSRxD(61) <= DataxDP(22) xor
		DataxDP(70);
   LFSRxD(62) <= DataxDP(23) xor
		DataxDP(71);
   LFSRxD(63) <= DataxDP(24) xor
		DataxDP(72);
   LFSRxD(64) <= DataxDP(0);
   LFSRxD(65) <= DataxDP(1);
   LFSRxD(66) <= DataxDP(2);
   LFSRxD(67) <= DataxDP(3);
   LFSRxD(68) <= DataxDP(4);
   LFSRxD(69) <= DataxDP(5);
   LFSRxD(70) <= DataxDP(6);
   LFSRxD(71) <= DataxDP(7);
   LFSRxD(72) <= DataxDP(8);

  -- This section has been modified to allow a regular shift register function
  -- into the LFSR. This way it can be initialized.
   
   with ScanEnxTI select
        DataxDN <= NextDataxD when '1',
                   LFSRxD     when others;

  -- NextData assignment 
   NextDataxD(72 downto 1)  <= DataxDP(71 downto 0);
   NextDataxD(0)            <= ScanInxTI;
   ScanOutxTO               <= DataxDP(72);


end architecture generated;

Generated on Tue Nov 22 15:16:34 CET 2011
Home