diff --git a/Changes b/Changes index 58e095465..6131c239e 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix compile issues with GCC 4.3, bug47. [Lane Brooks] +**** Fix VL_RANDom to better randomize bits. [Art Stamness] + * Verilator 3.700 2009/01/08 ** Add limited support for tristate inouts. Written by Lane Brooks. diff --git a/bin/verilator b/bin/verilator index a0fe43535..643335fc3 100755 --- a/bin/verilator +++ b/bin/verilator @@ -633,6 +633,12 @@ will call a function to determine the value, this allows randomization of all Xs to find reset bugs and is the slowest, but safest for finding reset bugs in code. +If using -x-assign unique, you may want to seed your random number +generator such that each regression run gets a different randomization +sequence. Use the system's srand48() or for Windows srand() function to do +this. You'll probably also want to print any seeds selected, and code to +enable rerunning with that same seed so you can reproduce bugs. + =back =head1 VERILOG ARGUMENTS diff --git a/include/verilated.cpp b/include/verilated.cpp index b4500c8d4..831cd63d8 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -73,9 +73,9 @@ void vl_fatal (const char* filename, int linenum, const char* hier, const char* IData VL_RAND32() { #if defined(_WIN32) && !defined(__CYGWIN__) // Windows doesn't have lrand48(), although Cygwin does. - return (rand()<<16) | rand(); + return (rand()<<16) ^ rand(); #else - return (lrand48()<<16) | lrand48(); + return (lrand48()<<16) ^ lrand48(); #endif }