1/* The IGEN simulator generator for GDB, the GNU Debugger. 2 3 Copyright 2002-2023 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 23/* Creates the files semantics.[hc]. 24 25 The generated file semantics contains functions that implement the 26 operations required to model a single target processor instruction. 27 28 Several different variations on the semantics file can be created: 29 30 o uncached 31 32 No instruction cache exists. The semantic function 33 needs to generate any required values locally. 34 35 o cached - separate cracker and semantic 36 37 Two independant functions are created. Firstly the 38 function that cracks an instruction entering it into a 39 cache and secondly the semantic function propper that 40 uses the cache. 41 42 o cached - semantic + cracking semantic 43 44 The function that cracks the instruction and enters 45 all values into the cache also contains a copy of the 46 semantic code (avoiding the need to call both the 47 cracker and the semantic function when there is a 48 cache miss). 49 50 For each of these general forms, several refinements can occure: 51 52 o do/don't duplicate/expand semantic functions 53 54 As a consequence of decoding an instruction, the 55 decoder, as part of its table may have effectivly made 56 certain of the variable fields in an instruction 57 constant. Separate functions for each of the 58 alternative values for what would have been treated as 59 a variable part can be created. 60 61 o use cache struct directly. 62 63 When a cracking cache is present, the semantic 64 functions can be generated to either hold intermediate 65 cache values in local variables or always refer to the 66 contents of the cache directly. */ 67 68 69 70 71 72 73extern void print_semantic_declaration 74 (lf *file, 75 const insn_entry *insn, 76 const opcode_bits *bits, 77 const insn_opcodes *opcodes, 78 int nr_prefetched_words); 79 80extern void print_semantic_definition 81 (lf *file, 82 const insn_entry *insn, 83 const opcode_bits *bits, 84 const insn_opcodes *opcodes, 85 cache_entry *cache_rules, 86 int nr_prefetched_words); 87 88 89typedef enum 90{ 91 invalid_illegal, 92 invalid_fp_unavailable, 93 invalid_wrong_slot, 94} 95invalid_type; 96 97extern void print_idecode_invalid 98 (lf *file, const char *result, invalid_type type); 99 100extern void print_semantic_body 101 (lf *file, 102 const insn_entry *instruction, 103 const opcode_bits *expanded_bits, 104 const insn_opcodes *opcodes); 105