166e63ce3Schristos /* This file is part of the program psim. 266e63ce3Schristos 366e63ce3Schristos Copyright 1994, 1995, 1996, 1997, 2003, Andrew Cagney 466e63ce3Schristos 566e63ce3Schristos This program is free software; you can redistribute it and/or modify 666e63ce3Schristos it under the terms of the GNU General Public License as published by 748596154Schristos the Free Software Foundation; either version 3 of the License, or 866e63ce3Schristos (at your option) any later version. 966e63ce3Schristos 1066e63ce3Schristos This program is distributed in the hope that it will be useful, 1166e63ce3Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 1266e63ce3Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1366e63ce3Schristos GNU General Public License for more details. 1466e63ce3Schristos 1566e63ce3Schristos You should have received a copy of the GNU General Public License 1648596154Schristos along with this program; if not, see <http://www.gnu.org/licenses/>. 1766e63ce3Schristos 1866e63ce3Schristos */ 1966e63ce3Schristos 2066e63ce3Schristos /* Instruction unpacking: 2166e63ce3Schristos 2266e63ce3Schristos Once the instruction has been decoded, the register (and other) 2366e63ce3Schristos fields within the instruction need to be extracted. 2466e63ce3Schristos 2566e63ce3Schristos The table that follows determines how each field should be treated. 2666e63ce3Schristos Importantly it considers the case where the extracted field is to 27*eaae8ed5Schristos be used immediately or stored in an instruction cache. 2866e63ce3Schristos 2966e63ce3Schristos <type> 3066e63ce3Schristos 3166e63ce3Schristos Indicates what to do with the cache entry. If a cache is to be 3266e63ce3Schristos used. SCRATCH and CACHE values are defined when a cache entry is 3366e63ce3Schristos being filled while CACHE and COMPUTE values are defined in the 3466e63ce3Schristos semantic code. 3566e63ce3Schristos 3666e63ce3Schristos Zero marks the end of the table. More importantly 1. indicates 3766e63ce3Schristos that the entry is valid and can be cached. 2. indicates that that 3866e63ce3Schristos the entry is valid but can not be cached. 3966e63ce3Schristos 4066e63ce3Schristos <field_name> 4166e63ce3Schristos 4266e63ce3Schristos The field name as given in the instruction spec. 4366e63ce3Schristos 4466e63ce3Schristos <derived_name> 4566e63ce3Schristos 4666e63ce3Schristos A new name for <field_name> once it has been extracted from the 4766e63ce3Schristos instruction (and possibly stored in the instruction cache). 4866e63ce3Schristos 4966e63ce3Schristos <type> 5066e63ce3Schristos 5166e63ce3Schristos String specifying the storage type for <new_name> (the extracted 5266e63ce3Schristos field>. 5366e63ce3Schristos 5466e63ce3Schristos <expression> 5566e63ce3Schristos 5666e63ce3Schristos Specifies how to get <new_name> from <old_name>. If null, old and 5766e63ce3Schristos new name had better be the same. */ 5866e63ce3Schristos 5966e63ce3Schristos 6066e63ce3Schristos typedef enum { 6166e63ce3Schristos scratch_value, 6266e63ce3Schristos cache_value, 6366e63ce3Schristos compute_value, 6466e63ce3Schristos } cache_rule_type; 6566e63ce3Schristos 6666e63ce3Schristos typedef struct _cache_table cache_table; 6766e63ce3Schristos struct _cache_table { 6866e63ce3Schristos cache_rule_type type; 6966e63ce3Schristos char *field_name; 7066e63ce3Schristos char *derived_name; 7166e63ce3Schristos char *type_def; 7266e63ce3Schristos char *expression; 7366e63ce3Schristos table_entry *file_entry; 7466e63ce3Schristos cache_table *next; 7566e63ce3Schristos }; 7666e63ce3Schristos 7766e63ce3Schristos 7866e63ce3Schristos extern cache_table *load_cache_table 7966e63ce3Schristos (char *file_name, 8066e63ce3Schristos int hi_bit_nr); 8166e63ce3Schristos 8266e63ce3Schristos extern void append_cache_rule 8366e63ce3Schristos (cache_table **table, 8466e63ce3Schristos char *type, 8566e63ce3Schristos char *field_name, 8666e63ce3Schristos char *derived_name, 8766e63ce3Schristos char *type_def, 8866e63ce3Schristos char *expression, 8966e63ce3Schristos table_entry *file_entry); 9066e63ce3Schristos 91