📄 smartmac.h
字号:
consth t4,CURRENT_INSTRUCTION cp_write_inst t4, START .if ( R_SOURCE == R_SOURCE_29000 ) && ( S_SOURCE == S_SOURCE_29027 ) cp_write_r operand1, operand1, START .endif .if ( R_SOURCE == R_SOURCE_29027 ) && ( S_SOURCE == S_SOURCE_29000 ) cp_write_s operand2, operand2, START .endif .if ( R_SOURCE == R_SOURCE_29000 ) && ( S_SOURCE == S_SOURCE_29000 ) cp_write_rs operand1, operand2, START .endif .endif .endm ; End of write_and_execute_single_operation macro definition;; MACRO NAME : read_double_result;; FUNCTION : If necessary, read the result from the 29027 into a; register on the 29000;; PARAMETER : destination - one of the possible destination registers; .macro read_double_result,destination .if ( DESTINATION == DESTINATION_29000 ) ; ; If the destination is not within the 29027 register file, read ; the result and store it into the correct register in the 29000 ; .ifeqs "@destination@","rtn0" cp_read_dp rtn0, rtn1 .else .err .print "Invalid destination for double result - @destination@" .exitm .endif .endif .endm ; End of read_double_result macro definition;; MACRO NAME : read_single_result;; FUNCTION : If necessary, read the result from the 29027 into a; register on the 29000;; PARAMETER : destination; .macro read_single_result,destination .if ( DESTINATION == DESTINATION_29000 ) ; ; If the destination is not within the 29027 register file, read ; the result and store it into the correct register in the 29000 ; .ifeqs "@destination@","rtn0" cp_read_sp rtn0 .else .err .print "Invalid destination for single result - @destination@" .exitm .endif .endif .endm ; End of read_single_result macro definition;; MACRO NAME : read_integer_result;; FUNCTION : If necessary, read the result from the 29027 into a; register on the 29000;; PARAMETER : destination; .macro read_integer_result,destination .if ( DESTINATION == DESTINATION_29000 ) ; ; If the destination is not within the 29027 register file, read ; the result and store it into the correct register in the 29000 ; .ifeqs "@destination@","rtn0" cp_read_int rtn0 .else .err .print "Invalid destination for single result - @destination@" .exitm .endif .endif .endm ; End of read_integer_result macro definition;; MACRO NAME : select_P_operand;; FUNCTION : Given an operand, determine if the operand is from the; register file, and if so, set the appropriate bits in; the current instruction word. In addition, set the; variable R_SOURCE to 0 for local register file, or 1 for; floating-point register file.;; PARAMETER : operand1 - one of the possible source operands; .macro select_P_operand,operand1 .ifeqs "@operand1@","t0" .set R_SOURCE,R_SOURCE_29000 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_R .exitm .endif .ifeqs "@operand1@","t2" .set R_SOURCE,R_SOURCE_29000 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_R .exitm .endif .ifeqs "@operand1@","rtn0" .set R_SOURCE,R_SOURCE_29000 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_R .exitm .endif .ifeqs "@operand1@","FP0" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_RF0 .exitm .endif .ifeqs "@operand1@","FP1" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_RF1 .exitm .endif .ifeqs "@operand1@","FP2" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_RF2 .exitm .endif .ifeqs "@operand1@","FP3" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_RF3 .exitm .endif .ifeqs "@operand1@","FP4" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_RF4 .exitm .endif .ifeqs "@operand1@","FP5" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_RF5 .exitm .endif .ifeqs "@operand1@","FP6" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_RF6 .exitm .endif .ifeqs "@operand1@","FP7" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_P_EQ_RF7 .exitm .endif .err .print "@operand1@ - Invalid operand" .endm ; end of select_P_operand macro definition;; MACRO NAME : select_S_operand;; FUNCTION : Given an operand, determine if the operand is from the; register file, and if so, set the appropriate bits in; the current instruction word. In addition, set the; variable S_SOURCE to S_SOURCE_29000 or S_SOURCE_29027; as appropriate;; PARAMETER : operand2 - one of the possible source operands; .macro select_S_operand,operand2 .ifeqs "@operand2@","t0" .set S_SOURCE,S_SOURCE_29000 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_S .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_S .endif .exitm .endif .ifeqs "@operand2@","t2" .set S_SOURCE,S_SOURCE_29000 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_S .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_S .endif .exitm .endif .ifeqs "@operand2@","rtn0" .set S_SOURCE,S_SOURCE_29000 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_S .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_S .endif .exitm .endif .ifeqs "@operand2@","FP0" .set S_SOURCE,S_SOURCE_29027 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF0 .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_RF0 .endif .exitm .endif .ifeqs "@operand2@","FP1" .set S_SOURCE,S_SOURCE_29027 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF1 .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_RF1 .endif .exitm .endif .ifeqs "@operand2@","FP2" .set S_SOURCE,S_SOURCE_29027 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF2 .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_RF2 .endif .exitm .endif .ifeqs "@operand2@","FP3" .set S_SOURCE,S_SOURCE_29027 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF3 .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_RF3 .endif .exitm .endif .ifeqs "@operand2@","FP4" .set S_SOURCE,S_SOURCE_29027 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF4 .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_RF4 .endif .exitm .endif .ifeqs "@operand2@","FP5" .set S_SOURCE,S_SOURCE_29027 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF5 .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_RF5 .endif .exitm .endif .ifeqs "@operand2@","FP6" .set S_SOURCE,S_SOURCE_29027 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF6 .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_RF6 .endif .exitm .endif .ifeqs "@operand2@","FP7" .set S_SOURCE,S_SOURCE_29027 .if ( OPERATION_TYPE == T_OPERATION ) .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF7 .else .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_Q_EQ_RF7 .endif .exitm .endif .err .print "@operand2@ - Invalid operand" .endm ; end of select_S_operand macro definition;; MACRO NAME : select_T_operand;; FUNCTION : Given an operand, determine if the operand is from the; register file, and if so, set the appropriate bits in; the current instruction word, to read the corresponding; source into the T operand. In addition, set the; variable R_SOURCE to 0 for local register file, or 1 for; floating-point register file.;; PARAMETER : operand1 - one of the possible source operands; .macro select_T_operand,operand1 .ifeqs "@operand1@","t0" .set R_SOURCE,R_SOURCE_29000 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_R .exitm .endif .ifeqs "@operand1@","t2" .set R_SOURCE,R_SOURCE_29000 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_R .exitm .endif .ifeqs "@operand1@","rtn0" .set R_SOURCE,R_SOURCE_29000 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_R .exitm .endif .ifeqs "@operand1@","FP0" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF0 .exitm .endif .ifeqs "@operand1@","FP1" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF1 .exitm .endif .ifeqs "@operand1@","FP2" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF2 .exitm .endif .ifeqs "@operand1@","FP3" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF3 .exitm .endif .ifeqs "@operand1@","FP4" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF4 .exitm .endif .ifeqs "@operand1@","FP5" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF5 .exitm .endif .ifeqs "@operand1@","FP6" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF6 .exitm .endif .ifeqs "@operand1@","FP7" .set R_SOURCE,R_SOURCE_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_T_EQ_RF7 .exitm .endif .err .print "@operand1@ - Invalid operand" .endm ; end of select_T_operand macro definition;; MACRO NAME : select_destination;; FUNCTION : Given a destination, determine if the operand is from the; register file, and if so, set the appropriate bits in; the current instruction word. In addition, set the; variable DESTINATION to DESTINATION_29000 or; DESTINATION_29027 as appropriate;; PARAMETER : destination - one of the possible destination operands; .macro select_destination,destination .ifeqs "@destination@","rtn0" .set DESTINATION,DESTINATION_29000 .exitm .endif .ifeqs "@destination@","FP0" .set DESTINATION,DESTINATION_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_DEST_EQ_RF0 .exitm .endif .ifeqs "@destination@","FP1" .set DESTINATION,DESTINATION_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_DEST_EQ_RF1 .exitm .endif .ifeqs "@destination@","FP2" .set DESTINATION,DESTINATION_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_DEST_EQ_RF2 .exitm .endif .ifeqs "@destination@","FP3" .set DESTINATION,DESTINATION_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_DEST_EQ_RF3 .exitm .endif .ifeqs "@destination@","FP4" .set DESTINATION,DESTINATION_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_DEST_EQ_RF4 .exitm .endif .ifeqs "@destination@","FP5" .set DESTINATION,DESTINATION_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_DEST_EQ_RF5 .exitm .endif .ifeqs "@destination@","FP6" .set DESTINATION,DESTINATION_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_DEST_EQ_RF6 .exitm .endif .ifeqs "@destination@","FP7" .set DESTINATION,DESTINATION_29027 .set CURRENT_INSTRUCTION, CURRENT_INSTRUCTION | CP_DEST_EQ_RF7 .exitm .endif .err .print "@destination@ - Invalid operand" .endm ; end of select_destination macro definition; MACRO NAME : initialize_previous_instruction;; FUNCTION : Make sure the previous instruction is defined and set to zero; .macro initialize_previous_instruction .ifndef PREVIOUS_INSTRUCTION ; ; Make sure that the previous instruction variable is initialized ; .set PREVIOUS_INSTRUCTION,0 .endif .endm ; end of initialize_previous_instruction macro definition; MACRO NAME : prepare_function_parameters;; FUNCTION : To place the input parameters into the correct position for; use by the function body. When the target language is; FORTRAN, the values of the input arguments are read from the; supplied addresses and moved to the t0-t3 temporary area.; When the target language is C or Pascal, the values of the; input arguments are simply moved to the t0-t3 temporary area.; .macro prepare_function_parameters,arg1,arg2 .if $narg==0 .err .print "Missing function argument(s)" .exitm .endif .if $narg>2 .err .print "Too many function arguments .exitm .endif .if $narg>=1 .if $isreg(@arg1) .ifdef FORTRAN load 0,0,t0,arg1 .if ( FUNCTION_TYPE == DOUBLE_FUNCTION ) add t1,arg1,4 load 0,0,t1,t1 .endif .else add t0,arg1,0 .if ( FUNCTION_TYPE == DOUBLE_FUNCTION ) add t1,%%(&arg1+1),0 .endif .endif .else .err .print "Function argument not register - @arg1@" .endif .endif .if $narg==2 .if $isreg (@arg2) .ifdef FORTRAN load 0,0,t2,arg2 .if ( FUNCTION_TYPE == DOUBLE_FUNCTION ) add t3,arg2,4 load 0,0,t3,t3 .endif .else add t2,arg2,0 .if ( FUNCTION_TYPE == DOUBLE_FUNCTION ) add t3,%%(&arg2+1),0 .endif .endif .else .err .print "Function argument not register - @arg2@" .endif .endif .endm ; end of prepare_function_parameters macro definition; end of smartmac.h file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -