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

Subversion Repositories aemb

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

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 206 sybreon
  // *** 6. EXCEPTIONS ***
79
  printtest("Hardware Exceptions");
80
  checkcode(exceptionTest(MAX_TEST));
81
 
82
  // *** 7. EXTENSION ***
83 141 sybreon
  printtest("Accellerator Link");
84
  checkcode(xslTest(MAX_TEST));
85
}
86 139 sybreon
 
87 141 sybreon
// run tests
88
int main()
89
{
90
  iprintf("AEMB2 32-bit Microprocessor Core Tests\n");
91
 
92
  numtests();
93
  coretests();
94
 
95 125 sybreon
  return EXIT_SUCCESS;
96 107 sybreon
}

powered by: WebSVN 2.1.0

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