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

Subversion Repositories pcie_vera_tb

[/] [pcie_vera_tb/] [trunk/] [scramble8.vri] - Rev 10

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

// ===========================================================================
// File    : scramble8.vri
// Author  : cwinward
// Date    : Mon Dec 3 11:03:46 MST 2007
// Project : TI PHY design
//
// Copyright (c) notice
// This code adheres to the GNU public license
//
// ===========================================================================
//
// $Id: scramble8.vri,v 1.1.1.1 2007-12-05 18:37:07 cmagleby Exp $
//
// ===========================================================================
//
// $Log: not supported by cvs2svn $
//
// ===========================================================================
// Function : This file scrambles the rx lines and descrambles the tx lines.
//
// ===========================================================================
// ===========================================================================
#include <vera_defines.vrh>



task scramble8(bit [7:0] data_in, bit skp_detect, bit com_detect, bit sram_bypass, bit [15:0] lfsr_old, var bit [7:0] scramble_data, var bit [15:0] lfsr) {


    if((sram_bypass == 1'b1) | (com_detect == 1'b1)) {
       scramble_data = data_in;
     }
     else {
       scramble_data[0] = lfsr_old[15] ^ data_in[0];
       scramble_data[1] = lfsr_old[14] ^ data_in[1];
       scramble_data[2] = lfsr_old[13] ^ data_in[2];
       scramble_data[3] = lfsr_old[12] ^ data_in[3];
       scramble_data[4] = lfsr_old[11] ^ data_in[4];
       scramble_data[5] = lfsr_old[10] ^ data_in[5];
       scramble_data[6] = lfsr_old[9]  ^ data_in[6];
       scramble_data[7] = lfsr_old[8]  ^ data_in[7];
     }

    
    if(com_detect == 1'b1) {
      lfsr = 16'hFFFF;
    }
    else if(skp_detect == 1'b0) {
      lfsr[0]  =  lfsr_old[8];
      lfsr[1]  =  lfsr_old[9];
      lfsr[2]  =  lfsr_old[10];
      lfsr[3]  =  lfsr_old[8] ^ lfsr_old[11];
      lfsr[4]  =  lfsr_old[8] ^ lfsr_old[9] ^ lfsr_old[12];
      lfsr[5]  =  lfsr_old[8] ^ lfsr_old[9] ^ lfsr_old[10] ^ lfsr_old[13];
      lfsr[6]  =  lfsr_old[9] ^ lfsr_old[10] ^ lfsr_old[11] ^ lfsr_old[14];
      lfsr[7]  =  lfsr_old[10] ^ lfsr_old[11] ^ lfsr_old[12] ^ lfsr_old[15];
      lfsr[8]  =  lfsr_old[0] ^ lfsr_old[11] ^ lfsr_old[12] ^ lfsr_old[13];
      lfsr[9]  =  lfsr_old[1] ^ lfsr_old[12] ^ lfsr_old[13] ^ lfsr_old[14];
      lfsr[10] =  lfsr_old[2] ^ lfsr_old[13] ^ lfsr_old[14] ^ lfsr_old[15];
      lfsr[11] =  lfsr_old[3] ^ lfsr_old[14] ^ lfsr_old[15];
      lfsr[12] =  lfsr_old[4] ^ lfsr_old[15];
      lfsr[13] =  lfsr_old[5];
      lfsr[14] =  lfsr_old[6];
      lfsr[15] =  lfsr_old[7];
    }
    else {
      lfsr = lfsr_old;
    }

}

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

powered by: WebSVN 2.1.0

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