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

Subversion Repositories aemb

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

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

Line No. Rev Author Line
1 130 sybreon
/* $Id: testbench.cc,v 1.3 2008-04-26 00:25:19 sybreon Exp $
2 125 sybreon
**
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 130 sybreon
#include <stdio.h>
23
#include <stdlib.h>
24 107 sybreon
#include "aemb/core.hh"
25 125 sybreon
#include "literate.hh"
26
#include "simboard.hh"
27
#include <vector>
28 107 sybreon
 
29 130 sybreon
using namespace aemb;
30
 
31 125 sybreon
#define MAX_TEST 5
32 107 sybreon
 
33 125 sybreon
int thread1() // runs math tests
34 107 sybreon
{
35 125 sybreon
  // *** 1. FIBONACCI *** //
36 130 sybreon
  printf("Fibonacci Test\n");
37 125 sybreon
  if (fibonacciTest(MAX_TEST) != EXIT_SUCCESS) trap(-1);
38 107 sybreon
 
39 125 sybreon
  // *** 2. EUCLIDEAN *** //
40 130 sybreon
  printf("Euclidean Test\n");
41 125 sybreon
  if (euclideanTest(MAX_TEST) != EXIT_SUCCESS) trap(-2);
42 107 sybreon
 
43 125 sybreon
  // *** 3. NEWTON-RHAPSON *** //
44 130 sybreon
  printf("Newton-Rhapson Test\n");
45 125 sybreon
  if (newtonTest(MAX_TEST) != EXIT_SUCCESS) trap(-3);
46 107 sybreon
 
47 130 sybreon
  printf("Test 1 Done\n");
48
  //rendezvous(); // Wait for other thread
49 125 sybreon
  return 0;
50 107 sybreon
}
51
 
52
 
53 125 sybreon
int thread0() // runs core tests
54 107 sybreon
{
55 125 sybreon
  // *** 1. MALLOC TEST ***/
56
  //if (memoryTest(100) != EXIT_SUCCESS) trap(1);
57 107 sybreon
 
58 125 sybreon
  // *** 2. INTERRUPT TEST *** //
59
  //if (interruptTest(10000) != EXIT_SUCCESS) trap(2);
60 107 sybreon
 
61 125 sybreon
  // *** 3. XSL *** //
62
  //if (xslTest(0xBADCAB1E) != EXIT_SUCCESS) trap(3);
63 107 sybreon
 
64 130 sybreon
  rendezvous(); // Wait for other thread
65 125 sybreon
  return 0;
66 107 sybreon
}
67
 
68 125 sybreon
int threads()
69
{
70 130 sybreon
  if (isThread1())
71 125 sybreon
    return thread1();
72
  else
73
    return thread0();
74 107 sybreon
}
75
 
76
// run tests
77
int main()
78 125 sybreon
{
79 130 sybreon
  printf("AEMB2 32-bit MICROPROCESSOR CORE\n");
80 125 sybreon
  threads();
81
  return EXIT_SUCCESS;
82 107 sybreon
}
83 125 sybreon
 
84
/*
85
$Log: not supported by cvs2svn $
86 130 sybreon
Revision 1.2  2008/04/21 12:13:12  sybreon
87
Passes arithmetic tests with single thread.
88
 
89 125 sybreon
*/

powered by: WebSVN 2.1.0

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