3 * simops.c (OP_6401): postdecrement on r15 is OK, remove exception.
8 * configure: Regenerated to track ../common/aclocal.m4 changes.
12 * interp.c (pc_addr): Discard upper bit(s) of PC in case
13 IMAP1 selects unified memory.
14 * d10v_sim.h (INC_ADDR): Align MOD_E to increment before testing
19 * configure: Regenerated to track ../common/aclocal.m4 changes.
23 * configure: Regenerated to track ../common/aclocal.m4 changes.
27 * configure: Regenerated to track ../common/aclocal.m4 changes.
31 * configure: Regenerated to track ../common/aclocal.m4 changes.
35 * configure: Regenerated to track ../common/aclocal.m4 changes.
39 * interp.c (sim_resume): Increment PC at end of rep
42 * simops.c (OP_4201): Fix rachi instruction.
44 Thu Sep 4 17:21:23 1997 Doug Evans <dje@seba>
46 * configure: Regenerated to track ../common/aclocal.m4 changes.
50 * configure: Regenerated to track ../common/aclocal.m4 changes.
55 * interp.c (sim_kill): Delete.
56 (sim_create_inferior): Add ABFD argument.
57 (sim_load): Move setting of PC from here.
58 (sim_create_inferior): To here.
59 (start_address): Delete variable.
63 * configure: Regenerated to track ../common/aclocal.m4 changes.
68 * interp.c (sim_open): Add ABFD argument.
72 * interp.c (sim_open): Add callback argument.
73 (sim_set_callbacks): Remove SIM_DESC argument.
77 * configure: Regenerated to track ../common/aclocal.m4 changes.
81 * interp.c (sim_open): Undo patch to add -E support.
85 * interp.c (sim_stop): New function.
89 * Makefile.in (SIM_OBJS): Add sim-load.o.
90 * d10v_sim.h (exec_bfd): Rename to prog_bfd.
91 * interp.c: #include bfd.h.
92 (myname, sim_kind, start_address): New static locals.
93 (prog_bfd_was_opened_p, prog_bfd): New static locals.
94 (decode_pc): Update to use prog_bfd.
95 (sim_open): Set sim_kind, myname. Ignore -E arg.
96 (sim_close): Close prog_bfd if simulator opened it.
97 (sim_create_inferior): Return SIM_RC. Delete arg start_address.
98 (sim_load): Return SIM_RC. New arg abfd. Set start address from bfd.
99 Call sim_load_file to load file into simulator.
100 * simops.c (trace_input_func): exec_bfd renamed to prog_bfd.
104 * simops.c (OP_5F00): Only provide system calls SYS_execv,
105 SYS_wait, SYS_wait, SYS_utime, SYS_time if defined by the host.
109 * configure: Regenerated to track ../common/aclocal.m4 changes.
114 * interp.c (sim_open): New arg `kind'.
116 * configure: Regenerated to track ../common/aclocal.m4 changes.
120 * configure: Regenerated to track ../common/aclocal.m4 changes.
124 * configure: Re-generate.
128 * configure: Regenerate to track ../common/aclocal.m4 changes.
130 * simops.c (OP_5F00): Remove old traps 1-3. Make trap 15 the same
131 as trap 0, which will be deprecated. Only set errno, if an error
132 in fact was returned.
136 * interp.c: Delete redundant prototypes of sim_foo fns.
137 (sim_open): New SIM_DESC result. Argument is now in argv form.
138 (other sim_*): New SIM_DESC argument.
142 * simops.c (trace_{input,output}_func): Call flush_stdout from the
145 (OP_6{4,6,C,A}01): Test for post decrement on the stack pointer.
146 (OP_{1200,1000000,201,5FE0,1003,17001002}): Fix problems in
147 setting the carry bit after an add or a subtract.
151 * simops.c (OP_{1403,15002A02,3{0,4}0{0,1}}): Only use the bottom
152 40 bits of accumulators. Sign/zero extend as appropriate.
156 * Makefile.in (@COMMON_MAKEFILE_FRAG): Use
157 COMMON_{PRE,POST}_CONFIG_FRAG instead.
158 * configure.in: sinclude ../common/aclocal.m4.
159 * configure: Regenerated.
163 * configure configure.in Makefile.in: Update to new configure
164 scheme which is more compatible with WinGDB builds.
165 * configure.in: Improve comment on how to run autoconf.
166 * configure: Re-run autoconf to get new ../common/aclocal.m4.
167 * Makefile.in: Use autoconf substitution to install common
172 * gencode.c: patch to not #include "d10v_sim.h" which
173 unecessarily includes bfd.h and causes wingdb configure
178 * interp.c (xfer_mem): Change unified memory to 0x0.
182 * simops.c (OP_3E01): Fix tracing information.
183 (OP_300{0,1}): Do not propigate sign.
187 * config.in (WORDS_BIGENDIAN): Add.
188 * configure: Regenerated.
189 * d10v_sim.h: #include "config.h"
193 * gencode.c (write_opcodes): Eliminate warnings when generated
198 * interp.c (sim_open): Cast result of calloc, and make sure NULL
200 (dmem_addr): If address is illegal or in I/O space, signal a bus
202 (pc_addr): Signal bus error, not illegal instruction for bogus
207 * Makefile.in: Delete all stuff moved to ../common/Make-common.in.
208 (SIM_OBJS,SIM_EXTRA_CFLAGS,SIM_EXTRA_CLEAN): Define.
209 * configure.in: Simplify using macros in ../common/aclocal.m4.
210 Call AC_CHECK_HEADERS(unistd.h).
211 * configure: Regenerated.
212 * config.in: New file.
213 * interp.c: #include "callback.h".
214 * simops.c: #include "config.h". #include <unistd.h> if present.
218 * d10v-sim.h (simops): Add flag is_long.
219 (State): Add pc_changed. Instructions which update the PC should
220 use the JMP macro which sets this.
221 (JMP): New macro. Sets the PC and the pc_changed flag.
223 * gencode.c (write_opcodes): Add is_long field.
225 * interp.c (lookup_hash): If we blindly apply a short opcode's mask
226 to a long opcode we could get a false match. Check the opcode size.
227 (hash): Add a size field to the hash table.
228 (sim_open): Initialize size field in hash table.
229 (sim_resume): Change to logic for setting the PC. Used to increment the
230 PC if it had not been changed. This didn't allow single-instruction loops.
231 Now checks the flag State.pc_changed. Also now stops when ^C is received.
232 (dmem_addr): Fix translation of data segments to unified memory.
233 (sim_ctrl_c): New function. When ^C is received, set stop_simulator flag.
235 * simops.c: Changed all branch and jump instructions to use new JMP macro.
236 (OP_20000000): Corrected trace information to show this is a ldi.l, not
241 * interp.c (sim_fetch_register, sim_store_register): Fix bug where
242 updating the accumulators was overwriting other parts of the global
247 * interp.c (bfd.h) Don't include it here any more.
248 (text{,_start,_end}): Move here from simops.c and make extern.
249 (decode_pc): New function to return the PC as an address that the
251 (dmem_addr): Print decoded PC in error message.
254 * simops.c (bfd.h) Don't include it here any more.
255 (text{,_start,_end}): Move to simops.c.
256 (trace_input_func): Move decoding of PC, and looking up .text
259 * d10v_sim.h (bfd.h): Include it here.
260 (text{,_start,_end}): Add external declarations.
266 * interp.c (sim_size): Now allocates unified memory for imap segments
267 0,1,2, and 127. Initializes imap0 and imap1 to 0x1000. Initializes dmap to 0.
268 (sim_write): Just call xfer_mem().
269 (sim_read): Just call xfer_mem().
270 (xfer_mem): New function. Does appropriate memory mapping and copies bytes.
271 (dmem_addr): New function. Reads dmap register and translates data
272 addresses to local addresses.
273 (pc_addr): New function. Reads imap register and computes local address
274 corresponding to contents of the PC.
275 (sim_resume): Change to use pc_addr().
276 (sim_create_inferior): Change reinitialization code. Also reinitializes
278 (sim_fetch_register): Add fake registers 32,33,34 for imap0, imap1, and dmap.
279 (sim_store_register): Add fake registers 32,33,34 for imap0, imap1, and dmap.
281 * simops.c (MEMPTR): Redefine to use dmem_addr().
282 (OP_5F00): Replace references to STate.imem with dmem_addr().
284 * d10v-sim.h (State): Remove mem_min and mem_max. Add umem[128].
285 (RB,SW,RW,SLW,RLW): Redefine to use dmem_addr().
286 (IMAP0,IMAP1,DMAP,SET_IMAP,SET_IMAP1,SET_DMAP): Define.
290 * d10v_sim.h (_ins_type): Reorganize, so that we can provide
291 better statistics, like not counting NOPS as parallel
292 instructions, and printing total cycles.
293 (ins_type_counters): Make unsigned long.
294 (left_nops,right_nops): Fold into ins_type_counters.
296 * simops.c (trace_input_func): Print new instruction types.
297 Handle OP_R2R3 as input types.
298 (OP_{38000000,7000}): Correctly sign extend bytes.
299 (OP_5E00): Don't count NOPs as parallel instructions.
300 (OP_460B): Remove unused variable.
303 * interp.c (ins_type_counters): Make unsigned long.
304 (left_nops,right_nops): Delete.
305 (most functions): Add prototypes.
306 (INLINE): If GCC and optimize define as __inline__.
307 ({,lookup_}hash,get_operands): Declare as INLINE.
308 (do_parallel): Count conditional operations.
309 (add_commas): New function, to add commas every 3 digits.
310 (sim_size): Call add_commas to print numbers.
311 (sim_{open,resume}): Delete unused variables.
312 (sim_info): Provide better statistics.
313 (sim_read): Add int return type.
317 * interp.c (sim_resume): Change the way single-stepping and exceptions
318 are handled so single-stepping works again.
322 * endian.c: Optimize simulated loads/stores on x86, AIX, and big
325 * configure.in (--enable-sim-bswap): New switch to enable using
326 the BSWAP instruction on x86's.
327 * configure: Regenerate.
329 * Makefile.in ({SWAP,CONFIG}_CFLAGS): Add --enable-sim-bswap
334 * endian.c: New file. Move endian functions here from interp.c.
335 Optimize code, and make it work as either inline functions or as a
338 * interp.c: Move endian functions from here to endian.c.
340 * Makefile.in (INCLUDE): Add endian.c.
341 (run,libsim.a): Add dependency on endian.o.
342 (endian.o): Add dependency.
344 * d10v_sim.h (read/write support): Always go through the machine
345 independent endian functions. If compiling with GCC and
346 optimizing, include endian.c so the endian functions are inlined.
348 * simops.c (OP_5F00): Correct tracing of accumulators.
352 * simops.c (OP_5F00): Add support for getpid, kill system calls.
354 * interp.c (do_{2_short,parallel}): If an exception is raised,
355 don't execute the second instruction.
359 * simops.c (OP_{31000000,6601,6201,6200}): Store address in a
360 temporary in case the register is overriden when loading.
361 (OP_6200): Output type is OP_DREG for tracing.
365 * d10v_sim.h (struct _state): Add mem_{min,max} fields.
367 * interp.c (sim_size): Initialize mem_{min,max} fields.
368 (sim_write): Update mem_{min,max} fields.
369 (sim_resume): If PC is not in the minimum/maximum memory range,
371 (sim_create_inferior): Preserve mem_{min,max} fields.
375 * simops.c (OP_5F00): Add support for time() system call.
379 * simops.c (OP_{6E01,6A01,6E1F,6A00}): Print both words being
381 (OP_5F00,trace_{in,out}put_func): Add finer grain tracing for
386 * simops.c (op_types): Add OP_{CONSTANT8,R2,R3}.
387 (trace_input_func): Add support for OP_{CONSTANT8,R2,R3}.
388 (OP_{4900,24800000,4800,4A00,4B00,4D00,4C00}): Add OP_R2 and OP_R3
389 to call/subroutine returns to trace the first two arguments and
390 the return value. For small jumps, use CONSTANT8, not CONSTANT16.
394 * interp.c (sim_create_inferior): Reinitialize State every time
395 sim_create_inferior() is called.
399 * simops.c (OP_{401,2000000,601,3000000,23000000}): Get sign right
401 (OP_401): Fix tracing information.
405 * simops.c (SIZE_{PC,LINE_NUMBER}): New default sizes for output.
406 (trace_input_func): Use them.
407 (trace_input_func): Make sure there is a trailing space after the
409 (OP_6200): Fix tracing info.
411 * Makefile.in (run): Add dependencies on libbfd.a and
416 * d10v_sim.h (DEBUG_INSTRUCTION): New debug value to include line
417 numbers and function names in debug trace.
418 (DEBUG): If not defined, set to DEBUG_TRACE, DEBUG_VALUES, and
420 (SIG_D10V_{STOP,EXIT}): Values to represent the stop instruction
421 and exit system call trap being executed.
423 * interp.c (sim_stop_reason): Set exit code correctly for stop
424 instruction and exit system call trap.
426 * configure.in (--enable-sim-cflags): Remove trace case.
427 (--enable-sim-debug): New switch to set the debug values.
428 * configure: Regenerate.
430 * simops.c (trace_{input,output}_func): Rename from
431 trace_{input,output}.
432 (trace_{input,output}): Call trace_{input,output}_func if
433 d10v_debug is non-zero.
434 (SIZE_INSTRUCTION): Cut down to 8.
435 (SIZE_OPERANDS): Cut down to 18.
436 (SIZE_LOCATION): New value for size of line number, function name
438 (init_text_p,text{,_start,_end}): New static variables for
439 printing line number and function name.
440 (exec_bfd): New external that run.c sets.
441 (trace_input_func): Print line number and function name if
442 available and if desired.
443 (OP_4E09): Don't print out DBT message.
444 (OP_5FE0): Set exception field to SIG_D10V_STOP.
445 (OP_5F00): Set exception field to SIG_D10V_EXIT.
449 * interp.c (do_2_short): If the instruction encodes jump->ins,
450 don't do the second instruction if the jump succeeds.
454 * simops.c (OP_5F00): Use unknown traps to print all GPRs,
455 accumulators, PC, and F0/F1/C flags.
459 * simops.c (OP_5F00): Fix problems with system calls.
463 * simops.c (OP_5F00): Correct tracing information for trap.
467 * Makefile.in (CSEARCH): Correctly find opcodes directory.
471 * simops.c (trace_output): Properly align accumulator output.
472 (OP_3{0,2,4}00): Properly parenthesize test expression. Add error
473 if shift count is too high.
474 (OP_4E{00,02,04,20,22,40,42}): Make tests agree with book.
475 (OP_4E09): Make cpfg properly trace the input flags.
476 (op_types): Add OP_FLAG_OUTPUT.
477 (trace_{input,output}): Support OP_FLAG_OUTPUT.
478 (OP_31000000): This ld2w varient is a 16-bit memory reference, not
479 an 8-bit memory reference instruction for tracing purposes.
480 (OP_201): Addi needs to set the carry.
484 * simops.c (OP_2600, OP_2601): Changed min and max comparisons
485 to use signed register values.
489 * d10v_sim.h (DEBUG_*): Add bit flags for controlling debug
491 (_ins_type): New enumeration to specify which container an
492 instruction is in, and whether it is part of a parallel operation.
493 (_state): Add ins_type field.
494 ({,u}int{8,16,32,64}): Use limits.h to size the appropriate types.
495 (ins_type_counters): Counters for the various instruction types.
496 ({left,right}_nops): Counters for the number of nops in each
498 (d10v_debug): New variable to indicate whether debugging is turned
501 * simops.c: (all functions): Change all #ifdef DEBUG code so that
502 the input and output values can be traced, along with the
503 instruction type. Make the -t option enable tracing.
504 (all functions): Change printf calls to use the printf_filtered
505 function in the callback table.
507 * interp.c (_leftright): New enumeration to say whether 2 short
508 instructions are done left first or right first.
509 (do_{long,2_short,parallel}): Indicate in the machine state which
510 type of instruction this is. Count each of the types of
511 instructions executed.
512 (sim_size): Only print the memory sizes if DEBUG_MEMSIZE debug
514 (sim_resume): Pass left/right indication to do_2_short.
515 (all functions): Change printf calls to use the printf_filtered
516 function in the callback table.
517 (sim_trace): Turn on debug flag if DEBUG was defined, and call
519 (sim_info): Print out statistics on instructions.
520 (sim_{trace,create_inferior}): Eliminate extraneous output unless
522 (sim_open): If args == -t and DEBUG was defined, set d10v_debug.
523 Only initialize the hash table the first time sim_open is called.
525 * Makefile.in: Make objects depend on d10v_sim.h.
526 ({,SIM_}CFLAGS): Include configure dependent switches. Setting
527 CFLAGS does not override host/target defines or SIM_CFLAGS.
528 (CC_FOR_BUILD,gencode): Use CC_FOR_BUILD to compile gencode.
529 (run): By default, the math library is not needed to be linked
531 ({BFD,LIBIBERTY}_LIB): Define as variables so they can be
533 (VPATH): Don't set to anything but @srcdir@ to work with non-GNU
535 ({run,callback}.o): Provide explicit paths to their appropriate
537 (gencode{,.o},d10v-opc.o): Split compilation into creating object
538 and linking. Instead of linking in libopcodes.a, just compile
539 d10v-opc.o directly to handle canadian cross.
540 (CSEARCH): Add opcodes directory.
542 * configure.in (--enable-sim-cflags): New switch to allow user to
544 (CC_FOR_BUILD): Deal with canadian crosses.
545 * configure: Regenerate.
549 * simops.c: Include correct syscall.h for d10v, not host's.
554 * simops.c (OP_5F00): Wrap all SYS_xxx traps with #ifdef.
555 Add trap 2 to be printf and trap 3 to be putchar.
559 * Makefile.in, d10v_sim.h, interp.c, simops.c: Add support
560 for low-level system calls.
564 * Makefile.in, d10v_sim.h, interp.c: Fix byte-order problems.
568 * d10v_sim.h (SEXT32): Added.
569 * interp.c: Commented out printfs.
570 * simops.c: Fixed error in sb and st2w.
574 * Makefile.in, d10v_sim.h, interp.c, simops.c: Added remaining
575 DSP instructions. Added modulo addressing.
579 * Makefile.in, d10v_sim.h, interp.c, simops.c: Snapshot.
583 * d10v_sim.h, simops.c: Snapshot.
587 * ChangeLog, Makefile.in, configure, configure.in, d10v_sim.h,
588 gencode.c, interp.c, simops.c: Created.