diff options
Diffstat (limited to 'sim/common')
-rw-r--r-- | sim/common/ChangeLog | 5 | ||||
-rw-r--r-- | sim/common/cgen-engine.h | 26 |
2 files changed, 26 insertions, 5 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index b5ef6a9..7f3f0e6 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,10 @@ 2009-11-22 Doug Evans <dje@sebabeach.org> + * cgen-engine.h (EXTRACT_MSB0_LGSINT, EXTRACT_MSB0_LGUINT): Define. + (EXTRACT_LSB0_LGSINT, EXTRACT_LSB0_LGUINT): Define. + (EXTRACT_FN, SEMANTIC_FN): Use CGEN_INSN_WORD in prototype + instead of CGEN_INSN_INT. + * cgen-trace.h (trace_extract): Add cast to fix warning. 2009-11-05 Doug Evans <dje@sebabeach.org> diff --git a/sim/common/cgen-engine.h b/sim/common/cgen-engine.h index 2433104..69f2ef6 100644 --- a/sim/common/cgen-engine.h +++ b/sim/common/cgen-engine.h @@ -17,9 +17,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* This file must be included after eng.h and before ${cpu}.h. +/* This file is included by ${cpu}.h. + It needs CGEN_INSN_WORD which is defined by ${cpu}.h. ??? A lot of this could be moved to genmloop.sh to be put in eng.h - and thus remove some conditional compilation. Worth it? */ + and thus remove some conditional compilation. We'd still need + CGEN_INSN_WORD though. */ /* Semantic functions come in six versions on two axes: fast/full-featured, and using one of the simple/scache/compilation engines. @@ -62,12 +64,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #define EXTRACT_LSB0_UINT(val, total, start, length) \ (((UINT) (val) << ((sizeof (UINT) * 8) - (start) - 1)) \ >> ((sizeof (UINT) * 8) - (length))) + +#define EXTRACT_MSB0_LGSINT(val, total, start, length) \ +(((CGEN_INSN_LGSINT) (val) << ((sizeof (CGEN_INSN_LGSINT) * 8) - (total) + (start))) \ + >> ((sizeof (CGEN_INSN_LGSINT) * 8) - (length))) +#define EXTRACT_MSB0_LGUINT(val, total, start, length) \ +(((CGEN_INSN_UINT) (val) << ((sizeof (CGEN_INSN_LGUINT) * 8) - (total) + (start))) \ + >> ((sizeof (CGEN_INSN_LGUINT) * 8) - (length))) + +#define EXTRACT_LSB0_LGSINT(val, total, start, length) \ +(((CGEN_INSN_LGSINT) (val) << ((sizeof (CGEN_INSN_LGSINT) * 8) - (start) - 1)) \ + >> ((sizeof (CGEN_INSN_LGSINT) * 8) - (length))) +#define EXTRACT_LSB0_LGUINT(val, total, start, length) \ +(((CGEN_INSN_LGUINT) (val) << ((sizeof (CGEN_INSN_LGUINT) * 8) - (start) - 1)) \ + >> ((sizeof (CGEN_INSN_LGUINT) * 8) - (length))) /* Semantic routines. */ /* Type of the machine generated extraction fns. */ /* ??? No longer used. */ -typedef void (EXTRACT_FN) (SIM_CPU *, IADDR, CGEN_INSN_INT, ARGBUF *); +typedef void (EXTRACT_FN) (SIM_CPU *, IADDR, CGEN_INSN_WORD, ARGBUF *); /* Type of the machine generated semantic fns. */ @@ -89,9 +105,9 @@ typedef unsigned int SEM_STATUS; /* Instruction fields are extracted by the semantic routine. ??? TODO: multi word insns. */ #if HAVE_PARALLEL_INSNS && ! WITH_PARALLEL_GENWRITE -typedef SEM_STATUS (SEMANTIC_FN) (SIM_CPU *, SEM_ARG, PAREXEC *, CGEN_INSN_INT); +typedef SEM_STATUS (SEMANTIC_FN) (SIM_CPU *, SEM_ARG, PAREXEC *, CGEN_INSN_WORD); #else -typedef SEM_STATUS (SEMANTIC_FN) (SIM_CPU *, SEM_ARG, CGEN_INSN_INT); +typedef SEM_STATUS (SEMANTIC_FN) (SIM_CPU *, SEM_ARG, CGEN_INSN_WORD); #endif #endif |