| 1 | /* This file is part of the program psim. |
| 2 | |
| 3 | Copyright (C) 1994-1995, 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 3 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, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | */ |
| 19 | |
| 20 | |
| 21 | /* Creates the files semantics.[hc]. |
| 22 | |
| 23 | The generated file semantics contains functions that implement the |
| 24 | operations required to model a single target processor instruction. |
| 25 | |
| 26 | Several different variations on the semantics file can be created: |
| 27 | |
| 28 | o uncached |
| 29 | |
| 30 | No instruction cache exists. The semantic function |
| 31 | needs to generate any required values locally. |
| 32 | |
| 33 | o cached - separate cracker and semantic |
| 34 | |
| 35 | Two independant functions are created. Firstly the |
| 36 | function that cracks an instruction entering it into a |
| 37 | cache and secondly the semantic function propper that |
| 38 | uses the cache. |
| 39 | |
| 40 | o cached - semantic + cracking semantic |
| 41 | |
| 42 | The function that cracks the instruction and enters |
| 43 | all values into the cache also contains a copy of the |
| 44 | semantic code (avoiding the need to call both the |
| 45 | cracker and the semantic function when there is a |
| 46 | cache miss). |
| 47 | |
| 48 | For each of these general forms, several refinements can occure: |
| 49 | |
| 50 | o do/don't duplicate/expand semantic functions |
| 51 | |
| 52 | As a consequence of decoding an instruction, the |
| 53 | decoder, as part of its table may have effectivly made |
| 54 | certain of the variable fields in an instruction |
| 55 | constant. Separate functions for each of the |
| 56 | alternative values for what would have been treated as |
| 57 | a variable part can be created. |
| 58 | |
| 59 | o use cache struct directly. |
| 60 | |
| 61 | When a cracking cache is present, the semantic |
| 62 | functions can be generated to either hold intermediate |
| 63 | cache values in local variables or always refer to the |
| 64 | contents of the cache directly. */ |
| 65 | |
| 66 | |
| 67 | |
| 68 | extern insn_handler print_semantic_declaration; |
| 69 | extern insn_handler print_semantic_definition; |
| 70 | |
| 71 | extern void print_idecode_illegal |
| 72 | (lf *file, |
| 73 | const char *result); |
| 74 | |
| 75 | extern void print_semantic_body |
| 76 | (lf *file, |
| 77 | insn *instruction, |
| 78 | insn_bits *expanded_bits, |
| 79 | opcode_field *opcodes); |
| 80 | |