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

Subversion Repositories aemb

[/] [aemb/] [tags/] [AEMB_711/] [sw/] [c/] [aeMB_testbench.c] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 sybreon
/*
2
 * $Id: aeMB_testbench.c,v 1.1 2007-03-09 17:41:57 sybreon Exp $
3
 *
4
 * Copyright (C) 2006 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
5
 *
6
 * This library is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU Lesser General Public License as published by
8
 * the Free Software Foundation; either version 2.1 of the License,
9
 * or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful, but
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14
 * License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License
17
 * along with this library; if not, write to the Free Software Foundation, Inc.,
18
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
 *
20
 * DESCRIPTION
21
 * Controls the state of the processor.
22
 *
23
 * HISTORY
24
 * $Log: not supported by cvs2svn $
25
 */
26
 
27
#include <stdlib.h>
28
 
29
int main () {
30
 
31
  int a;
32
  int b;
33
  int c[10];
34
  register int i;
35
 
36
  a = rand();
37
  b = rand();
38
 
39
  c[0] = add_test(a,b);
40
  c[1] = sub_test(a,b);
41
  c[2] = mul_test(a,b);
42
  c[3] = div_test(a,b);
43
 
44
  for (i=0;i<5;i++) {
45
        c[i+5] = c[i];
46
  }
47
 
48
  return c[3];
49
}
50
 
51
// RES = B - A
52
int sub_test(int a, int b) { return (b-a); }
53
 
54
// RES = A + B
55
int add_test(int a, int b) { return (a+b); }
56
 
57
// RES = A * B
58
int mul_test(int a, int b) { return (a*b); }
59
 
60
// RES = B / A
61
int div_test(int a, int b) { return (b/a); }

powered by: WebSVN 2.1.0

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