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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel-0-3-0-rc3/] [or1ksim/] [cpu/] [common/] [execute.h] - Blame information for rev 1758

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

Line No. Rev Author Line
1 2 cvs
/* execute.h -- Header file for architecture dependent execute.c
2 1748 jeremybenn
 
3 2 cvs
   Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
4 1748 jeremybenn
   Copyright (C) 2008 Embecosm Limited
5 2 cvs
 
6 1748 jeremybenn
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
7 2 cvs
 
8 1748 jeremybenn
   This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
9 2 cvs
 
10 1748 jeremybenn
   This program is free software; you can redistribute it and/or modify it
11
   under the terms of the GNU General Public License as published by the Free
12
   Software Foundation; either version 3 of the License, or (at your option)
13
   any later version.
14 2 cvs
 
15 1748 jeremybenn
   This program is distributed in the hope that it will be useful, but WITHOUT
16
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18
   more details.
19 2 cvs
 
20 1748 jeremybenn
   You should have received a copy of the GNU General Public License along
21
   with this program.  If not, see <http://www.gnu.org/licenses/>.  */
22
 
23
/* This program is commented throughout in a fashion suitable for processing
24
   with Doxygen. */
25
 
26
 
27
#ifndef EXECUTE__H
28
#define EXECUTE__H
29
 
30
#include "spr-defs.h"
31
#include "opcode/or32.h"
32
#include "abstract.h"
33
 
34 1452 nogj
#if DYNAMIC_EXECUTION
35 1692 nogj
#include "setjmp.h"
36 1751 jeremybenn
#include "dyn-rec.h"
37 1452 nogj
#endif
38
 
39 1432 nogj
 
40 1748 jeremybenn
#define CURINSN(INSN) (strcmp(cur->insn, (INSN)) == 0)
41 1432 nogj
 
42 1751 jeremybenn
/*! Sets a new SPR_SR_OV value, based on next register value */
43
#if SET_OV_FLAG
44
#define SET_OV_FLAG_FN(value) \
45
  if((value) & 0x80000000) \
46
    cpu_state.sprs[SPR_SR] |= SPR_SR_OV; \
47
  else \
48
    cpu_state.sprs[SPR_SR] &= ~SPR_SR_OV
49
#else
50
#define SET_OV_FLAG_FN(value)
51
#endif
52
 
53 1748 jeremybenn
/*!The main structure holding the current execution state of the CPU
54 1432 nogj
 
55 1748 jeremybenn
   Not to be confused with @c runtime, which holds the state of the
56
   simulation.
57 1432 nogj
 
58 1748 jeremybenn
   @c insn_ea field is only used to get dump_exe_log() correct.
59 1432 nogj
 
60 1748 jeremybenn
   @c iqueue and @c icomplet fields are only used in analysis().
61 1432 nogj
 
62 1748 jeremybenn
   The micro-operation queue, @c opqs, is only used to speed up
63
   recompile_page().                                                         */
64
struct cpu_state {
65
  uorreg_t             reg[MAX_GPRS];   /*!< General purpose registers */
66
  uorreg_t             sprs[MAX_SPRS];  /*!< Special purpose registers */
67
  oraddr_t             insn_ea;         /*!< EA of instrs that have an EA */
68
  int                  delay_insn;      /*!< Is current instr in delay slot */
69 1756 jeremybenn
  int                  npc_not_valid;   /*!< NPC updated while stalled */
70 1748 jeremybenn
  oraddr_t             pc;              /*!< PC (and translated PC) */
71
  oraddr_t             pc_delay;        /*!< Delay instr EA register */
72
  uint32_t             pic_lines;       /*!< State of PIC lines */
73
  struct iqueue_entry  iqueue;          /*!< Decode of just executed instr */
74
  struct iqueue_entry  icomplet;        /*!< Decode of instr before this */
75 1715 nogj
 
76 1452 nogj
#if DYNAMIC_EXECUTION
77 1748 jeremybenn
  jmp_buf              excpt_loc;       /*!< Longjump here for exception */
78
  struct dyn_page     *curr_page;       /*!< Current page in execution */
79
  struct dyn_page    **dyn_pages;       /*!< Pointers to recompiled pages */
80
  int32_t              cycles_dec;
81
  struct op_queue     *opqs;            /*!< Micro-operation queue */
82
#endif
83
};
84 1692 nogj
 
85 1748 jeremybenn
/*! History of execution */
86
struct hist_exec
87
{
88
  oraddr_t addr;
89
  struct hist_exec *prev;
90
  struct hist_exec *next;
91
};
92 1452 nogj
 
93 1748 jeremybenn
/* Globally visible data structures */
94
extern struct cpu_state  cpu_state;
95
extern oraddr_t          pcnext;
96
extern int               sbuf_wait_cyc;
97
extern int               sbuf_total_cyc;
98
extern int               do_stats;
99
extern struct hist_exec *hist_exec_tail;
100 1452 nogj
 
101 1687 nogj
 
102 1748 jeremybenn
/* Prototypes for external use */
103
extern void      dumpreg ();
104
extern void      dump_exe_log ();
105
extern int       cpu_clock ();
106
extern void      cpu_reset ();
107
extern uorreg_t  evalsim_reg (unsigned int  regno);
108
extern void      setsim_reg (unsigned int  regno,
109
                             uorreg_t      value);
110
extern uorreg_t  eval_operand_val (uint32_t               insn,
111
                                   struct insn_op_struct *opd);
112
extern void      analysis (struct iqueue_entry *current);
113
extern void      cpu_reset ();
114
extern int       cpu_clock ();
115
extern void      exec_main ();
116
extern int       depend_operands (struct iqueue_entry *prev,
117
                                  struct iqueue_entry *next);
118
#endif  /* EXECUTE__H */

powered by: WebSVN 2.1.0

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