filename | src/tools/gendec.h |
changeset | 359:c588dce7ebde |
next | 420:e6f43dec3cf0 |
author | nkeynes |
date | Thu Aug 23 12:33:27 2007 +0000 (16 years ago) |
permissions | -rw-r--r-- |
last change | Commit decoder generator Translator work in progress Fix mac.l, mac.w in emu core |
file | annotate | diff | log | raw |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00001.2 +++ b/src/tools/gendec.h Thu Aug 23 12:33:27 2007 +00001.3 @@ -0,0 +1,84 @@1.4 +/**1.5 + * $Id: gendec.h,v 1.1 2007-08-23 12:33:27 nkeynes Exp $1.6 + *1.7 + * mem is responsible for creating and maintaining the overall system memory1.8 + * map, as visible from the SH4 processor. (Note the ARM has a different map)1.9 + *1.10 + * Copyright (c) 2005 Nathan Keynes.1.11 + *1.12 + * This program is free software; you can redistribute it and/or modify1.13 + * it under the terms of the GNU General Public License as published by1.14 + * the Free Software Foundation; either version 2 of the License, or1.15 + * (at your option) any later version.1.16 + *1.17 + * This program is distributed in the hope that it will be useful,1.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of1.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1.20 + * GNU General Public License for more details.1.21 + */1.22 +1.23 +#ifndef gendec_H1.24 +#define gendec_H1.25 +1.26 +#include <stdint.h>1.27 +1.28 +#ifdef __cplusplus1.29 +extern "C" {1.30 +#endif1.31 +1.32 +#define MAX_OPERAND_NAME 81.33 +#define MAX_OPERANDS 41.34 +#define MAX_OPERATION_FORMAT 641.35 +#define MAX_RULES 5121.36 +1.37 +#define USE_NONE 01.38 +#define USE_READ 11.39 +#define USE_WRITE 21.40 +#define USE_READWRITE 31.41 +1.42 +struct operand {1.43 + int bit_count;1.44 + int bit_shift;1.45 + int left_shift;1.46 + int is_signed;1.47 + int use_mode;1.48 + char name[MAX_OPERAND_NAME+1];1.49 +};1.50 +1.51 +struct rule {1.52 + uint32_t bits;1.53 + uint32_t mask;1.54 + int bit_count;1.55 + int operand_count;1.56 + int flags_use_mode;1.57 + struct operand operands[MAX_OPERANDS];1.58 + char format[MAX_OPERATION_FORMAT+1];1.59 +};1.60 +1.61 +struct ruleset {1.62 + uint32_t rule_count;1.63 + struct rule *rules[MAX_RULES];1.64 +};1.65 +1.66 +struct ruleset *parse_ruleset_file( FILE *f );1.67 + void dump_ruleset( struct ruleset *rules, FILE *f );1.68 +1.69 +struct action {1.70 + char operand_names[MAX_OPERANDS][MAX_OPERAND_NAME+1];1.71 + char *body;1.72 +};1.73 +1.74 +struct actionset {1.75 + char *pretext;1.76 + char *posttext;1.77 + char *actions[MAX_RULES];1.78 +};1.79 +1.80 +struct actionset *parse_action_file( struct ruleset *rules, FILE *f );1.81 +1.82 +int generate_decoder( struct ruleset *rules, struct actionset *actions, FILE *f );1.83 +1.84 +#ifdef __cplusplus1.85 +}1.86 +#endif1.87 +#endif
.