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

Subversion Repositories turbo8051

[/] [turbo8051/] [trunk/] [verif/] [sw/] [C/] [gcd.c] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 dinesha
/*
2
 * Copyright (c) 1999-2001 Tony Givargis.  Permission to copy is granted
3
 * provided that this header remains intact.  This software is provided
4
 * with no warranties.
5
 *
6
 * Version : 2.9
7
 */
8
 
9
/*---------------------------------------------------------------------------*/
10
 
11
#include <8051.h>
12
 
13
/*---------------------------------------------------------------------------*/
14
 
15
void main() {
16
 
17
    unsigned char x=45, y=11;
18
 
19
    while( x != y ) {
20
 
21
        if( x > y ) {
22
 
23
            x -= y;
24
            P0 = x;
25
        }
26
        else {
27
 
28
            y -= x;
29
            P1 = y;
30
        }
31
    }
32
    if(x == 1 && y == 1) {
33
       P2 = 0xAA; // Pass Signature
34
       P3 = 0xAA;
35
    } else {
36
       P2 = 0x55; // Failure signature
37
       P3 = 0x1;
38
    }
39
    while(1);
40
}

powered by: WebSVN 2.1.0

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