URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
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
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.