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

Subversion Repositories aemb

[/] [aemb/] [trunk/] [sw/] [cc/] [memtest.hh] - Diff between revs 174 and 175

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 174 Rev 175
Line 1... Line 1...
/* $Id: memtest.hh,v 1.2 2008-06-21 10:01:35 sybreon Exp $
/* $Id: memtest.hh,v 1.3 2008-06-23 22:05:14 sybreon Exp $
**
**
** MEMORY TEST FUNCTIONS
** MEMORY TEST FUNCTIONS
** Copyright (C) 2008 Shawn Tan 
** Copyright (C) 2008 Shawn Tan 
**
**
** This file is part of AEMB.
** This file is part of AEMB.
Line 47... Line 47...
 
 
inline int memtestAddressBus(volatile int *ram, int len)
inline int memtestAddressBus(volatile int *ram, int len)
{
{
  const int p = 0xAAAAAAAA;
  const int p = 0xAAAAAAAA;
  const int q = 0x55555555;
  const int q = 0x55555555;
 
  int nlen = (len >> 2) - 1;
 
 
  // prefill memory
  // prefill memory
  for (int i=1; (i & (len-1))!=0 ; i<<=1)
  for (int i=1; (i & nlen)!=0 ; i<<=1)
    {
    {
      ram[i] = p;
      ram[i] = p;
    }
    }
 
 
  // check 1 - stuck high
  // check 1 - stuck high
  ram[0] = q;
  ram[0] = q;
  for (int i=1; (i & (len-1))!=0 ; i<<=1)
  for (int i=1; (i & nlen)!=0 ; i<<=1)
    {
    {
      if (ram[i] != p)
      if (ram[i] != p)
        return ram[i];
        return ram[i];
    }
    }
  ram[0] = p;
  ram[0] = p;
 
 
  // check 2 - stuck low
  // check 2 - stuck low
  for (int j=1; (j & (len-1))!=0 ; j<<=1)
  for (int j=1; (j & nlen)!=0 ; j<<=1)
    {
    {
      ram[j] = q;
      ram[j] = q;
      for (int i=1; (i & (len-1))!=0 ; i<<=1)
      for (int i=1; (i & nlen)!=0 ; i<<=1)
        {
        {
          if ((ram[i] != p) && (i != j))
          if ((ram[i] != p) && (i != j))
            return ram[i];
            return ram[i];
        }
        }
      ram[j] = p;
      ram[j] = p;
Line 115... Line 116...
 
 
#endif
#endif
 
 
/*
/*
  $Log: not supported by cvs2svn $
  $Log: not supported by cvs2svn $
 
  Revision 1.2  2008/06/21 10:01:35  sybreon
 
  *** empty log message ***
 
 
  Revision 1.1  2008/06/20 17:51:23  sybreon
  Revision 1.1  2008/06/20 17:51:23  sybreon
  initial import
  initial import
 
 
 */
 */

powered by: WebSVN 2.1.0

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