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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_63/] [or1ksim/] [cpu/] [common/] [abstract.h] - Diff between revs 201 and 221

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 201 Rev 221
/* abstract.c -- Abstract entities header file
/* abstract.c -- Abstract entities header file
   Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
   Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
 
 
This file is part of OpenRISC 1000 Architectural Simulator.
This file is part of OpenRISC 1000 Architectural Simulator.
 
 
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
(at your option) any later version.
 
 
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
GNU General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
#define MEMORY_START    0
#define DEFAULT_MEMORY_START    0
#define MEMORY_LEN      0x800000
#define DEFAULT_MEMORY_LEN      0x800000
#define STACK_SIZE      20
#define STACK_SIZE      20
#define LABELNAME_LEN   50
#define LABELNAME_LEN   50
#define INSNAME_LEN     15
#define INSNAME_LEN     15
#define OPERANDNAME_LEN 50
#define OPERANDNAME_LEN 50
 
 
#define MAX_OPERANDS    (4)
#define MAX_OPERANDS    (4)
 
 
/* Structure for holding several labels of a particular memory location */
/* Structure for holding several labels of a particular memory location */
struct label_entry {
struct label_entry {
  char *name;
  char *name;
  struct label_entry *next;
  struct label_entry *next;
};
};
 
 
#define OP_MEM_ACCESS 0x80000000
#define OP_MEM_ACCESS 0x80000000
 
 
/* This is an abstract memory type rather than physical memory type.  It holds
/* This is an abstract memory type rather than physical memory type.  It holds
disassembled instructions.  */
disassembled instructions.  */
struct mem_entry {
struct mem_entry {
  unsigned char data;
  unsigned char data;
  unsigned char brk;
  unsigned char brk;
  struct label_entry *label; /* labels */
  struct label_entry *label; /* labels */
};
};
 
 
enum insn_type { unknown, exception, arith, shift, compare, branch,
enum insn_type { unknown, exception, arith, shift, compare, branch,
                 jump, load, store, movimm, move, extend, nop, mac };
                 jump, load, store, movimm, move, extend, nop, mac };
 
 
/* Instruction queue */
/* Instruction queue */
struct iqueue_entry {
struct iqueue_entry {
  enum insn_type func_unit;
  enum insn_type func_unit;
  int insn_index;
  int insn_index;
  unsigned long insn;
  unsigned long insn;
  unsigned long op[2 * MAX_OPERANDS];
  unsigned long op[2 * MAX_OPERANDS];
  unsigned long insn_addr;
  unsigned long insn_addr;
};
};
 
 
/* Memory regions assigned to devices */
/* Memory regions assigned to devices */
struct dev_memarea {
struct dev_memarea {
  struct dev_memarea *next;
  struct dev_memarea *next;
  unsigned long baseaddr;
  unsigned long start;
 
  unsigned long end;
  unsigned long size;
  unsigned long size;
  unsigned long (*readfunc)(unsigned long);
  unsigned char (*readfunc)(unsigned long);
  void (*writefunc)(unsigned long, unsigned long);
  void (*writefunc)(unsigned long, unsigned char);
 
  struct mem_entry* (*getentry) (unsigned long);
 
  /* private data */
 
  unsigned long misc;
};
};
 
 
extern struct iqueue_entry iqueue[20];
extern struct iqueue_entry iqueue[20];
extern struct iqueue_entry icomplet[20];
extern struct iqueue_entry icomplet[20];
extern unsigned long pc;
extern unsigned long pc;
 
 
extern struct mem_entry mem[MEMORY_LEN];
 
extern void dumpmemory(unsigned int from, unsigned int to, int disasm);
extern void dumpmemory(unsigned int from, unsigned int to, int disasm);
extern unsigned long eval_label(char *label);
extern unsigned long eval_label(char *label);
extern unsigned long eval_mem32(unsigned long memaddr,int*);
extern unsigned long eval_mem32(unsigned long memaddr,int*);
extern unsigned short eval_mem16(unsigned long memaddr,int*);
extern unsigned short eval_mem16(unsigned long memaddr,int*);
extern unsigned char eval_mem8(unsigned long memaddr,int*);
extern unsigned char eval_mem8(unsigned long memaddr,int*);
extern void set_mem32(unsigned long memaddr, unsigned long value,int*);
extern void set_mem32(unsigned long memaddr, unsigned long value,int*);
extern void set_mem16(unsigned long memaddr, unsigned short value,int*);
extern void set_mem16(unsigned long memaddr, unsigned short value,int*);
extern void set_mem8(unsigned long memaddr, unsigned char value,int*);
extern void set_mem8(unsigned long memaddr, unsigned char value,int*);
 
 
unsigned long evalsim_mem32(unsigned long,int*);
unsigned long evalsim_mem32(unsigned long);
unsigned short evalsim_mem16(unsigned long,int*);
unsigned short evalsim_mem16(unsigned long);
unsigned char evalsim_mem8(unsigned long,int*);
unsigned char evalsim_mem8(unsigned long);
void setsim_mem32(unsigned long,unsigned long);
void setsim_mem32(unsigned long,unsigned long);
void setsim_mem16(unsigned long,unsigned short);
void setsim_mem16(unsigned long,unsigned short);
void setsim_mem8(unsigned long,unsigned char);
void setsim_mem8(unsigned long,unsigned char);
 
 
 
void sim_read_memory_table (char *filename);
 
 
 
/* Register read and write function for a memory area (used by peripheral
 
   devices like 16450 UART etc.) */
 
void register_memoryarea(unsigned long start, unsigned long size, unsigned char (readfunc)(unsigned long),
 
                         void (writefunc)(unsigned long, unsigned char), struct mem_entry *(getentry)(unsigned long));
 
/* Check if access is to registered area of memory. */
 
struct dev_memarea *verify_memoryarea(unsigned long addr);
 
/* Temporary variable to increase speed.  */
 
extern struct dev_memarea *cur_area;
 
 
#ifndef DEBUGMOD_OFF
#ifndef DEBUGMOD_OFF
extern int GlobalMode; /* Added by CZ 26/05/01 */
extern int GlobalMode; /* Added by CZ 26/05/01 */
#else /* DEBUGMOD_OFF */
#else /* DEBUGMOD_OFF */
#define GlobalMode 0
#define GlobalMode 0
#endif /* DEBUGMOD_OFF */
#endif /* DEBUGMOD_OFF */
 
 
/* Added by MM */
/* Added by MM */
#ifndef LONGEST
#ifndef LONGEST
 
 
#ifdef BFD64
 
 
 
#define LONGEST BFD_HOST_64_BIT
 
#define ULONGEST BFD_HOST_U_64_BIT
 
 
 
#else /* No BFD64 */
 
 
 
#ifdef CC_HAS_LONG_LONG
 
#define LONGEST long long
#define LONGEST long long
#define ULONGEST unsigned long long
#define ULONGEST unsigned long long
#else
 
#ifdef BFD_HOST_64_BIT
 
/* BFD_HOST_64_BIT is defined for some hosts that don't have long long
 
   (e.g. i386-windows) so try it.  */
 
#define LONGEST BFD_HOST_64_BIT
 
#define ULONGEST BFD_HOST_U_64_BIT
 
#else
 
#define LONGEST long
 
#define ULONGEST unsigned long
 
#endif
 
#endif
 
 
 
#endif /* No BFD64 */
 
 
 
#endif /* ! LONGEST */
#endif /* ! LONGEST */
 
 

powered by: WebSVN 2.1.0

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