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

Subversion Repositories openrisc_me

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [sim/] [igen/] [ld-insn.h] - Diff between revs 24 and 33

Only display areas with differences | Details | Blame | View Log

Rev 24 Rev 33
/* The IGEN simulator generator for GDB, the GNU Debugger.
/* The IGEN simulator generator for GDB, the GNU Debugger.
 
 
   Copyright 2002, 2007, 2008 Free Software Foundation, Inc.
   Copyright 2002, 2007, 2008 Free Software Foundation, Inc.
 
 
   Contributed by Andrew Cagney.
   Contributed by Andrew Cagney.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   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 3 of the License, or
   the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.  */
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 
 
 
 
typedef unsigned64 insn_uint;
typedef unsigned64 insn_uint;
 
 
 
 
/* Common among most entries:
/* Common among most entries:
 
 
   All non instruction records have the format:
   All non instruction records have the format:
 
 
   <...> ::=
   <...> ::=
       ":" <record-name>
       ":" <record-name>
       ":" <filter-flags>
       ":" <filter-flags>
       ":" <filter-models>
       ":" <filter-models>
       ":" ...
       ":" ...
 
 
 */
 */
 
 
enum
enum
{
{
  record_type_field = 1,
  record_type_field = 1,
  old_record_type_field = 2,
  old_record_type_field = 2,
  record_filter_flags_field = 2,
  record_filter_flags_field = 2,
  record_filter_models_field = 3,
  record_filter_models_field = 3,
};
};
 
 
 
 
/* Include:
/* Include:
 
 
   Include the specified file.
   Include the specified file.
 
 
   <include> ::=
   <include> ::=
       ":" "include"
       ":" "include"
       ":" <filter-flags>
       ":" <filter-flags>
       ":" <filter-models>
       ":" <filter-models>
       ":" <filename>
       ":" <filename>
       <nl>
       <nl>
       ;
       ;
 
 
   */
   */
 
 
enum
enum
{
{
  include_filename_field = 4,
  include_filename_field = 4,
  nr_include_fields,
  nr_include_fields,
};
};
 
 
 
 
 
 
/* Options:
/* Options:
 
 
   Valid options are: hi-bit-nr (default 0), insn-bit-size (default
   Valid options are: hi-bit-nr (default 0), insn-bit-size (default
   32), insn-specifying-widths (default true), multi-sim (default false).
   32), insn-specifying-widths (default true), multi-sim (default false).
 
 
   <option> ::=
   <option> ::=
       ":" "option"
       ":" "option"
       ":" <filter-flags>
       ":" <filter-flags>
       ":" <filter-models>
       ":" <filter-models>
       ":" <option-name>
       ":" <option-name>
       ":" <option-value>
       ":" <option-value>
       <nl>
       <nl>
       ;
       ;
 
 
   <option-name> ::=
   <option-name> ::=
       "insn-bit-size"
       "insn-bit-size"
       | "insn-specifying-widths"
       | "insn-specifying-widths"
       | "hi-bit-nr"
       | "hi-bit-nr"
       | "flags-filter"
       | "flags-filter"
       | "model-filter"
       | "model-filter"
       | "multi-sim"
       | "multi-sim"
       | "format-names"
       | "format-names"
       ;
       ;
 
 
   <option-value> ::=
   <option-value> ::=
       "true"
       "true"
       | "false"
       | "false"
       | <integer>
       | <integer>
       | <list>
       | <list>
       ;
       ;
 
 
 
 
   These update the global options structure. */
   These update the global options structure. */
 
 
 
 
enum
enum
{
{
  option_name_field = 4,
  option_name_field = 4,
  option_value_field,
  option_value_field,
  nr_option_fields,
  nr_option_fields,
};
};
 
 
 
 
 
 
/* Macro definitions:
/* Macro definitions:
 
 
   <insn-macro> ::=
   <insn-macro> ::=
       ":" "define"
       ":" "define"
       ":" <filter-flags>
       ":" <filter-flags>
       ":" <filter-models>
       ":" <filter-models>
       ":" <name>
       ":" <name>
       ":" <arg-list>
       ":" <arg-list>
       ":" <expression>
       ":" <expression>
       <nl>
       <nl>
       ;
       ;
 
 
   <arg-list> ::=
   <arg-list> ::=
       [ <name> { "," <arg-list> } ]
       [ <name> { "," <arg-list> } ]
       ;
       ;
 
 
   */
   */
 
 
 
 
enum
enum
{
{
  macro_name_field = 4,
  macro_name_field = 4,
  macro_args_field,
  macro_args_field,
  macro_expr_field,
  macro_expr_field,
  nr_macro_fields,
  nr_macro_fields,
};
};
 
 
 
 
 
 
/* Functions and internal routins:
/* Functions and internal routins:
 
 
   NB: <filter-models> and <function-models> are equivalent.
   NB: <filter-models> and <function-models> are equivalent.
 
 
 
 
   <function> ::=
   <function> ::=
       ":" "function"
       ":" "function"
       <function-spec>
       <function-spec>
       ;
       ;
 
 
   <internal> ::=
   <internal> ::=
       ":" "internal"
       ":" "internal"
       <function-spec>
       <function-spec>
       ;
       ;
 
 
   <format> ::=
   <format> ::=
       ":" ( "%s" | ... )
       ":" ( "%s" | ... )
       <function-spec>
       <function-spec>
       ;
       ;
 
 
   <function-model> ::=
   <function-model> ::=
       "*" [ <processor-list> ]
       "*" [ <processor-list> ]
       ":"
       ":"
       <nl>
       <nl>
       ;
       ;
 
 
   <function-spec> ::=
   <function-spec> ::=
       ":" <filter-flags>
       ":" <filter-flags>
       ":" <filter-models>
       ":" <filter-models>
       ":" <typedef>
       ":" <typedef>
       ":" <name>
       ":" <name>
       [ ":" <parameter-list> ]
       [ ":" <parameter-list> ]
       <nl>
       <nl>
       [ <function-model> ]
       [ <function-model> ]
       <code-block>
       <code-block>
       ;
       ;
 
 
   */
   */
 
 
enum
enum
{
{
  function_typedef_field = 4,
  function_typedef_field = 4,
  function_name_field,
  function_name_field,
  function_param_field,
  function_param_field,
  nr_function_fields,
  nr_function_fields,
};
};
 
 
enum
enum
{
{
  function_model_name_field = 0,
  function_model_name_field = 0,
  nr_function_model_fields = 1,
  nr_function_model_fields = 1,
};
};
 
 
enum
enum
{
{
  old_function_typedef_field = 0,
  old_function_typedef_field = 0,
  old_function_type_field = 2,
  old_function_type_field = 2,
  old_function_name_field = 4,
  old_function_name_field = 4,
  old_function_param_field = 5,
  old_function_param_field = 5,
  nr_old_function_fields = 5,   /* parameter-list is optional */
  nr_old_function_fields = 5,   /* parameter-list is optional */
};
};
 
 
 
 
typedef struct _function_entry function_entry;
typedef struct _function_entry function_entry;
struct _function_entry
struct _function_entry
{
{
  line_ref *line;
  line_ref *line;
  filter *flags;
  filter *flags;
  filter *models;
  filter *models;
  char *type;
  char *type;
  char *name;
  char *name;
  char *param;
  char *param;
  table_entry *code;
  table_entry *code;
  int is_internal;
  int is_internal;
  function_entry *next;
  function_entry *next;
};
};
 
 
 
 
typedef void function_entry_handler
typedef void function_entry_handler
  (lf *file, function_entry * function, void *data);
  (lf *file, function_entry * function, void *data);
 
 
extern void function_entry_traverse
extern void function_entry_traverse
  (lf *file,
  (lf *file,
   function_entry * functions, function_entry_handler * handler, void *data);
   function_entry * functions, function_entry_handler * handler, void *data);
 
 
 
 
/* cache-macro:
/* cache-macro:
 
 
   <cache-macro> ::=
   <cache-macro> ::=
       ":" <macro-type>
       ":" <macro-type>
       ":" <filter-flags>
       ":" <filter-flags>
       ":" <filter-models>
       ":" <filter-models>
       ":" <typedef>
       ":" <typedef>
       ":" <name>
       ":" <name>
       ":" <field-name> { "," <field-name> }
       ":" <field-name> { "," <field-name> }
       ":" <expression>
       ":" <expression>
       <nl>
       <nl>
       ;
       ;
 
 
   <cache-macro-type> ::=
   <cache-macro-type> ::=
       "scratch"
       "scratch"
       | "cache"
       | "cache"
       | "compute"
       | "compute"
       ;
       ;
 
 
   <name> ::=
   <name> ::=
       <ident>
       <ident>
       | <ident> "_is_" <integer>
       | <ident> "_is_" <integer>
       ;
       ;
 
 
   A cache entry is defined (for an instruction) when all
   A cache entry is defined (for an instruction) when all
   <field-name>s are present as named opcode fields within the
   <field-name>s are present as named opcode fields within the
   instructions format.
   instructions format.
 
 
   SCRATCH and CACHE macros are defined during the cache fill stage
   SCRATCH and CACHE macros are defined during the cache fill stage
   while CACHE and COMPUTE macros are defined during the instruction
   while CACHE and COMPUTE macros are defined during the instruction
   execution stage.
   execution stage.
 
 
   */
   */
 
 
enum
enum
{
{
  cache_typedef_field = 4,
  cache_typedef_field = 4,
  cache_name_field,
  cache_name_field,
  cache_original_fields_field,
  cache_original_fields_field,
  cache_expression_field,
  cache_expression_field,
  nr_cache_fields,
  nr_cache_fields,
};
};
 
 
typedef enum
typedef enum
{
{
  scratch_value,
  scratch_value,
  cache_value,
  cache_value,
  compute_value,
  compute_value,
}
}
cache_entry_type;
cache_entry_type;
 
 
typedef struct _cache_entry cache_entry;
typedef struct _cache_entry cache_entry;
struct _cache_entry
struct _cache_entry
{
{
  line_ref *line;
  line_ref *line;
  filter *flags;
  filter *flags;
  filter *models;
  filter *models;
  cache_entry_type entry_type;
  cache_entry_type entry_type;
  char *name;
  char *name;
  filter *original_fields;
  filter *original_fields;
  char *type;
  char *type;
  char *expression;
  char *expression;
  cache_entry *next;
  cache_entry *next;
};
};
 
 
 
 
 
 
/* Model specs:
/* Model specs:
 
 
   <model-processor> ::=
   <model-processor> ::=
       ":" "model"
       ":" "model"
       ":" <filter-flags>
       ":" <filter-flags>
       ":" <filter-models>
       ":" <filter-models>
       ":" <processor>
       ":" <processor>
       ":" <BFD-processor>
       ":" <BFD-processor>
       ":" <function-unit-data>
       ":" <function-unit-data>
       <nl>
       <nl>
       ;
       ;
 
 
   <model-macro> ::=
   <model-macro> ::=
       ":" "model-macro"
       ":" "model-macro"
       ":" <filter-flags>
       ":" <filter-flags>
       ":" <filter-models>
       ":" <filter-models>
       <nl>
       <nl>
       <code-block>
       <code-block>
       ;
       ;
 
 
   <model-data> ::=
   <model-data> ::=
       ":" "model-data"
       ":" "model-data"
       ":" <filter-flags>
       ":" <filter-flags>
       ":" <filter-models>
       ":" <filter-models>
       <nl>
       <nl>
       <code-block>
       <code-block>
       ;
       ;
 
 
   <model-static> ::=
   <model-static> ::=
       ":" "model-static"
       ":" "model-static"
       <function-spec>
       <function-spec>
       ;
       ;
 
 
   <model-internal> ::=
   <model-internal> ::=
       ":" "model-internal"
       ":" "model-internal"
       <function-spec>
       <function-spec>
       ;
       ;
 
 
   <model-function> ::=
   <model-function> ::=
       ":" "model-internal"
       ":" "model-internal"
       <function-spec>
       <function-spec>
       ;
       ;
 
 
 */
 */
 
 
enum
enum
{
{
  nr_model_macro_fields = 4,
  nr_model_macro_fields = 4,
  nr_model_data_fields = 4,
  nr_model_data_fields = 4,
  nr_model_static_fields = nr_function_fields,
  nr_model_static_fields = nr_function_fields,
  nr_model_internal_fields = nr_function_fields,
  nr_model_internal_fields = nr_function_fields,
  nr_model_function_fields = nr_function_fields,
  nr_model_function_fields = nr_function_fields,
};
};
 
 
typedef struct _model_data model_data;
typedef struct _model_data model_data;
struct _model_data
struct _model_data
{
{
  line_ref *line;
  line_ref *line;
  filter *flags;
  filter *flags;
  table_entry *entry;
  table_entry *entry;
  table_entry *code;
  table_entry *code;
  model_data *next;
  model_data *next;
};
};
 
 
enum
enum
{
{
  model_name_field = 4,
  model_name_field = 4,
  model_full_name_field,
  model_full_name_field,
  model_unit_data_field,
  model_unit_data_field,
  nr_model_processor_fields,
  nr_model_processor_fields,
};
};
 
 
typedef struct _model_entry model_entry;
typedef struct _model_entry model_entry;
struct _model_entry
struct _model_entry
{
{
  line_ref *line;
  line_ref *line;
  filter *flags;
  filter *flags;
  char *name;
  char *name;
  char *full_name;
  char *full_name;
  char *unit_data;
  char *unit_data;
  model_entry *next;
  model_entry *next;
};
};
 
 
 
 
typedef struct _model_table model_table;
typedef struct _model_table model_table;
struct _model_table
struct _model_table
{
{
  filter *processors;
  filter *processors;
  int nr_models;
  int nr_models;
  model_entry *models;
  model_entry *models;
  model_data *macros;
  model_data *macros;
  model_data *data;
  model_data *data;
  function_entry *statics;
  function_entry *statics;
  function_entry *internals;
  function_entry *internals;
  function_entry *functions;
  function_entry *functions;
};
};
 
 
 
 
 
 
/* Instruction format:
/* Instruction format:
 
 
   An instruction is composed of a sequence of N bit instruction
   An instruction is composed of a sequence of N bit instruction
   words.  Each word broken into a number of instruction fields.
   words.  Each word broken into a number of instruction fields.
   Those fields being constant (ex. an opcode) or variable (register
   Those fields being constant (ex. an opcode) or variable (register
   spec).
   spec).
 
 
   <insn-word> ::=
   <insn-word> ::=
       <insn-field> { "," <insn-field> } ;
       <insn-field> { "," <insn-field> } ;
 
 
   <insn-field> ::=
   <insn-field> ::=
       ( <binary-value-implying-width>
       ( <binary-value-implying-width>
       | <field-name-implying-width>
       | <field-name-implying-width>
       | [ <start-or-width> "." ] <field>
       | [ <start-or-width> "." ] <field>
       )
       )
       { [ "!" | "=" ] [ <value> | <field-name> ] }
       { [ "!" | "=" ] [ <value> | <field-name> ] }
       ;
       ;
 
 
   <field> ::=
   <field> ::=
         { "*" }+
         { "*" }+
       | { "/" }+
       | { "/" }+
       | <field-name>
       | <field-name>
       | "0x" <hex-value>
       | "0x" <hex-value>
       | "0b" <binary-value>
       | "0b" <binary-value>
       | "0" <octal-value>
       | "0" <octal-value>
       | <integer-value> ;
       | <integer-value> ;
 
 
*/
*/
 
 
typedef enum _insn_field_cond_type
typedef enum _insn_field_cond_type
{
{
  insn_field_cond_value,
  insn_field_cond_value,
  insn_field_cond_field,
  insn_field_cond_field,
}
}
insn_field_cond_type;
insn_field_cond_type;
typedef enum _insn_field_cond_test
typedef enum _insn_field_cond_test
{
{
  insn_field_cond_eq,
  insn_field_cond_eq,
  insn_field_cond_ne,
  insn_field_cond_ne,
}
}
insn_field_cond_test;
insn_field_cond_test;
typedef struct _insn_field_cond insn_field_cond;
typedef struct _insn_field_cond insn_field_cond;
struct _insn_field_cond
struct _insn_field_cond
{
{
  insn_field_cond_type type;
  insn_field_cond_type type;
  insn_field_cond_test test;
  insn_field_cond_test test;
  insn_uint value;
  insn_uint value;
  struct _insn_field_entry *field;
  struct _insn_field_entry *field;
  char *string;
  char *string;
  insn_field_cond *next;
  insn_field_cond *next;
};
};
 
 
 
 
typedef enum _insn_field_type
typedef enum _insn_field_type
{
{
  insn_field_invalid,
  insn_field_invalid,
  insn_field_int,
  insn_field_int,
  insn_field_reserved,
  insn_field_reserved,
  insn_field_wild,
  insn_field_wild,
  insn_field_string,
  insn_field_string,
}
}
insn_field_type;
insn_field_type;
 
 
typedef struct _insn_field_entry insn_field_entry;
typedef struct _insn_field_entry insn_field_entry;
struct _insn_field_entry
struct _insn_field_entry
{
{
  int first;
  int first;
  int last;
  int last;
  int width;
  int width;
  int word_nr;
  int word_nr;
  insn_field_type type;
  insn_field_type type;
  insn_uint val_int;
  insn_uint val_int;
  char *pos_string;
  char *pos_string;
  char *val_string;
  char *val_string;
  insn_field_cond *conditions;
  insn_field_cond *conditions;
  insn_field_entry *next;
  insn_field_entry *next;
  insn_field_entry *prev;
  insn_field_entry *prev;
};
};
 
 
typedef struct _insn_bit_entry insn_bit_entry;
typedef struct _insn_bit_entry insn_bit_entry;
struct _insn_bit_entry
struct _insn_bit_entry
{
{
  int value;
  int value;
  int mask;
  int mask;
  insn_field_entry *field;
  insn_field_entry *field;
};
};
 
 
 
 
 
 
 
 
typedef struct _insn_entry insn_entry;  /* forward */
typedef struct _insn_entry insn_entry;  /* forward */
 
 
typedef struct _insn_word_entry insn_word_entry;
typedef struct _insn_word_entry insn_word_entry;
struct _insn_word_entry
struct _insn_word_entry
{
{
  /* list of sub-fields making up the instruction.  bit provides
  /* list of sub-fields making up the instruction.  bit provides
     faster access to the field data for bit N.  */
     faster access to the field data for bit N.  */
  insn_field_entry *first;
  insn_field_entry *first;
  insn_field_entry *last;
  insn_field_entry *last;
  insn_bit_entry *bit[max_insn_bit_size];
  insn_bit_entry *bit[max_insn_bit_size];
  /* set of all the string fields */
  /* set of all the string fields */
  filter *field_names;
  filter *field_names;
  /* For multi-word instructions, The Nth word (from zero). */
  /* For multi-word instructions, The Nth word (from zero). */
  insn_word_entry *next;
  insn_word_entry *next;
};
};
 
 
 
 
 
 
/* Instruction model:
/* Instruction model:
 
 
   Provides scheduling and other data for the code modeling the
   Provides scheduling and other data for the code modeling the
   instruction unit.
   instruction unit.
 
 
   <insn-model> ::=
   <insn-model> ::=
       "*" [ <processor-list> ]
       "*" [ <processor-list> ]
       ":" [ <function-unit-data> ]
       ":" [ <function-unit-data> ]
       <nl>
       <nl>
       ;
       ;
 
 
   <processor-list> ::=
   <processor-list> ::=
       <processor> { "," <processor>" }
       <processor> { "," <processor>" }
       ;
       ;
 
 
   If the <processor-list> is empty, the model is made the default for
   If the <processor-list> is empty, the model is made the default for
   this instruction.
   this instruction.
 
 
   */
   */
 
 
enum
enum
{
{
  insn_model_name_field = 0,
  insn_model_name_field = 0,
  insn_model_unit_data_field = 1,
  insn_model_unit_data_field = 1,
  nr_insn_model_fields = 1,
  nr_insn_model_fields = 1,
};
};
 
 
typedef struct _insn_model_entry insn_model_entry;
typedef struct _insn_model_entry insn_model_entry;
struct _insn_model_entry
struct _insn_model_entry
{
{
  line_ref *line;
  line_ref *line;
  insn_entry *insn;
  insn_entry *insn;
  filter *names;
  filter *names;
  char *full_name;
  char *full_name;
  char *unit_data;
  char *unit_data;
  insn_model_entry *next;
  insn_model_entry *next;
};
};
 
 
 
 
 
 
/* Instruction mnemonic:
/* Instruction mnemonic:
 
 
   List of assembler mnemonics for the instruction.
   List of assembler mnemonics for the instruction.
 
 
   <insn-mnenonic> ::=
   <insn-mnenonic> ::=
       "\"" <assembler-mnemonic> "\""
       "\"" <assembler-mnemonic> "\""
       [ ":" <conditional-expression> ]
       [ ":" <conditional-expression> ]
       <nl>
       <nl>
       ;
       ;
 
 
   An assembler mnemonic string has the syntax:
   An assembler mnemonic string has the syntax:
 
 
   <assembler-mnemonic>  ::=
   <assembler-mnemonic>  ::=
       ( [ "%" <format-spec> ] "<" <func> [ "#" <param-list> ] ">"
       ( [ "%" <format-spec> ] "<" <func> [ "#" <param-list> ] ">"
       | "%%"
       | "%%"
       | <other-letter>
       | <other-letter>
       )+
       )+
 
 
    Where, for instance, the text is translated into a printf format
    Where, for instance, the text is translated into a printf format
    and argument pair:
    and argument pair:
 
 
       "<FUNC>"         : "%ld", (long) FUNC
       "<FUNC>"         : "%ld", (long) FUNC
       "%<FUNC>..."     : "%...", FUNC
       "%<FUNC>..."     : "%...", FUNC
       "%s<FUNC>"       : "%s", <%s>FUNC (SD_, FUNC)
       "%s<FUNC>"       : "%s", <%s>FUNC (SD_, FUNC)
       "%s<FUNC#P1,P2>" : "%s", <%s>FUNC (SD_, P1,P2)
       "%s<FUNC#P1,P2>" : "%s", <%s>FUNC (SD_, P1,P2)
       "%lx<FUNC>"      : "%lx", (unsigned long) FUNC
       "%lx<FUNC>"      : "%lx", (unsigned long) FUNC
       "%08lx<FUNC>"    : "%08lx", (unsigned long) FUNC
       "%08lx<FUNC>"    : "%08lx", (unsigned long) FUNC
 
 
    And "<%s>FUNC" denotes a function declared using the "%s" record
    And "<%s>FUNC" denotes a function declared using the "%s" record
    specifier.
    specifier.
 
 
 
 
 
 
       ;
       ;
 
 
   */
   */
 
 
enum
enum
{
{
  insn_mnemonic_format_field = 0,
  insn_mnemonic_format_field = 0,
  insn_mnemonic_condition_field = 1,
  insn_mnemonic_condition_field = 1,
  nr_insn_mnemonic_fields = 1,
  nr_insn_mnemonic_fields = 1,
};
};
 
 
typedef struct _insn_mnemonic_entry insn_mnemonic_entry;
typedef struct _insn_mnemonic_entry insn_mnemonic_entry;
struct _insn_mnemonic_entry
struct _insn_mnemonic_entry
{
{
  line_ref *line;
  line_ref *line;
  insn_entry *insn;
  insn_entry *insn;
  char *format;
  char *format;
  char *condition;
  char *condition;
  insn_mnemonic_entry *next;
  insn_mnemonic_entry *next;
};
};
 
 
 
 
 
 
/* Instruction:
/* Instruction:
 
 
   <insn> ::=
   <insn> ::=
       <insn-word> { "+" <insn-word> }
       <insn-word> { "+" <insn-word> }
       ":" <format-name>
       ":" <format-name>
       ":" <filter-flags>
       ":" <filter-flags>
       ":" <options>
       ":" <options>
       ":" <name>
       ":" <name>
       <nl>
       <nl>
       { <insn-model> }
       { <insn-model> }
       { <insn-mnemonic> }
       { <insn-mnemonic> }
       <code-block>
       <code-block>
 
 
 */
 */
 
 
enum
enum
{
{
  insn_word_field = 0,
  insn_word_field = 0,
  insn_format_name_field = 1,
  insn_format_name_field = 1,
  insn_filter_flags_field = 2,
  insn_filter_flags_field = 2,
  insn_options_field = 3,
  insn_options_field = 3,
  insn_name_field = 4,
  insn_name_field = 4,
  nr_insn_fields = 5,
  nr_insn_fields = 5,
};
};
 
 
 
 
/* typedef struct _insn_entry insn_entry; */
/* typedef struct _insn_entry insn_entry; */
struct _insn_entry
struct _insn_entry
{
{
  line_ref *line;
  line_ref *line;
  filter *flags;                /* filtered by options.filters */
  filter *flags;                /* filtered by options.filters */
  char *format_name;
  char *format_name;
  filter *options;
  filter *options;
  char *name;
  char *name;
  /* the words that make up the instruction. Word provides direct
  /* the words that make up the instruction. Word provides direct
     access to word N. Pseudo instructions can be identified by
     access to word N. Pseudo instructions can be identified by
     nr_words == 0. */
     nr_words == 0. */
  int nr_words;
  int nr_words;
  insn_word_entry *words;
  insn_word_entry *words;
  insn_word_entry **word;
  insn_word_entry **word;
  /* a set of all the fields from all the words */
  /* a set of all the fields from all the words */
  filter *field_names;
  filter *field_names;
  /* an array of processor models, missing models are NULL! */
  /* an array of processor models, missing models are NULL! */
  int nr_models;
  int nr_models;
  insn_model_entry *models;
  insn_model_entry *models;
  insn_model_entry **model;
  insn_model_entry **model;
  filter *processors;
  filter *processors;
  /* list of assember formats */
  /* list of assember formats */
  int nr_mnemonics;
  int nr_mnemonics;
  insn_mnemonic_entry *mnemonics;
  insn_mnemonic_entry *mnemonics;
  /* code body */
  /* code body */
  table_entry *code;
  table_entry *code;
  insn_entry *next;
  insn_entry *next;
};
};
 
 
 
 
/* Instruction table:
/* Instruction table:
 
 
 */
 */
 
 
typedef struct _insn_table insn_table;
typedef struct _insn_table insn_table;
struct _insn_table
struct _insn_table
{
{
  cache_entry *caches;
  cache_entry *caches;
  int max_nr_words;
  int max_nr_words;
  int nr_insns;
  int nr_insns;
  insn_entry *insns;
  insn_entry *insns;
  function_entry *functions;
  function_entry *functions;
  insn_entry *illegal_insn;
  insn_entry *illegal_insn;
  model_table *model;
  model_table *model;
  filter *options;
  filter *options;
  filter *flags;
  filter *flags;
};
};
 
 
extern insn_table *load_insn_table (char *file_name, cache_entry *cache);
extern insn_table *load_insn_table (char *file_name, cache_entry *cache);
 
 
typedef void insn_entry_handler
typedef void insn_entry_handler
  (lf *file, insn_table *isa, insn_entry * insn, void *data);
  (lf *file, insn_table *isa, insn_entry * insn, void *data);
 
 
extern void insn_table_traverse_insn
extern void insn_table_traverse_insn
  (lf *file, insn_table *isa, insn_entry_handler * handler, void *data);
  (lf *file, insn_table *isa, insn_entry_handler * handler, void *data);
 
 
 
 
 
 
/* Printing */
/* Printing */
 
 
extern void print_insn_words (lf *file, insn_entry * insn);
extern void print_insn_words (lf *file, insn_entry * insn);
 
 
 
 
 
 
/* Debugging */
/* Debugging */
 
 
void
void
  dump_insn_field
  dump_insn_field
  (lf *file, char *prefix, insn_field_entry *field, char *suffix);
  (lf *file, char *prefix, insn_field_entry *field, char *suffix);
 
 
void
void
  dump_insn_word_entry
  dump_insn_word_entry
  (lf *file, char *prefix, insn_word_entry *word, char *suffix);
  (lf *file, char *prefix, insn_word_entry *word, char *suffix);
 
 
void
void
  dump_insn_entry (lf *file, char *prefix, insn_entry * insn, char *suffix);
  dump_insn_entry (lf *file, char *prefix, insn_entry * insn, char *suffix);
 
 
void
void
  dump_cache_entries
  dump_cache_entries
  (lf *file, char *prefix, cache_entry *entry, char *suffix);
  (lf *file, char *prefix, cache_entry *entry, char *suffix);
 
 
void dump_insn_table (lf *file, char *prefix, insn_table *isa, char *suffix);
void dump_insn_table (lf *file, char *prefix, insn_table *isa, char *suffix);
 
 

powered by: WebSVN 2.1.0

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