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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [loop/] [loop-init.c] - Blame information for rev 146

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 98 jeremybenn
/* loop-init.c. Or1ksim simple C loop program which initializes data.
2
 
3
   Copyright (C) 1999-2006 OpenCores
4
   Copyright (C) 2010 Embecosm Limited
5
 
6
   Contributors various OpenCores participants
7
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8
 
9
   This file is part of OpenRISC 1000 Architectural Simulator.
10
 
11
   This program is free software; you can redistribute it and/or modify it
12
   under the terms of the GNU General Public License as published by the Free
13
   Software Foundation; either version 3 of the License, or (at your option)
14
   any later version.
15
 
16
   This program is distributed in the hope that it will be useful, but WITHOUT
17
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
19
   more details.
20
 
21
   You should have received a copy of the GNU General Public License along
22
   with this program.  If not, see <http:  www.gnu.org/licenses/>.  */
23
 
24
/* ----------------------------------------------------------------------------
25
   This code is commented throughout for use with Doxygen.
26
   --------------------------------------------------------------------------*/
27
 
28
/* A program which initializes memory and SPR, then just loops. Used in
29
   testing libor1ksim JTAG read functionality. */
30
 
31
#include "support.h"
32
#include "spr-defs.h"
33
 
34
int
35
main ()
36
{
37
  unsigned long int  r;
38
  int                i;
39
 
40
  /* Set the SR to have SUMRA bit set, so that we can access certain regs in
41
     user mode. */
42
  r = mfspr (SPR_SR);
43
  mtspr (SPR_SR, r | SPR_SR_SUMRA);
44
 
45
  /* Set the MACLO and MACHI regs */
46
  mtspr (SPR_MACLO, 0xdeadbeef);
47
  mtspr (SPR_MACHI, 0xcafebabe);
48
 
49
  /* Set main memory starting at 0x100000. Set at later intervals 2^16 bytes
50
     further on as well. */
51
  for (i = 0; i < 16; i++)
52
    {
53
      unsigned char *block0 = (unsigned char *) (0x100000 + i);
54
      unsigned char *block1 = (unsigned char *) (0x110000 + i);
55
      unsigned char *block2 = (unsigned char *) (0x120000 + i);
56
 
57
      *block0 = 16 + i;
58
      *block1 = 32 + i;
59
      *block2 = 48 + i;
60
    }
61
 
62
  /* Set the top of each memory block and the bottom of the second memory
63
     block to a defined sequence. */
64
  unsigned char *mem1top = (unsigned char *) (0x001ffff8);
65
  unsigned char *mem2bot = (unsigned char *) (0xffe00000);
66
  unsigned char *mem2top = (unsigned char *) (0xfffffff8);
67
 
68
  mem1top[0] = 0xde;
69
  mem1top[1] = 0xad;
70
  mem1top[2] = 0xbe;
71
  mem1top[3] = 0xef;
72
  mem1top[4] = 0xca;
73
  mem1top[5] = 0xfe;
74
  mem1top[6] = 0xba;
75
  mem1top[7] = 0xbe;
76
 
77
  mem2bot[0] = 0xde;
78
  mem2bot[1] = 0xad;
79
  mem2bot[2] = 0xbe;
80
  mem2bot[3] = 0xef;
81
  mem2bot[4] = 0xca;
82
  mem2bot[5] = 0xfe;
83
  mem2bot[6] = 0xba;
84
  mem2bot[7] = 0xbe;
85
 
86
  mem2top[0] = 0xde;
87
  mem2top[1] = 0xad;
88
  mem2top[2] = 0xbe;
89
  mem2top[3] = 0xef;
90
  mem2top[4] = 0xca;
91
  mem2top[5] = 0xfe;
92
  mem2top[6] = 0xba;
93
  mem2top[7] = 0xbe;
94
 
95
  /* Loop for ever doing stuff */
96
  while (1)
97
    {
98
    }
99
}       /* main () */

powered by: WebSVN 2.1.0

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