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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_42/] [or1ksim/] [testbench/] [support/] [support.c] - Diff between revs 381 and 511

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

Rev 381 Rev 511
Line 1... Line 1...
/* Support */
/* Support */
 
 
#include <sys/time.h> 
#include <sys/time.h> 
 
#include "spr_defs.h"
#include "support.h"
#include "support.h"
#include "int.h"
#include "int.h"
 
 
#if OR1K
#if OR1K
void excpt_dummy();
void excpt_dummy();
Line 32... Line 33...
 
 
/* return value by making a syscall */
/* return value by making a syscall */
void exit (int i)
void exit (int i)
{
{
  asm("l.add r3,r0,%0": : "r" (i));
  asm("l.add r3,r0,%0": : "r" (i));
  asm("l.sys 203");
  asm("l.nop %0": :"K" (NOP_EXIT));
 
  while (1);
}
}
 
 
/* activate printf support in simulator */
/* activate printf support in simulator */
void printf(const char *fmt, ...)
void printf(const char *fmt, ...)
{
{
  va_list args;
  va_list args;
  va_start(args, fmt);
  va_start(args, fmt);
  asm("l.addi\tr3,%0,0": :"r" (fmt));
  asm("l.addi\tr3,%0,0": :"r" (fmt));
  asm("l.addi\tr4,%0,0": :"r" (args));
  asm("l.addi\tr4,%0,0": :"r" (args));
  asm("l.sys 202");
  asm("l.nop %0": :"K" (NOP_PRINTF));
}
}
 
 
/* print long */
/* print long */
void report(unsigned long value)
void report(unsigned long value)
{
{
  unsigned long spr = 0x1234;
  asm("l.addi\tr3,%0,0": :"r" (value));
  asm("l.mtspr\t\t%0,%1,0x0" : : "r" (spr), "r" (value));
  asm("l.nop %0": :"K" (NOP_REPORT));
  return;
 
}
}
 
 
/* just to satisfy linker */
/* just to satisfy linker */
void __main()
void __main()
{
{
Line 71... Line 72...
{
{
  unsigned long count = 0;
  unsigned long count = 0;
 
 
  /* Read the Time Stamp Counter */
  /* Read the Time Stamp Counter */
/*        asm("simrdtsc %0" :"=r" (count)); */
/*        asm("simrdtsc %0" :"=r" (count)); */
  asm("l.sys 201");
  /*asm("l.sys 201"); */
  return count;
  return count;
}
}
 
 
/* For writing into SPR. */
/* For writing into SPR. */
void mtspr(unsigned long spr, unsigned long value)
void mtspr(unsigned long spr, unsigned long value)

powered by: WebSVN 2.1.0

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