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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [tests/] [or1200/] [sim/] [or1200-dctest.c] - Diff between revs 439 and 485

Show entire file | Details | Blame | View Log

Rev 439 Rev 485
Line 12... Line 12...
#include "spr-defs.h"
#include "spr-defs.h"
 
 
#define LOOPS 64
#define LOOPS 64
#define WORD_STRIDE 8
#define WORD_STRIDE 8
 
 
// Memory area to test at
extern unsigned long _stack;
#define TEST_BASE 0x600000 /* 6MB */
 
 
 
unsigned long int my_lfsr;
unsigned long int my_lfsr;
 
 
unsigned long int next_rand()
unsigned long int next_rand()
{
{
Line 27... Line 26...
 
 
int
int
main()
main()
{
{
 
 
 
        unsigned long stack_top = (unsigned long) &_stack;
 
 
  // Check data cache is present and enabled
  // Check data cache is present and enabled
  if (!(mfspr(SPR_UPR)& SPR_UPR_DCP) | !(mfspr(SPR_SR) & SPR_SR_DCE))
  if (!(mfspr(SPR_UPR)& SPR_UPR_DCP) | !(mfspr(SPR_SR) & SPR_SR_DCE))
    {
    {
      // Not really a pass, but not really a fail, either.
      // Not really a pass, but not really a fail, either.
      report(0x8000000d);
      report(0x8000000d);
      return 0;
      return 0;
    }
    }
 
 
  volatile char* ptr = (volatile char*) TEST_BASE;
  volatile char* ptr = (volatile char*) (stack_top + 256);
  int i;
  int i;
 
 
  ptr[0] = 0xab;
  ptr[0] = 0xab;
 
 
  ptr[4096] = 0xcd;
  ptr[4096] = 0xcd;
Line 97... Line 98...
  // Now generate some random numbers, write them in in strides that should 
  // Now generate some random numbers, write them in in strides that should 
  // execercise the cache's line reloading/storing mechanism.
  // execercise the cache's line reloading/storing mechanism.
 
 
  // init LFSR
  // init LFSR
  my_lfsr = RAND_LFSR_SEED;
  my_lfsr = RAND_LFSR_SEED;
  volatile unsigned long int *lptr = (volatile unsigned long int*) TEST_BASE;
  volatile unsigned long int *lptr = (volatile unsigned long int*) (stack_top + 256);
  for(i=0;i<LOOPS;i++)
  for(i=0;i<LOOPS;i++)
    {
    {
      lptr[(i*WORD_STRIDE)-1] = next_rand();
      lptr[(i*WORD_STRIDE)-1] = next_rand();
      lptr[(i*WORD_STRIDE)+0] = next_rand();
      lptr[(i*WORD_STRIDE)+0] = next_rand();
      lptr[(i*WORD_STRIDE)+1] = next_rand();
      lptr[(i*WORD_STRIDE)+1] = next_rand();

powered by: WebSVN 2.1.0

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