Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
cray1_sim.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include "arith.internal.h"
#include "int64.h"
Include dependency graph for cray1_sim.c:

Go to the source code of this file.

Classes

union  u

Defines

#define YMP   7
#define C90   8
#define T3D   10
#define T90   11
#define T3E   12
#define CRAY_FLOAT_64   (UNROUNDED_TYPE(AR_Float_Cray1_64))
#define CRAY_FLOAT_128   (UNROUNDED_TYPE(AR_Float_Cray1_128))
#define CRAY_COMPLEX_64   (UNROUNDED_TYPE(AR_Complex_Cray1_64))
#define CRAY_COMPLEX_128   (UNROUNDED_TYPE(AR_Complex_Cray1_128))
#define IEEE_FLOAT_64   (UNROUNDED_TYPE(AR_Float_IEEE_NR_64))
#define IEEE_FLOAT_128   (UNROUNDED_TYPE(AR_Float_IEEE_NR_128))
#define IEEE_COMPLEX_64   (UNROUNDED_TYPE(AR_Complex_IEEE_NR_64))
#define IEEE_COMPLEX_128   (UNROUNDED_TYPE(AR_Complex_IEEE_NR_128))
#define DATA   0 /* Implicit data segment identifier */
#define STACK   1 /* Stack segment identifier */
#define STACK_SIZE   20480 /* # words to allocate for stack space */
#define MAX_ARGS   8 /* Max # of arguments supported */
#define MAX_EXT_ADDRS   16 /* Max # of EXT addresses passed */
#define RMMASK   6 /* Masks RM[01] bits in SR0 */
#define INTERRUPT_INV   8
#define INTERRUPT_DIV   16
#define INTERRUPT_OVF   32
#define INTERRUPT_UNF   64
#define INTERRUPT_INX   128
#define INTERRUPT_INP   256
#define DISASM0(fmt)
#define DISASM1(fmt, x)
#define DISASM2(fmt, x, y)
#define DISASM3(fmt, x, y, z)
#define DISASM4(fmt, x, y, z, v)
#define DISASM5(fmt, x, y, z, v, w)
#define DISASMB(b, c, ft)
#define DISASMT(t, c, ft)
#define DISASMV(v, ft)
#define set_a_size(s)
#define NOINTRIN   1 /* Unknown/unsupported intrinsic name */
#define ARITHERR   2 /* Arithmetic error detected by intrinsic */
#define EXTERROR   3 /* Unsupported external called by intrinsic */
#define SETERRNO   4 /* Set errno = ERANGE */
#define IFACEERR   5 /* Unsupported simulation interface */
#define HOSTEXT   6 /* Call host system external */
#define UNIMPL_INST   7 /* Unimplemented instruction encountered */
#define UNIMPL_PRFX   8 /* Unimplemented prefixed instruction encountered */
#define getp1(pc)   ( (((int) code[(pc)*2])<<8) | code[(pc)*2+1] )
#define prefix_check(p)   if (p) { status = UNIMPL_PRFX; break; } else
#define LO32(i)   ((int64) (((u*)&(i))->ui32.p2))
#define HI32(i)   ((int64) (((u*)&(i))->ui32.p1))
#define CRAY_AHDR_SIZE   8 /* # words in cray a.out files */
#define PAGESZ   256 /* # words in data space pages read in */
#define PAGESHFT   8 /* Shift to get page # */

Typedefs

typedef unsigned long long int64

Functions

static void open_arith_file ()
static int64 load_pvp_word (long vaddr)
static void store_pvp_word (long vaddr, int64 word)
static int ar_imul64u (int64 *result, int64 opnd1, int64 opnd2)
int ar_clear_sim_state (AR_TYPE resulttype)
int ar_ext_address (int64 *intaddr, const char *extaddr, int length)
int ar_pass_arg_address (const ar_data *arg, const AR_TYPE *argtype)
int ar_pass_ext_address (int64 *extdesc, const char *addr, int nwords)
int ar_pass_fcd_address (const char *str, long lenstr)
int ar_pass_arg_value (const ar_data *arg, const AR_TYPE *argtype)
int ar_put_real_address (AR_INT_64 *extdesc)
int ar_get_function_value (ar_data *result, AR_TYPE *resulttype)
static int call_host_external (char *func)
static int ar_check_status (int status, AR_IEEE_64 *rr)
int ar_sim (char *intrinsic)

Variables

static const char USMID [] = "@(#)30/cray1_sim.c 30.0 03/18/98 12:06:00"
int ar_mach_type = 0
int ar_rounding_modes = 0
int ar_underflow_modes = 0
char AR_libmv2 []
char AR_version []
static AR_TYPE integer_64_s = AR_Int_64_S
static AR_TYPE integer_64_u = AR_Int_64_U
static AR_TYPE integer_128_s = AR_Int_128_S
static AR_TYPE integer_128_u = AR_Int_128_U
static AR_TYPE cray_float_64 = (AR_TYPE) CRAY_FLOAT_64
static AR_TYPE cray_float_128 = (AR_TYPE) CRAY_FLOAT_128
static AR_TYPE cray_complex_64 = (AR_TYPE) CRAY_COMPLEX_64
static AR_TYPE cray_complex_128 = (AR_TYPE) CRAY_COMPLEX_128
static AR_TYPE ieee_float_64 = (AR_TYPE) IEEE_FLOAT_64
static AR_TYPE ieee_float_128 = (AR_TYPE) IEEE_FLOAT_128
static AR_TYPE ieee_complex_64 = (AR_TYPE) IEEE_COMPLEX_64
static AR_TYPE ieee_complex_128 = (AR_TYPE) IEEE_COMPLEX_128
static int ar_sim_version = 0
static unsigned char * code = NULL
static int64stack = NULL
static int JSZP
static int VSZ
static int64 AMASK
static int64 ASB
static int64 A [8]
static int64 S [8]
static int64 B [64]
static int64 T [64]
static int SR0
static int VL
static int64 VM
static int64 VM1
static int64V
static int numargs
static int numargwds
static int n_external_addresses
static char * external_address [MAX_EXT_ADDRS]
static long external_length [MAX_EXT_ADDRS]
static int idf_fd
static long idf_size
static long text_size
static long data_size
static long data_offset
static int shared_text = 0
static long data_address
static int64 ** data_page
static int ndata_pages

Define Documentation

#define ARITHERR   2 /* Arithmetic error detected by intrinsic */

Definition at line 651 of file cray1_sim.c.

Referenced by ar_sim().

#define C90   8

Definition at line 53 of file cray1_sim.c.

Referenced by open_arith_file().

#define CRAY_AHDR_SIZE   8 /* # words in cray a.out files */

Definition at line 3229 of file cray1_sim.c.

Referenced by open_arith_file().

#define DATA   0 /* Implicit data segment identifier */

Definition at line 103 of file cray1_sim.c.

Referenced by ar_ext_address(), load_pvp_word(), and store_pvp_word().

#define DISASM0 (   fmt)

Definition at line 215 of file cray1_sim.c.

Referenced by ar_sim().

#define DISASM1 (   fmt,
 
)

Definition at line 216 of file cray1_sim.c.

Referenced by ar_sim().

#define DISASM2 (   fmt,
  x,
 
)

Definition at line 217 of file cray1_sim.c.

Referenced by ar_sim().

#define DISASM3 (   fmt,
  x,
  y,
 
)

Definition at line 218 of file cray1_sim.c.

Referenced by ar_sim().

#define DISASM4 (   fmt,
  x,
  y,
  z,
 
)

Definition at line 219 of file cray1_sim.c.

Referenced by ar_sim().

#define DISASM5 (   fmt,
  x,
  y,
  z,
  v,
 
)

Definition at line 220 of file cray1_sim.c.

Referenced by ar_sim().

#define DISASMB (   b,
  c,
  ft 
)

Definition at line 221 of file cray1_sim.c.

Referenced by ar_sim().

#define DISASMT (   t,
  c,
  ft 
)

Definition at line 222 of file cray1_sim.c.

Referenced by ar_sim().

#define DISASMV (   v,
  ft 
)

Definition at line 223 of file cray1_sim.c.

Referenced by ar_sim().

#define EXTERROR   3 /* Unsupported external called by intrinsic */

Definition at line 652 of file cray1_sim.c.

Referenced by ar_sim().

#define getp1 (   pc)    ( (((int) code[(pc)*2])<<8) | code[(pc)*2+1] )

Definition at line 663 of file cray1_sim.c.

Referenced by ar_sim().

#define HI32 (   i)    ((int64) (((u*)&(i))->ui32.p1))

Definition at line 3195 of file cray1_sim.c.

Referenced by ar_imul64u().

#define HOSTEXT   6 /* Call host system external */

Definition at line 655 of file cray1_sim.c.

Referenced by ar_sim().

#define IFACEERR   5 /* Unsupported simulation interface */

Definition at line 654 of file cray1_sim.c.

Referenced by ar_sim().

#define INTERRUPT_DIV   16

Definition at line 148 of file cray1_sim.c.

Referenced by ar_check_status(), and ar_sim().

#define INTERRUPT_INP   256

Definition at line 152 of file cray1_sim.c.

Referenced by ar_sim().

#define INTERRUPT_INV   8

Definition at line 147 of file cray1_sim.c.

Referenced by ar_check_status(), and ar_sim().

#define INTERRUPT_INX   128

Definition at line 151 of file cray1_sim.c.

Referenced by ar_sim().

#define INTERRUPT_OVF   32

Definition at line 149 of file cray1_sim.c.

Referenced by ar_check_status(), and ar_sim().

#define INTERRUPT_UNF   64

Definition at line 150 of file cray1_sim.c.

Referenced by ar_sim().

#define LO32 (   i)    ((int64) (((u*)&(i))->ui32.p2))

Definition at line 3194 of file cray1_sim.c.

Referenced by ar_imul64u().

#define MAX_ARGS   8 /* Max # of arguments supported */
#define MAX_EXT_ADDRS   16 /* Max # of EXT addresses passed */

Definition at line 109 of file cray1_sim.c.

Referenced by ar_ext_address().

#define NOINTRIN   1 /* Unknown/unsupported intrinsic name */

Definition at line 650 of file cray1_sim.c.

Referenced by ar_sim().

#define PAGESHFT   8 /* Shift to get page # */

Definition at line 3232 of file cray1_sim.c.

Referenced by load_pvp_word(), open_arith_file(), and store_pvp_word().

#define PAGESZ   256 /* # words in data space pages read in */

Definition at line 3231 of file cray1_sim.c.

Referenced by load_pvp_word(), open_arith_file(), and store_pvp_word().

#define prefix_check (   p)    if (p) { status = UNIMPL_PRFX; break; } else

Definition at line 666 of file cray1_sim.c.

Referenced by ar_sim().

#define RMMASK   6 /* Masks RM[01] bits in SR0 */

Definition at line 145 of file cray1_sim.c.

Referenced by ar_sim().

#define set_a_size (   s)

Definition at line 225 of file cray1_sim.c.

Referenced by open_arith_file().

#define SETERRNO   4 /* Set errno = ERANGE */

Definition at line 653 of file cray1_sim.c.

Referenced by ar_sim().

#define STACK   1 /* Stack segment identifier */
#define STACK_SIZE   20480 /* # words to allocate for stack space */
#define T3D   10

Definition at line 54 of file cray1_sim.c.

Referenced by open_arith_file().

#define T3E   12

Definition at line 56 of file cray1_sim.c.

Referenced by open_arith_file().

#define T90   11

Definition at line 55 of file cray1_sim.c.

Referenced by ar_pass_fcd_address(), ar_sim(), and open_arith_file().

#define UNIMPL_INST   7 /* Unimplemented instruction encountered */

Definition at line 656 of file cray1_sim.c.

Referenced by ar_sim().

#define UNIMPL_PRFX   8 /* Unimplemented prefixed instruction encountered */

Definition at line 657 of file cray1_sim.c.

Referenced by ar_sim().

#define YMP   7

Definition at line 52 of file cray1_sim.c.

Referenced by open_arith_file().


Typedef Documentation

typedef unsigned long long int64

Definition at line 98 of file cray1_sim.c.


Function Documentation

static int ar_imul64u ( int64 result,
int64  opnd1,
int64  opnd2 
) [static]

Definition at line 3198 of file cray1_sim.c.

References AR_STAT_OK, HI32, and LO32.

Referenced by ar_sim().

int ar_pass_arg_address ( const ar_data arg,
const AR_TYPE argtype 
)
int ar_pass_arg_value ( const ar_data arg,
const AR_TYPE argtype 
)

Definition at line 475 of file cray1_sim.c.

Referenced by ar_cabs(), ar_exp(), ar_log(), ar_power(), and ar_sqrt().

int ar_pass_ext_address ( int64 extdesc,
const char *  addr,
int  nwords 
)

Definition at line 380 of file cray1_sim.c.

References ar_ext_address(), ar_internal_error(), AR_STAT_OK, IS_ERROR_STATUS, MAX_ARGS, NULL, numargs, numargwds, S, STACK, STACK_SIZE, and store_pvp_word().

Referenced by ar_convert_str_to_float(), ar_reshape(), and ar_transfer().

Here is the call graph for this function:

int ar_pass_fcd_address ( const char *  str,
long  lenstr 
)

Definition at line 427 of file cray1_sim.c.

Referenced by ar_index(), ar_scan(), and ar_verify().

int ar_put_real_address ( AR_INT_64 extdesc)

Definition at line 537 of file cray1_sim.c.

Referenced by ar_reshape(), and ar_transfer().

static int call_host_external ( char *  func) [static]

Definition at line 632 of file cray1_sim.c.

References ar_ext_address(), AR_STAT_UNDEFINED, and S.

Referenced by ar_sim().

Here is the call graph for this function:

static int64 load_pvp_word ( long  vaddr) [static]
static void store_pvp_word ( long  vaddr,
int64  word 
) [static]

Variable Documentation

int64 A[8] [static]

Definition at line 122 of file cray1_sim.c.

Referenced by ar_sim(), and NAME().

int64 AMASK [static]

Definition at line 119 of file cray1_sim.c.

Referenced by ar_sim(), and open_arith_file().

char AR_libmv2[]

Definition at line 39 of file edition.c.

Referenced by open_arith_file(), and open_intrinsics_file().

int ar_mach_type = 0

Definition at line 63 of file cray1_sim.c.

Referenced by ar_pass_fcd_address(), ar_sim(), open_arith_file(), and open_intrinsics_file().

Definition at line 64 of file cray1_sim.c.

int ar_sim_version = 0 [static]

Definition at line 101 of file cray1_sim.c.

Referenced by ar_sim().

Definition at line 65 of file cray1_sim.c.

char AR_version[]

Definition at line 38 of file edition.c.

Referenced by ar_internal_error().

int64 ASB [static]

Definition at line 120 of file cray1_sim.c.

Referenced by ar_sim(), and open_arith_file().

int64 B[64] [static]

Definition at line 125 of file cray1_sim.c.

Referenced by ar_sim().

Definition at line 88 of file cray1_sim.c.

Referenced by ar_get_function_value().

Definition at line 87 of file cray1_sim.c.

Referenced by ar_get_function_value().

Definition at line 86 of file cray1_sim.c.

Referenced by ar_get_function_value().

Definition at line 85 of file cray1_sim.c.

Referenced by ar_get_function_value().

long data_address [static]

Definition at line 3240 of file cray1_sim.c.

Referenced by load_pvp_word(), and open_arith_file().

long data_offset [static]

Definition at line 3238 of file cray1_sim.c.

Referenced by load_pvp_word(), open_arith_file(), and store_pvp_word().

int64** data_page [static]

Definition at line 3242 of file cray1_sim.c.

Referenced by load_pvp_word(), open_arith_file(), and store_pvp_word().

long data_size [static]

Definition at line 140 of file cray1_sim.c.

Referenced by ar_ext_address(), ar_put_real_address(), load_pvp_word(), and store_pvp_word().

Definition at line 141 of file cray1_sim.c.

Referenced by ar_ext_address(), load_pvp_word(), and store_pvp_word().

int idf_fd [static]

Definition at line 3234 of file cray1_sim.c.

Referenced by load_pvp_word(), and open_arith_file().

long idf_size [static]

Definition at line 3235 of file cray1_sim.c.

Referenced by load_pvp_word(), and open_arith_file().

Definition at line 93 of file cray1_sim.c.

Referenced by ar_get_function_value().

Definition at line 92 of file cray1_sim.c.

Referenced by ar_get_function_value().

Definition at line 91 of file cray1_sim.c.

Referenced by ar_get_function_value().

Definition at line 90 of file cray1_sim.c.

Referenced by ar_get_function_value(), and ar_sim().

Definition at line 82 of file cray1_sim.c.

Definition at line 83 of file cray1_sim.c.

Definition at line 80 of file cray1_sim.c.

Definition at line 81 of file cray1_sim.c.

int JSZP [static]

Definition at line 116 of file cray1_sim.c.

Referenced by ar_sim(), and open_arith_file().

int ndata_pages [static]

Definition at line 3243 of file cray1_sim.c.

Referenced by load_pvp_word(), open_arith_file(), and store_pvp_word().

int shared_text = 0 [static]

Definition at line 3239 of file cray1_sim.c.

Referenced by open_arith_file().

int SR0 [static]

Definition at line 128 of file cray1_sim.c.

Referenced by ar_check_status(), and ar_sim().

int64* stack = NULL [static]

Definition at line 112 of file cray1_sim.c.

Referenced by ar_pass_arg_address(), load_pvp_word(), open_arith_file(), and store_pvp_word().

long text_size [static]

Definition at line 3236 of file cray1_sim.c.

Referenced by open_arith_file().

const char USMID[] = "@(#)30/cray1_sim.c 30.0 03/18/98 12:06:00" [static]

Definition at line 35 of file cray1_sim.c.

int64* V [static]

Definition at line 133 of file cray1_sim.c.

Referenced by ar_sim(), and open_arith_file().

int VL [static]

Definition at line 130 of file cray1_sim.c.

Referenced by ar_sim().

int64 VM [static]

Definition at line 131 of file cray1_sim.c.

Referenced by ar_sim().

int64 VM1 [static]

Definition at line 132 of file cray1_sim.c.

Referenced by ar_sim().

int VSZ [static]

Definition at line 117 of file cray1_sim.c.

Referenced by ar_sim(), and open_arith_file().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines