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