Home | History | Annotate | Line # | Download | only in igen
      1 /* The IGEN simulator generator for GDB, the GNU Debugger.
      2 
      3    Copyright 2002-2024 Free Software Foundation, Inc.
      4 
      5    Contributed by Andrew Cagney.
      6 
      7    This file is part of GDB.
      8 
      9    This program is free software; you can redistribute it and/or modify
     10    it under the terms of the GNU General Public License as published by
     11    the Free Software Foundation; either version 3 of the License, or
     12    (at your option) any later version.
     13 
     14    This program is distributed in the hope that it will be useful,
     15    but WITHOUT ANY WARRANTY; without even the implied warranty of
     16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17    GNU General Public License for more details.
     18 
     19    You should have received a copy of the GNU General Public License
     20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     21 
     22 #ifndef IGEN_GEN_SEMANTICS_H
     23 #define IGEN_GEN_SEMANTICS_H
     24 
     25 /* Creates the files semantics.[hc].
     26 
     27    The generated file semantics contains functions that implement the
     28    operations required to model a single target processor instruction.
     29 
     30    Several different variations on the semantics file can be created:
     31 
     32 	o	uncached
     33 
     34         	No instruction cache exists.  The semantic function
     35 		needs to generate any required values locally.
     36 
     37 	o	cached - separate cracker and semantic
     38 
     39 		Two independent functions are created.  Firstly the
     40 		function that cracks an instruction entering it into a
     41 		cache and secondly the semantic function proper that
     42 		uses the cache.
     43 
     44 	o	cached - semantic + cracking semantic
     45 
     46 		The function that cracks the instruction and enters
     47 		all values into the cache also contains a copy of the
     48 		semantic code (avoiding the need to call both the
     49 		cracker and the semantic function when there is a
     50 		cache miss).
     51 
     52    For each of these general forms, several refinements can occure:
     53 
     54 	o	do/don't duplicate/expand semantic functions
     55 
     56 		As a consequence of decoding an instruction, the
     57 		decoder, as part of its table may have effectivly made
     58 		certain of the variable fields in an instruction
     59 		constant. Separate functions for each of the
     60 		alternative values for what would have been treated as
     61 		a variable part can be created.
     62 
     63 	o	use cache struct directly.
     64 
     65 		When a cracking cache is present, the semantic
     66 		functions can be generated to either hold intermediate
     67 		cache values in local variables or always refer to the
     68 		contents of the cache directly. */
     69 
     70 
     71 
     72 
     73 
     74 
     75 extern void print_semantic_declaration
     76   (lf *file,
     77    const insn_entry *insn,
     78    const opcode_bits *bits,
     79    const insn_opcodes *opcodes,
     80    int nr_prefetched_words);
     81 
     82 extern void print_semantic_definition
     83   (lf *file,
     84    const insn_entry *insn,
     85    const opcode_bits *bits,
     86    const insn_opcodes *opcodes,
     87    cache_entry *cache_rules,
     88    int nr_prefetched_words);
     89 
     90 
     91 typedef enum
     92 {
     93   invalid_illegal,
     94   invalid_fp_unavailable,
     95   invalid_wrong_slot,
     96 }
     97 invalid_type;
     98 
     99 extern void print_idecode_invalid
    100   (lf *file, const char *result, invalid_type type);
    101 
    102 extern void print_semantic_body
    103   (lf *file,
    104    const insn_entry *instruction,
    105    const opcode_bits *expanded_bits,
    106    const insn_opcodes *opcodes);
    107 
    108 #endif /* IGEN_GEN_SEMANTICS_H */
    109