Line 1... |
Line 1... |
/*
|
/*
|
* $Id: aeMB_testbench.c,v 1.7 2007-11-02 18:32:19 sybreon Exp $
|
* $Id: aeMB_testbench.c,v 1.8 2007-11-03 08:40:18 sybreon Exp $
|
*
|
*
|
* AEMB Function Verification C Testbench
|
* AEMB Function Verification C Testbench
|
* Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
|
* Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
|
*
|
*
|
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
Line 23... |
Line 23... |
* It tests a whole gamut of operations and is tightly linked to the
|
* It tests a whole gamut of operations and is tightly linked to the
|
* ae68_testbench.v testbench module for verification.
|
* ae68_testbench.v testbench module for verification.
|
*
|
*
|
* HISTORY
|
* HISTORY
|
* $Log: not supported by cvs2svn $
|
* $Log: not supported by cvs2svn $
|
|
* Revision 1.7 2007/11/02 18:32:19 sybreon
|
|
* Enable MSR_IE with software.
|
|
*
|
* Revision 1.6 2007/04/30 15:57:10 sybreon
|
* Revision 1.6 2007/04/30 15:57:10 sybreon
|
* Removed byte acrobatics.
|
* Removed byte acrobatics.
|
*
|
*
|
* Revision 1.5 2007/04/27 15:17:59 sybreon
|
* Revision 1.5 2007/04/27 15:17:59 sybreon
|
* Added code documentation.
|
* Added code documentation.
|
Line 51... |
Line 54... |
|
|
This tests for the following:
|
This tests for the following:
|
- Pointer addressing
|
- Pointer addressing
|
- Interrupt handling
|
- Interrupt handling
|
*/
|
*/
|
void int_call_func (void); // __attribute__((save_volatiles));
|
// void int_service (void) __attribute__((save_volatiles));
|
void int_handler_func (void) __attribute__ ((interrupt_handler));
|
void int_handler (void) __attribute__ ((interrupt_handler));
|
|
|
|
void int_enable()
|
|
{
|
|
asm ("mfs r14, rmsr");
|
|
asm ("ori r14, r14, 0x0002");
|
|
asm ("mts rmsr, r14");
|
|
}
|
|
|
void int_handler_func (void) {
|
void int_disable()
|
int_call_func();
|
{
|
|
asm ("mfs r14, rmsr");
|
|
asm ("andi r14, r14, 0x00FD");
|
|
asm ("mts rmsr, r14");
|
}
|
}
|
|
|
void int_call_func (void) {
|
void int_service()
|
int* pio = (int*)0xFFFFFFFF;
|
{
|
|
int* pio = (int*)0xFFFFFFFC;
|
*pio = 0x52544E49; // "INTR"
|
*pio = 0x52544E49; // "INTR"
|
}
|
}
|
|
|
|
void int_handler()
|
|
{
|
|
int_service();
|
|
}
|
|
|
|
|
/**
|
/**
|
FIBONACCI TEST
|
FIBONACCI TEST
|
http://en.literateprograms.org/Fibonacci_numbers_(C)
|
http://en.literateprograms.org/Fibonacci_numbers_(C)
|
|
|
This tests for the following:
|
This tests for the following:
|
Line 251... |
Line 270... |
This is the main test procedure. It will output signals onto the
|
This is the main test procedure. It will output signals onto the
|
MPI port that is checked by the testbench.
|
MPI port that is checked by the testbench.
|
*/
|
*/
|
|
|
|
|
void int_enable()
|
|
{
|
|
asm ("mfs r14, rmsr");
|
|
asm ("ori r14, r14, 0x0002");
|
|
asm ("mts rmsr, r14");
|
|
}
|
|
|
|
void int_disable()
|
|
{
|
|
asm ("mfs r14, rmsr");
|
|
asm ("andi r14, r14, 0x00FD");
|
|
asm ("mts rmsr, r14");
|
|
}
|
|
|
|
int main ()
|
int main ()
|
{
|
{
|
// Message Passing Port
|
// Message Passing Port
|
int* mpi = (int*)0xFFFFFFFF;
|
int* mpi = (int*)0xFFFFFFFF;
|
|
|
// Number of each test to run
|
// Number of each test to run
|
int max = 3;
|
int max = 10;
|
|
|
// Enable Global Interrupts
|
// Enable Global Interrupts
|
int_enable();
|
int_enable();
|
|
|
// Fibonacci Test
|
// Fibonacci Test
|