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

Subversion Repositories aemb

[/] [aemb/] [trunk/] [sw/] [cc/] [testbench.cc] - Blame information for rev 125

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

Line No. Rev Author Line
1 125 sybreon
/* $Id: testbench.cc,v 1.2 2008-04-21 12:13:12 sybreon Exp $
2
**
3
** AEMB Function Verification C++ Testbench
4
** Copyright (C) 2004-2008 Shawn Tan <shawn.tan@aeste.net>
5
**
6
** This file is part of AEMB.
7
**
8
** AEMB is free software: you can redistribute it and/or modify it
9
** under the terms of the GNU General Public License as published by
10
** the Free Software Foundation, either version 3 of the License, or
11
** (at your option) any later version.
12
**
13
** AEMB is distributed in the hope that it will be useful, but WITHOUT
14
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
** or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16
** License for more details.
17
**
18
** You should have received a copy of the GNU General Public License
19
** along with AEMB.  If not, see <http://www.gnu.org/licenses/>.
20
*/
21 107 sybreon
 
22
#include <cstdio>
23
#include <cstdlib>
24
#include "aemb/core.hh"
25 125 sybreon
#include "literate.hh"
26
#include "simboard.hh"
27
#include <vector>
28 107 sybreon
 
29 125 sybreon
#define MAX_TEST 5
30 107 sybreon
 
31 125 sybreon
int thread1() // runs math tests
32 107 sybreon
{
33 125 sybreon
  // *** 1. FIBONACCI *** //
34
  outword (0xF1B07357);
35
  if (fibonacciTest(MAX_TEST) != EXIT_SUCCESS) trap(-1);
36 107 sybreon
 
37 125 sybreon
  // *** 2. EUCLIDEAN *** //
38
  outword (0xEC1D7357);
39
  if (euclideanTest(MAX_TEST) != EXIT_SUCCESS) trap(-2);
40 107 sybreon
 
41 125 sybreon
  // *** 3. NEWTON-RHAPSON *** //
42
  outword (0xF10A7357);
43
  if (newtonTest(MAX_TEST) != EXIT_SUCCESS) trap(-3);
44 107 sybreon
 
45 125 sybreon
  outword (0xAAAAAAAA);
46
  aemb::rendezvous(); // Wait for other thread
47
  return 0;
48 107 sybreon
}
49
 
50
 
51 125 sybreon
int thread0() // runs core tests
52 107 sybreon
{
53 125 sybreon
  // *** 1. MALLOC TEST ***/
54
  //if (memoryTest(100) != EXIT_SUCCESS) trap(1);
55 107 sybreon
 
56 125 sybreon
  // *** 2. INTERRUPT TEST *** //
57
  //if (interruptTest(10000) != EXIT_SUCCESS) trap(2);
58 107 sybreon
 
59 125 sybreon
  // *** 3. XSL *** //
60
  //if (xslTest(0xBADCAB1E) != EXIT_SUCCESS) trap(3);
61 107 sybreon
 
62 125 sybreon
  outword (0xBBBBBBBB);
63
  aemb::rendezvous(); // Wait for other thread
64
  return 0;
65 107 sybreon
}
66
 
67 125 sybreon
int threads()
68
{
69
  if (aemb::isThread1())
70
    return thread1();
71
  else
72
    return thread0();
73 107 sybreon
}
74
 
75
// run tests
76
int main()
77 125 sybreon
{
78
  threads();
79
  return EXIT_SUCCESS;
80 107 sybreon
}
81 125 sybreon
 
82
/*
83
$Log: not supported by cvs2svn $
84
*/

powered by: WebSVN 2.1.0

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