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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [support/] [support.c] - Diff between revs 93 and 233

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

Rev 93 Rev 233
Line 889... Line 889...
 
 
  return dst;
  return dst;
 
 
}       /* memcpy () */
}       /* memcpy () */
 
 
 No newline at end of file
 No newline at end of file
 
/* --------------------------------------------------------------------------*/
 
/*!Pseudo-random number generator
 
 
 
   This should return pseudo-random numbers, based on a Galois LFSR
 
 
 
   @return The next pseudo-random number                                     */
 
/* --------------------------------------------------------------------------*/
 
unsigned long int
 
rand ()
 
{
 
  static unsigned long int lfsr = 1;
 
  static int period = 0;
 
  /* taps: 32 31 29 1; characteristic polynomial: x^32 + x^31 + x^29 + x + 1 */
 
  lfsr = (lfsr >> 1) ^ (unsigned long int)((0 - (lfsr & 1u)) & 0xd0000001u);
 
  ++period;
 
  return lfsr;
 
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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