/* Pfe module: slbench-ext.c ^Forth input: slbench.hf Date: 06-Dec-2002 09:53:21 Translator: 0.1.6 */ #define _P4_SOURCE 1 /* pfe register variables, etc. */ #include /* Compiler switches for extra registers are NO_EXTRA_REGS, HF_TOSREG, and HF_FTOSREG.*/ #if !defined NO_EXTRA_REGS #if defined __target_arch_ppc register int hf_index asm ("21"); /* top DO ... LOOP params */ register int hf_limit asm ("22"); #ifdef HF_TOSREG register int TOS asm ("23"); register int hf_flag asm ("24"); #endif /* HF_TOSREG */ #ifdef HF_FTOSREG register double FTOS asm ("f14"); #endif /* HF_FTOSREG */ #elif defined __target_arch_i386 static int hf_index; /* top DO ... LOOP params */ static int hf_limit; #undef HF_TOSREG #ifdef HF_FTOSREG /* THIS DOES NOT WORK! */ register double FTOS asm ("%st(7)"); #endif /* HF_FTOSREG */ #elif defined __target_cpu_hppa register int hf_index asm ("r11"); /* top DO ... LOOP params */ register int hf_limit asm ("r10"); #ifdef HF_TOSREG register int TOS asm ("r9"); register int hf_flag asm ("r8"); #endif /* HF_TOSREG */ #ifdef HF_FTOSREG register double FTOS asm ("fr21"); #endif /* HF_FTOSREG */ #else #define NO_EXTRA_REGS 1 #warning Unknown architecture, using no extra register variables. #endif #endif /* !defined NO_EXTRA_REGS */ #ifdef NO_EXTRA_REGS static int hf_index; /* top DO ... LOOP params */ static int hf_limit; #undef HF_TOSREG #undef HF_FTOSREG #endif /* NO_EXTRA_REGS */ #ifdef HF_TOSREG #define HF_FILL_TOS TOS = *SP; /* note ";" in these two */ #define HF_SPILL_TOS *SP = TOS; #define HF_PUSH(A) *SP-- = TOS; TOS = (A) #define HF_POP(A) (A) = TOS; TOS = *++SP #define HF_DROP1 TOS = *++SP #define HF_DROP2 SP += 2; TOS = *SP #define HF_IF HF_POP(hf_flag); if (hf_flag) #define HF_NIF HF_POP(hf_flag); if (!hf_flag) #define HF_UNTIL HF_POP(hf_flag);}while (!hf_flag) #define HF_NUNTIL HF_POP(hf_flag);}while (hf_flag) #else #define TOS *SP #define HF_FILL_TOS #define HF_SPILL_TOS #define HF_PUSH(A) *--SP = (A) #define HF_POP(A) (A) = *SP++ #define HF_DROP1 SP += 1 #define HF_DROP2 SP += 2 #define HF_IF if (*SP++) #define HF_NIF if (!*SP++) #define HF_UNTIL }while (!*SP++) #define HF_NUNTIL }while (*SP++) #endif /* HF_TOSREG */ #ifdef HF_FTOSREG #define HF_FILL_FTOS FTOS = *FP; /* note ";" in these two */ #define HF_SPILL_FTOS *FP = FTOS; #define HF_FPUSH(A) *FP-- = FTOS; FTOS = (A) #define HF_FPOP(A) (A) = FTOS; FTOS = *++FP #define HF_FDROP1 FTOS = *++FP #define HF_FDROP2 FP += 2; FTOS = *FP #define HF_FDROP3 FP += 3; FTOS = *FP #else #define FTOS *FP #define HF_FILL_FTOS #define HF_SPILL_FTOS #define HF_FPUSH(A) *--FP = (A) #define HF_FPOP(A) (A) = *FP++ #define HF_FDROP1 FP += 1 #define HF_FDROP2 FP += 2 #define HF_FDROP3 FP += 3 #endif /* HF_FTOSREG */ /* The basic pfe include. */ #include /* Extra includes. */ /* #include */ #include #define zero 0 #define one 1 #define two 2 #define three 3 #define four 4 #define five 5 #define six 6 #define seven 7 #define eight 8 #define nine 9 #define ten 10 #define sixteen 16 #define minus_one -1 #define minus_two -2 #define minus_three -3 #define minus_four -4 #define minus_five -5 #define bl 32 #define true -1 #define false 0 FCode (p4_dot); FCode (p4_abort); FCode (p4_char); FCode (p4_cr); FCode (p4_emit); FCode (p4_roll); FCode (p4_source); FCode (p4_space); FCode (p4_spaces); FCode (p4_type); FCode (p4_to_float); FCode (p4_d_to_f); FCode (p4_f_to_d); FCode (p4_f_round); FCode (p4_represent); FCode (p4_f_dot); FCode (p4_f_e_dot); FCode (p4_f_s_dot); FCode (hf_f_proximate); #define f_zero .0000000000E0 FCode (hfi_f_zero) { *--FP = f_zero; } #define f_one .1000000000E1 FCode (hfi_f_one) { *--FP = f_one; } #define f_two .2000000000E1 FCode (hfi_f_two) { *--FP = f_two; } #define f_six .6000000000E1 FCode (hfi_f_six) { *--FP = f_six; } #define f_half .5000000000E0 FCode (hfi_f_half) { *--FP = f_half; } FCode (hf_sqr); FCode (hfi_sqr) { HF_FILL_TOS HF_FILL_FTOS hf_sqr_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_sqr) { #ifdef HF_FTOSREG *FP-- = FTOS; #else FP--; FP[0] = FP[1]; #endif { double res = FTOS * FP[1]; FP++; FTOS = res; } } FCode (hf_mag2); FCode (hfi_mag2) { HF_FILL_TOS HF_FILL_FTOS hf_mag2_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_mag2) { hf_sqr_ (); { double h = FP[1]; FP[1] = FTOS; FTOS = h; } hf_sqr_ (); { double res = FTOS + FP[1]; FP++; FTOS = res; } } #define SVSIZE 3 FCode (hfi_SVSIZE) { *--SP = SVSIZE; } FCode (hf_sv_store); FCode (hfi_sv_store) { HF_FILL_TOS HF_FILL_FTOS hf_sv_store_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_sv_store) { HF_PUSH(3); --TOS; TOS *= sizeof (double); { p4cell res = TOS + SP[1]; SP++; TOS = res; } HF_PUSH(3); HF_PUSH(0); { RP -= 2; RP[0] = (p4xt *) hf_index; RP[1] = (p4xt *) hf_limit; hf_index = TOS; hf_limit = SP[1]; HF_DROP2; while (hf_index < hf_limit){ #ifdef HF_TOSREG *SP-- = TOS; #else SP--; SP[0] = SP[1]; #endif *(double *) TOS = FTOS; HF_DROP1; HF_FDROP1; HF_PUSH(1); TOS *= sizeof (double); { p4cell res = SP[1] - TOS; SP++; TOS = res; } hf_index++; } hf_index = (int) *RP++; hf_limit = (int) *RP++; } HF_DROP1; } FCode (hf_sv_fetch); FCode (hfi_sv_fetch) { HF_FILL_TOS HF_FILL_FTOS hf_sv_fetch_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_sv_fetch) { HF_PUSH(3); HF_PUSH(0); { RP -= 2; RP[0] = (p4xt *) hf_index; RP[1] = (p4xt *) hf_limit; hf_index = TOS; hf_limit = SP[1]; HF_DROP2; while (hf_index < hf_limit){ #ifdef HF_TOSREG *SP-- = TOS; #else SP--; SP[0] = SP[1]; #endif HF_FPUSH (*(double *) TOS); HF_DROP1; TOS += sizeof (double); hf_index++; } hf_index = (int) *RP++; hf_limit = (int) *RP++; } HF_DROP1; } FCode (hf_sv_plus); FCode (hfi_sv_plus) { HF_FILL_TOS HF_FILL_FTOS hf_sv_plus_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_sv_plus) { HF_PUSH(3); HF_PUSH(0); { RP -= 2; RP[0] = (p4xt *) hf_index; RP[1] = (p4xt *) hf_limit; hf_index = TOS; hf_limit = SP[1]; HF_DROP2; while (hf_index < hf_limit){ #ifdef HF_TOSREG SP[0] = TOS; SP -= 2; SP[1] = SP[3]; #else SP -= 2; SP[0] = SP[2]; SP[1] = SP[3]; #endif HF_FPUSH (*(double *) TOS); HF_DROP1; HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS + FP[1]; FP++; FTOS = res; } TOS += sizeof (double); { p4cell h = SP[1]; SP[1] = TOS; TOS = h; } TOS += sizeof (double); { p4cell h = SP[1]; SP[1] = TOS; TOS = h; } hf_index++; } hf_index = (int) *RP++; hf_limit = (int) *RP++; } HF_DROP2; } FCode (hf_svc_star); FCode (hfi_svc_star) { HF_FILL_TOS HF_FILL_FTOS hf_svc_star_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_svc_star) { HF_PUSH(3); HF_PUSH(0); { RP -= 2; RP[0] = (p4xt *) hf_index; RP[1] = (p4xt *) hf_limit; hf_index = TOS; hf_limit = SP[1]; HF_DROP2; while (hf_index < hf_limit){ #ifdef HF_TOSREG *SP-- = TOS; #else SP--; SP[0] = SP[1]; #endif HF_FPUSH (*(double *) TOS); HF_DROP1; HF_SPILL_FTOS --FP; FTOS = FP[2]; { double res = FTOS * FP[1]; FP++; FTOS = res; } { double h = FP[1]; FP[1] = FTOS; FTOS = h; } TOS += sizeof (double); hf_index++; } hf_index = (int) *RP++; hf_limit = (int) *RP++; } HF_DROP1; HF_FDROP1; } #define fpi .3141592654E1 FCode (hfi_fpi) { *--FP = fpi; } FCode (hf_intensity); FCode (hfi_intensity) { HF_FILL_TOS HF_FILL_FTOS hf_intensity_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_intensity) { #ifdef HF_TOSREG *SP-- = TOS; #else SP--; SP[0] = SP[1]; #endif HF_FPUSH (*(double *) TOS); HF_DROP1; TOS += sizeof (double); HF_FPUSH (*(double *) TOS); HF_DROP1; hf_mag2_ (); } FCode (hf_phase); FCode (hfi_phase) { HF_FILL_TOS HF_FILL_FTOS hf_phase_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_phase) { #ifdef HF_TOSREG *SP-- = TOS; #else SP--; SP[0] = SP[1]; #endif HF_FPUSH (*(double *) TOS); HF_DROP1; TOS += sizeof (double); HF_FPUSH (*(double *) TOS); HF_DROP1; { double h = FP[1]; FP[1] = FTOS; FTOS = h; } { double res = atan2 (FP [1], FTOS); FP++; FTOS = res; } } double t_p = .4500000000E-11; FCode (hfi_t_p) { *--SP = (p4cell) &t_p; } double t_s = .7000000000E-9; FCode (hfi_t_s) { *--SP = (p4cell) &t_s; } double G_N = .2600000000E-5; FCode (hfi_G_N) { *--SP = (p4cell) &G_N; } double N_th = .1500000000E19; FCode (hfi_N_th) { *--SP = (p4cell) &N_th; } double I_th = .2000000000E2; FCode (hfi_I_th) { *--SP = (p4cell) &I_th; } double alpha = .5000000000E1; FCode (hfi_alpha) { *--SP = (p4cell) α } double T_ratio = .0000000000E0; FCode (hfi_T_ratio) { *--SP = (p4cell) &T_ratio; } double PumpFactor = .0000000000E0; FCode (hfi_PumpFactor) { *--SP = (p4cell) &PumpFactor; } double P = .0000000000E0; FCode (hfi_P) { *--SP = (p4cell) &P; } FCode (hf_init_params); FCode (hfi_init_params) { HF_FILL_TOS HF_FILL_FTOS hf_init_params_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_init_params) { HF_PUSH((p4cell) &t_s); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_PUSH((p4cell) &t_p); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FP[1] / FTOS; FP++; FTOS = res; } HF_PUSH((p4cell) &T_ratio); *(double *) TOS = FTOS; HF_DROP1; HF_FDROP1; HF_PUSH((p4cell) &t_p); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_PUSH((p4cell) &G_N); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_PUSH((p4cell) &N_th); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_FPUSH(.2000000000E1); { double res = FP[1] / FTOS; FP++; FTOS = res; } HF_PUSH((p4cell) &PumpFactor); *(double *) TOS = FTOS; HF_DROP1; HF_FDROP1; } FCode (hf_separator); FCode (hfi_separator) { HF_FILL_TOS HF_FILL_FTOS hf_separator_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_separator) { HF_FILL_TOS SP -= 2; TOS = 51; (char *) SP[1] = "==================================================="; HF_SPILL_TOS p4_type_ (); } FCode (hf_tab); FCode (hfi_tab) { HF_FILL_TOS HF_FILL_FTOS hf_tab_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_tab) { HF_PUSH(9); HF_SPILL_TOS HF_SPILL_FTOS p4_emit_ (); HF_FILL_TOS HF_FILL_FTOS } FCode (hf_params_dot); FCode (hfi_params_dot) { HF_FILL_TOS HF_FILL_FTOS hf_params_dot_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_params_dot) { HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS hf_separator_ (); HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_FILL_TOS SP -= 2; TOS = 6; (char *) SP[1] = "Symbol"; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_FILL_TOS SP -= 2; TOS = 30; (char *) SP[1] = "Parameter "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_FILL_TOS SP -= 2; TOS = 5; (char *) SP[1] = "Value"; HF_SPILL_TOS p4_type_ (); HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS hf_separator_ (); HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_FILL_TOS SP -= 2; TOS = 6; (char *) SP[1] = " t_p "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_FILL_TOS SP -= 2; TOS = 30; (char *) SP[1] = "Photon lifetime (s): "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_PUSH((p4cell) &t_p); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_FILL_TOS SP -= 2; TOS = 6; (char *) SP[1] = " t_s "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_FILL_TOS SP -= 2; TOS = 30; (char *) SP[1] = "Carrier lifetime (s): "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_PUSH((p4cell) &t_s); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_FILL_TOS SP -= 2; TOS = 6; (char *) SP[1] = " G_N "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_FILL_TOS SP -= 2; TOS = 30; (char *) SP[1] = "Differential gain (cm^3/s): "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_PUSH((p4cell) &G_N); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_FILL_TOS SP -= 2; TOS = 6; (char *) SP[1] = " N_th "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_FILL_TOS SP -= 2; TOS = 30; (char *) SP[1] = "Thr. carrier density (cm^-3): "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_PUSH((p4cell) &N_th); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_FILL_TOS SP -= 2; TOS = 6; (char *) SP[1] = " I_th "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_FILL_TOS SP -= 2; TOS = 30; (char *) SP[1] = "Thr. current (mA): "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_PUSH((p4cell) &I_th); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_FILL_TOS SP -= 2; TOS = 6; (char *) SP[1] = " alpha"; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_FILL_TOS SP -= 2; TOS = 30; (char *) SP[1] = "Linewidth enhancement factor: "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_PUSH((p4cell) &alpha); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS hf_separator_ (); HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_FILL_TOS SP -= 2; TOS = 33; (char *) SP[1] = "Derived Dimensionless Parameters "; HF_SPILL_TOS p4_type_ (); HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS hf_separator_ (); HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_FILL_TOS SP -= 2; TOS = 15; (char *) SP[1] = "t_s/t_p ratio: "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_PUSH((p4cell) &T_ratio); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_FILL_TOS SP -= 2; TOS = 13; (char *) SP[1] = "Pump factor: "; HF_SPILL_TOS p4_type_ (); hf_tab_ (); HF_PUSH((p4cell) &PumpFactor); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS hf_separator_ (); HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS } FCode (hf_init_params_dot); FCode (hfi_init_params_dot) { HF_FILL_TOS HF_FILL_FTOS hf_init_params_dot_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_init_params_dot) { hf_init_params_ (); hf_params_dot_ (); } double temp = .0000000000E0; FCode (hfi_temp) { *--SP = (p4cell) &temp; } FCode (hf_dY_by_ds); FCode (hfi_dY_by_ds) { HF_FILL_TOS HF_FILL_FTOS hf_dY_by_ds_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_dY_by_ds) { hf_sv_fetch_ (); HF_PUSH((p4cell) &temp); *(double *) TOS = FTOS; HF_DROP1; HF_FDROP1; HF_SPILL_FTOS --FP; FTOS = FP[2]; HF_SPILL_FTOS --FP; FTOS = FP[2]; HF_PUSH((p4cell) &alpha); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } { double res = FP[1] - FTOS; FP++; FTOS = res; } HF_PUSH((p4cell) &temp); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } { double h = FP[2]; FP[2] = FP[1]; FP[1] = FTOS; FTOS = h; } HF_PUSH((p4cell) &alpha); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } { double h = FP[2]; FP[2] = FP[1]; FP[1] = FTOS; FTOS = h; } { double res = FTOS + FP[1]; FP++; FTOS = res; } HF_PUSH((p4cell) &temp); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } } double temp2 = .0000000000E0; FCode (hfi_temp2) { *--SP = (p4cell) &temp2; } FCode (hf_dZ_by_ds); FCode (hfi_dZ_by_ds) { HF_FILL_TOS HF_FILL_FTOS hf_dZ_by_ds_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_dZ_by_ds) { hf_sv_fetch_ (); #ifdef HF_FTOSREG *FP-- = FTOS; #else FP--; FP[0] = FP[1]; #endif HF_PUSH((p4cell) &temp); *(double *) TOS = FTOS; HF_DROP1; HF_FDROP1; HF_FPUSH(.2000000000E1); { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_FPUSH(.1000000000E1); { double res = FTOS + FP[1]; FP++; FTOS = res; } HF_PUSH((p4cell) &temp2); *(double *) TOS = FTOS; HF_DROP1; HF_FDROP1; hf_mag2_ (); HF_PUSH((p4cell) &temp2); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_PUSH((p4cell) &P); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_PUSH((p4cell) &temp); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FP[1] - FTOS; FP++; FTOS = res; } { double h = FP[1]; FP[1] = FTOS; FTOS = h; } { double res = FP[1] - FTOS; FP++; FTOS = res; } HF_PUSH((p4cell) &T_ratio); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FP[1] / FTOS; FP++; FTOS = res; } } FCode (hf_dV_by_ds); FCode (hfi_dV_by_ds) { HF_FILL_TOS HF_FILL_FTOS hf_dV_by_ds_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_dV_by_ds) { #ifdef HF_TOSREG *SP-- = TOS; #else SP--; SP[0] = SP[1]; #endif hf_dZ_by_ds_ (); hf_dY_by_ds_ (); { double h = FP[2]; FP[2] = FP[1]; FP[1] = FTOS; FTOS = h; } } double vstep[3]; FCode (hfi_vstep) { *--SP = (p4cell) &vstep; } FCode (hf_stepV); FCode (hfi_stepV) { HF_FILL_TOS HF_FILL_FTOS hf_stepV_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_stepV) { hf_svc_star_ (); HF_PUSH((p4cell) &vstep); hf_sv_store_ (); HF_PUSH((p4cell) &vstep); hf_sv_plus_ (); } double h = .0000000000E0; FCode (hfi_h) { *--SP = (p4cell) &h; } double hh = .0000000000E0; FCode (hfi_hh) { *--SP = (p4cell) &hh; } double h6 = .0000000000E0; FCode (hfi_h6) { *--SP = (p4cell) &h6; } double yt[3]; FCode (hfi_yt) { *--SP = (p4cell) &yt; } double dyt[3]; FCode (hfi_dyt) { *--SP = (p4cell) &dyt; } double dym[3]; FCode (hfi_dym) { *--SP = (p4cell) &dym; } p4cell av = 0; FCode (hfi_av) { *--SP = (p4cell) &av; } p4cell adv = 0; FCode (hfi_adv) { *--SP = (p4cell) &adv; } FCode (hf_rk4); FCode (hfi_rk4) { HF_FILL_TOS HF_FILL_FTOS hf_rk4_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_rk4) { HF_PUSH((p4cell) &adv); *(p4cell *) TOS = SP[1]; HF_DROP2; HF_PUSH((p4cell) &h); *(double *) TOS = FTOS; HF_DROP1; HF_FDROP1; HF_PUSH((p4cell) &av); *(p4cell *) TOS = SP[1]; HF_DROP2; HF_PUSH((p4cell) &h); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_FPUSH(.5000000000E0); { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_PUSH((p4cell) &hh); *(double *) TOS = FTOS; HF_DROP1; HF_FDROP1; HF_PUSH((p4cell) &h); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_FPUSH(.6000000000E1); { double res = FP[1] / FTOS; FP++; FTOS = res; } HF_PUSH((p4cell) &h6); *(double *) TOS = FTOS; HF_DROP1; HF_FDROP1; HF_PUSH((p4cell) &av); TOS = *(p4cell *) TOS; HF_PUSH((p4cell) &hh); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_PUSH((p4cell) &adv); TOS = *(p4cell *) TOS; hf_stepV_ (); HF_PUSH((p4cell) &yt); hf_sv_store_ (); HF_PUSH((p4cell) &yt); hf_dV_by_ds_ (); HF_PUSH((p4cell) &dyt); hf_sv_store_ (); HF_PUSH((p4cell) &av); TOS = *(p4cell *) TOS; HF_PUSH((p4cell) &hh); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_PUSH((p4cell) &dyt); hf_stepV_ (); HF_PUSH((p4cell) &yt); hf_sv_store_ (); HF_PUSH((p4cell) &yt); hf_dV_by_ds_ (); HF_PUSH((p4cell) &dym); hf_sv_store_ (); HF_PUSH((p4cell) &av); TOS = *(p4cell *) TOS; HF_PUSH((p4cell) &h); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_PUSH((p4cell) &dym); hf_stepV_ (); HF_PUSH((p4cell) &yt); hf_sv_store_ (); HF_PUSH((p4cell) &dyt); HF_PUSH((p4cell) &dym); hf_sv_plus_ (); HF_PUSH((p4cell) &dym); hf_sv_store_ (); HF_PUSH((p4cell) &yt); hf_dV_by_ds_ (); HF_PUSH((p4cell) &dyt); hf_sv_store_ (); HF_FPUSH(.2000000000E1); HF_PUSH((p4cell) &dym); hf_svc_star_ (); HF_PUSH((p4cell) &dym); hf_sv_store_ (); HF_PUSH((p4cell) &dyt); HF_PUSH((p4cell) &dym); hf_sv_plus_ (); HF_PUSH((p4cell) &dyt); hf_sv_store_ (); HF_PUSH((p4cell) &adv); TOS = *(p4cell *) TOS; HF_PUSH((p4cell) &dyt); hf_sv_plus_ (); HF_PUSH((p4cell) &dyt); hf_sv_store_ (); HF_PUSH((p4cell) &av); TOS = *(p4cell *) TOS; HF_PUSH((p4cell) &h6); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_PUSH((p4cell) &dyt); hf_stepV_ (); } double fwhm = .1000000000E1; FCode (hfi_fwhm) { *--SP = (p4cell) &fwhm; } double pulse_amp = .2000000000E2; FCode (hfi_pulse_amp) { *--SP = (p4cell) &pulse_amp; } double d_c_current = .3000000000E2; FCode (hfi_d_c_current) { *--SP = (p4cell) &d_c_current; } double peak_offset = .3000000000E1; FCode (hfi_peak_offset) { *--SP = (p4cell) &peak_offset; } #define Pulse_magic -.2770660000E1 FCode (hfi_Pulse_magic) { *--FP = Pulse_magic; } FCode (hf_GaussianPulse); FCode (hfi_GaussianPulse) { HF_FILL_TOS HF_FILL_FTOS hf_GaussianPulse_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_GaussianPulse) { HF_PUSH((p4cell) &peak_offset); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FP[1] - FTOS; FP++; FTOS = res; } HF_PUSH((p4cell) &fwhm); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FP[1] / FTOS; FP++; FTOS = res; } hf_sqr_ (); HF_FPUSH(-.2770660000E1); { double res = FTOS * FP[1]; FP++; FTOS = res; } FTOS = exp (FTOS); HF_PUSH((p4cell) &pulse_amp); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_PUSH((p4cell) &d_c_current); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS + FP[1]; FP++; FTOS = res; } } FCode (hf_pump); FCode (hfi_pump) { HF_FILL_TOS HF_FILL_FTOS hf_pump_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_pump) { HF_PUSH((p4cell) &I_th); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FP[1] / FTOS; FP++; FTOS = res; } HF_FPUSH(.1000000000E1); { double res = FP[1] - FTOS; FP++; FTOS = res; } HF_PUSH((p4cell) &PumpFactor); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_PUSH((p4cell) &P); *(double *) TOS = FTOS; HF_DROP1; HF_FDROP1; } double V[3]; FCode (hfi_V) { *--SP = (p4cell) &V; } double Vdot[3]; FCode (hfi_Vdot) { *--SP = (p4cell) &Vdot; } double ds = .1000000000E0; FCode (hfi_ds) { *--SP = (p4cell) &ds; } #define sharp_time_steps 20000 FCode (hfi_sharp_time_steps) { *--SP = sharp_time_steps; } #define ns .1000000000E-8 FCode (hfi_ns) { *--FP = ns; } FCode (hf_main); FCode (hfi_main) { HF_FILL_TOS HF_FILL_FTOS hf_main_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_main) { hf_init_params_ (); HF_FPUSH(.2000000000E1); FTOS = sqrt (FTOS); HF_FPUSH(.0000000000E0); HF_FPUSH(.0000000000E0); HF_PUSH((p4cell) &V); hf_sv_store_ (); HF_PUSH(20000); HF_PUSH(0); { RP -= 2; RP[0] = (p4xt *) hf_index; RP[1] = (p4xt *) hf_limit; hf_index = TOS; hf_limit = SP[1]; HF_DROP2; while (hf_index < hf_limit){ HF_PUSH (hf_index); HF_PUSH(0); HF_SPILL_TOS HF_SPILL_FTOS p4_d_to_f_ (); HF_FILL_TOS HF_FILL_FTOS HF_PUSH((p4cell) &t_p); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_PUSH((p4cell) &ds); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_FPUSH(.1000000000E-8); { double res = FP[1] / FTOS; FP++; FTOS = res; } hf_GaussianPulse_ (); hf_pump_ (); HF_PUSH((p4cell) &V); hf_dV_by_ds_ (); HF_PUSH((p4cell) &Vdot); hf_sv_store_ (); HF_PUSH((p4cell) &V); HF_PUSH((p4cell) &ds); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_PUSH((p4cell) &Vdot); hf_rk4_ (); HF_PUSH((p4cell) &V); hf_sv_store_ (); HF_PUSH (hf_index); HF_PUSH(1); { fdiv_t res = p4_fdiv (SP[1], TOS); SP++; TOS = res.rem; } TOS = P4_FLAG (TOS == 0); { HF_IF{ HF_PUSH((p4cell) &V); hf_intensity_ (); HF_FDROP1; HF_PUSH((p4cell) &V); hf_phase_ (); HF_FPUSH(.3141592654E1); { double res = FP[1] / FTOS; FP++; FTOS = res; } HF_FDROP1; HF_PUSH((p4cell) &V); HF_PUSH(2); TOS *= sizeof (double); { p4cell res = TOS + SP[1]; SP++; TOS = res; } HF_FPUSH (*(double *) TOS); HF_DROP1; HF_FDROP1; }} hf_index++; } hf_index = (int) *RP++; hf_limit = (int) *RP++; } } FCode (hf_s_l_dot); FCode (hfi_s_l_dot) { HF_FILL_TOS HF_FILL_FTOS hf_s_l_dot_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_s_l_dot) { hf_init_params_ (); HF_FPUSH(.2000000000E1); FTOS = sqrt (FTOS); HF_FPUSH(.0000000000E0); HF_FPUSH(.0000000000E0); HF_PUSH((p4cell) &V); hf_sv_store_ (); HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS HF_PUSH(0); { RP -= 2; RP[0] = (p4xt *) hf_index; RP[1] = (p4xt *) hf_limit; hf_index = TOS; hf_limit = SP[1]; HF_DROP2; while (hf_index < hf_limit){ HF_PUSH (hf_index); HF_PUSH(0); HF_SPILL_TOS HF_SPILL_FTOS p4_d_to_f_ (); HF_FILL_TOS HF_FILL_FTOS HF_PUSH((p4cell) &t_p); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_PUSH((p4cell) &ds); HF_FPUSH (*(double *) TOS); HF_DROP1; { double res = FTOS * FP[1]; FP++; FTOS = res; } HF_FPUSH(.1000000000E-8); { double res = FP[1] / FTOS; FP++; FTOS = res; } #ifdef HF_FTOSREG *FP-- = FTOS; #else FP--; FP[0] = FP[1]; #endif HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_PUSH(2); HF_SPILL_TOS HF_SPILL_FTOS p4_spaces_ (); HF_FILL_TOS HF_FILL_FTOS hf_GaussianPulse_ (); #ifdef HF_FTOSREG *FP-- = FTOS; #else FP--; FP[0] = FP[1]; #endif HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_PUSH(2); HF_SPILL_TOS HF_SPILL_FTOS p4_spaces_ (); HF_FILL_TOS HF_FILL_FTOS hf_pump_ (); HF_PUSH((p4cell) &V); hf_dV_by_ds_ (); HF_PUSH((p4cell) &Vdot); hf_sv_store_ (); HF_PUSH((p4cell) &V); HF_PUSH((p4cell) &ds); HF_FPUSH (*(double *) TOS); HF_DROP1; HF_PUSH((p4cell) &Vdot); hf_rk4_ (); HF_PUSH((p4cell) &V); hf_sv_store_ (); HF_PUSH (hf_index); HF_PUSH(1); { fdiv_t res = p4_fdiv (SP[1], TOS); SP++; TOS = res.rem; } TOS = P4_FLAG (TOS == 0); { HF_IF{ HF_PUSH((p4cell) &V); hf_intensity_ (); HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_PUSH(2); HF_SPILL_TOS HF_SPILL_FTOS p4_spaces_ (); HF_FILL_TOS HF_FILL_FTOS HF_PUSH((p4cell) &V); hf_phase_ (); HF_FPUSH(.3141592654E1); { double res = FP[1] / FTOS; FP++; FTOS = res; } HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_PUSH(2); HF_SPILL_TOS HF_SPILL_FTOS p4_spaces_ (); HF_FILL_TOS HF_FILL_FTOS HF_PUSH((p4cell) &V); HF_PUSH(2); TOS *= sizeof (double); { p4cell res = TOS + SP[1]; SP++; TOS = res; } HF_FPUSH (*(double *) TOS); HF_DROP1; HF_SPILL_TOS HF_SPILL_FTOS p4_f_dot_ (); HF_FILL_TOS HF_FILL_FTOS HF_SPILL_TOS HF_SPILL_FTOS p4_cr_ (); HF_FILL_TOS HF_FILL_FTOS }} hf_index++; } hf_index = (int) *RP++; hf_limit = (int) *RP++; } } FCode (hf_bench); FCode (hfi_bench) { HF_FILL_TOS HF_FILL_FTOS hf_bench_ (); HF_SPILL_TOS HF_SPILL_FTOS } FCode (hf_bench) { HF_PUSH(0); { RP -= 2; RP[0] = (p4xt *) hf_index; RP[1] = (p4xt *) hf_limit; hf_index = TOS; hf_limit = SP[1]; HF_DROP2; while (hf_index < hf_limit){ hf_main_ (); hf_index++; } hf_index = (int) *RP++; hf_limit = (int) *RP++; } } P4_LISTWORDS (slbench) = { P4_FXco ("fzero", hfi_f_zero), P4_FXco ("fone", hfi_f_one), P4_FXco ("ftwo", hfi_f_two), P4_FXco ("fsix", hfi_f_six), P4_FXco ("fhalf", hfi_f_half), P4_FXco ("Sqr", hfi_sqr), P4_FXco ("Mag2", hfi_mag2), P4_FXco ("SVSIZE", hfi_SVSIZE), P4_FXco ("sv!", hfi_sv_store), P4_FXco ("sv@", hfi_sv_fetch), P4_FXco ("sv+", hfi_sv_plus), P4_FXco ("svc*", hfi_svc_star), P4_FXco ("fpi", hfi_fpi), P4_FXco ("intensity", hfi_intensity), P4_FXco ("phase", hfi_phase), P4_FXco ("t_p", hfi_t_p), P4_FXco ("t_s", hfi_t_s), P4_FXco ("G_N", hfi_G_N), P4_FXco ("N_th", hfi_N_th), P4_FXco ("I_th", hfi_I_th), P4_FXco ("alpha", hfi_alpha), P4_FXco ("T_ratio", hfi_T_ratio), P4_FXco ("PumpFactor", hfi_PumpFactor), P4_FXco ("P", hfi_P), P4_FXco ("init_params", hfi_init_params), P4_FXco ("separator", hfi_separator), P4_FXco ("tab", hfi_tab), P4_FXco ("params.", hfi_params_dot), P4_FXco ("init_params.", hfi_init_params_dot), P4_FXco ("temp", hfi_temp), P4_FXco ("dY/ds", hfi_dY_by_ds), P4_FXco ("temp2", hfi_temp2), P4_FXco ("dZ/ds", hfi_dZ_by_ds), P4_FXco ("dV/ds", hfi_dV_by_ds), P4_FXco ("vstep", hfi_vstep), P4_FXco ("stepV", hfi_stepV), P4_FXco ("h", hfi_h), P4_FXco ("hh", hfi_hh), P4_FXco ("h6", hfi_h6), P4_FXco ("yt", hfi_yt), P4_FXco ("dyt", hfi_dyt), P4_FXco ("dym", hfi_dym), P4_FXco ("av", hfi_av), P4_FXco ("adv", hfi_adv), P4_FXco ("rk4", hfi_rk4), P4_FXco ("fwhm", hfi_fwhm), P4_FXco ("pulse_amp", hfi_pulse_amp), P4_FXco ("dc_current", hfi_d_c_current), P4_FXco ("peak_offset", hfi_peak_offset), P4_FXco ("Pulse_magic", hfi_Pulse_magic), P4_FXco ("GaussianPulse", hfi_GaussianPulse), P4_FXco ("pump", hfi_pump), P4_FXco ("V", hfi_V), P4_FXco ("Vdot", hfi_Vdot), P4_FXco ("ds", hfi_ds), P4_FXco ("#time-steps", hfi_sharp_time_steps), P4_FXco ("ns", hfi_ns), P4_FXco ("main", hfi_main), P4_FXco ("sl.", hfi_s_l_dot), P4_FXco ("bench", hfi_bench) }; P4_COUNTWORDS (slbench, "KM's laser rate benchmark");