diff options
author | Andrew Cagney <cagney@redhat.com> | 2000-07-27 11:07:01 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2000-07-27 11:07:01 +0000 |
commit | 3c765a54971db6d8dbeafdf5230ad692cad271b3 (patch) | |
tree | 756b8c00633eb607f9651a74c24c720b25923849 /sim/common/sim-bits.h | |
parent | 0a17cd59446fd9191aa49369b8fd8b42a0c748cf (diff) | |
download | gdb-3c765a54971db6d8dbeafdf5230ad692cad271b3.zip gdb-3c765a54971db6d8dbeafdf5230ad692cad271b3.tar.gz gdb-3c765a54971db6d8dbeafdf5230ad692cad271b3.tar.bz2 |
From 2000-06-25 Stephane Carrez <Stephane.Carrez@worldnet.fr>:
* sim-bits.h (_MSB_16, _LSB_16): Define for 16-bit targets.
(MASK, LSBIT, MSBIT): Likewise and use _MSB_16 and _LSB_16.
(EXTENDED): Define for 16-bit word size.
* sim-bits.c (LSEXTRACTED, MSEXTRACTED, LSINSERTED,
MSINSERTED, LSSEXT, MSSEXT): Implement for 16-bit word size.
* sim-types.h: Added support for 16-bit targets.
Diffstat (limited to 'sim/common/sim-bits.h')
-rw-r--r-- | sim/common/sim-bits.h | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/sim/common/sim-bits.h b/sim/common/sim-bits.h index d111bcd..caebf0a 100644 --- a/sim/common/sim-bits.h +++ b/sim/common/sim-bits.h @@ -166,20 +166,32 @@ #define _MSB_32(START, STOP) (START <= STOP \ ? (START < 32 ? 0 : START - 32) \ : (STOP < 32 ? 0 : STOP - 32)) +#define _MSB_16(START, STOP) (START <= STOP \ + ? (START < 48 ? 0 : START - 48) \ + : (STOP < 48 ? 0 : STOP - 48)) #else #define _MSB_32(START, STOP) (START >= STOP \ ? (START >= 32 ? 31 : START) \ : (STOP >= 32 ? 31 : STOP)) +#define _MSB_16(START, STOP) (START >= STOP \ + ? (START >= 16 ? 15 : START) \ + : (STOP >= 16 ? 15 : STOP)) #endif #if (WITH_TARGET_WORD_MSB == 0) #define _LSB_32(START, STOP) (START <= STOP \ ? (STOP < 32 ? 0 : STOP - 32) \ : (START < 32 ? 0 : START - 32)) +#define _LSB_16(START, STOP) (START <= STOP \ + ? (STOP < 48 ? 0 : STOP - 48) \ + : (START < 48 ? 0 : START - 48)) #else #define _LSB_32(START, STOP) (START >= STOP \ ? (STOP >= 32 ? 31 : STOP) \ : (START >= 32 ? 31 : START)) +#define _LSB_16(START, STOP) (START >= STOP \ + ? (STOP >= 16 ? 15 : STOP) \ + : (START >= 16 ? 15 : START)) #endif #if (WITH_TARGET_WORD_MSB == 0) @@ -204,11 +216,17 @@ #if (WITH_TARGET_WORD_BITSIZE == 64) #define LSBIT(POS) LSBIT64 (POS) -#else +#endif +#if (WITH_TARGET_WORD_BITSIZE == 32) #define LSBIT(POS) ((unsigned32)((POS) >= 32 \ ? 0 \ : (1 << ((POS) >= 32 ? 0 : (POS))))) #endif +#if (WITH_TARGET_WORD_BITSIZE == 16) +#define LSBIT(POS) ((unsigned16)((POS) >= 16 \ + ? 0 \ + : (1 << ((POS) >= 16 ? 0 : (POS))))) +#endif #define MSBIT8(POS) ((unsigned8) 1 << ( 8 - 1 - (POS))) @@ -218,11 +236,17 @@ #if (WITH_TARGET_WORD_BITSIZE == 64) #define MSBIT(POS) MSBIT64 (POS) -#else +#endif +#if (WITH_TARGET_WORD_BITSIZE == 32) #define MSBIT(POS) ((unsigned32)((POS) < 32 \ ? 0 \ : (1 << ((POS) < 32 ? 0 : (64 - 1) - (POS))))) #endif +#if (WITH_TARGET_WORD_BITSIZE == 16) +#define MSBIT(POS) ((unsigned16)((POS) < 48 \ + ? 0 \ + : (1 << ((POS) < 48 ? 0 : (64 - 1) - (POS))))) +#endif /* Bit operations */ @@ -287,6 +311,23 @@ _MSB_POS (32, 0), \ _MSB_32 ((START), (STOP)))))) #endif +#if (WITH_TARGET_WORD_BITSIZE == 16) +#define MASK(START, STOP) \ + (_POS_LE ((START), (STOP)) \ + ? (_POS_LE ((STOP), _MSB_POS (64, 15)) \ + ? 0 \ + : _MASKn (16, \ + _MSB_16 ((START), (STOP)), \ + _LSB_16 ((START), (STOP)))) \ + : (_MASKn (16, \ + _LSB_16 ((START), (STOP)), \ + _LSB_POS (16, 0)) \ + | (_POS_LE ((STOP), _MSB_POS (64, 15)) \ + ? 0 \ + : _MASKn (16, \ + _MSB_POS (16, 0), \ + _MSB_16 ((START), (STOP)))))) +#endif #if !defined (MASK) #error "MASK never undefined" #endif @@ -475,6 +516,9 @@ INLINE_SIM_BITS(unsigned_word) MSINSERTED (unsigned_word val, int start, int sto #if (WITH_TARGET_WORD_BITSIZE == 32) #define EXTENDED(X) (X) #endif +#if (WITH_TARGET_WORD_BITSIZE == 16) +#define EXTENDED(X) (X) +#endif /* memory alignment macro's */ |