From 28647e4c0c74b2426a530b2b9ec3c95b92944662 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 30 Aug 1996 05:41:10 +0000 Subject: * v850_sim.h: The V850 doesn't have split I&D spaces. Change accordingly. Remove many unused definitions. * interp.c: The V850 doesn't have split I&D spaces. Change accordingly. (get_longlong, get_longword, get_word): Deleted. (write_longlong, write_longword, write_word): Deleted. (get_operands): Deleted. (get_byte, get_half, get_word): New functions. (put_byte, put_half, put_word): New functions. * simops.c: Remove unused functions. Rough cut at "ld.b", "ld.h", "ld.w", "st.b", "st.h", "st.w" insns. --- sim/v850/interp.c | 101 +++++++++++++++++++++--------------------------------- 1 file changed, 40 insertions(+), 61 deletions(-) (limited to 'sim/v850/interp.c') diff --git a/sim/v850/interp.c b/sim/v850/interp.c index d824590..fbd808d 100644 --- a/sim/v850/interp.c +++ b/sim/v850/interp.c @@ -6,8 +6,7 @@ #include "v850_sim.h" -#define IMEM_SIZE 18 /* V850 instruction memory size is 18 bits */ -#define DMEM_SIZE 16 /* Data memory */ +#define MEM_SIZE 18 /* V850 memory size is 18 bits XXX */ uint16 OP[4]; @@ -72,82 +71,58 @@ lookup_hash (ins) return (h); } -uint32 -get_longword (x) - uint8 *x; +uint8 +get_byte (x) + uint8 *x; { - uint8 *a = x; - return (a[3]<<24) + (a[2]<<16) + (a[1]<<8) + (a[0]); + return *x; } -int64 -get_longlong (x) - uint8 *x; +uint16 +get_half (x) + uint8 *x; { uint8 *a = x; - return ((int64)a[0]<<56) + ((int64)a[1]<<48) + ((int64)a[2]<<40) + ((int64)a[3]<<32) + - ((int64)a[4]<< 24) + ((int64)a[5]<<16) + ((int64)a[6]<<8) + (int64)a[7]; + return (a[1] << 8) + (a[0]); } -uint16 +uint32 get_word (x) uint8 *x; { uint8 *a = x; - return ((uint16)a[0]<<8) + a[1]; + return (a[3]<<24) + (a[2]<<16) + (a[1]<<8) + (a[0]); } - void -write_word (addr, data) +put_byte (addr, data) uint8 *addr; - uint16 data; + uint8 data; { uint8 *a = addr; - a[0] = data >> 8; - a[1] = data & 0xff; + a[0] = data; } void -write_longword (addr, data) +put_half (addr, data) uint8 *addr; - uint32 data; + uint16 data; { - addr[0] = (data >> 24) & 0xff; - addr[1] = (data >> 16) & 0xff; - addr[2] = (data >> 8) & 0xff; - addr[3] = data & 0xff; + uint8 *a = addr; + a[0] = data & 0xff; + a[1] = (data >> 8) & 0xff; } void -write_longlong (addr, data) +put_word (addr, data) uint8 *addr; - int64 data; + uint32 data; { uint8 *a = addr; - a[0] = data >> 56; - a[1] = (data >> 48) & 0xff; - a[2] = (data >> 40) & 0xff; - a[3] = (data >> 32) & 0xff; - a[4] = (data >> 24) & 0xff; - a[5] = (data >> 16) & 0xff; - a[6] = (data >> 8) & 0xff; - a[7] = data & 0xff; -} - -static void -get_operands (struct simops *s, uint32 ins) -{ - int i, shift, bits, flags; - uint32 mask; - for (i=0; i < s->numops; i++) - { - shift = s->operands[3*i]; - bits = s->operands[3*i+1]; - flags = s->operands[3*i+2]; - mask = 0x7FFFFFFF >> (31 - bits); - OP[i] = (ins >> shift) & mask; - } + a[0] = data & 0xff; + a[1] = (data >> 8) & 0xff; + a[2] = (data >> 16) & 0xff; + a[3] = (data >> 24) & 0xff; } static void @@ -213,7 +188,14 @@ static void do_format_7 (insn) uint32 insn; { + struct hash_entry *h; printf("format 7 0x%x\n", insn); + + h = lookup_hash (insn); + OP[0] = insn & 0x1f; + OP[1] = (insn >> 11) & 0x1f; + OP[2] = (insn >> 16) & 0xffff; + (h->ops->func) (); } static void @@ -241,27 +223,24 @@ sim_size (power) int power; { - if (State.imem) + if (State.mem) { - free (State.imem); - free (State.dmem); + free (State.mem); } - State.imem = (uint8 *)calloc(1,1<