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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [sim/] [ppc/] [ld-decode.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*  This file is part of the program psim.
2
 
3
    Copyright (C) 1994,1995,1996, Andrew Cagney <cagney@highland.com.au>
4
 
5
    This program is free software; you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
 
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
 
15
    You should have received a copy of the GNU General Public License
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
 
19
    */
20
 
21
/* Instruction decode table:
22
 
23
   <options>:<first>:<last>:<force-first>:<force-last>:<force-expand>:<special>...
24
 
25
 
26
 
27
   Ignore the below:
28
 
29
 
30
   The instruction decode table contains rules that dictate how igen
31
   is going to firstly break down the opcode table and secondly
32
 
33
   The table that follows is used by gen to construct a decision tree
34
   that can identify each possible instruction.  Gen then outputs this
35
   decision tree as (according to config) a table or switch statement
36
   as the function idecode.
37
 
38
   In parallel to this, as mentioned above, WITH_EXPANDED_SEMANTICS
39
   determines of the semantic functions themselves should be expanded
40
   in a similar way.
41
 
42
   <first>
43
   <last>
44
 
45
   Range of bits (within the instruction) that should be searched for
46
   an instruction field.  Within such ranges, gen looks for opcodes
47
   (constants), registers (strings) and reserved bits (slash) and
48
   according to the rules that follows includes or excludes them from
49
   a possible instruction field.
50
 
51
   <force_first>
52
   <force_last>
53
 
54
   If an instruction field was found, enlarge the field size so that
55
   it is forced to at least include bits starting from <force_first>
56
   (<force_last>).  To stop this occuring, use <force_first> = <last>
57
   + 1 and <force_last> = <first> - 1.
58
 
59
   <force_slash>
60
 
61
   Treat `/' fields as a constant instead of variable when looking for
62
   an instruction field.
63
 
64
   <force_expansion>
65
 
66
   Treat any contained register (string) fields as constant when
67
   determining the instruction field.  For the instruction decode (and
68
   controled by IDECODE_EXPAND_SEMANTICS) this forces the expansion of
69
   what would otherwize be non constant bits of an instruction.
70
 
71
   <use_switch>
72
 
73
   Should this table be expanded using a switch statement (val 1) and
74
   if so, should it be padded with entries so as to force the compiler
75
   to generate a jump table (val 2). Or a branch table (val 3).
76
 
77
   <special_mask>
78
   <special_value>
79
   <special_rule>
80
   <special_constant>
81
 
82
   Special rule to fine tune how specific (or groups) of instructions
83
   are expanded.  The applicability of the rule is determined by
84
 
85
     <special_mask> != 0 && (instruction> & <special_mask>) == <special_value>
86
 
87
   Where <instruction> is obtained by looking only at constant fields
88
   with in an instructions spec.  When determining an expansion, the
89
   rule is only considered when a node contains a single instruction.
90
   <special_rule> can be any of:
91
 
92
        0: for this instruction, expand by earlier rules
93
        1: expand bits <force_low> .. <force_hi> only
94
        2: boolean expansion of only zero/non-zero cases
95
        3: boolean expansion of equality of special constant
96
 
97
        */
98
 
99
 
100
typedef enum {
101
  normal_decode_rule,
102
  expand_forced_rule,
103
  boolean_rule,
104
  nr_decode_rules
105
} decode_special_type;
106
 
107
typedef enum {
108
  invalid_gen,
109
  array_gen,
110
  switch_gen,
111
  padded_switch_gen,
112
  goto_switch_gen,
113
  nr_decode_gen_types,
114
} decode_gen_type;
115
 
116
 
117
typedef struct _decode_table decode_table;
118
struct _decode_table {
119
  decode_special_type type;
120
  decode_gen_type gen;
121
  int first;
122
  int last;
123
  int force_first;
124
  int force_last;
125
  int force_slash;
126
  char *force_expansion;
127
  unsigned special_mask;
128
  unsigned special_value;
129
  unsigned special_constant;
130
  decode_table *next;
131
};
132
 
133
 
134
extern void force_decode_gen_type
135
(const char *type);
136
 
137
extern decode_table *load_decode_table
138
(char *file_name,
139
 int hi_bit_nr);
140
 
141
extern void dump_decode_rule
142
(decode_table *rule,
143
 int indent);

powered by: WebSVN 2.1.0

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