TIc80 simulator checkpoint - runs 3 instructions - trap, addu, br.a.
authorAndrew Cagney <cagney@redhat.com>
Tue, 22 Apr 1997 17:46:07 +0000 (17:46 +0000)
committerAndrew Cagney <cagney@redhat.com>
Tue, 22 Apr 1997 17:46:07 +0000 (17:46 +0000)
27 files changed:
gdb/ChangeLog
gdb/config/tic80/tic80.mt
sim/.Sanitize
sim/ChangeLog
sim/Makefile.in
sim/common/ChangeLog
sim/configure
sim/configure.in
sim/igen/ChangeLog
sim/igen/gen-idecode.c
sim/igen/gen-semantics.c [new file with mode: 0644]
sim/igen/gen-support.c [new file with mode: 0644]
sim/igen/igen.c
sim/tic80/.Sanitize [new file with mode: 0644]
sim/tic80/ChangeLog [new file with mode: 0644]
sim/tic80/Makefile.in [new file with mode: 0644]
sim/tic80/alu.h [new file with mode: 0644]
sim/tic80/config.in [new file with mode: 0644]
sim/tic80/configure [new file with mode: 0755]
sim/tic80/configure.in [new file with mode: 0644]
sim/tic80/cpu.h [new file with mode: 0644]
sim/tic80/dc [new file with mode: 0644]
sim/tic80/ic [new file with mode: 0644]
sim/tic80/insns [new file with mode: 0644]
sim/tic80/interp.c [new file with mode: 0644]
sim/tic80/sim-calls.c [new file with mode: 0644]
sim/tic80/sim-main.h [new file with mode: 0644]

index ff065330c109c85edd0f211f173c130114da4d82..ccf170d72b3d9d81f30d6677a984ec29af27643b 100644 (file)
@@ -1,3 +1,9 @@
+start-sanitize-tic80
+Mon Apr 21 22:44:47 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * config/tic80/tic80.mt (SIM): Link in simulator.
+
+end-sanitize-tic80
 Tue Apr 22 09:02:10 1997  Stu Grossman  (grossman@critters.cygnus.com)
 
        * config/alpha/alpha-osf3.mh config/i386/{i386gnu linux}.mh
index 7a6e3d57e3696936e7ee5a021271c2dbbd0a0a7f..84b6eb228aabc65d2ba9ec578bbaf922612a9a00 100644 (file)
@@ -3,5 +3,5 @@ TDEPFILES= tic80-tdep.o
 TM_FILE= tm-tic80.h
 
 # Disable using the simulator until it is ready.
-#SIM_OBS = remote-sim.o
-#SIM = ../sim/tic80/libsim.a -lm
+SIM_OBS = remote-sim.o
+SIM = ../sim/tic80/libsim.a -lm
index f9fabadcc59d2d7fed6dcaee14f4e4fb649fae66..5780d7b6bf09af23cc29db77974f0c64ab51e370 100644 (file)
 
 Do-first:
 
-v850_files="v850"
-if ( echo $* | grep keep\-v850 > /dev/null ) ; then
-        keep_these_too="${v850_files} ${keep_these_too}"
-else
-        lose_these_too="${v850_files} ${lose_these_too}"
-fi
-
 d30v_files="d30v igen testsuite"
 if ( echo $* | grep keep\-d30v > /dev/null ) ; then
         keep_these_too="${d30v_files} ${keep_these_too}"
@@ -29,6 +22,20 @@ else
         lose_these_too="${d30v_files} ${lose_these_too}"
 fi
 
+tic80_files="tic80 igen"
+if ( echo $* | grep keep\-tic80 > /dev/null ) ; then
+        keep_these_too="${tic80_files} ${keep_these_too}"
+else
+        lose_these_too="${tic80_files} ${lose_these_too}"
+fi
+
+v850_files="v850"
+if ( echo $* | grep keep\-v850 > /dev/null ) ; then
+        keep_these_too="${v850_files} ${keep_these_too}"
+else
+        lose_these_too="${v850_files} ${lose_these_too}"
+fi
+
 # All files listed between the "Things-to-keep:" line and the
 # "Files-to-sed:" line will be kept.  All other files will be removed.
 # Directories listed in this section will have their own Sanitize
@@ -62,23 +69,23 @@ Things-to-lose:
 
 Do-last:
 
-v850_files="configure configure.in ChangeLog"
-if ( echo $* | grep keep\-v850 > /dev/null ) ; then
-        for i in $v850_files ; do
-                if test ! -d $i && (grep sanitize-v850 $i > /dev/null) ; then
+d30v_files="configure configure.in ChangeLog"
+if ( echo $* | grep keep\-d30v > /dev/null ) ; then
+        for i in $d30v_files ; do
+                if test ! -d $i && (grep sanitize-d30v $i > /dev/null) ; then
                         if [ -n "${verbose}" ] ; then
-                                echo Keeping v850 stuff in $i
+                                echo Keeping d30v stuff in $i
                         fi
                 fi
         done
 else
-        for i in $v850_files ; do
-                if test ! -d $i && (grep sanitize-v850 $i > /dev/null) ; then
+        for i in $d30v_files ; do
+                if test ! -d $i && (grep sanitize-d30v $i > /dev/null) ; then
                         if [ -n "${verbose}" ] ; then
-                                echo Removing traces of \"v850\" from $i...
+                                echo Removing traces of \"d30v\" from $i...
                         fi
                         cp $i new
-                        sed '/start\-sanitize\-v850/,/end-\sanitize\-v850/d' < $i > new
+                        sed '/start\-sanitize\-d30v/,/end-\sanitize\-d30v/d' < $i > new
                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
                                 if [ -n "${verbose}" ] ; then
                                         echo Caching $i in .Recover...
@@ -90,23 +97,51 @@ else
         done
 fi
 
-d30v_files="configure configure.in ChangeLog"
-if ( echo $* | grep keep\-d30v > /dev/null ) ; then
-        for i in $d30v_files ; do
-                if test ! -d $i && (grep sanitize-d30v $i > /dev/null) ; then
+tic80_files="configure configure.in ChangeLog"
+if ( echo $* | grep keep\-tic80 > /dev/null ) ; then
+        for i in $tic80_files ; do
+                if test ! -d $i && (grep sanitize-tic80 $i > /dev/null) ; then
                         if [ -n "${verbose}" ] ; then
-                                echo Keeping d30v stuff in $i
+                                echo Keeping tic80 stuff in $i
                         fi
                 fi
         done
 else
-        for i in $d30v_files ; do
-                if test ! -d $i && (grep sanitize-d30v $i > /dev/null) ; then
+        for i in $tic80_files ; do
+                if test ! -d $i && (grep sanitize-tic80 $i > /dev/null) ; then
                         if [ -n "${verbose}" ] ; then
-                                echo Removing traces of \"d30v\" from $i...
+                                echo Removing traces of \"tic80\" from $i...
                         fi
                         cp $i new
-                        sed '/start\-sanitize\-d30v/,/end-\sanitize\-d30v/d' < $i > new
+                        sed '/start\-sanitize\-tic80/,/end-\sanitize\-tic80/d' < $i > new
+                        if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
+                                if [ -n "${verbose}" ] ; then
+                                        echo Caching $i in .Recover...
+                                fi
+                                mv $i .Recover
+                        fi
+                        mv new $i
+                fi
+        done
+fi
+
+v850_files="configure configure.in ChangeLog"
+if ( echo $* | grep keep\-v850 > /dev/null ) ; then
+        for i in $v850_files ; do
+                if test ! -d $i && (grep sanitize-v850 $i > /dev/null) ; then
+                        if [ -n "${verbose}" ] ; then
+                                echo Keeping v850 stuff in $i
+                        fi
+                fi
+        done
+else
+        for i in $v850_files ; do
+                if test ! -d $i && (grep sanitize-v850 $i > /dev/null) ; then
+                        if [ -n "${verbose}" ] ; then
+                                echo Removing traces of \"v850\" from $i...
+                        fi
+                        cp $i new
+                        sed '/start\-sanitize\-v850/,/end-\sanitize\-v850/d' < $i > new
                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
                                 if [ -n "${verbose}" ] ; then
                                         echo Caching $i in .Recover...
index bb760cfe660bbfa8d4f4945a0d164334aa929c79..1b7a325f87a0ff0a543738a2f1850f317095516b 100644 (file)
@@ -1,3 +1,19 @@
+Mon Apr 21 22:57:55 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * Makefile.in (.NOEXPORT, MAKEOVERRIDES): Moved to end, BSD make
+       thought that .NOEXPORT was the default target.
+
+start-sanitize-tic80
+Mon Apr 21 22:26:52 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * configure.in (tic80-*-*): New target.
+
+end-sanitize-tic80
+Fri Apr 11 17:18:07 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+       * Makefile.in (clean mostlyclean): Restore targets accidentally
+       deleted in earlier change.
+
 Thu Apr  3 12:20:32 1997  Andrew Cagney  <cagney@kremvax.cygnus.com>
 
        * Makefile.in (autoheader-common, autoheader-changelog,
index 7c9308ec826a3b98f7e7b6f4576721edf94afeb9..c70355c1f2ec5d63704ee35ce840590c3c9d5537 100644 (file)
@@ -61,10 +61,6 @@ RANLIB = @RANLIB@
 
 SUBDIRS = @subdirs@
 
-.NOEXPORT:
-MAKEOVERRIDES=
-
-
 INCDIR = $(srcdir)/../include
 CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
 DEP = mkdep
@@ -133,6 +129,16 @@ all:
                else true; fi; \
        done
 
+clean mostlyclean:
+       @rootme=`pwd` ; export rootme ; \
+       for dir in . ${SUBDIRS}; do \
+               if [ "$$dir" = "." ]; then \
+                       true; \
+               elif [ -d $$dir ]; then \
+                       (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) $@); \
+               else true; fi; \
+       done
+
 distclean maintainer-clean realclean:
        @rootme=`pwd` ; export rootme ; \
        for dir in . ${SUBDIRS}; do \
@@ -178,6 +184,9 @@ dvi:
 ### 
 ### 
 
+.NOEXPORT:
+MAKEOVERRIDES=
+
 .PHONY: check installcheck
 check:
 installcheck:
index cb12926c623a65ffb24dc57624461f1212537571..5585de89e290e3097630cb1c91e6a1ed1ba7bfb4 100644 (file)
@@ -1,3 +1,9 @@
+Wed Apr 23 02:55:54 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * sim-events.c (insert_sim_event): Call sim_io_error instead of
+       less well defined engine_error.
+       * sim-core.c: Ditto.
+
 Tue Apr 22 08:48:16 1997  Stu Grossman  (grossman@critters.cygnus.com)
 
        * Make-common.in:  Change clean targets to use :: so that other
index 30b1b360988cc789645461333c4e2174e5bb147e..0f9cf45989a87ac011001f19ee09e36c70e6949f 100755 (executable)
@@ -1273,6 +1273,7 @@ fi
 # Assume simulator can be built with cc.
 # If the user passes --enable-sim built it regardless of $(CC).
 only_if_gcc=no
+extra_subdirs=common
 
 # WHEN ADDING ENTRIES TO THIS MATRIX:
 #  Make sure that the left side always has two dashes.  Otherwise you
@@ -1282,6 +1283,13 @@ only_if_gcc=no
 case "${target}" in
   arm*-*-*)            sim_target=arm ;;
   d10v-*-*)            sim_target=d10v ;;
+# start-sanitize-d30v
+  d30v-*-*)
+       sim_target=d30v
+       only_if_gcc=yes
+       extra_subdirs="${extra_subdirs} igen testsuite"
+       ;;
+# end-sanitize-d30v
   h8300*-*-*)          sim_target=h8300 ;;
   h8500-*-*)           sim_target=h8500 ;;
   mips*-*-*)
@@ -1294,6 +1302,9 @@ case "${target}" in
        sim_target=mn10300
        only_if_gcc=yes
        ;;
+  mn10200*-*-*)
+       sim_target=mn10200
+       ;;
   sh*-*-*)             sim_target=sh ;;
   powerpc*-*-eabi* | powerpc*-*-solaris* | powerpc*-*-sysv4* | powerpc*-*-elf* | powerpc*-*-linux* )
        # The PowerPC simulator uses the GCC extension long long as well as
@@ -1301,7 +1312,15 @@ case "${target}" in
        # unless asked to.
        sim_target=ppc
        only_if_gcc=yes
+       #extra_subdirs="${extra_subdirs}"
+       ;;
+# start-sanitize-tic80
+  tic80-*-*)
+       sim_target=tic80
+       only_if_gcc=yes
+       extra_subdirs="${extra_subdirs} igen"
        ;;
+# end-sanitize-tic80
 # start-sanitize-v850
   v850-*-*)
        # The V850 simulator can only be compiled by gcc.
@@ -1342,7 +1361,7 @@ yes)
 esac
 
 if test x"${sim_target}" != xnone ; then
-       configdirs="common ${sim_target}"
+       configdirs="${extra_subdirs} ${sim_target}"
        subdirs="$configdirs"
 
 fi
index 4ce0c84eade5c787e8946b2b97c3badefabfd728..85b24c5500710506f5afb48fd02b2feddea47a81 100644 (file)
@@ -79,6 +79,13 @@ case "${target}" in
        only_if_gcc=yes
        #extra_subdirs="${extra_subdirs}"
        ;;
+# start-sanitize-tic80
+  tic80-*-*)
+       sim_target=tic80
+       only_if_gcc=yes
+       extra_subdirs="${extra_subdirs} igen"
+       ;;
+# end-sanitize-tic80
 # start-sanitize-v850
   v850-*-*)
        # The V850 simulator can only be compiled by gcc.
index a889da48a7b091f582658adea5cccf1dce836ac2..fa5eba8a013a62b1a35c249a88507c17f50ab89e 100644 (file)
@@ -1,3 +1,25 @@
+Tue Apr 22 21:46:28 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * igen.c (main), igen.h: Support new option - delayed-branch -
+       generate code to drive a delayed branch processor.
+
+       * gen-idecode.c (gen_idecode_h): Define instruction_address type.
+
+       * igen.c (print_icache_function_formal): Replace address_word with
+       instruction_address.
+       (print_semantic_function_formal): Ditto.
+       (print_semantic_function_type): Ditto.
+       * gen-idecode.c (print_idecode_issue_function_body): Ditto.
+
+       * gen-semantics.c (print_semantic_body): Ditto.
+       (print_c_semantic): Ditto.
+
+       * gen-support.c (support_c_function): Return a zeroed CIA instead
+       of just zero - works with any cia type.
+
+       * igen.c (print_itrace): For delayed branch case, print just the
+       current instruction.
+       
 Thu Apr 17 07:02:33 1997  Doug Evans  <dje@canuck.cygnus.com>
 
        * igen.c (print_itrace): Use TRACE_FOO_P and trace_printf.
index c0972957222ee8c466d9e2c223d8f10b2f87c70d..8dfe14596be1303542ce0a017d3aa66eff8e1a8a 100644 (file)
@@ -732,22 +732,22 @@ print_idecode_issue_function_body(lf *file,
 {
   lf_printf(file, "{\n");
   lf_indent(file, +2);
-  lf_printf(file, "address_word nia;\n");
+  lf_printf(file, "instruction_address nia;\n");
   if (!(code & generate_with_icache)) {
     print_idecode_body(file, table, "nia =");;
   }
   else {
     error("FIXME - idecode with cache?\n");
     lf_putstr(file, "idecode_cache *cache_entry =\n");
-    lf_putstr(file, "  cpu_icache_entry(processor, cia);\n");
+    lf_putstr(file, "  cpu_icache_entry(cpu, cia);\n");
     lf_putstr(file, "if (cache_entry->address == cia) {\n");
     lf_putstr(file, "  /* cache hit */\n");
     lf_putstr(file, "  idecode_semantic *const semantic = cache_entry->semantic;\n");
-    lf_putstr(file, "  cia = semantic(processor, cache_entry, cia);\n");
+    lf_putstr(file, "  cia = semantic(cpu, cache_entry, cia);\n");
     /* tail */
     if (can_stop) {
       lf_putstr(file, "if (keep_running != NULL && !*keep_running)\n");
-      lf_putstr(file, "  cpu_halt(processor, cia, was_continuing, 0/*ignore*/);\n");
+      lf_putstr(file, "  cpu_halt(cpu, cia, was_continuing, 0/*ignore*/);\n");
     }
     lf_putstr(file, "}\n");
     lf_putstr(file, "else {\n");
@@ -758,9 +758,9 @@ print_idecode_issue_function_body(lf *file,
       lf_indent(file, -2);
     }
     lf_putstr(file, "  instruction_word instruction =\n");
-    lf_putstr(file, "    vm_instruction_map_read(cpu_instruction_map(processor), processor, cia);\n");
+    lf_putstr(file, "    vm_instruction_map_read(cpu_instruction_map(cpu), cpu, cia);\n");
     lf_putstr(file, "  if (WITH_MON != 0)\n");
-    lf_putstr(file, "    mon_event(mon_event_icache_miss, processor, cia);\n");
+    lf_putstr(file, "    mon_event(mon_event_icache_miss, cpu, cia);\n");
     if ((code & generate_with_semantic_icache)) {
       lf_putstr(file, "{\n");
       lf_indent(file, +2);
@@ -770,7 +770,7 @@ print_idecode_issue_function_body(lf *file,
     }
     else {
       print_idecode_body(file, table, "semantic =");
-      lf_putstr(file, "  cia = semantic(processor, cache_entry, cia);\n");
+      lf_putstr(file, "  cia = semantic(cpu, cache_entry, cia);\n");
     }
     lf_putstr(file, "}\n");
   }
@@ -788,22 +788,22 @@ print_jump(lf *file,
 {
   if (is_tail) {
     lf_putstr(file, "if (keep_running != NULL && !*keep_running)\n");
-    lf_putstr(file, "  cpu_halt(processor, nia, was_continuing, 0/*na*/);\n");
+    lf_putstr(file, "  cpu_halt(cpu, nia, was_continuing, 0/*na*/);\n");
   }
   
   if (!generate_smp) {
     lf_putstr(file, "if (WITH_EVENTS) {\n");
     lf_putstr(file, "  if (event_queue_tick(events)) {\n");
-    lf_putstr(file, "    cpu_set_program_counter(processor, nia);\n");
+    lf_putstr(file, "    cpu_set_program_counter(cpu, nia);\n");
     lf_putstr(file, "    event_queue_process(events);\n");
-    lf_putstr(file, "    nia = cpu_get_program_counter(processor);\n");
+    lf_putstr(file, "    nia = cpu_get_program_counter(cpu);\n");
     lf_putstr(file, "  }\n");
     lf_putstr(file, "}\n");
   }
 
   if (generate_smp) {
     if (is_tail)
-      lf_putstr(file, "cpu_set_program_counter(processor, nia);\n");
+      lf_putstr(file, "cpu_set_program_counter(cpu, nia);\n");
     lf_putstr(file, "if (WITH_EVENTS) {\n");
     lf_putstr(file, "  current_cpu += 1;\n");
     lf_putstr(file, "  if (current_cpu >= nr_cpus) {\n");
@@ -816,12 +816,12 @@ print_jump(lf *file,
     lf_putstr(file, "else {\n");
     lf_putstr(file, "  current_cpu = (current_cpu + 1) % nr_cpus;\n");
     lf_putstr(file, "}\n");
-    lf_putstr(file, "processor = processors[current_cpu];\n");
-    lf_putstr(file, "nia = cpu_get_program_counter(processor);\n");
+    lf_putstr(file, "cpu = cpus[current_cpu];\n");
+    lf_putstr(file, "nia = cpu_get_program_counter(cpu);\n");
   }
 
   if ((code & generate_with_icache)) {
-    lf_putstr(file, "cache_entry = cpu_icache_entry(processor, nia);\n");
+    lf_putstr(file, "cache_entry = cpu_icache_entry(cpu, nia);\n");
     lf_putstr(file, "if (cache_entry->address == nia) {\n");
     lf_putstr(file, "  /* cache hit */\n");
     lf_putstr(file, "  goto *cache_entry->semantic;\n");
@@ -1020,7 +1020,7 @@ print_jump_until_stop_body(lf *file,
     lf_printf(file, "int *keep_running = NULL;\n");
   lf_putstr(file, "jmp_buf halt;\n");
   lf_putstr(file, "jmp_buf restart;\n");
-  lf_putstr(file, "cpu *processor = NULL;\n");
+  lf_putstr(file, "sim_cpu *cpu = NULL;\n");
   lf_putstr(file, "unsigned_word nia = -1;\n");
   lf_putstr(file, "instruction_word instruction = 0;\n");
   if ((code & generate_with_icache)) {
@@ -1039,7 +1039,7 @@ print_jump_until_stop_body(lf *file,
     lf_putstr(file, "{\n");
     lf_putstr(file, "  int cpu_nr;\n");
     lf_putstr(file, "  for (cpu_nr = 0; cpu_nr < nr_cpus; cpu_nr++)\n");
-    lf_putstr(file, "    cpu_flush_icache(processors[cpu_nr]);\n");
+    lf_putstr(file, "    cpu_flush_icache(cpus[cpu_nr]);\n");
     lf_putstr(file, "}\n");
   }
 
@@ -1055,8 +1055,8 @@ print_jump_until_stop_body(lf *file,
 
   lf_putstr(file, "\n");
   if (!generate_smp) {
-    lf_putstr(file, "processor = processors[0];\n");
-    lf_putstr(file, "nia = cpu_get_program_counter(processor);\n");
+    lf_putstr(file, "cpu = cpus[0];\n");
+    lf_putstr(file, "nia = cpu_get_program_counter(cpu);\n");
   }
   else {
     lf_putstr(file, "current_cpu = psim_last_cpu(system);\n");
@@ -1078,8 +1078,8 @@ print_jump_until_stop_body(lf *file,
   }
 
   lf_putstr(file, "instruction\n");
-  lf_putstr(file, "  = vm_instruction_map_read(cpu_instruction_map(processor),\n");
-  lf_putstr(file, "                            processor, nia);\n");
+  lf_putstr(file, "  = vm_instruction_map_read(cpu_instruction_map(cpu),\n");
+  lf_putstr(file, "                            cpu, nia);\n");
   print_idecode_body(file, table, "/*IGORE*/");
 
   /* print out a table of all the internals functions */
@@ -1220,7 +1220,7 @@ print_idecode_validate(lf *file,
       lf_printf(file, "\n");
       lf_indent_suppress(file);
       lf_printf(file, "#if defined(IS_FP_AVAILABLE)\n");
-      lf_printf(file, "/* Validate: FP available according to processor */\n");
+      lf_printf(file, "/* Validate: FP available according to cpu */\n");
       lf_printf(file, "if (!IS_FP_AVAILABLE) {\n");
       lf_indent(file, +2);
       print_idecode_invalid(file, "return",  invalid_fp_unavailable);
@@ -1284,21 +1284,34 @@ print_idecode_issue_function_header(lf *file,
 
 
 void
-gen_idecode_h(lf *file,
-             insn_table *table,
-             cache_table *cache_rules)
+gen_idecode_h (lf *file,
+              insn_table *table,
+              cache_table *cache_rules)
 {
   lf_printf(file, "typedef unsigned%d %sinstruction_word;\n",
            insn_bit_size, global_name_prefix);
+  if ((code & generate_with_semantic_delayed_branch))
+    {
+      lf_printf (file, "typedef struct _instruction_address {\n");
+      lf_printf (file, "  address_word ip; /* instruction pointer */\n");
+      lf_printf (file, "  address_word dp; /* delayed-slot pointer */\n");
+      lf_printf (file, "} instruction_address;\n");
+    }
+  else
+    {
+      lf_printf (file, "typedef address_word instruction_address;\n");
+    }
   lf_printf(file, "\n");
   print_icache_struct(table, cache_rules, file);
   lf_printf(file, "\n");
-  if ((code & generate_with_icache)) {
-    error("FIXME - idecode with icache incomplete");
-  }
-  else {
-    print_idecode_issue_function_header(file, 0/*is definition*/);
-  }
+  if ((code & generate_with_icache))
+    {
+      error("FIXME - idecode with icache incomplete");
+    }
+  else
+    {
+      print_idecode_issue_function_header(file, 0/*is definition*/);
+    }
 }
 
 
@@ -1328,7 +1341,7 @@ gen_idecode_c(lf *file,
              cache_table *cache_rules)
 {
   /* the intro */
-  lf_printf(file, "#include \"engine.h\"\n");
+  lf_printf(file, "#include \"sim-main.h\"\n");
   lf_printf(file, "#include \"%sidecode.h\"\n", global_name_prefix);
   lf_printf(file, "#include \"%ssemantics.h\"\n", global_name_prefix);
   lf_printf(file, "#include \"%sicache.h\"\n", global_name_prefix);
diff --git a/sim/igen/gen-semantics.c b/sim/igen/gen-semantics.c
new file mode 100644 (file)
index 0000000..57363c9
--- /dev/null
@@ -0,0 +1,303 @@
+/*  This file is part of the program psim.
+
+    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    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, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+    */
+
+
+
+#include "misc.h"
+#include "lf.h"
+#include "table.h"
+#include "filter.h"
+
+#include "ld-decode.h"
+#include "ld-cache.h"
+#include "ld-insn.h"
+
+#include "igen.h"
+
+#include "gen-semantics.h"
+#include "gen-icache.h"
+#include "gen-idecode.h"
+
+
+static void
+print_semantic_function_header(lf *file,
+                              const char *basename,
+                              insn_bits *expanded_bits,
+                              int is_function_definition)
+{
+  int indent;
+  lf_printf(file, "\n");
+  lf_print_function_type_function(file, print_semantic_function_type, "EXTERN_SEMANTICS",
+                                 (is_function_definition ? "\n" : " "));
+  indent = print_function_name(file,
+                              basename,
+                              expanded_bits,
+                              function_name_prefix_semantics);
+  if (is_function_definition)
+    lf_indent(file, +indent);
+  else
+    lf_printf(file, "\n");
+  lf_printf(file, "(");
+  print_semantic_function_formal(file);
+  lf_printf(file, ")");
+  if (is_function_definition)
+    lf_indent(file, -indent);
+  else
+    lf_printf(file, ";");
+  lf_printf(file, "\n");
+}
+
+void
+print_semantic_declaration(insn_table *entry,
+                          lf *file,
+                          void *data,
+                          insn *instruction,
+                          int depth)
+{
+  if (generate_expanded_instructions) {
+    ASSERT(entry->nr_insn == 1);
+    print_semantic_function_header(file,
+                                  instruction->file_entry->fields[insn_name],
+                                  entry->expanded_bits,
+                                  0/* is not function definition*/);
+  }
+  else {
+    print_semantic_function_header(file,
+                                  instruction->file_entry->fields[insn_name],
+                                  NULL,
+                                  0/* is not function definition*/);
+  }
+}
+
+
+\f
+/* generate the semantics.c file */
+
+
+void
+print_idecode_invalid(lf *file,
+                     const char *result,
+                     invalid_type type)
+{
+  const char *name;
+  switch (type) {
+  case invalid_illegal: name = "illegal"; break;
+  case invalid_fp_unavailable: name = "fp_unavailable"; break;
+  case invalid_wrong_slot: name = "wrong_slot"; break;
+  }
+  if ((code & generate_jumps))
+    lf_printf(file, "goto %s_%s;\n",
+             (code & generate_with_icache) ? "icache" : "semantic",
+             name);
+  else if ((code & generate_with_icache)) {
+    lf_printf(file, "%s %sicache_%s(", result, global_name_prefix, name);
+    print_icache_function_actual(file);
+    lf_printf(file, ");\n");
+  }
+  else {
+    lf_printf(file, "%s %ssemantic_%s(", result, global_name_prefix, name);
+    print_semantic_function_actual(file);
+    lf_printf(file, ");\n");
+  }
+}
+
+
+void
+print_semantic_body(lf *file,
+                   insn *instruction,
+                   insn_bits *expanded_bits,
+                   opcode_field *opcodes)
+{
+  print_itrace(file, instruction->file_entry, 0/*put_value_in_cache*/);
+
+  /* validate the instruction, if a cache this has already been done */
+  if (!(code & generate_with_icache))
+    print_idecode_validate(file, instruction, opcodes);
+
+  /* generate the profiling call - this is delayed until after the
+     instruction has been verified */
+  lf_printf(file, "\n");
+  lf_indent_suppress(file);
+  lf_printf(file, "#if defined(WITH_MON)\n");
+  lf_printf(file, "/* monitoring: */\n");
+  lf_printf(file, "if (WITH_MON & MONITOR_INSTRUCTION_ISSUE) {\n");
+  lf_printf(file, "  mon_issue(");
+  print_function_name(file,
+                     instruction->file_entry->fields[insn_name],
+                     NULL,
+                     function_name_prefix_itable);
+  lf_printf(file, ", cpu, cia);\n");
+  lf_printf(file, "}\n");
+  lf_indent_suppress(file);
+  lf_printf(file, "#endif\n");
+  lf_printf(file, "\n");
+
+  /* determine the new instruction address */
+  lf_printf(file, "/* keep the next instruction address handy */\n");
+  if ((code & generate_with_semantic_returning_modified_nia_only))
+    lf_printf(file, "nia = -1;\n");
+  else if ((code & generate_with_semantic_delayed_branch)) {
+    lf_printf(file, "nia.ip = cia.dp; /* instruction pointer */\n");
+    lf_printf(file, "nia.dp = cia.dp + %d; /* delayed-slot pointer\n",
+             insn_bit_size / 8);
+  }
+  else
+    lf_printf(file, "nia = cia + %d;\n", insn_bit_size / 8);
+
+  /* if conditional, generate code to verify that the instruction
+     should be issued */
+  if (it_is("c", instruction->file_entry->fields[insn_options])
+      || (code & generate_with_semantic_conditional_issue)) {
+    lf_printf(file, "\n");
+    lf_printf(file, "/* execute only if conditional passes */\n");
+    lf_printf(file, "if (IS_CONDITION_OK) {\n");
+    lf_indent(file, +2);
+    /* FIXME - need to log a conditional failure */
+  }
+  
+  /* generate the code (or at least something */
+  lf_printf(file, "\n");
+  lf_printf(file, "/* semantics: */\n");
+  if (instruction->file_entry->annex != NULL) {
+    /* true code */
+    table_entry_print_cpp_line_nr(file, instruction->file_entry);
+    lf_printf(file, "{\n");
+    lf_indent(file, +2);
+    lf_print__c_code(file, instruction->file_entry->annex);
+    lf_indent(file, -2);
+    lf_printf(file, "}\n");
+    lf_print__internal_reference(file);
+  }
+  else if (it_is("nop", instruction->file_entry->fields[insn_flags])) {
+    lf_print__internal_reference(file);
+  }
+  else {
+    /* abort so it is implemented now */
+    table_entry_print_cpp_line_nr(file, instruction->file_entry);
+    lf_printf(file, "engine_error(system, \"%s:%d:0x%%08lx:%%s unimplemented\\n\",\n",
+             filter_filename(instruction->file_entry->file_name),
+             instruction->file_entry->line_nr);
+    lf_printf(file, "             (long)cia, itable[MY_INDEX].name);\n");
+    lf_print__internal_reference(file);
+  }
+
+  /* Close off the conditional execution */
+  if (it_is("c", instruction->file_entry->fields[insn_options])
+      || (code & generate_with_semantic_conditional_issue)) {
+    lf_indent(file, -2);
+    lf_printf(file, "}\n");
+  }  
+}
+
+static void
+print_c_semantic(lf *file,
+                insn *instruction,
+                insn_bits *expanded_bits,
+                opcode_field *opcodes,
+                cache_table *cache_rules)
+{
+
+  lf_printf(file, "{\n");
+  lf_indent(file, +2);
+
+  print_my_defines(file, expanded_bits, instruction->file_entry);
+  lf_printf(file, "\n");
+  print_icache_body(file,
+                   instruction,
+                   expanded_bits,
+                   cache_rules,
+                   ((code & generate_with_direct_access)
+                    ? define_variables
+                    : declare_variables),
+                   ((code & generate_with_icache)
+                    ? get_values_from_icache
+                    : do_not_use_icache));
+
+  lf_printf(file, "instruction_address nia;\n");
+  print_semantic_body(file,
+                     instruction,
+                     expanded_bits,
+                     opcodes);
+  lf_printf(file, "return nia;\n");
+
+  /* generate something to clean up any #defines created for the cache */
+  if (code & generate_with_direct_access)
+    print_icache_body(file,
+                     instruction,
+                     expanded_bits,
+                     cache_rules,
+                     undef_variables,
+                     ((code & generate_with_icache)
+                      ? get_values_from_icache
+                      : do_not_use_icache));
+
+  lf_indent(file, -2);
+  lf_printf(file, "}\n");
+}
+
+static void
+print_c_semantic_function(lf *file,
+                         insn *instruction,
+                         insn_bits *expanded_bits,
+                         opcode_field *opcodes,
+                         cache_table *cache_rules)
+{
+  /* build the semantic routine to execute the instruction */
+  print_semantic_function_header(file,
+                                instruction->file_entry->fields[insn_name],
+                                expanded_bits,
+                                1/*is-function-definition*/);
+  print_c_semantic(file,
+                  instruction,
+                  expanded_bits,
+                  opcodes,
+                  cache_rules);
+}
+
+void
+print_semantic_definition(insn_table *entry,
+                         lf *file,
+                         void *data,
+                         insn *instruction,
+                         int depth)
+{
+  cache_table *cache_rules = (cache_table*)data;
+  if (generate_expanded_instructions) {
+    ASSERT(entry->nr_insn == 1
+          && entry->opcode == NULL
+          && entry->parent != NULL
+          && entry->parent->opcode != NULL);
+    ASSERT(entry->nr_insn == 1
+          && entry->opcode == NULL
+          && entry->parent != NULL
+          && entry->parent->opcode != NULL
+          && entry->parent->opcode_rule != NULL);
+    print_c_semantic_function(file,
+                             entry->insns,
+                             entry->expanded_bits,
+                             entry->parent->opcode,
+                             cache_rules);
+  }
+  else {
+    print_c_semantic_function(file, instruction,
+                             NULL, NULL,
+                             cache_rules);
+  }
+}
diff --git a/sim/igen/gen-support.c b/sim/igen/gen-support.c
new file mode 100644 (file)
index 0000000..d73a0de
--- /dev/null
@@ -0,0 +1,165 @@
+/*  This file is part of the program psim.
+
+    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    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, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+    */
+
+#include "misc.h"
+#include "lf.h"
+#include "table.h"
+#include "filter.h"
+
+#include "ld-decode.h"
+#include "ld-cache.h"
+#include "ld-insn.h"
+
+#include "igen.h"
+
+#include "gen-semantics.h"
+#include "gen-support.h"
+
+static void
+print_support_function_name(lf *file,
+                           table_entry *function,
+                           int is_function_definition)
+{
+  if (it_is("internal", function->fields[insn_flags])) {
+    lf_print_function_type_function(file, print_semantic_function_type, "INLINE_SUPPORT",
+                                   (is_function_definition ? "\n" : " "));
+    print_function_name(file,
+                       function->fields[function_name],
+                       NULL,
+                       function_name_prefix_semantics);
+    lf_printf(file, "\n(");
+    print_semantic_function_formal(file);
+    lf_printf(file, ")");
+    if (!is_function_definition)
+      lf_printf(file, ";");
+    lf_printf(file, "\n");
+  }
+  else {
+    /* map the name onto a globally valid name */
+    if (!is_function_definition && strcmp(global_name_prefix, "") != 0) {
+      lf_indent_suppress(file);
+      lf_printf(file, "#define %s %s%s\n",
+               function->fields[function_name],
+               global_name_prefix,
+               function->fields[function_name]);
+    }
+    lf_print_function_type(file,
+                          function->fields[function_type],
+                          "INLINE_SUPPORT",
+                          (is_function_definition ? "\n" : " "));
+    lf_printf(file, "%s%s\n(",
+             global_name_prefix,
+             function->fields[function_name]);
+    if (generate_smp)
+      lf_printf(file, "sim_cpu *cpu");
+    else
+      lf_printf(file, "SIM_DESC sd");
+    if (strcmp(function->fields[function_param], "") != 0)
+      lf_printf(file, ", %s", function->fields[function_param]);
+    lf_printf(file, ")%s", (is_function_definition ? "\n" : ";\n"));
+  }
+}
+
+
+static void
+support_h_function(insn_table *entry,
+                  lf *file,
+                  void *data,
+                  table_entry *function)
+{
+  ASSERT(function->fields[function_type] != NULL);
+  ASSERT(function->fields[function_param] != NULL);
+  print_support_function_name(file,
+                             function,
+                             0/*!is_definition*/);
+  lf_printf(file, "\n");
+}
+
+
+extern void
+gen_support_h(insn_table *table,
+             lf *file)
+{
+  /* output the definition of `_SD'*/
+  if (generate_smp) {
+    lf_printf(file, "#define _SD cpu\n");
+    lf_printf(file, "#define SD cpu->sd\n");
+    lf_printf(file, "#define CPU cpu\n");
+  }
+  else {
+    lf_printf(file, "#define _SD sd\n");
+    lf_printf(file, "#define SD sd\n");
+    lf_printf(file, "#define CPU (&sd->cpu)\n");
+  }
+  lf_printf(file, "\n");
+  /* output a declaration for all functions */
+  insn_table_traverse_function(table,
+                              file, NULL,
+                              support_h_function);
+  lf_printf(file, "\n");
+  lf_printf(file, "#if defined(SUPPORT_INLINE)\n");
+  lf_printf(file, "# if ((SUPPORT_INLINE & INCLUDE_MODULE)\\\n");
+  lf_printf(file, "      && (SUPPORT_INLINE & INCLUDED_BY_MODULE))\n");
+  lf_printf(file, "#  include \"%ssupport.c\"\n", global_name_prefix);
+  lf_printf(file, "# endif\n");
+  lf_printf(file, "#endif\n");
+}
+
+static void
+support_c_function(insn_table *table,
+                  lf *file,
+                  void *data,
+                  table_entry *function)
+{
+  ASSERT (function->fields[function_type] != NULL);
+  print_support_function_name (file,
+                              function,
+                              1/*!is_definition*/);
+  table_entry_print_cpp_line_nr (file, function);
+  lf_printf (file, "{\n");
+  lf_indent (file, +2);
+  lf_print__c_code (file, function->annex);
+  if (it_is ("internal", function->fields[insn_flags]))
+    {
+      lf_printf (file, "sim_io_error (sd, \"Internal function must longjump\\n\");\n");
+      lf_printf (file, "memset (&cia, 0, sizeof cia);\n");
+      lf_printf (file, "return cia;\n");
+    }
+  lf_indent (file, -2);
+  lf_printf (file, "}\n");
+  lf_print__internal_reference (file);
+  lf_printf (file, "\n");
+}
+
+
+void
+gen_support_c(insn_table *table,
+             lf *file)
+{
+  lf_printf(file, "#include \"sim-main.h\"\n");
+  lf_printf(file, "#include \"%sidecode.h\"\n", global_name_prefix);
+  lf_printf(file, "#include \"%ssupport.h\"\n", global_name_prefix);
+  lf_printf(file, "\n");
+
+  /* output a definition (c-code) for all functions */
+  insn_table_traverse_function(table,
+                              file, NULL,
+                              support_c_function);
+}
index d7a0b9420cf37ce1c4eac846ca2cb9e8892edd5d..2590dc5a35af979623a336cf63f8e5a37c8f2cea 100644 (file)
@@ -64,13 +64,13 @@ print_semantic_function_formal(lf *file)
 {
   int nr;
   if ((code & generate_with_icache))
-    nr = lf_printf(file, "SIM_DESC sd,\n %sidecode_cache *cache_entry,\n address_word cia",
+    nr = lf_printf(file, "SIM_DESC sd,\n %sidecode_cache *cache_entry,\n instruction_address cia",
                   global_name_prefix);
   else if (generate_smp)
-    nr = lf_printf(file, "sim_cpu *cpu,\n %sinstruction_word instruction,\n address_word cia",
+    nr = lf_printf(file, "sim_cpu *cpu,\n %sinstruction_word instruction,\n instruction_address cia",
                   global_name_prefix);
   else
-    nr = lf_printf(file, "SIM_DESC sd,\n %sinstruction_word instruction,\n address_word cia",
+    nr = lf_printf(file, "SIM_DESC sd,\n %sinstruction_word instruction,\n instruction_address cia",
                   global_name_prefix);
   return nr;
 }
@@ -92,7 +92,7 @@ int
 print_semantic_function_type(lf *file)
 {
   int nr;
-  nr = lf_printf(file, "address_word");
+  nr = lf_printf(file, "instruction_address");
   return nr;
 }
 
@@ -108,7 +108,7 @@ print_icache_function_formal(lf *file)
   else
     nr += lf_printf(file, "SIM_DESC sd,\n");
   nr += lf_printf(file, " %sinstruction_word instruction,\n", global_name_prefix);
-  nr += lf_printf(file, " address_word cia,\n");
+  nr += lf_printf(file, " instruction_address cia,\n");
   nr += lf_printf(file, " %sidecode_cache *cache_entry", global_name_prefix);
   return nr;
 }
@@ -257,7 +257,7 @@ print_itrace(lf *file,
   lf_printf(file, "    \"%s:%d:0x%%08lx:%%s\\n\", %s, %s);\n",
            filter_filename(file_entry->file_name),
            file_entry->line_nr,
-           "(long)cia",
+           ((code & generate_with_semantic_delayed_branch) ? "(long)cia.ip" : "(long)cia"),
            "itable[MY_INDEX].name");
   lf_printf(file, "}\n");
   lf_indent_suppress(file);
@@ -450,6 +450,7 @@ main(int argc,
     printf("                      semantic-icache - include semantic code in cracking functions\n");
     printf("                      insn-in-icache - save original instruction when cracking\n");
     printf("                      default-nia-minus-one - instead of cia + insn-size\n");
+    printf("                      delayed-branch - instead of cia + insn-size\n");
     printf("                      conditional-issue - conditionally issue each instruction\n");
     printf("                      validate-slot - perform slot verification as part of decode\n");
     printf("\n");
@@ -548,6 +549,11 @@ main(int argc,
       }
       else if (strcmp(optarg, "default-nia-minus-one") == 0) {
        code |= generate_with_semantic_returning_modified_nia_only;
+       code &= ~generate_with_semantic_delayed_branch;
+      }
+      else if (strcmp(optarg, "delayed-branch") == 0) {
+       code |= generate_with_semantic_delayed_branch;
+       code &= ~generate_with_semantic_returning_modified_nia_only;
       }
       else if (strcmp(optarg, "conditional-issue") == 0) {
        code |= generate_with_semantic_conditional_issue;
diff --git a/sim/tic80/.Sanitize b/sim/tic80/.Sanitize
new file mode 100644 (file)
index 0000000..8039fb3
--- /dev/null
@@ -0,0 +1,45 @@
+# .Sanitize for devo/sim/ppc.
+
+# Each directory to survive it's way into a release will need a file
+# like this one called "./.Sanitize".  All keyword lines must exist,
+# and must exist in the order specified by this file.  Each directory
+# in the tree will be processed, top down, in the following order.
+
+# Hash started lines like this one are comments and will be deleted
+# before anything else is done.  Blank lines will also be squashed
+# out.
+
+# The lines between the "Do-first:" line and the "Things-to-keep:"
+# line are executed as a /bin/sh shell script before anything else is
+# done in this 
+
+Do-first:
+
+# All files listed between the "Things-to-keep:" line and the
+# "Files-to-sed:" line will be kept.  All other files will be removed.
+# Directories listed in this section will have their own Sanitize
+# called.  Directories not listed will be removed in their entirety
+# with rm -rf.
+
+Things-to-keep:
+
+ChangeLog
+Makefile.in
+alu.h
+config.in
+configure
+configure.in
+cpu.h
+dc
+ic
+insns
+interp.c
+sim-calls.c
+sim-main.h
+
+Things-to-lose:
+
+
+Do-last:
+
+# End of file.
diff --git a/sim/tic80/ChangeLog b/sim/tic80/ChangeLog
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/sim/tic80/Makefile.in b/sim/tic80/Makefile.in
new file mode 100644 (file)
index 0000000..2d0c8d1
--- /dev/null
@@ -0,0 +1,141 @@
+# Makefile for blah ...
+# Copyright blah ...
+
+
+
+## COMMON_PRE_CONFIG_FRAG
+
+# These variables are given default values in COMMON_PRE_CONFIG_FRAG.
+# We override the ones we need to here.
+# Not all of these need to be mentioned, only the necessary ones.
+
+# List of object files, less common parts.
+SIM_OBJS = sim-endian.o sim-bits.o sim-config.o interp.o \
+       support.o idecode.o semantics.o itable.o \
+       sim-calls.o \
+       sim-events.o \
+       sim-core.o \
+       sim-io.o \
+       sim-utils.o \
+       sim-load.o \
+       sim-options.o \
+       sim-trace.o
+
+# List of extra dependencies.
+# Generally this consists of simulator specific files included by sim-main.h.
+SIM_EXTRA_DEPS = itable.h idecode.h cpu.h alu.h
+
+# List of generators
+SIM_GEN=tmp-igen
+
+# List of flags to always pass to $(CC).
+SIM_WARNINGS=@sim_warnings@
+SIM_ENDIAN=@sim_endian@
+SIM_HOSTENDIAN=@sim_hostendian@
+SIM_INLINE=@sim_inline@
+SIM_RESERVED_BITS=@sim_reserved_bits@
+
+SIM_EXTRA_CFLAGS = \
+       $(SIM_WARNINGS) \
+       $(SIM_ENDIAN) \
+       $(SIM_HOSTENDIAN) \
+       $(SIM_INLINE) \
+       $(SIM_RESERVED_BITS) \
+       -DWITH_TARGET_WORD_MSB=31
+
+# List of main object files for `run'.
+SIM_RUN_OBJS = nrun.o
+
+# Dependency of `clean' to clean any extra files.
+SIM_EXTRA_CLEAN = clean-igen
+
+
+## COMMON_POST_CONFIG_FRAG
+
+# Rules need to build $(SIM_OBJS), plus whatever else the target wants.
+
+# ... target specific rules ...
+
+BUILT_SRC_FROM_IGEN = \
+       icache.h \
+       icache.c \
+       idecode.h \
+       idecode.c \
+       semantics.h \
+       semantics.c \
+       model.h \
+       model.c \
+       support.h \
+       support.c \
+       itable.h itable.c
+$(BUILT_SRC_FROM_IGEN): tmp-igen
+#
+
+.PHONY: clean-igen
+clean-igen:
+       rm -f $(BUILT_SRC_FROM_IGEN)
+       rm -f tmp-igen tmp-insns
+
+../igen/igen:
+       cd ../igen && $(MAKE)
+
+tmp-igen: $(srcdir)/dc $(srcdir)/insns $(srcdir)/ic ../igen/igen
+       cd ../igen && $(MAKE)
+       @echo "Generating short version ..."
+       ../igen/igen \
+               -G direct-access \
+               -G delayed-branch \
+               -G omit-line-numbers \
+               -F short,emul \
+               -B 32 -H 31 \
+               -o $(srcdir)/dc \
+               -k $(srcdir)/ic \
+               -i $(srcdir)/insns \
+               -n icache.h    -hc tmp-icache.h \
+               -n icache.c    -c  tmp-icache.c \
+               -n semantics.h -hs tmp-semantics.h \
+               -n semantics.c -s  tmp-semantics.c \
+               -n idecode.h   -hd tmp-idecode.h \
+               -n idecode.c   -d  tmp-idecode.c \
+               -n model.h     -hm tmp-model.h \
+               -n model.c     -m  tmp-model.c \
+               -n support.h   -hf tmp-support.h \
+               -n support.c   -f  tmp-support.c \
+               -n itable.h    -ht tmp-itable.h \
+               -n itable.c    -t  tmp-itable.c
+       $(srcdir)/../../move-if-change tmp-icache.h icache.h
+       $(srcdir)/../../move-if-change tmp-icache.c icache.c
+       $(srcdir)/../../move-if-change tmp-idecode.h idecode.h
+       $(srcdir)/../../move-if-change tmp-idecode.c idecode.c
+       $(srcdir)/../../move-if-change tmp-semantics.h semantics.h
+       $(srcdir)/../../move-if-change tmp-semantics.c semantics.c
+       $(srcdir)/../../move-if-change tmp-model.h model.h
+       $(srcdir)/../../move-if-change tmp-model.c model.c
+       $(srcdir)/../../move-if-change tmp-support.h support.h
+       $(srcdir)/../../move-if-change tmp-support.c support.c
+       $(srcdir)/../../move-if-change tmp-itable.h itable.h
+       $(srcdir)/../../move-if-change tmp-itable.c itable.c
+       touch tmp-igen
+
+ENGINE_H = \
+       sim-main.h \
+       $(srcdir)/../common/sim-basics.h \
+       config.h \
+       $(srcdir)/../common/sim-config.h \
+       $(srcdir)/../common/sim-inline.h \
+       $(srcdir)/../common/sim-types.h \
+       $(srcdir)/../common/sim-bits.h \
+       $(srcdir)/../common/sim-endian.h \
+       itable.h \
+       idecode.h \
+       cpu.h \
+       alu.h \
+       $(srcdir)/../common/sim-alu.h \
+       $(srcdir)/../common/sim-core.h \
+       $(srcdir)/../common/sim-events.h \
+
+idecode.o: $(ENGINE_H)
+semantics.o: $(ENGINE_H)
+interp.o: interp.c $(ENGINE_H)
+sim-calls.o: sim-calls.c $(ENGINE_H)
+cpu.o: cpu.c $(ENGINE_H)
diff --git a/sim/tic80/alu.h b/sim/tic80/alu.h
new file mode 100644 (file)
index 0000000..2f0aad5
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef _TIC80_ALU_H_
+#define _TIC80_ALU_H_
+
+#define ALU_CARRY 0 /* FIXME */
+
+#include "sim-alu.h"
+
+#define ALU32_END(TARG) \
+{ \
+  (TARG) = (unsigned32)alu_carry_val; /* FIXME */ \
+}}
+
+#define ALU_END(TARG) ALU32_END(TARG)
+
+
+/* Bring data in from the cold */
+
+#define IMEM(EA) sim_core_read_4(sd, sim_core_execute_map, (EA))
+
+#define MEM(SIGN, EA, NR_BYTES) \
+((SIGN##_##NR_BYTES) sim_core_read_##NR_BYTES(sd, sim_core_read_map, (EA)))
+
+#define STORE(EA, NR_BYTES, VAL) \
+do { \
+  sim_core_write_##NR_BYTES(sd, sim_core_write_map, (EA), (VAL)); \
+} while (0)
+
+
+#define long_immediate(VARIABLE) \
+     unsigned_word VARIABLE = MEM (unsigned, nia.ip, 4); \
+     nia.ip += sizeof (instruction_word); \
+     nia.dp += sizeof (instruction_word);
+
+#endif
diff --git a/sim/tic80/config.in b/sim/tic80/config.in
new file mode 100644 (file)
index 0000000..41a2785
--- /dev/null
@@ -0,0 +1,35 @@
+/* config.in.  Generated automatically from configure.in by autoheader.  */
+
+/* Define as the return type of signal handlers (int or void).  */
+#undef RETSIGTYPE
+
+/* Define if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+#undef WORDS_BIGENDIAN
+
+/* Define if you have the getrusage function.  */
+#undef HAVE_GETRUSAGE
+
+/* Define if you have the time function.  */
+#undef HAVE_TIME
+
+/* Define if you have the <stdlib.h> header file.  */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file.  */
+#undef HAVE_STRING_H
+
+/* Define if you have the <strings.h> header file.  */
+#undef HAVE_STRINGS_H
+
+/* Define if you have the <sys/resource.h> header file.  */
+#undef HAVE_SYS_RESOURCE_H
+
+/* Define if you have the <sys/time.h> header file.  */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <time.h> header file.  */
+#undef HAVE_TIME_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H
diff --git a/sim/tic80/configure b/sim/tic80/configure
new file mode 100755 (executable)
index 0000000..2e1619c
--- /dev/null
@@ -0,0 +1,1961 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.12 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+  --enable-sim-bswap                   Use Host specific BSWAP instruction."
+ac_help="$ac_help
+  --enable-sim-cflags=opts             Extra CFLAGS for use in building simulator"
+ac_help="$ac_help
+  --enable-sim-debug=opts              Enable debugging flags"
+ac_help="$ac_help
+  --enable-sim-stdio                   Specify whether to use stdio for console input/output."
+ac_help="$ac_help
+  --enable-sim-trace=opts              Enable tracing flags"
+ac_help="$ac_help
+  --enable-sim-inline=inlines          Specify which functions should be inlined."
+ac_help="$ac_help
+  --enable-sim-endian=endian           Specify target byte endian orientation."
+ac_help="$ac_help
+  --enable-sim-hostendain=end          Specify host byte endian orientation."
+ac_help="$ac_help
+  --enable-sim-warnings=opts           Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o"
+ac_help="$ac_help
+  --enable-sim-reserved-bits           Specify whether to check reserved bits in instruction."
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir="$ac_optarg" ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build="$ac_optarg" ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file="$ac_optarg" ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix="$ac_optarg" ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host="$ac_optarg" ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir="$ac_optarg" ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir="$ac_optarg" ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir="$ac_optarg" ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir="$ac_optarg" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir="$ac_optarg" ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir="$ac_optarg" ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix="$ac_optarg" ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix="$ac_optarg" ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix="$ac_optarg" ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name="$ac_optarg" ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir="$ac_optarg" ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir="$ac_optarg" ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site="$ac_optarg" ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir="$ac_optarg" ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir="$ac_optarg" ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target="$ac_optarg" ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.12"
+    exit 0 ;;
+
+  -with-* | --with-*)
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_${ac_package}='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    # Reject names that are not valid shell variable names.
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes="$ac_optarg" ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries="$ac_optarg" ;;
+
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+    ;;
+
+  *)
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=Makefile.in
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='       '
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:544: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 559 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:565: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 576 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+
+# autoconf.info says this should be called right after AC_INIT.
+
+
+ac_aux_dir=
+for ac_dir in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+#    same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:655: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`$ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`$ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:676: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+  case $nonopt in
+  NONE) target_alias=$host_alias ;;
+  *) target_alias=$nonopt ;;
+  esac ;;
+esac
+
+target=`$ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:694: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`$ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+if test "$program_transform_name" = s,x,x,; then
+  program_transform_name=
+else
+  # Double any \ or $.  echo might interpret backslashes.
+  cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+  rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:738: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:767: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  ac_prog_rejected=no
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+       continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:815: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 825 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+if { (eval echo configure:829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:849: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:854: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:863: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+  ac_test_CFLAGS="${CFLAGS+set}"
+  ac_save_CFLAGS="$CFLAGS"
+  CFLAGS=
+  echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:878: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+  if test "$ac_test_CFLAGS" = set; then
+    CFLAGS="$ac_save_CFLAGS"
+  elif test $ac_cv_prog_cc_g = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-O2"
+  fi
+else
+  GCC=
+  test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:916: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      for ac_prog in ginstall installbsd scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+         if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           # OSF/1 installbsd also uses dspmsg, but is usable.
+           :
+         else
+           ac_cv_path_install="$ac_dir/$ac_prog -c"
+           break 2
+         fi
+       fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test "x$cross_compiling" = "xno"; then
+  CC_FOR_BUILD='$(CC)'
+else
+  CC_FOR_BUILD=gcc
+fi
+
+
+
+
+AR=${AR-ar}
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:981: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+# Check for common headers.
+# FIXME: Seems to me this can cause problems for i386-windows hosts.
+# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
+for ac_hdr in stdlib.h string.h strings.h unistd.h time.h sys/time.h sys/resource.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1015: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1020 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1025: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getrusage time
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1054: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1059 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+. ${srcdir}/../../bfd/configure.host
+
+
+
+# Check whether --enable-sim-bswap or --disable-sim-bswap was given.
+if test "${enable_sim_bswap+set}" = set; then
+  enableval="$enable_sim_bswap"
+  case "${enableval}" in
+  yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
+  no)  sim_bswap="-DWITH_BSWAP=0";;
+  *)   { echo "configure: error: "--enable-sim-bswap does not take a value"" 1>&2; exit 1; }; sim_bswap="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
+  echo "Setting bswap flags = $sim_bswap" 6>&1
+fi
+else
+  sim_bswap=""
+fi
+
+
+
+# Check whether --enable-sim-cflags or --disable-sim-cflags was given.
+if test "${enable_sim_cflags+set}" = set; then
+  enableval="$enable_sim_cflags"
+  case "${enableval}" in
+  yes)  sim_cflags="-O2";;
+  trace) { echo "configure: error: "Please use --enable-sim-debug instead."" 1>&2; exit 1; }; sim_cflags="";;
+  no)   sim_cflags="";;
+  *)    sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
+  echo "Setting sim cflags = $sim_cflags" 6>&1
+fi
+else
+  sim_cflags=""
+fi
+
+
+
+# Check whether --enable-sim-debug or --disable-sim-debug was given.
+if test "${enable_sim_debug+set}" = set; then
+  enableval="$enable_sim_debug"
+  case "${enableval}" in
+  yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
+  no)  sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
+  *)   sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
+  echo "Setting sim debug = $sim_debug" 6>&1
+fi
+else
+  sim_debug=""
+fi
+
+
+
+# Check whether --enable-sim-stdio or --disable-sim-stdio was given.
+if test "${enable_sim_stdio+set}" = set; then
+  enableval="$enable_sim_stdio"
+  case "${enableval}" in
+  yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
+  no)  sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
+  *)   { echo "configure: error: "Unknown value $enableval passed to --enable-sim-stdio"" 1>&2; exit 1; }; sim_stdio="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
+  echo "Setting stdio flags = $sim_stdio" 6>&1
+fi
+else
+  sim_stdio=""
+fi
+
+
+
+# Check whether --enable-sim-trace or --disable-sim-trace was given.
+if test "${enable_sim_trace+set}" = set; then
+  enableval="$enable_sim_trace"
+  case "${enableval}" in
+  yes) sim_trace="-DTRACE=1 -DWITH_TRACE=1";;
+  no)  sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
+  *)   sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
+  echo "Setting sim trace = $sim_trace" 6>&1
+fi
+else
+  sim_trace=""
+fi
+
+
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:1198: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1203 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:1220: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_type_signal=void
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+
+
+sim_link_files=
+sim_link_links=
+
+sim_link_links=tconfig.h
+if test -f ${srcdir}/tconfig.in
+then
+  sim_link_files=tconfig.in
+else
+  sim_link_files=../common/tconfig.in
+fi
+
+# targ-vals.def points to the libc macro description file.
+case "${target}" in
+*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
+esac
+sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
+sim_link_links="${sim_link_links} targ-vals.def"
+
+
+
+
+default_sim_inline="-DDEFAULT_INLINE=0"
+# Check whether --enable-sim-inline or --disable-sim-inline was given.
+if test "${enable_sim_inline+set}" = set; then
+  enableval="$enable_sim_inline"
+  sim_inline=""
+case "$enableval" in
+  no)          sim_inline="-DDEFAULT_INLINE=0";;
+  0)           sim_inline="-DDEFAULT_INLINE=0";;
+  yes | 2)     sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
+  1)           sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
+  *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+       new_flag=""
+       case "$x" in
+        *_INLINE=*)    new_flag="-D$x";;
+        *=*)           new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
+        *_INLINE)      new_flag="-D$x=ALL_INLINE";;
+        *)             new_flag="-D$x""_INLINE=ALL_INLINE";;
+       esac
+       if test x"$sim_inline" = x""; then
+        sim_inline="$new_flag"
+       else
+        sim_inline="$sim_inline $new_flag"
+       fi
+     done;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
+  echo "Setting inline flags = $sim_inline" 6>&1
+fi
+else
+  if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
+  sim_inline="${default_sim_inline}"
+  if test x"$silent" != x"yes"; then
+    echo "Setting inline flags = $sim_inline" 6>&1
+  fi
+else
+  sim_inline=""
+fi
+fi
+
+
+
+default_sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN"
+# Check whether --enable-sim-endian or --disable-sim-endian was given.
+if test "${enable_sim_endian+set}" = set; then
+  enableval="$enable_sim_endian"
+  case "${enableval}" in
+  yes) case "$target" in
+         *powerpc-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
+         *powerpcle-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
+         *) echo "Unknown target $target" 1>&6; sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
+       esac;;
+  no)   sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
+  b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
+  l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
+  *)    { echo "configure: error: "Unknown value $enableval for --enable-sim-endian"" 1>&2; exit 1; }; sim_endian="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
+  echo "Setting endian flags = $sim_endian" 6>&1
+fi
+else
+  sim_endian="${default_sim_endian}"
+fi
+
+
+
+# Check whether --enable-sim-hostendian or --disable-sim-hostendian was given.
+if test "${enable_sim_hostendian+set}" = set; then
+  enableval="$enable_sim_hostendian"
+  case "${enableval}" in
+  no)   sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
+  b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
+  l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
+  *)    { echo "configure: error: "Unknown value $enableval for --enable-sim-hostendian"" 1>&2; exit 1; }; sim_hostendian="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
+  echo "Setting hostendian flags = $sim_hostendian" 6>&1
+fi
+else
+  
+if test "x$cross_compiling" = "xno"; then
+  echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:1342: checking whether byte ordering is bigendian" >&5
+if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat > conftest.$ac_ext <<EOF
+#line 1349 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:1360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat > conftest.$ac_ext <<EOF
+#line 1364 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:1375: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_bigendian=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1395 "configure"
+#include "confdefs.h"
+main () {
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long l;
+    char c[sizeof (long)];
+  } u;
+  u.l = 1;
+  exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:1408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_bigendian=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+  cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+  if test $ac_cv_c_bigendian = yes; then
+    sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
+  else
+    sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
+  fi
+else
+  sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
+fi
+fi
+
+
+
+# Check whether --enable-sim-warnings or --disable-sim-warnings was given.
+if test "${enable_sim_warnings+set}" = set; then
+  enableval="$enable_sim_warnings"
+  case "${enableval}" in
+  yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
+  no)  sim_warnings="-w";;
+  *)   sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
+  echo "Setting warning flags = $sim_warnings" 6>&1
+fi
+else
+  sim_warnings=""
+fi
+
+
+
+default_sim_reserved_bits="1"
+# Check whether --enable-sim-reserved-bits or --disable-sim-reserved-bits was given.
+if test "${enable_sim_reserved_bits+set}" = set; then
+  enableval="$enable_sim_reserved_bits"
+  case "${enableval}" in
+  yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
+  no)  sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
+  *)   { echo "configure: error: "--enable-sim-reserved-bits does not take a value"" 1>&2; exit 1; }; sim_reserved_bits="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
+  echo "Setting reserved flags = $sim_reserved_bits" 6>&1
+fi
+else
+  sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"
+fi
+
+
+
+for ac_hdr in stdlib.h unistd.h string.h strings.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1482: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1487 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+  case `(ac_space=' '; set) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[        ]*VPATH[        ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.12"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
+s%@HDEFINES@%$HDEFINES%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@CPP@%$CPP%g
+s%@sim_bswap@%$sim_bswap%g
+s%@sim_cflags@%$sim_cflags%g
+s%@sim_debug@%$sim_debug%g
+s%@sim_stdio@%$sim_stdio%g
+s%@sim_trace@%$sim_trace%g
+s%@sim_inline@%$sim_inline%g
+s%@sim_endian@%$sim_endian%g
+s%@sim_hostendian@%$sim_hostendian%g
+s%@sim_warnings@%$sim_warnings%g
+s%@sim_reserved_bits@%$sim_reserved_bits%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+  fi
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  fi
+done
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dir_suffix= ac_dots=
+  fi
+
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  case "$ac_given_INSTALL" in
+  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
+  esac
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([  ]*\)#\([        ]*define[       ][      ]*\)'
+ac_dB='\([     ][      ]*\)[^  ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
+ac_uB='\([     ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+  CONFIG_HEADERS="config.h:config.in"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  echo creating $ac_file
+
+  rm -f conftest.frag conftest.in conftest.out
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h.  And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[   ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+  ac_lines=`grep -c . conftest.vals`
+  # grep -c gives empty output for an empty file on some AIX systems.
+  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+  # Write a limited-size here document to conftest.frag.
+  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  echo 'CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+  rm -f conftest.vals
+  mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+  rm -f conftest.frag conftest.h
+  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
+  cat conftest.in >> conftest.h
+  rm -f conftest.in
+  if cmp -s $ac_file conftest.h 2>/dev/null; then
+    echo "$ac_file is unchanged"
+    rm -f conftest.h
+  else
+    # Remove last slash and all that follows it.  Not all systems have dirname.
+      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+      # The file is in a subdirectory.
+      test ! -d "$ac_dir" && mkdir "$ac_dir"
+    fi
+    rm -f $ac_file
+    mv conftest.h $ac_file
+  fi
+fi; done
+
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+ac_sources="$sim_link_files"
+ac_dests="$sim_link_links"
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+srcdir=$ac_given_srcdir
+while test -n "$ac_sources"; do
+  set $ac_dests; ac_dest=$1; shift; ac_dests=$*
+  set $ac_sources; ac_source=$1; shift; ac_sources=$*
+
+  echo "linking $srcdir/$ac_source to $ac_dest"
+
+  if test ! -r $srcdir/$ac_source; then
+    { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; }
+  fi
+  rm -f $ac_dest
+
+  # Make relative symlinks.
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
+    # The dest file is in a subdirectory.
+    test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
+    ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dest_dir_suffix.
+    ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
+  else
+    ac_dest_dir_suffix= ac_dots=
+  fi
+
+  case "$srcdir" in
+  [/$]*) ac_rel_source="$srcdir/$ac_source" ;;
+  *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
+  esac
+
+  # Make a symlink if possible; otherwise try a hard link.
+  if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
+    ln $srcdir/$ac_source $ac_dest; then :
+  else
+    { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
+  fi
+done
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+case "x$CONFIG_FILES" in xMakefile*)
+   echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
+   rm -f Makesim1.tmp Makesim2.tmp Makefile
+   sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
+   sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
+   sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
+       -e '/^## COMMON_POST_/ r Makesim2.tmp' \
+       <Makefile.sim >Makefile
+   rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
+   ;;
+ esac
+ case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+
diff --git a/sim/tic80/configure.in b/sim/tic80/configure.in
new file mode 100644 (file)
index 0000000..d927edf
--- /dev/null
@@ -0,0 +1,19 @@
+dnl Process this file with autoconf to produce a configure script.
+sinclude(../common/aclocal.m4)
+AC_PREREQ(2.5)dnl
+AC_INIT(Makefile.in)
+
+SIM_AC_COMMON
+
+dnl Options available in this module
+SIM_AC_OPTION_INLINE(0)
+SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
+SIM_AC_OPTION_HOSTENDIAN
+SIM_AC_OPTION_WARNINGS
+SIM_AC_OPTION_RESERVED_BITS(1)
+
+dnl For UNIX emulation
+AC_CHECK_HEADERS(stdlib.h unistd.h string.h strings.h)
+
+
+SIM_AC_OUTPUT
diff --git a/sim/tic80/cpu.h b/sim/tic80/cpu.h
new file mode 100644 (file)
index 0000000..4cb7178
--- /dev/null
@@ -0,0 +1,7 @@
+typedef struct _sim_cpu {
+  unsigned_word reg[32];
+  sim_cpu_base base;
+  instruction_address cia;
+} sim_cpu;
+
+#define GPR(N) ((CPU)->reg[N])
diff --git a/sim/tic80/dc b/sim/tic80/dc
new file mode 100644 (file)
index 0000000..efd6e41
--- /dev/null
@@ -0,0 +1 @@
+switch: 21: 12: 21: 12
diff --git a/sim/tic80/ic b/sim/tic80/ic
new file mode 100644 (file)
index 0000000..0059cd9
--- /dev/null
@@ -0,0 +1,25 @@
+compute:Dest:Dest:
+compute:Dest:rDest:signed32 *:(&(CPU)->reg[Dest])
+#
+compute:Source1:Source1:
+compute:Source1:rSource1:signed32:(Source1 == 0 ? 0 : (CPU)->reg[Source1])
+#
+compute:Source2:Source2:
+compute:Source2:rSource2:signed32:(Source2 == 0 ? 0 : (CPU)->reg[Source2])
+#
+compute:Source:Source:
+compute:Source:rSource:signed32:(Source == 0 ? 0 : (CPU)->reg[Source])
+#
+compute:IndOff:IndOff:
+compute:IndOff:rIndOff:signed32:(IndOff == 0 ? 0 : (CPU)->reg[IndOff])
+#
+# Trap Number
+compute:UTN:UTN:
+compute:INDTR:INDTR:
+compute:INDTR:UTN:unsigned32:(INDTR == 0 ? 0 : (CPU)->reg[INDTR])
+#
+compute:A:A:
+#
+compute:SI:SI:
+compute:SI:SignedOffset:unsigned32:SEXT (SI, 14)
+compute:BITNUM:BITNUM:
diff --git a/sim/tic80/insns b/sim/tic80/insns
new file mode 100644 (file)
index 0000000..7f805a9
--- /dev/null
@@ -0,0 +1,610 @@
+// The following is called when ever an illegal instruction is
+// encountered
+::internal::illegal
+       engine_error (sd, cia, "illegal instruction at 0x%lx", cia.ip);
+
+// Signed Integer Add - add source1, source2, dest
+void::function::do_add:signed_word *rDest, signed_word Source1, signed_word Source2
+       ALU_BEGIN (Source1);
+       ALU_ADD (Source2);
+       ALU_END (*rDest);
+31.Dest,26.Source2,21.0b101100,15.0,14.SI::::add i
+       do_add (_SD, rDest, SI, rSource2);
+31.Dest,26.Source2,21.0b11101100,13.0,12.0,11./,4.Source1::::add r
+       do_add (_SD, rDest, rSource1, rSource2);
+31.Dest,26.Source2,21.0b11101100,13.0,12.1,11./::::add l
+       long_immediate (LSI);
+       do_add (_SD, rDest, LSI, rSource2);
+
+
+// Unsigned Integer Add - addu source1, source2, dest
+void::function::do_addu:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+       *rDest = Source1 + Source2;
+31.Dest,26.Source2,21.0b101100,15.1,14.SI::::addu i
+       do_addu (_SD, rDest, SI, rSource2);
+31.Dest,26.Source2,21.0b11101100,13.1,12.0,11./,4.Source1::::addu r
+       do_addu (_SD, rDest, rSource1, rSource2);
+31.Dest,26.Source2,21.0b11101100,13.1,12.1,11./::::addu l
+       long_immediate (LSI);
+       do_addu (_SD, rDest, LSI, rSource2);
+
+
+#void::function::do_and:unsigned_word *rDest, unsigned_word source1, unsigned_word source2
+#      *rD = source1 & source2;
+
+
+// and, and.tt
+#31.Dest,26.Source2,21.0b0010001,14.SI::::and.tt i
+#      do_and (_SD, *rDest, SI, rSource2);
+#31.Dest,26.Source2,21.0b110010001,0,11./,4.Source1::::and.tt r
+#      do_and (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b110010001,1,11./::::and.tt l
+#      do_and (_SD, *rDest, LSI, rSource2);
+
+
+// and.ff
+#31.Dest,26.Source2,21.0b0010001,14.SI::::and.ff i
+#      do_and (_SD, *rDest, ~SI, ~rSource2);
+#31.Dest,26.Source2,21.0b110010001,0,11./,4.Source1::::and.ff r
+#      do_and (_SD, *rDest, ~rSource1, ~rSource2);
+#31.Dest,26.Source2,21.0b110010001,1,11./::::and.ff l
+#      do_and (_SD, *rDest, ~LSI, ~rSource2);
+
+
+// and.ft
+#31.Dest,26.Source2,21.0b0010001,14.SI::::and.ft i
+#      do_and (_SD, *rDest, ~SI, rSource2);
+#31.Dest,26.Source2,21.0b110010001,0,11./,4.Source1::::and.ft r
+#      do_and (_SD, *rDest, ~rSource1, rSource2);
+#31.Dest,26.Source2,21.0b110010001,1,11./::::and.ft l
+#      do_and (_SD, *rDest, ~LSI, rSource2);
+
+
+// and.tf
+#31.Dest,26.Source2,21.0b0010001,14.SI::::and.tf i
+#      do_and (_SD, *rDest, SI, ~rSource2);
+#31.Dest,26.Source2,21.0b110010001,0,11./,4.Source1::::and.tf r
+#      do_and (_SD, *rDest, rSource1, ~rSource2);
+#31.Dest,26.Source2,21.0b110010001,1,11./::::and.tf l
+#      do_and (_SD, *rDest, LSI, ~rSource2);
+
+
+// bbo.[a]
+#void::function::do_bbo:int annul, int bitnum, unsigned_word offset, unsigned_word source
+#      sim_io_error ("bbo");
+#31.BM,26.Source2,21.0b100101,A,14.SI14::::and.tf i
+#      do_bbo (_SD, A, SI, rSource2);
+#31.BM,26.Source2,21.0b11100101,A,0,11./,4.Source1::::and.tf r
+#      do_bbo (_SD, A, rSource1, rSource2);
+#31.BM,26.Source2,21.0b11100101,A,1,11./::::and.tf l
+#      do_bbo (_SD, A, LSI, rSource2);
+
+
+// bbz[.a]
+instruction_address::function::do_bbz:instruction_address cia, instruction_address nia, int bitnum, unsigned_word source, int annul, unsigned_word offset
+       if (!MASKED32 (source, bitnum, bitnum))
+         {
+           if (annul)
+             nia.ip = -1;
+           nia.dp = cia.ip + 4 * offset;
+         }
+       return nia;
+31.BITNUM,26.Source,21.0b100100,15.A,14.SI::::bbz i
+       nia = do_bbz (_SD, cia, nia, BITNUM, rSource, A, SignedOffset);
+31.BITNUM,26.Source,21.0b11100100,13.A,12.0,11./,4.IndOff::::bbz r
+       nia = do_bbz (_SD, cia, nia, BITNUM, rSource, A, rIndOff);
+31.BITNUM,26.Source,21.0b11100100,13.A,12.1,11./::::bbz l
+       long_immediate (LSI);
+       nia = do_bbz (_SD, cia, nia, BITNUM, rSource, A, LSI);
+
+
+// bcnd[.a]
+#void::function::do_bcnd:int annul, int bitnum, unsigned_word offset, unsigned_word source
+#      sim_io_error ("bcnd");
+#31.BM,26.Source2,21.0b100110,A,14.SI::::and.tf i
+#      do_bcnd (_SD, A, SI, rSource2);
+#31.BM,26.Source2,21.0b11100110,A,0,11./,4.Source1::::and.tf r
+#      do_bcnd (_SD, A, rSource1, rSource2);
+#31.BM,26.Source2,21.0b11100110,A,1,11./::::and.tf l
+#      do_bcnd (_SD, A, LSI, rSource2);
+
+
+// br[.a] - see bbz[.a]
+
+
+// brcr
+#void::function::do_brcr:unsigned_word offset
+#      sim_io_error ("brcr");
+#31.//,27.0,26.//,21.0b0000110,14.CRN::::and.tf i
+#      do_brcr (_SD, rCRN_val);
+#31.//,27.0,26.//,21.0b110000110,0,11./,4.Source1::::and.tf r
+#      do_brcr (_SD, CRN[rSource1]);
+#31.//,27.0,26.//,21.0b110000110,1,11./::::and.tf l
+#      do_brcr (_SD, CRN[SL]);
+
+
+// bsr[.a]
+#void::function::do_bsr:int annul, int bitnum, unsigned_word offset, unsigned_word source
+#      sim_io_error ("bsr");
+#31.Link,26.//,21.0b100000,A,14.SI::::and.tf i
+#      do_bsr (_SD, A, LK, SI);
+#31.Link,26.//,21.0b11100000,A,0,11./,4.Source1::::and.tf r
+#      do_bsr (_SD, A, LK, rSource1);
+#31.Link,26.//,21.0b11100000,A,1,11./::::and.tf l
+#      do_bsr (_SD, A, LK, SL);
+
+
+// cmnd
+#31./,21.0b0000010,14.UI::::cmnd i
+#31./,21.0b110000010,12.0,11./,4.Source1::::cmnd r
+#31./,21.0b110000010,12.1,11./::::cmnd l
+
+
+// cmp
+#void::function::do_cmp:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("cmp");
+#31.Dest,26.Source2,21.0b1010000,14.SI::::cmp i
+#      do_cmp (_SD, *rDest, SI, rSource2);
+#31.Dest,26.Source2,21.0b111010000,0,11./,4.Source1::::cmp r
+#      do_cmp (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b111010000,1,11./::::cmp l
+#      do_cmp (_SD, *rDest, LSI, rSource2);
+
+
+// dcache
+#31./,27.F,26.S1,21.0b0111,M,00,14.SO::::dcache i
+#31./,27.F,26.S1,21.0b110111,M,00,12.0,11./,4.Source1::::dcache r
+#31./,27.F,26.S1,21.0b110111,M,00,12.1,11./::::dcache l
+
+
+// dld[{.b|.h|.d}]
+#void::function::do_dld:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("dld");
+#31.Dest,26.Source2,21.0b110100,m,sz,0,S,1,9./,4.Source1::::dld r
+#      do_dld (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11110100,m,sz,1,S,1,9./::::dld l
+#      do_dld (_SD, *rDest, LSI, rSource2);
+
+
+// dld.u[{.b|.h|.d}]
+#void::function::do_dld_u:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("dld.u");
+#31.Dest,26.Source2,21.0b110101,m,sz,0,S,1,9./,4.Source1::::dld.u r
+#      do_dld_u (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11110101,m,sz,1,S,1,9./::::dld.u l
+#      do_dld_u (_SD, *rDest, LSI, rSource2);
+
+
+// dst[{.b|.h|.d}]
+#void::function::do_dst:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("dst");
+#31.Dest,26.Source2,21.0b110110,m,sz,0,S,1,9./,4.Source1::::dst r
+#      do_dst (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11110110,m,sz,1,S,1,9./::::dst l
+#      do_dst (_SD, *rDest, LSI, rSource2);
+
+
+// estop
+#31./,21.0b1111111,1,0,0,11./::::estop
+
+
+// etrap
+#31./,27.1,26./,21.0b0000001,14.UTN::::etrap i
+#31./,27.1,26./,21.0b110000001,12.0,11./,4.iUTN::::etrap r
+#31./,27.1,26./,21.0b110000001,12.1,11./::::etrap l
+
+
+// exts - see shift.ds
+
+
+// extu - see shift.dz
+
+
+// fadd.{s|d}{s|d}{s|d}
+#void::function::do_fadd:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("fadd");
+#31.Dest,26.Source2,21.0b111110000,0,r,PD,P2,P1,4.Source1::::fadd r
+#      do_fadd (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11111110000,1,r,PD,P2,P1,4./::::fadd l
+#      do_fadd (_SD, *rDest, LSI, rSource2);
+
+
+// fcmp.{s|d}{s|d}{s|d}
+#void::function::do_fcmp:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("fcmp");
+#31.Dest,26.Source2,21.0b111110101,0,/,00,P2,P1,4.Source1::::fcmp r
+#      do_fcmp (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11111110101,1,/,00,P2,P1,4./::::fcmp l
+#      do_fcmp (_SD, *rDest, LSI, rSource2);
+
+
+// fdiv.{s|d}{s|d}{s|d}
+#void::function::do_fdiv:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("fdiv");
+#31.Dest,26.Source2,21.0b111110011,0,/,PD,P2,P1,4.Source1::::fdiv r
+#      do_fdiv (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11111110011,1,/,PD,P2,P1,4./::::fdiv l
+#      do_fdiv (_SD, *rDest, LSI, rSource2);
+
+
+// fmpy.{s|d|i|u}{s|d|i|u}{s|d|i|u}
+#void::function::do_fmpy:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("fmpy");
+#31.Dest,26.Source2,21.0b111110010,0,/,PD,P2,P1,4.Source1::::fmpy r
+#      do_fmpy (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11111110010,1,/,PD,P2,P1,4./::::fmpy l
+#      do_fmpy (_SD, *rDest, LSI, rSource2);
+
+
+// frndm.{s|d|i|u}{s|d|i|u}{s|d|i|u}
+#void::function::do_frndm:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("frndm");
+#31.Dest,26.Source2,21.0b111110100,0,r,PD,11,P1,4.Source1::::frndm r
+#      do_frndm (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11111110100,1,r,PD,11,P1,4./::::frndm l
+#      do_frndm (_SD, *rDest, LSI, rSource2);
+
+
+// frndn.{s|d|i|u}{s|d|i|u}{s|d|i|u}
+#void::function::do_frndn:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("frndn");
+#31.Dest,26.Source2,21.0b111110100,0,r,PD,00,P1,4.Source1::::frndn r
+#      do_frndn (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11111110100,1,r,PD,00,P1,4./::::frndn l
+#      do_frndn (_SD, *rDest, LSI, rSource2);
+
+
+// frndp.{s|d|i|u}{s|d|i|u}{s|d|i|u}
+#void::function::do_frndp:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("frndp");
+#31.Dest,26.Source2,21.0b111110100,0,r,PD,10,P1,4.Source1::::frndp r
+#      do_frndp (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11111110100,1,r,PD,10,P1,4./::::frndp l
+#      do_frndp (_SD, *rDest, LSI, rSource2);
+
+
+// frndz.{s|d|i|u}{s|d|i|u}{s|d|i|u}
+#void::function::do_frndz:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("frndz");
+#31.Dest,26.Source2,21.0b111110100,0,r,PD,01,P1,4.Source1::::frndz r
+#      do_frndz (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11111110100,1,r,PD,01,P1,4./::::frndz l
+#      do_frndz (_SD, *rDest, LSI, rSource2);
+
+
+// fsqrt.{s|d}{s|d}{s|d}
+#void::function::do_fsqrt:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("fsqrt");
+#31.Dest,26.Source2,21.0b111110111,0,/,PD,//,P1,4.Source1::::fsqrt r
+#      do_fsqrt (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11111110111,1,/,PD,//,P1,4./::::fsqrt l
+#      do_fsqrt (_SD, *rDest, LSI, rSource2);
+
+
+// fsub.{s|d}{s|d}{s|d}
+#void::function::do_fsub:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("fsub");
+#31.Dest,26.Source2,21.0b111110001,0,r,PD,P2,P1,4.Source1::::fsub r
+#      do_fsub (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11111110001,1,r,PD,P2,P1,4./::::fsub l
+#      do_fsub (_SD, *rDest, LSI, rSource2);
+
+
+// illop
+#31./,21.0b0000000,14./::::illop
+#31./,21.0b111111111,12./::::illop l
+
+
+// ins - see shift.im
+
+
+// jsr[.a]
+#void::function::do_jsr:int annul, int bitnum, unsigned_word offset, unsigned_word source
+#      sim_io_error ("jsr");
+#31.Link,26.Base,21.0b100010,A,14.SI::::and.tf i
+#      do_jsr (_SD, A, LK, SI);
+#31.Link,26.Base,21.0b11100010,A,0,11./,4.Source1::::and.tf r
+#      do_jsr (_SD, A, LK, rSource1);
+#31.Link,26.Base,21.0b11100010,A,1,11./::::and.tf l
+#      do_jsr (_SD, A, LK, SL);
+
+
+// ld[{.b.h.d}]
+#void::function::do_ld:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("dld.u");
+#31.Dest,26.Base,21.0b0100,m,sz,14.SI::::ld i
+#      do_ld (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Base,21.0b110100,m,sz,0,S,0,9./::::ld r
+#      do_ld (_SD, *rDest, LSI, rSource2);
+#31.Dest,26.Base,21.0b110100,m,sz,1,S,0,9./::::ld l
+#      do_ld (_SD, *rDest, LSI, rSource2);
+
+
+// ld.u[{.b.h.d}]
+#void::function::do_ld_u:unsigned_word *rDest, unsigned_word Source1, unsigned_word Source2
+#      sim_io_error ("dld.u");
+#31.Dest,26.Base,21.0b0100,m,sz,14.SI::::ld.u i
+#      do_ld_u (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Base,21.0b110100,m,sz,0,S,0,9./::::ld.u r
+#      do_ld_u (_SD, *rDest, LSI, rSource2);
+#31.Dest,26.Base,21.0b110100,m,sz,1,S,0,9./::::ld.u l
+#      do_ld_u (_SD, *rDest, LSI, rSource2);
+
+
+// lmo
+#31.Dest,26.Source,111111000,0,11./::::lmo
+
+
+// nop
+#31.0,26.0,21.0b0000100,14.0::::nop
+
+
+#void::function::do_or:unsigned_word *rDest, unsigned_word source1, unsigned_word source2
+#      *rD = source1 | source2;
+
+
+// or, or.tt
+#31.Dest,26.Source2,21.0b0010111,14.SI::::or.tt i
+#      do_or (_SD, *rDest, SI, rSource2);
+#31.Dest,26.Source2,21.0b110010111,0,11./,4.Source1::::or.tt r
+#      do_or (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b110010111,1,11./::::or.tt l
+#      do_or (_SD, *rDest, LSI, rSource2);
+
+
+// or.ff
+#31.Dest,26.Source2,21.0b0011110,14.SI::::or.ff i
+#      do_or (_SD, *rDest, ~SI, ~rSource2);
+#31.Dest,26.Source2,21.0b110011110,0,11./,4.Source1::::or.ff r
+#      do_or (_SD, *rDest, ~rSource1, ~rSource2);
+#31.Dest,26.Source2,21.0b110011110,1,11./::::or.ff l
+#      do_or (_SD, *rDest, ~LSI, ~rSource2);
+
+
+// or.ft
+#31.Dest,26.Source2,21.0b0011101,14.SI::::or.ft i
+#      do_or (_SD, *rDest, ~SI, rSource2);
+#31.Dest,26.Source2,21.0b110011101,0,11./,4.Source1::::or.ft r
+#      do_or (_SD, *rDest, ~rSource1, rSource2);
+#31.Dest,26.Source2,21.0b110011101,1,11./::::or.ft l
+#      do_or (_SD, *rDest, ~LSI, rSource2);
+
+
+// or.tf
+#31.Dest,26.Source2,21.0b0011011,14.SI::::or.tf i
+#      do_or (_SD, *rDest, SI, ~rSource2);
+#31.Dest,26.Source2,21.0b110011011,0,11./,4.Source1::::or.tf r
+#      do_or (_SD, *rDest, rSource1, ~rSource2);
+#31.Dest,26.Source2,21.0b110011011,1,11./::::or.tf l
+#      do_or (_SD, *rDest, LSI, ~rSource2);
+
+
+// rdcr
+#31.Dest,26.0,21.0b0000100,14.UCRN::::rdcr i
+#31.Dest,26.0,21.0b110000100,0,11./,4.INDCR::::rdcr r
+#31.Dest,26.0,21.0b110000100,1,11./::::rdcr l
+
+
+// rmo
+#31.Dest,26.Source,21.0b111111001,0,11./::::rmo
+
+
+// rotl - see shift.dz
+
+
+//rotr - see shift.dz
+
+
+// shl - see shift.iz
+
+
+// sl.{d|e|i}{m|s|z}
+#31.Dest,26.Source,21.0b0001,17.Merge,14./,11.0,0,9.EndMask::::4.Rotate:sl i
+#31.Dest,26.Source,21.0b110001,15.Merge,12.0,11.0,0,9.EndMask::::4.RotReg:sl r
+
+
+// sli.{d|e|i}{m|s|z}
+#31.Dest,26.Source,21.0b0001,17.Merge,14./,11.1,0,9.EndMask::::4.Rotate:sli i
+#31.Dest,26.Source,21.0b110001,15.Merge,12.0,11.1,0,9.EndMask::::4.RotReg:sli r
+
+
+// sr.{d|e|i}{m|s|z}
+#31.Dest,26.Source,21.0b0001,17.Merge,14./,11.0,1,9.EndMask::::4.Rotate:sr i
+#31.Dest,26.Source,21.0b110001,15.Merge,12.0,11.0,1,9.EndMask::::4.RotReg:sr r
+
+
+// sra - see sr.es
+
+
+// sri.{d|e|i}{m|s|z}
+#31.Dest,26.Source,21.0b0001,17.Merge,14./,11.1,1,9.EndMask::::4.Rotate:sri i
+#31.Dest,26.Source,21.0b110001,15.Merge,12.0,11.1,1,9.EndMask::::4.RotReg:sri r
+
+
+// srl - see sr.ez
+
+
+// st[{.b|.h|.d}]
+#31.Dest,26.Base,21.0b0110,m,sz,14.SO::::st i
+#31.Dest,26.Base,21.0b110110,m,sz,0,S,0,14./,4.IO::::st i
+#31.Dest,26.Base,21.0b110110,m,sz,1,S,0,14./::::st i
+
+
+// sub
+#void::function::do_sub:signed_word *rDest, signed_word Source1, signed_word Source2
+#      ALU_BEGIN (Source1);
+#      ALU_SUB (Source2);
+#      ALU_END (*rD);  
+#31.Dest,26.Source2,21.0b101100,0,14.SI::::sub i
+#      do_sub (_SD, *rDest, SI, rSource2);
+#31.Dest,26.Source2,21.0b11101100,0,0,11./,4.Source1::::sub r
+#      do_sub (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11101100,0,1,11./::::sub l
+#      do_sub (_SD, *rDest, LSI, rSource2);
+
+
+// subu
+#void::function::do_subu:signed_word *rDest, signed_word Source1, signed_word Source2
+#      ALU_BEGIN (Source1);
+#      ALU_SUBU (Source2);
+#      ALU_END (*rD);  
+#31.Dest,26.Source,21.0b101100,0,14.SI::::subu i
+#      do_subu (_SD, *rDest, SI, rSource2);
+#31.Dest,26.Source,21.0b11101100,0,0,11./,4.Source1::::subu r
+#      do_subu (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source,21.0b11101100,0,1,11./::::subu l
+#      do_subu (_SD, *rDest, LSI, rSource2);
+
+
+// swcr
+#void::function::do_swcr:signed_word *rDest, signed_word Source1, signed_word Source2
+#31.Dest,26.Source,21.0b000010,1,14.SI::::swcr i
+#      do_swcr (_SD, *rDest, SI, rSource2);
+#31.Dest,26.Source,21.0b11000010,1,0,11./,4.INDCR::::swcr r
+#      do_swcr (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source,21.0b11000010,1,1,11./::::swcr l
+#      do_swcr (_SD, *rDest, LSI, rSource2);
+
+
+// trap
+void::function::do_trap:instruction_address cia, unsigned_word trap_number
+       if (trap_number == 72)
+         {
+           switch (GPR(2))
+             {
+             case 1: /* EXIT */
+               {
+                 engine_halt (SD, cia, sim_exited, GPR(3));
+                 break;
+               }
+             case 4: /* WRITE */
+               {
+                 int i;
+                 if (GPR(3) != 1)
+                   engine_error (SD, cia, "write to invalid fid %d", GPR(3));
+                 for (i = 0; i < GPR(5); i++)
+                   {
+                     char c;
+                     c = MEM (unsigned, GPR(4) + i, 1);
+                     sim_io_write_stdout (SD, &c, 1);
+                   }
+                 GPR(2) = GPR(5);
+                 break;
+               }
+             default:
+               engine_error (SD, cia, "unknown trap %d", GPR(2));
+             }
+         }
+31./,27.0,26./,21.0b0000001,14.UTN::::trap i
+       do_trap (_SD, cia, UTN);
+31./,27.0,26./,21.0b110000001,12.0,11./,4.INDTR::::trap r
+       do_trap (_SD, cia, UTN);
+31./,27.0,26./,21.0b110000001,12.1,11./::::trap l
+       long_immediate (UTN);
+       do_trap (_SD, cia, UTN);
+
+
+// vadd.{s|d}{s|d}
+#void::function::do_vadd:signed_word *rDest, signed_word Source1, signed_word Source2
+#31.*,26.Dest,21.0b11110,r,000,r,*,**,7.PD,6.*,5.P1,4.Source::::vadd r
+#      do_vadd (_SD, *rDest, SI, rSource2);
+#31.*,26.Dest,21.0b1111110,r,000,r,*,**,7.PD,6.*,5.P1,4./::::vadd l
+#      do_vadd (_SD, *rDest, LSI, rSource2);
+
+
+// vld{0|1}.{s|d}
+#31.Dest,26.*,21.0b11110,18.*,10.1,S,**,p,******::::vld r
+
+
+// vmac.ss{s|d}
+#31.*,26.Source2,21.0b11110,a,110,0,a,**,Z,r,*,r,4.Source1::::vmac.ss ra
+#31.Dest,26.Source2,21.0b11110,a,110,0,a,**,Z,r,*,r,4.Source1::::vmac.ss rr
+#31.*,26.Source2,21.0b11110,a,110,0,a,**,Z,r,*,r,4.Source1::::vmac.ss ia
+#31.Dest,26.Source2,21.0b11110,a,110,0,a,**,Z,r,*,r,4.Source1::::vmac.ss ir
+
+
+// vmpy.{s|d}{s|d}
+#void::function::do_vmpy:signed_word *rDest, signed_word Source1, signed_word Source2
+#31.*,26.Dest,21.0b11110,r,000,r,*,**,7.PD,6.*,5.P1,4.Source::::vmpy r
+#      do_vmpy (_SD, *rDest, SI, rSource2);
+#31.*,26.Dest,21.0b1111110,r,000,r,*,**,7.PD,6.*,5.P1,4./::::vmpy l
+#      do_vmpy (_SD, *rDest, LSI, rSource2);
+
+
+// vmsc.ss{s|d}
+#31.*,26.Source2,21.0b11110,a,110,0,a,**,Z,r,*,r,4.Source1::::vmsc.ss ra
+#31.Dest,26.Source2,21.0b11110,a,110,0,a,**,Z,r,*,r,4.Source1::::vmsc.ss rr
+#31.*,26.Source2,21.0b11110,a,110,0,a,**,Z,r,*,r,4.Source1::::vmsc.ss ia
+#31.Dest,26.Source2,21.0b11110,a,110,0,a,**,Z,r,*,r,4.Source1::::vmsc.ss ir
+
+
+// vmsub.{s|d}{s|d}
+#void::function::do_vmsub:signed_word *rDest, signed_word Source1, signed_word Source2
+#31.*,26.Dest,21.0b11110,r,000,r,*,**,7.PD,6.*,5.P1,4.Source::::vmsub r
+#      do_vmsub (_SD, *rDest, SI, rSource2);
+#31.*,26.Dest,21.0b1111110,r,000,r,*,**,7.PD,6.*,5.P1,4./::::vmsub l
+#      do_vmsub (_SD, *rDest, LSI, rSource2);
+
+
+// vrnd.{s|d}{s|d}
+#void::function::do_vrnd:signed_word *rDest, signed_word Source1, signed_word Source2
+#31.*,26.Dest,21.0b11110,r,000,r,*,**,7.PD,6.*,5.P1,4.Source::::vrnd r
+#      do_vrnd (_SD, *rDest, SI, rSource2);
+#31.*,26.Dest,21.0b1111110,r,000,r,*,**,7.PD,6.*,5.P1,4./::::vrnd l
+#      do_vrnd (_SD, *rDest, LSI, rSource2);
+
+
+// vrnd.{i|u}{s|d}
+#void::function::do_vrnd:signed_word *rDest, signed_word Source1, signed_word Source2
+#31.*,26.Dest,21.0b11110,r,000,r,*,**,7.PD,6.*,5.P1,4.Source::::vrnd r
+#      do_vrnd (_SD, *rDest, SI, rSource2);
+#31.*,26.Dest,21.0b1111110,r,000,r,*,**,7.PD,6.*,5.P1,4./::::vrnd l
+#      do_vrnd (_SD, *rDest, LSI, rSource2);
+
+
+// vst.{s|d}
+#31.Source,26.*,21.0b1110,16.*,10.0,9.S,**,1,******::::vst
+
+
+// vsub.{i|u}{s|d}
+#void::function::do_vsub:signed_word *rDest, signed_word Source1, signed_word Source2
+#31.*,26.Dest,21.0b11110,r,000,r,*,**,7.PD,6.*,5.P1,4.Source::::vsub r
+#      do_vsub (_SD, *rDest, SI, rSource2);
+#31.*,26.Dest,21.0b1111110,r,000,r,*,**,7.PD,6.*,5.P1,4./::::vsub l
+#      do_vsub (_SD, *rDest, LSI, rSource2);
+
+
+// wrcr
+#void::function::do_wrcr:signed_word *rDest, signed_word Source1, signed_word Source2
+#31.Dest,26.Source,21.0b000010,1,14.SI::::wrcr i
+#      do_wrcr (_SD, *rDest, SI, rSource2);
+#31.Dest,26.Source,21.0b11000010,1,0,11./,4.INDCR::::wrcr r
+#      do_wrcr (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source,21.0b11000010,1,1,11./::::wrcr l
+#      do_wrcr (_SD, *rDest, LSI, rSource2);
+
+
+// xnor
+#void::function::do_xnor:signed_word *rDest, signed_word Source1, signed_word Source2
+#      ALU_BEGIN (Source1);
+#      ALU_XNOR (Source2);
+#      ALU_END (*rD);  
+#31.Dest,26.Source2,21.0b101100,0,14.SI::::xnor i
+#      do_xnor (_SD, *rDest, SI, rSource2);
+#31.Dest,26.Source2,21.0b11101100,0,0,11./,4.Source1::::xnor r
+#      do_xnor (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11101100,0,1,11./::::xnor l
+#      do_xnor (_SD, *rDest, LSI, rSource2);
+
+
+// xor
+#void::function::do_xor:signed_word *rDest, signed_word Source1, signed_word Source2
+#      ALU_BEGIN (Source1);
+#      ALU_XOR (Source2);
+#      ALU_END (*rD);  
+#31.Dest,26.Source2,21.0b101100,0,14.SI::::xor i
+#      do_xor (_SD, *rDest, SI, rSource2);
+#31.Dest,26.Source2,21.0b11101100,0,0,11./,4.Source1::::xor r
+#      do_xor (_SD, *rDest, rSource1, rSource2);
+#31.Dest,26.Source2,21.0b11101100,0,1,11./::::xor l
+#      do_xor (_SD, *rDest, LSI, rSource2);
diff --git a/sim/tic80/interp.c b/sim/tic80/interp.c
new file mode 100644 (file)
index 0000000..5845e06
--- /dev/null
@@ -0,0 +1,117 @@
+/*  This file is part of the GDB simulators.
+
+    Copyright (C) 1997, Free Software Foundation
+    Condtributed by Cyngnus Solutions.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    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, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+    */
+
+
+
+#include "sim-main.h"
+
+#include "idecode.h"
+
+#include <signal.h>
+
+void
+engine_init (SIM_DESC sd)
+{
+  memset (&STATE_CPU (sd, 0)->reg, 0, sizeof STATE_CPU (sd, 0)->reg);
+  memset (&STATE_CPU (sd, 0)->cia, 0, sizeof STATE_CPU (sd, 0)->cia);
+  CPU_STATE (STATE_CPU (sd, 0)) = sd;
+}
+
+
+/* Mechanisms for stopping/restarting the simulation */
+
+void
+engine_error (SIM_DESC sd,
+             instruction_address cia,
+             const char *fmt,
+             ...)
+{
+  va_list ap;
+  va_start (ap, fmt);
+  sim_io_evprintf (sd, fmt, ap);
+  va_end (ap);
+
+  if (sd->halt_ok)
+    {
+      sim_io_printf (sd, "\n");
+      engine_halt (sd, cia, sim_signalled, SIGABRT);
+    }
+  else
+    sim_io_error (sd, " - aborting simulation");
+}
+
+void
+engine_halt (SIM_DESC sd,
+            instruction_address cia,
+            enum sim_stop reason,
+            int siggnal)
+{
+  if (!sd->halt_ok)
+    sim_io_error (sd, "engine_halt - bad longjmp");
+  sd->reason = reason;
+  sd->siggnal = siggnal;
+  sd->halt_ok = 0;
+  sd->restart_ok = 0;
+  sd->cpu.cia = cia;
+  longjmp (sd->path_to_halt, 1);
+}
+
+void
+engine_restart (SIM_DESC sd,
+               instruction_address cia)
+{
+  if (!sd->restart_ok)
+    sim_io_error (sd, "engine_restart - bad longjmp");
+  sd->restart_ok = 0;
+  sd->cpu.cia = cia;
+  longjmp(sd->path_to_restart, 1);
+}
+
+
+void
+engine_run_until_stop (SIM_DESC sd,
+                      volatile int *keep_running)
+{
+  if (!setjmp (sd->path_to_halt))
+    {
+      instruction_address cia;
+      sd->halt_ok = 1;
+      setjmp (sd->path_to_restart);
+      sd->restart_ok = 1;
+      cia = STATE_CPU (sd, 0)->cia;
+      do
+       {
+         if (cia.ip == -1)
+           {
+             /* anulled instruction */
+             cia.ip = cia.dp;
+             cia.dp = cia.dp + sizeof (instruction_word);
+           }
+         else
+           {
+             instruction_word insn = IMEM (cia.ip);
+             cia = idecode_issue (sd, insn, cia);
+           }
+       }
+      while (*keep_running);
+      engine_halt (sd, cia, sim_stopped, SIGINT);
+    }
+}
diff --git a/sim/tic80/sim-calls.c b/sim/tic80/sim-calls.c
new file mode 100644 (file)
index 0000000..6c8098c
--- /dev/null
@@ -0,0 +1,212 @@
+/*  This file is part of the program psim.
+
+    Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
+    Copyright (C) 1997, Free Software Foundation
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    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, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+    */
+
+
+#include <signal.h> /* FIXME - should be machine dependant version */
+#include <stdarg.h>
+#include <ctype.h>
+
+#include "bfd.h"
+#include "sim-main.h"
+
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+
+
+#define SIM_ADDR unsigned
+
+/* Structures used by the simulator, for gdb just have static structures */
+
+struct sim_state simulation = { 0 };
+
+
+SIM_DESC
+sim_open (SIM_OPEN_KIND kind, char **argv)
+{
+  /*FIXME - later make these configurable */
+  static void *eit_ram;
+  static int sizeof_eit_ram = 0x1000;
+
+  STATE_OPEN_KIND (&simulation) = kind;
+
+  /* establish the simulator configuration */
+  sim_config (&simulation,
+             LITTLE_ENDIAN/*d30v always big endian*/);
+
+  if (sim_pre_argv_init (&simulation, argv[0]) != SIM_RC_OK)
+    return 0;
+
+  /* getopt will print the error message so we just have to exit if this fails.
+     FIXME: Hmmm...  in the case of gdb we need getopt to call
+     print_filtered.  */
+  if (sim_parse_args (&simulation, argv) != SIM_RC_OK)
+    return 0;
+
+  engine_init(&simulation);
+
+  /* external memory */
+  sim_core_attach(&simulation,
+                 attach_raw_memory,
+                 access_read_write_exec,
+                 0, 0x2000000, 0x100000, NULL, NULL);
+
+ /* FIXME: for now */
+  return (SIM_DESC) &simulation;
+}
+
+
+/* NOTE: sim_size is going away */
+void sim_size (int i);
+void
+sim_size (int i)
+{
+  sim_io_error (NULL, "unexpected call to sim_size()");
+}
+
+
+void
+sim_close (SIM_DESC sd, int quitting)
+{
+}
+
+
+SIM_RC
+sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty)
+{
+  extern bfd *sim_load_file (); /* ??? Don't know where this should live.  */
+  bfd *prog_bfd;
+
+  prog_bfd = sim_load_file (sd, STATE_MY_NAME (sd),
+                           STATE_CALLBACK (sd),
+                           prog,
+                           /* pass NULL for abfd, we always open our own */
+                           NULL,
+                           STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG);
+  if (prog_bfd == NULL)
+    return SIM_RC_FAIL;
+  sim_analyze_program (sd, prog_bfd);
+  return SIM_RC_OK;
+}
+
+
+void
+sim_kill (SIM_DESC sd)
+{
+}
+
+
+int
+sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)
+{
+  sim_io_error (sd, "sim_read");
+  return 0;
+}
+
+
+int
+sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)
+{
+  return sim_core_write_buffer (sd, sim_core_write_map,
+                               buf, mem, length);
+}
+
+
+void
+sim_fetch_register (SIM_DESC sd, int regno, unsigned char *buf)
+{
+  sim_io_error (sd, "sim_fetch_register");
+}
+
+
+void
+sim_store_register (SIM_DESC sd, int regno, unsigned char *buf)
+{
+  sim_io_error (sd, "sim_info");
+}
+
+
+void
+sim_info (SIM_DESC sd, int verbose)
+{
+}
+
+
+SIM_RC
+sim_create_inferior (SIM_DESC sd,
+                    char **argv,
+                    char **envp)
+{
+  STATE_CPU (sd, 0)->cia.ip = STATE_START_ADDR(sd);
+  STATE_CPU (sd, 0)->cia.dp = (STATE_START_ADDR(sd)
+                              + sizeof (instruction_word));
+  return SIM_RC_OK;
+}
+
+
+volatile int keep_running = 1;
+
+void
+sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
+{
+  *reason = simulation.reason;
+  *sigrc = simulation.siggnal;
+  keep_running = 1; /* ready for next run */
+}
+
+
+int
+sim_stop (SIM_DESC sd)
+{
+  keep_running = 0;
+  return 1;
+}
+
+void
+sim_resume (SIM_DESC sd, int step, int siggnal)
+{
+  /* keep_running = 1 - in sim_stop_reason */
+  if (step)
+    keep_running = 0;
+  engine_run_until_stop(sd, &keep_running);
+}
+
+void
+sim_do_command (SIM_DESC sd, char *cmd)
+{
+  sim_io_error (sd, "sim_do_command - unimplemented");
+}
+
+
+void
+sim_set_callbacks (SIM_DESC sd, host_callback *callback)
+{
+  STATE_CALLBACK (&simulation) = callback;
+}
diff --git a/sim/tic80/sim-main.h b/sim/tic80/sim-main.h
new file mode 100644 (file)
index 0000000..2f726f6
--- /dev/null
@@ -0,0 +1,107 @@
+/*  This file is part of the program psim.
+
+    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright (C) 1997, Free Software Foundation
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    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, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+    */
+
+
+#ifndef _SIM_MAIN_H_
+#define _SIM_MAIN_H_
+
+#include "sim-basics.h"
+#include "sim-inline.h"
+#include "sim-types.h"
+#include "sim-bits.h"
+#include "sim-endian.h"
+
+/* These are generated files.  */
+#include "itable.h"
+#include "idecode.h"
+#include "idecode.h"
+
+#include "cpu.h"
+#include "alu.h"
+
+#include "sim-core.h"
+#include "sim-events.h"
+#include "sim-io.h"
+
+
+struct sim_state {
+
+  /* real time */
+  sim_events events;
+
+  /* memory and IO */
+  sim_core core;
+
+  /* escape route for inner functions */
+  int halt_ok;
+  jmp_buf path_to_halt;
+  int restart_ok;
+  jmp_buf path_to_restart;
+
+  /* status from last halt */
+  enum sim_stop reason;
+  int siggnal;
+
+  /* the processors proper */
+  sim_cpu cpu;
+#define STATE_CPU(sd, n) (&(sd)->cpu)
+
+  /* The base class.  */
+  sim_state_base base;
+
+};
+
+/* (re) initialize the simulator */
+
+extern void engine_init
+(SIM_DESC sd);
+
+
+/* Mechanisms for stopping/restarting the simulation */
+
+extern void engine_error
+(SIM_DESC sd,
+ instruction_address cia,
+ const char *fmt,
+ ...);
+
+extern void engine_halt
+(SIM_DESC sd,
+ instruction_address cia,
+ enum sim_stop reason,
+ int siggnal);
+
+extern void engine_restart
+(SIM_DESC sd,
+ instruction_address cia);
+
+
+
+
+/* SIMULATE INSTRUCTIONS, various different ways of achieving the same
+   thing (others later) */
+
+extern void engine_run_until_stop
+(SIM_DESC sd,
+ volatile int *keep_running);
+
+
+#endif
This page took 0.073093 seconds and 4 git commands to generate.