OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_c/] [orcc/] [lib/] [orcc_func.c] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
 
2
 
3
 
4
// a simple delay function
5
void delay ( unsigned int num ){
6
 
7
        while (num>0){
8
                num--;
9
                nop(); // asm volatile ("nop");
10
        }
11
        return;
12
 
13
}
14
 
15
 
16
#ifndef RANDOM_H
17
        #define RANDOM_H
18
 
19
// KISS is one random number generator according to three numbers.
20
static unsigned int x=123456789,y=234567891,z=345678912,w=456789123,c=0;
21
 
22
unsigned int JKISS32() {
23
    unsigned int t;
24
 
25
    y ^= (y<<5); y ^= (y>>7); y ^= (y<<22);
26
 
27
    t = z+w+c; z = w; c = t < 0; w = t&2147483647;
28
 
29
    x += 1411392427;
30
 
31
    return x + y + w;
32
}
33
 
34
unsigned int rand(void){
35
        return JKISS32();
36
}
37
 
38
void srand(unsigned int seed){
39
        x^=seed; y+=seed; z^=seed; w-=seed;
40
}
41
 
42
 
43
 
44
#endif

powered by: WebSVN 2.1.0

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