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

Subversion Repositories test_project

[/] [test_project/] [trunk/] [sw/] [mul/] [mul.c] - Diff between revs 52 and 54

Show entire file | Details | Blame | View Log

Rev 52 Rev 54
Line 2... Line 2...
#define OR1K 1
#define OR1K 1
 
 
/* Test l.mul, l.mac and l.macrc instructions */
/* Test l.mul, l.mac and l.macrc instructions */
#include "support.h"
#include "support.h"
 
 
#if USE_UCLIBC
 
#include "stdio.h"
 
#endif
 
 
 
#define T1 0xa6312f33
#define T1 0xa6312f33
#define T2 0x0d4de375
#define T2 0x0d4de375
#define T3 0x61ab48dc
#define T3 0x61ab48dc
 
 
#ifndef __or32__
#ifndef __or32__
Line 25... Line 21...
  printf ("(%08x,%08x)\n", (unsigned long)(acc >> 32), (unsigned long)(acc & 0xffffffff));\
  printf ("(%08x,%08x)\n", (unsigned long)(acc >> 32), (unsigned long)(acc & 0xffffffff));\
}
}
#define MACRC    (macrc())
#define MACRC    (macrc())
static inline long macrc() {
static inline long macrc() {
  long result = acc >> 28;
  long result = acc >> 28;
  //printf ("<%08x>\n", (unsigned long)result);
  printf ("<%08x>\n", (unsigned long)result);
  acc = 0;
  acc = 0;
  return result;
  return result;
}
}
#else /* OR1K */
#else /* OR1K */
 
 
Line 129... Line 125...
  report (MACRC);
  report (MACRC);
  or32_exit(0);
  or32_exit(0);
*/
*/
  printf ("%8x\n", MACRC);
  printf ("%8x\n", MACRC);
  t1 = test_mul (888888887, 0x87654321);
  t1 = test_mul (888888887, 0x87654321);
  t2 = test_mac (888888887, 0x87654321);
  //t2 = test_mac (888888887, 0x87654321);    
  t3 = test_mul_mac (888888887, 0x87654321);
  //t3 = test_mul_mac (888888887, 0x87654321);
  printf ("%08x, expected %08x\n", t1, T1);
  printf ("%08x, expected %08x\n", t1, T1);
  printf ("%08x, expected %08x\n", t2, T2);
  //printf ("%08x, expected %08x\n", t2, T2);
  printf ("%08x, expected %08x\n", t3, T3);
  //printf ("%08x, expected %08x\n", t3, T3);
  report (t1 ^ t2 ^ t3 ^ T1 ^ T2 ^ T3 ^ 0xdeaddead);
  report (t1 /*^ t2 ^ t3*/ ^ T1 /* ^ T2 ^ T3*/ ^ 0xdeaddead);
  if (t1 != T1 || t2 != T2 || t3 != T3) {
  if (t1 != T1 /* || t2 != T2 || t3 != T3*/) {
    printf ("Test failed!\n");
    printf ("Test failed!\n");
    if (t1 != T1) or32_exit (1);
    if (t1 != T1) or32_exit (1);
    if (t2 != T2) or32_exit (2);
    //if (t2 != T2) or32_exit (2);
    if (t3 != T3) or32_exit (3);
    //if (t3 != T3) or32_exit (3);
  } else {
  } else {
    printf ("Test succesful.\n");
    printf ("Test succesful.\n");
    or32_exit (0);
    or32_exit (0);
  }
  }
  or32_exit (0);
  or32_exit (0);

powered by: WebSVN 2.1.0

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