ieee_inst.h

Go to the documentation of this file.
00001 /*
00002 *****************************************************************************
00003 **                                                                          *
00004 **                          COPYRIGHT 1990 BY                               *
00005 **             DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.                *
00006 **                         ALL RIGHTS RESERVED                              *
00007 **                                                                          *
00008 **  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED  *
00009 **  ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE  *
00010 **  INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER  *
00011 **  COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY  *
00012 **  OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY  *
00013 **  TRANSFERRED.                                                            *
00014 **                                                                          *
00015 **  THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE  *
00016 **  AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT  *
00017 **  CORPORATION.                                                            *
00018 **                                                                          *
00019 **  DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS  *
00020 **  SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.                 *
00021 **                                                                          *
00022 *****************************************************************************
00023 **++
00024 **  FACILITY:
00025 **
00026 **      SYS
00027 **
00028 **  ABSTRACT:
00029 **
00030 **  AUTHORS:
00031 **
00032 **      Robert Gries
00033 **
00034 **  CREATION DATE:      07-Oct-1993
00035 **
00036 **  MODIFICATION HISTORY:
00037 **      
00038 **      X-1                             Robert Gries            07-Oct-1993
00039 **              Initial implementation
00040 **
00041 **      X-2                             Ellen Batbouta          17-Dec-1993
00042 **              Add new status message, IEEE$_COULD_BE_INTOVF
00043 **  
00044 **      X-3     WBF                     Burns Fisher            26-Oct-1995
00045 **              Retroactively add mod history and add opcodes for byte/word
00046 **              instructions
00047 **
00048 **      X-4     EMB                     Ellen M. Batbouta       31-Jul-1997
00049 **              Eliminate the symbol, __LANGUAGE_C__.  This symbol conflicts
00050 **              with the new C compiler about to be used for our builds.
00051 **
00052 **      X-5     WBF                     Burns Fisher            15-Mar-1999
00053 **              Add opcodes for count instructions: CTLZ, CTPOP, CTTZ
00054 **
00055 **      X-6     EMB                     Ellen M. Batbouta       02-Apr-1999     
00056 **              Add the following constants, IEEE_FLOAT, VAX_FLOATS, SINGLE_PRECISION,
00057 **              and DOUBLE_PRECISION.  These constants are used as input to the
00058 **              square root emulation routine, softfp_isqrt.    Add constants,
00059 **              itfp_sqrts and itfp_sqrtt (the function codes for the IEEE square
00060 **              root functions).
00061 **--
00062 **/
00063 
00064 #ifndef _ALPHA_INST_H_
00065 #define _ALPHA_INST_H_  1
00066 
00067 /*
00068 ** Define constants used as part of the interface
00069 */
00070 
00071 #define IEEE_FLOAT              1
00072 #define VAX_FLOATS              0
00073 
00074 #define SINGLE_PRECISION        0
00075 #define DOUBLE_PRECISION        1
00076 
00077 /*
00078  * inst.h -- instruction format defines
00079  */
00080 
00081 union alpha_instruction {
00082         unsigned long word;
00083         unsigned char byte[4];
00084 
00085         /* common fields to all instructions */
00086         struct {
00087 #ifdef __MSDOS__
00088                 unsigned short function_lo: 16;
00089                 unsigned function_hi:10;
00090 #else
00091                 unsigned : 26;
00092 #endif
00093                 unsigned opcode : 6;
00094         } common;
00095 
00096         /* memory format */
00097         struct {
00098                 signed memory_displacement : 16;
00099                 unsigned rb : 5;
00100                 unsigned ra : 5;
00101                 unsigned opcode : 6;
00102         } m_format;
00103 
00104         /* branch format */
00105         struct {
00106 #ifdef __MSDOS__
00107                 unsigned short branch_displacement_lo;
00108                 unsigned branch_displacement_hi : 5;
00109 #else
00110                 signed branch_displacement : 21;
00111 #endif
00112                 unsigned ra : 5;
00113                 unsigned opcode : 6;
00114         } b_format;
00115 
00116         /* operate format */
00117         struct {
00118                 unsigned rc : 5;
00119                 unsigned function : 7;
00120                 unsigned form : 1;
00121                 unsigned : 3;
00122                 unsigned rb : 5;
00123                 unsigned ra : 5;
00124                 unsigned opcode : 6;
00125         } o_format;
00126 
00127         /* literal (operate) format */
00128         struct {
00129                 unsigned rc : 5;
00130                 unsigned function : 7;
00131                 unsigned form : 1;
00132 #ifdef __MSDOS__
00133                 unsigned literal_lo : 3;
00134                 unsigned literal_hi : 5;
00135 #else
00136                 unsigned literal : 8;
00137 #endif
00138                 unsigned ra : 5;
00139                 unsigned opcode : 6;
00140         } l_format;
00141 
00142         /* floating point format */
00143         struct {
00144                 unsigned fc: 5;
00145                 unsigned fnc: 4;
00146                 unsigned src: 2;
00147                 unsigned rnd: 2;
00148                 unsigned u: 1;
00149                 unsigned ie: 1;
00150                 unsigned s: 1;
00151                 unsigned fb : 5;
00152                 unsigned fa : 5;
00153                 unsigned opcode : 6;
00154         } f_format;
00155 
00156         /* indepentent floating point format */
00157         struct {
00158                 unsigned fc: 5;
00159                 unsigned function : 11;
00160                 unsigned fb : 5;
00161                 unsigned fa : 5;
00162                 unsigned opcode : 6;
00163         } ipf_format;
00164 
00165         /* vax floating point format */
00166         struct {
00167                 unsigned fc: 5;
00168                 unsigned function : 11;
00169                 unsigned fb : 5;
00170                 unsigned fa : 5;
00171                 unsigned opcode : 6;
00172         } vax_format;
00173 
00174         /* pal format */
00175         struct {
00176 #ifdef __MSDOS__
00177                 unsigned short function_lo: 16;
00178                 unsigned function_hi:10;
00179 #else
00180                 unsigned function: 26;
00181 #endif
00182                 unsigned opcode : 6;
00183         } pal_format;
00184 
00185         /* jsr (memory) format */
00186         struct {
00187                 signed hint : 14;
00188                 unsigned function : 2;
00189                 unsigned rb : 5;
00190                 unsigned ra : 5;
00191                 unsigned opcode : 6;
00192         } j_format;
00193 };
00194 
00195 /* This section is for status codes.  The one currently defined below
00196  * is returned by DECODE_INSTRUCTION when it determines that the current
00197  * instruction is either CVTQL/SV or CVTGQ/SV
00198  */
00199 
00200 #define IEEE$_COULD_BE_INTOVF 2
00201 
00202 /*
00203  * The following are the major instruction opcodes which are contained
00204  * in the 6-bit 'opcode' field above. The opcodes which are commented as
00205  * being a "group" have sub-opcodes which are defined later.
00206  */
00207 #define op_call_pal     0x00            /* pal group; see pal.h functions */
00208 #define op_opc01        0x01
00209 #define op_opc02        0x02
00210 #define op_opc03        0x03
00211 #define op_opc04        0x04
00212 #define op_opc05        0x05
00213 #define op_opc06        0x06
00214 #define op_opc07        0x07
00215 #define op_lda          0x08
00216 #define op_ldah         0x09
00217 #define op_ldbu         0x0a
00218 #define op_ldq_u        0x0b
00219 #define op_ldwu         0x0c
00220 #define op_stw          0x0d
00221 #define op_stb          0x0e
00222 #define op_stq_u        0x0f
00223 #define op_inta         0x10            /* integer arithmetic group */
00224 #define op_intl         0x11            /* integer logical group */
00225 #define op_ints         0x12            /* integer shift group */
00226 #define op_intm         0x13            /* integer multiply group */
00227 #define op_itfp         0x14            /* Integer to floating point register move opcodes */
00228 #define op_fltv         0x15            /* vax floating point group */
00229 #define op_flti         0x16            /* ieee floating point group */
00230 #define op_fltl         0x17            /* datatype independent FP group */
00231 #define op_misc         0x18            /* miscellenous group */
00232 #define op_pal19        0x19
00233 #define op_jsr          0x1a            /* jsr group */
00234 #define op_pal1b        0x1b
00235 #define op_sext         0x1c            /* sext b/w group */
00236 #define op_pal1d        0x1d
00237 #define op_pal1e        0x1e
00238 #define op_pal1f        0x1f
00239 #define op_ldf          0x20
00240 #define op_ldg          0x21
00241 #define op_lds          0x22
00242 #define op_ldt          0x23
00243 #define op_stf          0x24
00244 #define op_stg          0x25
00245 #define op_sts          0x26
00246 #define op_stt          0x27
00247 #define op_ldl          0x28
00248 #define op_ldq          0x29
00249 #define op_ldl_l        0x2a
00250 #define op_ldq_l        0x2b
00251 #define op_stl          0x2c
00252 #define op_stq          0x2d
00253 #define op_stl_c        0x2e
00254 #define op_stq_c        0x2f
00255 #define op_br           0x30
00256 #define op_fbeq         0x31
00257 #define op_fblt         0x32
00258 #define op_fble         0x33
00259 #define op_bsr          0x34
00260 #define op_fbne         0x35
00261 #define op_fbge         0x36
00262 #define op_fbgt         0x37
00263 #define op_blbc         0x38
00264 #define op_beq          0x39
00265 #define op_blt          0x3a
00266 #define op_ble          0x3b
00267 #define op_blbs         0x3c
00268 #define op_bne          0x3d
00269 #define op_bge          0x3e
00270 #define op_bgt          0x3f
00271 
00272 /*
00273  * op_inta: integer arithmetic group. These instructions are operate format
00274  * (o_format or l_format) instructions with the function code encoded in
00275  * the 7-bit 'function' field.
00276  */
00277 #define inta_addl       0x00
00278 #define inta_s4addl     0x02
00279 #define inta_subl       0x09
00280 #define inta_s4subl     0x0b
00281 #define inta_cmpbge     0x0f
00282 #define inta_s8addl     0x12
00283 #define inta_s8subl     0x1b
00284 #define inta_cmpult     0x1d
00285 #define inta_addq       0x20
00286 #define inta_s4addq     0x22
00287 #define inta_subq       0x29
00288 #define inta_s4subq     0x2b
00289 #define inta_cmpeq      0x2d
00290 #define inta_s8addq     0x32
00291 #define inta_s8subq     0x3b
00292 #define inta_cmpule     0x3d
00293 #define inta_addlv      0x40
00294 #define inta_sublv      0x49
00295 #define inta_cmplt      0x4d
00296 #define inta_addqv      0x60
00297 #define inta_subqv      0x69
00298 #define inta_cmple      0x6d
00299 
00300 /*
00301  * op_intl: integer logical group. These instructions are operate format
00302  * (o_format or l_format) instructions with the function code encoded in
00303  * the 7-bit 'function' field.
00304  */
00305 #define intl_and        0x00
00306 #define intl_bic        0x08
00307 #define intl_cmovlbs    0x14
00308 #define intl_cmovlbc    0x16
00309 #define intl_bis        0x20
00310 #define intl_cmoveq     0x24
00311 #define intl_cmovne     0x26
00312 #define intl_ornot      0x28
00313 #define intl_xor        0x40
00314 #define intl_cmovlt     0x44
00315 #define intl_cmovge     0x46
00316 #define intl_eqv        0x48
00317 #define intl_cmovle     0x64
00318 #define intl_cmovgt     0x66
00319 
00320 /*
00321  * op_ints: integer shift group. These instructions are operate format
00322  * (o_format or l_format) instructions with the function code encoded in
00323  * the 7-bit 'function' field.
00324  */
00325 #define ints_mskbl      0x02
00326 #define ints_extbl      0x06
00327 #define ints_insbl      0x0b
00328 #define ints_mskwl      0x12
00329 #define ints_extwl      0x16
00330 #define ints_inswl      0x1b
00331 #define ints_mskll      0x22
00332 #define ints_extll      0x26
00333 #define ints_insll      0x2b
00334 #define ints_zap        0x30
00335 #define ints_zapnot     0x31
00336 #define ints_mskql      0x32
00337 #define ints_srl        0x34
00338 #define ints_extql      0x36
00339 #define ints_sll        0x39
00340 #define ints_insql      0x3b
00341 #define ints_sra        0x3c
00342 #define ints_mskwh      0x52
00343 #define ints_inswh      0x57
00344 #define ints_extwh      0x5a
00345 #define ints_msklh      0x62
00346 #define ints_inslh      0x67
00347 #define ints_extlh      0x6a
00348 #define ints_mskqh      0x72
00349 #define ints_insqh      0x77
00350 #define ints_extqh      0x7a
00351 
00352 /*
00353  * op_intm: integer multiply group. These instructions are operate format
00354  * (o_format or l_format) instructions with the function code encoded in
00355  * the 7-bit 'function' field.
00356  */
00357 #define intm_mull       0x00
00358 #define intm_mulq       0x20
00359 #define intm_umulh      0x30
00360 #define intm_mullv      0x40
00361 #define intm_mulqv      0x60
00362 
00363 /*
00364  * op_jsr: jsr group. These instructions are memory format (j_format)
00365  * instructions with the function code encoded in the 2-bit 'function'
00366  * field.
00367  */
00368 #define jsr_jmp         0x0
00369 #define jsr_jsr         0x1
00370 #define jsr_ret         0x2
00371 #define jsr_jsr_coroutine 0x3
00372 
00373 /*
00374  * op_misc: miscellenous group. These instructions are memory format
00375  * (m_format) instructions with the function code encoded in the 16-bit
00376  * displacement field
00377  */
00378 #define misc_trapb      0x0000
00379 #define misc_excb       0x0400
00380 #define misc_mb         0x4000
00381 #define misc_wmb        0x4400
00382 #define misc_fetch      0x8000
00383 #define misc_fetch_m    0xa000
00384 #define misc_rpcc       0xc000
00385 #define misc_rc         0xe000
00386 #define misc_rs         0xf000
00387 
00388 /*
00389  * op_fltl: datatype independent floating point group. These instructions
00390  * are floating point operate format (f_format) instructions with the function
00391  * code encoded in the 11-bit 'function' field.
00392  */
00393 #define fltl_cvtlq      0x010
00394 #define fltl_cpys       0x020
00395 #define fltl_cpysn      0x021
00396 #define fltl_cpyse      0x022
00397 #define fltl_mt_fpcr    0x024
00398 #define fltl_mf_fpcr    0x025
00399 #define fltl_fcmoveq    0x02a
00400 #define fltl_fcmovne    0x02b
00401 #define fltl_fcmovlt    0x02c
00402 #define fltl_fcmovge    0x02d
00403 #define fltl_fcmovle    0x02e
00404 #define fltl_fcmovgt    0x02f
00405 #define fltl_cvtql      0x030
00406 #define fltl_cvtqlv     0x130
00407 #define fltl_cvtqlsv    0x530
00408 
00409 /*
00410  * Vax floating point group - Only need to define one instruction.
00411  */
00412 
00413 #define fltv_cvtgqsv    0x5af
00414 
00415 /*
00416  * op_fltl: datatype independent floating point group. These instructions
00417  * are floating point operate format (f_format) instructions with the function
00418  * code encoded in the 11-bit 'function' field.
00419  */
00420 #define fltl_add        0x0
00421 #define fltl_sub        0x1
00422 #define fltl_mul        0x2
00423 #define fltl_div        0x3
00424 #define fltl_cmpun      0x4
00425 #define fltl_cmpeq      0x5
00426 #define fltl_cmplt      0x6
00427 #define fltl_cmple      0x7
00428 #define fltl_res8       0x8
00429 #define fltl_res9       0x9
00430 #define fltl_resa       0xa
00431 #define fltl_resb       0xb
00432 #define fltl_cvtxq      0xf
00433 #define fltl_cvtxf      0xc
00434 #define fltl_cvtxd      0xd
00435 #define fltl_cvtxg      0xe
00436 #define fltl_cvtxq      0xf
00437 
00438 /* 
00439  * op_itfp: Integer to floating point register move group
00440  */
00441 #define itfp_sqrts 0x08b
00442 #define itfp_sqrtt 0x0ab
00443 
00444 /*
00445  * op_sext: Sign extension group (plus ctx group)
00446  */
00447 #define sext_sextb      0x0         
00448 #define sext_sextw      0x1         
00449 
00450 #define sext_ctpop      0x30
00451 #define sext_ctlz       0x32
00452 #define sext_cttz       0x33
00453 
00454 #endif /* _ALPHA_INST_H_ */

SourceForge.net Logo
Project space on SourceForge.net