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

Subversion Repositories aemb

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

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

Line No. Rev Author Line
1 141 sybreon
/* $Id: testbench.cc,v 1.6 2008-04-27 16:04:42 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 141 sybreon
/**
22
AEMB Software Verification
23
@file testbench.cc
24 107 sybreon
 
25 141 sybreon
This programme performs numerical and functional verification of the
26
AEMB. It can be compiled by the GCC compiler.
27
*/
28
 
29 130 sybreon
#include <stdio.h>
30
#include <stdlib.h>
31 107 sybreon
#include "aemb/core.hh"
32 125 sybreon
#include "literate.hh"
33
#include "simboard.hh"
34 141 sybreon
#include "corefunc.hh"
35 107 sybreon
 
36 136 sybreon
#define MAX_TEST 3
37 130 sybreon
 
38 141 sybreon
void checkcode(int code)
39 136 sybreon
{
40 141 sybreon
  if (code == EXIT_SUCCESS)
41
    iprintf("\t\t-PASS-\n");
42
  else
43
    iprintf("\t\t*FAIL*\n");
44
}
45 107 sybreon
 
46 141 sybreon
void printtest(char *msg)
47
{
48
  static int count = 1;
49
  iprintf("\t%d. %s\n",count++, msg);
50
}
51
 
52
void numtests()
53
{
54 136 sybreon
  // *** 1. FIBONACCI ***
55 141 sybreon
  printtest("Integer Arithmetic");
56
  checkcode(fibonacciTest(MAX_TEST));
57 107 sybreon
 
58 136 sybreon
  // *** 2. EUCLIDEAN ***
59 141 sybreon
  printtest("Integer Factorisation");
60
  checkcode(euclideanTest(MAX_TEST));
61 107 sybreon
 
62 136 sybreon
  // *** 3. NEWTON-RHAPSON ***
63 141 sybreon
  printtest("Floating Point Arithmetic");
64
  checkcode(newtonTest(MAX_TEST));
65 107 sybreon
 
66 141 sybreon
}
67
 
68
void coretests()
69
{
70 139 sybreon
  // *** 4. MEMORY-ALLOC ***
71 141 sybreon
  printtest("Memory Allocation");
72
  checkcode(memoryTest(MAX_TEST));
73 139 sybreon
 
74
  // *** 5. INTERRUPT ***
75 141 sybreon
  printtest("Hardware Interrupts");
76
  checkcode(interruptTest(MAX_TEST));
77
 
78 139 sybreon
  // *** 6. EXTENSION ***
79 141 sybreon
  printtest("Accellerator Link");
80
  checkcode(xslTest(MAX_TEST));
81
}
82 139 sybreon
 
83 141 sybreon
// run tests
84
int main()
85
{
86
  iprintf("AEMB2 32-bit Microprocessor Core Tests\n");
87
 
88
  numtests();
89
  coretests();
90
 
91 125 sybreon
  return EXIT_SUCCESS;
92 107 sybreon
}
93 125 sybreon
 
94
/*
95 136 sybreon
  $Log: not supported by cvs2svn $
96 141 sybreon
  Revision 1.5  2008/04/26 19:32:00  sybreon
97
  Made headers C compatible.
98
 
99 139 sybreon
  Revision 1.4  2008/04/26 18:08:12  sybreon
100
  Made single-thread compatible.
101
 
102 136 sybreon
  Revision 1.3  2008/04/26 00:25:19  sybreon
103
  switched printf's to iprintf's because iprintf's don't work by
104
  -O3 for some reason.
105
 
106
  Revision 1.2  2008/04/21 12:13:12  sybreon
107
  Passes arithmetic tests with single thread.
108 125 sybreon
*/

powered by: WebSVN 2.1.0

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