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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_49/] [or1ksim/] [cpu/] [common/] [abstract.h] - Diff between revs 30 and 37

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

Rev 30 Rev 37
/* 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 MEMORY_START    0
#define MEMORY_LEN      102400
#define MEMORY_LEN      102400
#define STACK_SIZE      10000
#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
 
 
/* 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;
};
};
 
 
/* Structure that holds disassembled instruction. */
/* Structure that holds disassembled instruction. */
struct insn_entry {
struct insn_entry {
        char *insn;
        char *insn;
        char *op1;
        char *op1;
        char *op2;
        char *op2;
        char *op3;
        char *op3;
        char *op4;
        char *op4;
};
};
 
 
/* 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 */
        struct insn_entry *insn; /* insn */
        struct insn_entry *insn; /* insn */
};
};
 
 
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 };
                 jump, load, store, movimm, move, extend, nop };
 
 
/* Instruction queue */
/* Instruction queue */
struct iqueue_entry {
struct iqueue_entry {
        char insn[INSNAME_LEN];
        char insn[INSNAME_LEN];
        enum insn_type func_unit;
        enum insn_type func_unit;
        char op1[OPERANDNAME_LEN];
        char op1[OPERANDNAME_LEN];
        char op2[OPERANDNAME_LEN];
        char op2[OPERANDNAME_LEN];
        char op3[OPERANDNAME_LEN];
        char op3[OPERANDNAME_LEN];
        char op4[OPERANDNAME_LEN];
        char op4[OPERANDNAME_LEN];
        char *dependdst;
        char *dependdst;
        char *dependsrc1;
        char *dependsrc1;
        char *dependsrc2;
        char *dependsrc2;
        unsigned long insn_addr;
        unsigned long insn_addr;
};
};
 
 
/* Completition queue */
/* Completition queue */
struct icomplet_entry {
struct icomplet_entry {
        char insn[INSNAME_LEN];
        char insn[INSNAME_LEN];
        enum insn_type func_unit;
        enum insn_type func_unit;
        char op1[OPERANDNAME_LEN];
        char op1[OPERANDNAME_LEN];
        char op2[OPERANDNAME_LEN];
        char op2[OPERANDNAME_LEN];
        char op3[OPERANDNAME_LEN];
        char op3[OPERANDNAME_LEN];
        char op4[OPERANDNAME_LEN];
        char op4[OPERANDNAME_LEN];
        char *dependdst;
        char *dependdst;
        char *dependsrc1;
        char *dependsrc1;
        char *dependsrc2;
        char *dependsrc2;
        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 baseaddr;
        unsigned long size;
        unsigned long size;
        unsigned char (*readfunc)(unsigned long);
        unsigned char (*readfunc)(unsigned long);
        void (*writefunc)(unsigned long, unsigned char);
        void (*writefunc)(unsigned long, unsigned char);
};
};
 
 
extern struct iqueue_entry iqueue[20];
extern struct iqueue_entry iqueue[20];
extern struct icomplet_entry icomplet[20];
extern struct icomplet_entry icomplet[20];
extern unsigned long pc;
extern unsigned long pc;
 
 
extern struct mem_entry mem[MEMORY_LEN];
extern struct mem_entry mem[MEMORY_LEN];
extern void dumpmemory(unsigned int from, unsigned int to);
extern void dumpmemory(unsigned int from, unsigned int to);
extern unsigned long eval_label(char *label);
extern unsigned long eval_label(char *label);
extern unsigned long eval_mem32(unsigned long memaddr);
extern unsigned long eval_mem32(unsigned long memaddr);
extern unsigned short eval_mem16(unsigned long memaddr);
extern unsigned short eval_mem16(unsigned long memaddr);
extern unsigned char eval_mem8(unsigned long memaddr);
extern unsigned char eval_mem8(unsigned long memaddr);
extern void set_mem32(unsigned long memaddr, unsigned long value);
extern void set_mem32(unsigned long memaddr, unsigned long value);
extern void set_mem16(unsigned long memaddr, unsigned short value);
extern void set_mem16(unsigned long memaddr, unsigned short value);
extern void set_mem8(unsigned long memaddr, unsigned char value);
extern void set_mem8(unsigned long memaddr, unsigned char value);
 
 

powered by: WebSVN 2.1.0

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