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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [verif/] [sw/] [C/] [divmul.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 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 x = 134;
18
    unsigned y = 1;
19
    unsigned q, r, p, i;
20
 
21
    for(i=0; i<12; i++) {
22
 
23
        y++;
24
    }
25
 
26
    q = x / y;
27
    r = x % y;
28
    p = q * y + r;
29
 
30
    P0 = q;
31
    P0 = r;
32
    P0 = p;
33
    if(p == 134 && r == 4 && q == 10) {
34
        P2 = 0xAA; // Pass Signature
35
        P3 = 0xAA;
36
    } else {
37
        P2 = 0x55; // Fail Signature
38
        P3 = 0x1;
39
   }
40
 
41
    while(1);
42
}

powered by: WebSVN 2.1.0

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