Line 1... |
Line 1... |
/* execute.h -- Header file for architecture dependent execute.c
|
/* execute.h -- Header file for architecture dependent execute.c
|
|
|
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
|
Copyright (C) 2008 Embecosm Limited
|
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
|
|
This program is free software; you can redistribute it and/or modify
|
This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
|
#if DYNAMIC_EXECUTION
|
This program is free software; you can redistribute it and/or modify it
|
#include "setjmp.h"
|
under the terms of the GNU General Public License as published by the Free
|
#include "dyn_rec.h"
|
Software Foundation; either version 3 of the License, or (at your option)
|
#endif
|
any later version.
|
|
|
struct cpu_state {
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
/* General purpose registers. */
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
uorreg_t reg[MAX_GPRS];
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
more details.
|
|
|
/* Sprs */
|
You should have received a copy of the GNU General Public License along
|
uorreg_t sprs[MAX_SPRS];
|
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
/* Effective address of instructions that have an effective address. This is
|
/* This program is commented throughout in a fashion suitable for processing
|
* only used to get dump_exe_log correct */
|
with Doxygen. */
|
oraddr_t insn_ea;
|
|
|
|
/* Is current instruction in execution in a delay slot? */
|
|
int delay_insn;
|
|
|
|
/* Program counter (and translated PC) */
|
#ifndef EXECUTE__H
|
oraddr_t pc;
|
#define EXECUTE__H
|
|
|
/* Delay instruction effective address register */
|
#include "spr-defs.h"
|
oraddr_t pc_delay;
|
#include "opcode/or32.h"
|
|
#include "abstract.h"
|
|
|
/* State of the lines leading into the PIC */
|
#if DYNAMIC_EXECUTION
|
uint32_t pic_lines;
|
#include "setjmp.h"
|
|
#include "dyn_rec.h"
|
|
#endif
|
|
|
/* Decoding of the just executed instruction. Only used in analysis(). */
|
|
struct iqueue_entry iqueue;
|
|
|
|
/* decoding of the instruction that was executed before this one. Only used
|
#define CURINSN(INSN) (strcmp(cur->insn, (INSN)) == 0)
|
* in analysis(). */
|
|
struct iqueue_entry icomplet;
|
|
|
|
#if DYNAMIC_EXECUTION
|
/*!The main structure holding the current execution state of the CPU
|
/* longjmp() to this location in case of an exception */
|
|
jmp_buf excpt_loc;
|
|
|
|
/* Current page in execution */
|
Not to be confused with @c runtime, which holds the state of the
|
struct dyn_page *curr_page;
|
simulation.
|
|
|
/* Pointers to recompiled pages */
|
@c insn_ea field is only used to get dump_exe_log() correct.
|
struct dyn_page **dyn_pages;
|
|
|
|
int32_t cycles_dec;
|
@c iqueue and @c icomplet fields are only used in analysis().
|
|
|
|
The micro-operation queue, @c opqs, is only used to speed up
|
|
recompile_page(). */
|
|
struct cpu_state {
|
|
uorreg_t reg[MAX_GPRS]; /*!< General purpose registers */
|
|
uorreg_t sprs[MAX_SPRS]; /*!< Special purpose registers */
|
|
oraddr_t insn_ea; /*!< EA of instrs that have an EA */
|
|
int delay_insn; /*!< Is current instr in delay slot */
|
|
oraddr_t pc; /*!< PC (and translated PC) */
|
|
oraddr_t pc_delay; /*!< Delay instr EA register */
|
|
uint32_t pic_lines; /*!< State of PIC lines */
|
|
struct iqueue_entry iqueue; /*!< Decode of just executed instr */
|
|
struct iqueue_entry icomplet; /*!< Decode of instr before this */
|
|
|
/* Micro operation queue. Only used to speed up recompile_page */
|
#if DYNAMIC_EXECUTION
|
struct op_queue *opqs;
|
jmp_buf excpt_loc; /*!< Longjump here for exception */
|
|
struct dyn_page *curr_page; /*!< Current page in execution */
|
|
struct dyn_page **dyn_pages; /*!< Pointers to recompiled pages */
|
|
int32_t cycles_dec;
|
|
struct op_queue *opqs; /*!< Micro-operation queue */
|
#endif
|
#endif
|
};
|
};
|
|
|
extern struct cpu_state cpu_state;
|
/*! History of execution */
|
|
struct hist_exec
|
#define CURINSN(INSN) (strcmp(cur->insn, (INSN)) == 0)
|
{
|
|
oraddr_t addr;
|
/*extern machword eval_operand(char *srcoperand,int* breakpoint);
|
struct hist_exec *prev;
|
extern void set_operand(char *dstoperand, unsigned long value,int* breakpoint);*/
|
struct hist_exec *next;
|
void dumpreg();
|
};
|
inline void dump_exe_log();
|
|
inline int cpu_clock ();
|
|
void cpu_reset ();
|
|
uorreg_t evalsim_reg(unsigned int regno);
|
|
void setsim_reg(unsigned int regno, uorreg_t value);
|
|
|
|
|
/* Globally visible data structures */
|
|
extern struct cpu_state cpu_state;
|
extern oraddr_t pcnext;
|
extern oraddr_t pcnext;
|
int depend_operands(struct iqueue_entry *prev, struct iqueue_entry *next);
|
extern int sbuf_wait_cyc;
|
void exec_main(void);
|
extern int sbuf_total_cyc;
|
|
extern int do_stats;
|
|
extern struct hist_exec *hist_exec_tail;
|
|
|
|
|
|
/* Prototypes for external use */
|
|
extern void dumpreg ();
|
|
extern void dump_exe_log ();
|
|
extern int cpu_clock ();
|
|
extern void cpu_reset ();
|
|
extern uorreg_t evalsim_reg (unsigned int regno);
|
|
extern void setsim_reg (unsigned int regno,
|
|
uorreg_t value);
|
|
extern uorreg_t eval_operand_val (uint32_t insn,
|
|
struct insn_op_struct *opd);
|
|
extern void analysis (struct iqueue_entry *current);
|
|
extern void cpu_reset ();
|
|
extern int cpu_clock ();
|
|
extern void exec_main ();
|
|
extern int depend_operands (struct iqueue_entry *prev,
|
|
struct iqueue_entry *next);
|
|
|
|
#endif /* EXECUTE__H */
|
|
|
No newline at end of file
|
No newline at end of file
|