14e98e3e1Schristos /* The IGEN simulator generator for GDB, the GNU Debugger. 24e98e3e1Schristos 3*71f62182Schristos Copyright 2002-2024 Free Software Foundation, Inc. 44e98e3e1Schristos 54e98e3e1Schristos Contributed by Andrew Cagney. 64e98e3e1Schristos 74e98e3e1Schristos This file is part of GDB. 84e98e3e1Schristos 94e98e3e1Schristos This program is free software; you can redistribute it and/or modify 104e98e3e1Schristos it under the terms of the GNU General Public License as published by 114e98e3e1Schristos the Free Software Foundation; either version 3 of the License, or 124e98e3e1Schristos (at your option) any later version. 134e98e3e1Schristos 144e98e3e1Schristos This program is distributed in the hope that it will be useful, 154e98e3e1Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 164e98e3e1Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 174e98e3e1Schristos GNU General Public License for more details. 184e98e3e1Schristos 194e98e3e1Schristos You should have received a copy of the GNU General Public License 204e98e3e1Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 214e98e3e1Schristos 22*71f62182Schristos #ifndef IGEN_GEN_SEMANTICS_H 23*71f62182Schristos #define IGEN_GEN_SEMANTICS_H 244e98e3e1Schristos 254e98e3e1Schristos /* Creates the files semantics.[hc]. 264e98e3e1Schristos 274e98e3e1Schristos The generated file semantics contains functions that implement the 284e98e3e1Schristos operations required to model a single target processor instruction. 294e98e3e1Schristos 304e98e3e1Schristos Several different variations on the semantics file can be created: 314e98e3e1Schristos 324e98e3e1Schristos o uncached 334e98e3e1Schristos 344e98e3e1Schristos No instruction cache exists. The semantic function 354e98e3e1Schristos needs to generate any required values locally. 364e98e3e1Schristos 374e98e3e1Schristos o cached - separate cracker and semantic 384e98e3e1Schristos 394e98e3e1Schristos Two independant functions are created. Firstly the 404e98e3e1Schristos function that cracks an instruction entering it into a 414e98e3e1Schristos cache and secondly the semantic function propper that 424e98e3e1Schristos uses the cache. 434e98e3e1Schristos 444e98e3e1Schristos o cached - semantic + cracking semantic 454e98e3e1Schristos 464e98e3e1Schristos The function that cracks the instruction and enters 474e98e3e1Schristos all values into the cache also contains a copy of the 484e98e3e1Schristos semantic code (avoiding the need to call both the 494e98e3e1Schristos cracker and the semantic function when there is a 504e98e3e1Schristos cache miss). 514e98e3e1Schristos 524e98e3e1Schristos For each of these general forms, several refinements can occure: 534e98e3e1Schristos 544e98e3e1Schristos o do/don't duplicate/expand semantic functions 554e98e3e1Schristos 564e98e3e1Schristos As a consequence of decoding an instruction, the 574e98e3e1Schristos decoder, as part of its table may have effectivly made 584e98e3e1Schristos certain of the variable fields in an instruction 594e98e3e1Schristos constant. Separate functions for each of the 604e98e3e1Schristos alternative values for what would have been treated as 614e98e3e1Schristos a variable part can be created. 624e98e3e1Schristos 634e98e3e1Schristos o use cache struct directly. 644e98e3e1Schristos 654e98e3e1Schristos When a cracking cache is present, the semantic 664e98e3e1Schristos functions can be generated to either hold intermediate 674e98e3e1Schristos cache values in local variables or always refer to the 684e98e3e1Schristos contents of the cache directly. */ 694e98e3e1Schristos 704e98e3e1Schristos 714e98e3e1Schristos 724e98e3e1Schristos 734e98e3e1Schristos 744e98e3e1Schristos 754e98e3e1Schristos extern void print_semantic_declaration 764e98e3e1Schristos (lf *file, 774b169a6bSchristos const insn_entry *insn, 784b169a6bSchristos const opcode_bits *bits, 794b169a6bSchristos const insn_opcodes *opcodes, 804b169a6bSchristos int nr_prefetched_words); 814e98e3e1Schristos 824e98e3e1Schristos extern void print_semantic_definition 834e98e3e1Schristos (lf *file, 844b169a6bSchristos const insn_entry *insn, 854b169a6bSchristos const opcode_bits *bits, 864b169a6bSchristos const insn_opcodes *opcodes, 874b169a6bSchristos cache_entry *cache_rules, 884b169a6bSchristos int nr_prefetched_words); 894e98e3e1Schristos 904e98e3e1Schristos 914e98e3e1Schristos typedef enum 924e98e3e1Schristos { 934e98e3e1Schristos invalid_illegal, 944e98e3e1Schristos invalid_fp_unavailable, 954e98e3e1Schristos invalid_wrong_slot, 964e98e3e1Schristos } 974e98e3e1Schristos invalid_type; 984e98e3e1Schristos 994e98e3e1Schristos extern void print_idecode_invalid 1004e98e3e1Schristos (lf *file, const char *result, invalid_type type); 1014e98e3e1Schristos 1024e98e3e1Schristos extern void print_semantic_body 1034e98e3e1Schristos (lf *file, 1044b169a6bSchristos const insn_entry *instruction, 1054b169a6bSchristos const opcode_bits *expanded_bits, 1064b169a6bSchristos const insn_opcodes *opcodes); 107*71f62182Schristos 108*71f62182Schristos #endif /* IGEN_GEN_SEMANTICS_H */ 109