⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smartmac.h

📁 用于嵌入式Linux系统的标准C的库函数
💻 H
📖 第 1 页 / 共 3 页
字号:
       read_double_result destination     .else       .if ( destination_precision == FORMAT_SINGLE )         read_single_result destination       .else         read_integer_result destination       .endif     .endif   .else  ;  ; For 29000 mode (the default) just invoke the trap-inducing instruction  ;     convert destination,source,sign_flag,rounding_mode,destination_precision,source_precision     .endif .endm       ; end of mfeq macro definition;;  SMART MACRO: mfeq;;  FUNCTION: Single precision, floating point compare;;  PARAMETERS:  destination  -  one of the possible destinations;               operand1     -  one of the possible sources;               operand2     -  one of the possible sources; .macro mfeq, destination, operand1, operand2   .if $narg!=3     .err     .print "mfeq: missing parameter(s)"     .exitm   .endif   .ifdef _29027_MODE     ;  ; Generate in line 29027 code  ;     initialize_previous_instruction     .set CURRENT_INSTRUCTION, CP_S_S  | CP_COMPARE_P_AND_T     .set OPERATION_TYPE,  T_OPERATION     select_destination destination    ;    ; 29027 registers are not valid destinations for compare operations    ; If the destination is a 29000 register, write the appropriate    ; Boolean value to that register.    ;     .if ( DESTINATION == DESTINATION_29027 )       .err       .print "29027 destinations invalid for compares - @destination@"       .exitm     .else       perform_single_operation destination, operand1, operand2       cp_read_flags destination       srl  destination,  destination, CP_EQUAL_FLAG_POSITION       sll  destination,  destination,  31     .endif   .else  ;  ; For 29000 mode (the default) just invoke the trap-inducing instruction  ;     feq destination,operand1,operand2   .endif .endm       ; end of mfeq macro definition;;  SMART MACRO: mfge;;  FUNCTION: Single precision, floating point compare;;  PARAMETERS:  destination  -  one of the possible destinations;               operand1     -  one of the possible sources;               operand2     -  one of the possible sources; .macro mfge, destination, operand1, operand2   .if $narg!=3     .err     .print "mfge: missing parameter(s)"     .exitm   .endif   .ifdef _29027_MODE     ;  ; Generate in line 29027 code  ;     initialize_previous_instruction     .set CURRENT_INSTRUCTION, CP_S_S  | CP_COMPARE_P_AND_T     .set OPERATION_TYPE,  T_OPERATION     select_destination destination    ;    ; 29027 registers are not valid destinations for compare operations    ; If the destination is a 29000 register, write the appropriate    ; Boolean value to that register.    ;     .if ( DESTINATION == DESTINATION_29027 )       .err       .print "29027 destinations invalid for compares - @destination@"       .exitm     .else        perform_single_operation destination, operand1, operand2        cp_read_flags destination        and   destination, destination, CP_EQUAL_FLAG | CP_GREATER_THAN_FLAG        cpneq destination, destination, 0x0     .endif   .else  ;  ; For 29000 mode (the default) just invoke the trap-inducing instruction  ;     fge destination,operand1,operand2   .endif .endm       ; end of mfge macro definition;;  SMART MACRO: mfgt;;  FUNCTION: Single precision, floating point compare;;  PARAMETERS:  destination  -  one of the possible destinations;               operand1     -  one of the possible sources;               operand2     -  one of the possible sources; .macro mfgt, destination, operand1, operand2   .if $narg!=3     .err     .print "mfgt: missing parameter(s)"     .exitm   .endif   .ifdef _29027_MODE     ;  ; Generate in line 29027 code  ;     initialize_previous_instruction     .set CURRENT_INSTRUCTION, CP_S_S  | CP_COMPARE_P_AND_T     .set OPERATION_TYPE,  T_OPERATION     select_destination destination    ;    ; 29027 registers are not valid destinations for compare operations    ; If the destination is a 29000 register, write the appropriate    ; Boolean value to that register.    ;     .if ( DESTINATION == DESTINATION_29027 )       .err       .print "29027 destinations invalid for compares - @destination@"       .exitm     .else        perform_single_operation destination, operand1, operand2        cp_read_flags destination        srl  destination,  destination, CP_GREATER_THAN_FLAG_POSITION        sll  destination,  destination,  31     .endif   .else  ;  ; For 29000 mode (the default) just invoke the trap-inducing instruction  ;     fgt destination,operand1,operand2   .endif .endm       ; end of mfgt macro definition;;  SMART MACRO: mdeq;;  FUNCTION: Double precision, floating point compare;;  PARAMETERS:  destination  -  one of the possible destinations;               operand1     -  one of the possible sources;               operand2     -  one of the possible sources; .macro mdeq, destination, operand1, operand2   .if $narg!=3     .err     .print "mdeq: missing parameter(s)"     .exitm   .endif   .ifdef _29027_MODE     ;  ; Generate in line 29027 code  ;     initialize_previous_instruction     .set CURRENT_INSTRUCTION, CP_D_D  | CP_COMPARE_P_AND_T     .set OPERATION_TYPE,  T_OPERATION     select_destination destination    ;    ; 29027 registers are not valid destinations for compare operations    ; If the destination is a 29000 register, write the appropriate    ; Boolean value to that register.    ;     .if ( DESTINATION == DESTINATION_29027 )       .err       .print "29027 destinations invalid for compare - @destination@"       .exitm     .else       perform_double_operation destination, operand1, operand2       cp_read_flags destination       srl  destination,  destination, CP_EQUAL_FLAG_POSITION       sll  destination,  destination,  31     .endif   .else  ;  ; For 29000 mode (the default) just invoke the trap-inducing instruction  ;     deq destination,operand1,operand2   .endif .endm        ; end of mdeq macro definition;;  SMART MACRO: mdge;;  FUNCTION: Double precision, floating point compare;;  PARAMETERS:  destination  -  one of the possible destinations;               operand1     -  one of the possible sources;               operand2     -  one of the possible sources; .macro mdge, destination, operand1, operand2   .if $narg!=3     .err     .print "mdge: missing parameter(s)"     .exitm   .endif   .ifdef _29027_MODE     ;  ; Generate in line 29027 code  ;     initialize_previous_instruction     .set CURRENT_INSTRUCTION, CP_D_D  | CP_COMPARE_P_AND_T     .set OPERATION_TYPE,  T_OPERATION     select_destination destination    ;    ; 29027 registers are not valid destinations for compare operations    ; If the destination is a 29000 register, write the appropriate    ; Boolean value to that register.    ;     .if ( DESTINATION == DESTINATION_29027 )       .err       .print "29027 destinations invalid for compare - @destination@"       .exitm     .else       perform_double_operation destination, operand1, operand2       cp_read_flags destination       and   destination,  destination,  CP_EQUAL_FLAG | CP_GREATER_THAN_FLAG       cpneq destination,  destination,  0x0     .endif   .else  ;  ; For 29000 mode (the default) just invoke the trap-inducing instruction  ;     dge destination,operand1,operand2   .endif .endm        ; end of mdge macro definition;;  SMART MACRO: mdgt;;  FUNCTION: Double precision, floating point compare;;  PARAMETERS:  destination  -  one of the possible destinations;               operand1     -  one of the possible sources;               operand2     -  one of the possible sources; .macro mdgt, destination, operand1, operand2   .if $narg!=3     .err     .print "mdgt: missing parameter(s)"     .exitm   .endif   .ifdef _29027_MODE     ;  ; Generate in line 29027 code  ;     initialize_previous_instruction     .set CURRENT_INSTRUCTION, CP_D_D  | CP_COMPARE_P_AND_T     .set OPERATION_TYPE,  T_OPERATION     select_destination destination    ;    ; 29027 registers are not valid destinations for compare operations    ; If the destination is a 29000 register, write the appropriate    ; Boolean value to that register.    ;     .if ( DESTINATION == DESTINATION_29027 )       .err       .print "29027 destinations invalid for compare - @destination@"       .exitm     .else       perform_double_operation destination, operand1, operand2       cp_read_flags destination       srl  destination,  destination,  CP_GREATER_THAN_FLAG_POSITION       sll  destination,  destination,  31     .endif   .else  ;  ; For 29000 mode (the default) just invoke the trap-inducing instruction  ;     dgt destination,operand1,operand2   .endif .endm    ; end of mdgt macro definition;; MACRO NAME : perform_double_operation;; FUNCTION : After the instruction base is set up, do the appropriate checking;            to send the instruction if necessary, send the double-precision;            operands if necessary, and start the operation;; PARAMETERS : destination - one of possible destination operands;              operand1    - one of possible source operands;              operand2    - one of possible source operands; .macro perform_double_operation,destination,operand1,operand2   .if $narg!=3     .err     .print "perform_double_operation: missing parameter(s)"     .exitm   .endif  ;  ; Start defining the instruction  ;   select_destination destination   select_P_operand   operand1   select_S_operand   operand2   write_and_execute_double_operation operand1, operand2 .endm      ; End of perform_double_operation macro definition;; MACRO NAME : perform_single_operation;; FUNCTION : After the instruction base is set up, do the appropriate checking;            to send the instruction if necessary, send the single-precision;            operands if necessary and start the operation;; PARAMETERS : destination - one of possible destination operands;              operand1    - one of possible source operands;              operand2    - one of possible source operands; .macro perform_single_operation,destination,operand1,operand2  ;  ; Start defining the instruction  ;   select_destination destination   select_P_operand operand1   select_S_operand operand2   write_and_execute_single_operation operand1,operand2 .endm      ; End of perform_single_operation macro definition;; MACRO NAME : write_and_execute_double_operation;; FUNCTION : Write the instruction and operands for a double-precision;            operation, and start the operation;; PARAMETER : operand1 - first operand of double-precision operation;             operand2 - second operand of operation; .macro write_and_execute_double_operation,operand1,operand2   .if ( ( R_SOURCE == R_SOURCE_29027 ) && ( S_SOURCE == S_SOURCE_29027 ) )  ;  ; If both sources are within the 29027, write the instruction  ; and start the operation  ;       const  t4, CURRENT_INSTRUCTION       consth t4, CURRENT_INSTRUCTION       cp_write_inst t4, START   .else  ;  ; One or both of the sources must be written first, so check the  ; previous instruction  ;       const  t4, CURRENT_INSTRUCTION       consth t4, CURRENT_INSTRUCTION       cp_write_inst t4     .if ( R_SOURCE == R_SOURCE_29000 ) && ( S_SOURCE == S_SOURCE_29027 )       .ifeqs "@operand1@","t0"         cp_write_r t0, t1, START       .else         .ifeqs "@operand1@","t2"           cp_write_r t2, t3, START         .else           .ifeqs "@operand1@","rtn0"             cp_write_r rtn0, rtn1, START           .else             .err             .print "Invalid source for double operation - @operand1@"             .exitm           .endif         .endif       .endif     .endif     .if ( R_SOURCE == R_SOURCE_29027 ) && ( S_SOURCE == S_SOURCE_29000 )       .ifeqs "@operand2@","t0"         cp_write_s t0, t1, START       .else         .ifeqs "@operand2@","t2"           cp_write_s t2, t3, START         .else           .ifeqs "@operand2@","rtn0"             cp_write_s rtn0, rtn1, START           .else             .err             .print "Invalid source for double operation - @operand1@"             .exitm           .endif         .endif       .endif     .endif     .if ( R_SOURCE == R_SOURCE_29000 ) && ( S_SOURCE == S_SOURCE_29000 )       .ifeqs "@operand1@","t0"         cp_write_r t0, t1       .else         .ifeqs "@operand1@","t2"           cp_write_r t2, t3         .else           .ifeqs "@operand1@","rtn0"             cp_write_r rtn0, rtn1           .else             .err             .print "Invalid source for double operation - @operand1@"             .exitm           .endif         .endif       .endif       .ifeqs "@operand2@","t0"         cp_write_s t0, t1, START       .else         .ifeqs "@operand2@","t2"           cp_write_s t2, t3, START         .else           .ifeqs "@operand2@","rtn0"             cp_write_s rtn0, rtn1, START           .else             .err             .print "Invalid source for double operation - @operand1@"             .exitm           .endif         .endif       .endif     .endif   .endif .endm       ; end of write_and_execute_double_operation macro definition;; MACRO NAME : write_and_execute_single_operation;; FUNCTION : If necessary, read the result from the 29027 into a;            register on the 29000;; PARAMETER : operand1 - first source for single-precision operation;             operand2 - second source for operation; .macro write_and_execute_single_operation,operand1,operand2   .if ( ( R_SOURCE == R_SOURCE_29027 ) && ( S_SOURCE == S_SOURCE_29027 ) )  ;  ; If both sources are within the 29027, write the instruction  ; and start the operation  ;       const  t4, CURRENT_INSTRUCTION       consth t4, CURRENT_INSTRUCTION       cp_write_inst t4, START   .else  ;  ; One or both of the sources must be written first, so check the  ; previous instruction  ;     const  t4,CURRENT_INSTRUCTION

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -