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

Subversion Repositories myblaze

[/] [myblaze/] [trunk/] [rtl/] [testbench.c] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 rockee
#include "stdio.h"
2
/*#include <stdio.h>*/
3
#include "xil_printf.c"
4
char str[] = "Hallo, Welt!\r\n";
5
/*[>char str[] = "1";<]*/
6
int fib(int n){
7
    switch (n) {
8
        case 0:
9
            return 0;
10
        case 1:
11
            return 1;
12
        default:
13
            return fib(n-1) + fib(n-2);
14
    }
15
}
16
int main()
17
{
18
    char count = 0;
19
    int f = 0;
20
    volatile char *led = (char *) 0xffffffb0;
21
while(1) {
22
    *led = (char) count;
23
    count += 1;
24
    xil_printf2(
25
                /*"02"*/
26
            "0:Hello, world!\r\n"
27
            "1:Hello, world!\r\n"
28
    );
29
    xil_printf2(str);
30
    f = fib(15);
31
    if (f == 610)
32
        /*xil_printf2("Okey\r\n");*/
33
        xil_printf2("0x%x\r\n", f);
34
    else
35
        xil_printf2("Error\r\n");
36
    xil_printf2(str);
37
}
38
    return 0;
39
}

powered by: WebSVN 2.1.0

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