From 2c8f0de695ce97cd6c09eca707e1a216c8b69943 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Thu, 1 May 1997 17:45:25 +0000 Subject: (EXTRACT_SIGNED,EXTRACT_UNSIGNED,HOST_LONGS_FOR_BITS): Move from cgen-types.h to cgen-sim.h. --- sim/common/cgen-sim.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'sim/common') diff --git a/sim/common/cgen-sim.h b/sim/common/cgen-sim.h index 4cfc7d2..7df7d3f 100644 --- a/sim/common/cgen-sim.h +++ b/sim/common/cgen-sim.h @@ -42,6 +42,20 @@ enum sim_signal_type { void engine_halt PARAMS ((struct _sim_cpu *, enum exec_state, int)); void engine_signal PARAMS ((struct _sim_cpu *, enum sim_signal_type)); +/* Instruction field support macros. */ + +#define EXTRACT_SIGNED(val, total, start, length) \ +(((((val) >> ((total) - ((start) + (length)))) & ((1 << (length)) - 1)) \ + ^ (1 << ((length) - 1))) \ + - (1 << ((length) - 1))) + +#define EXTRACT_UNSIGNED(val, total, start, length) \ +(((val) >> ((total) - ((start) + (length)))) & ((1 << (length)) - 1)) + +/* Compute number of longs required to hold N bits. */ +#define HOST_LONGS_FOR_BITS(n) \ + (((n) + sizeof (long) * 8 - 1) / sizeof (long) * 8) + /* Decode,extract,semantics. */ typedef void (EXTRACT_FN) PARAMS ((SIM_CPU *, PCADDR, insn_t, struct argbuf *)); -- cgit v1.1