Assembler for MIMD-TRAP2/3 (c) V.Angelov, v3.7, Jul 2008 SVN Revision 2158, SVN Date 2008-07-17 Please send any comments to: angelov@kip.uni-heidelberg.de 17:11:18 / 12 Nov 2008 Source code file: src/GIOtst.asm Memory initialisation file: Log file: wrk/cpu2.log Program memory size in words: 4096 Default constants, read from /usr/share/trap/asm_mimd.inc 1 CPU2 = 2 CC_SIGNED = 0X14 3 CC_NSIGNED = 0X04 4 CC_ZERO = 0X11 5 CC_NZERO = 0X01 6 CC_OVERFL = 0X13 7 CC_NOVERFL = 0X03 8 CC_NEG = 0X12 9 CC_NNEG = 0X02 10 CC_CARRY = 0X10 11 CC_NCARRY = 0X00 12 CC_BUSY = 0X17 13 CC_NBUSY = 0X07 14 CC_DIVB = 0X15 15 CC_NDIVB = 0X05 16 CC_ERRDIV = 0X16 17 CC_NERRDIV = 0X06 18 CC_UNCOND = 0X0F 19 CC_EQ = 0X11 20 CC_NEQ = 0X01 21 CC_NEG = 0X12 22 CC_POS0 = 0X02 23 CC_LTS = 0X14 24 CC_GES = 0X04 25 CC_LTU = 0X10 26 CC_GEU = 0X00 27 CC_LES = 0X19 28 CC_GTS = 0X09 29 CC_LEU = 0X18 30 CC_GTU = 0X08 31 RR_BYTE = 3 32 RR_WORD = 1 33 RR_DWORD = 0 34 LRA1 = LRA 3, 35 LRA2 = LRA 1, 36 LRA4 = LRA 0, 37 LRA4+ = LRA+ 0, 38 XOR = EOR 39 NOT = COM 40 SHLT = SHL 41 ANDT = AND 42 R0 = PRF[0] 43 R1 = PRF[1] 44 R2 = PRF[2] 45 R3 = PRF[3] 46 R4 = PRF[4] 47 R5 = PRF[5] 48 R6 = PRF[6] 49 R7 = PRF[7] 50 R8 = PRF[8] 51 R9 = PRF[9] 52 R10 = PRF[10] 53 R11 = PRF[11] 54 R12 = PRF[12] 55 R13 = PRF[13] 56 R14 = PRF[14] 57 R15 = PRF[15] 58 G0 = GRF[0] 59 G1 = GRF[1] 60 G2 = GRF[2] 61 G3 = GRF[3] 62 G4 = GRF[4] 63 G5 = GRF[5] 64 G6 = GRF[6] 65 G7 = GRF[7] 66 G8 = GRF[8] 67 G9 = GRF[9] 68 G10 = GRF[10] 69 G11 = GRF[11] 70 G12 = GRF[12] 71 G13 = GRF[13] 72 G14 = GRF[14] 73 G15 = GRF[15] 74 F0 = FIT[0] 75 F1 = FIT[1] 76 F2 = FIT[2] 77 F3 = FIT[3] 78 F4 = FIT[4] 79 F5 = FIT[5] 80 F6 = FIT[6] 81 F7 = FIT[7] 82 F8 = FIT[8] 83 F9 = FIT[9] 84 F10 = FIT[10] 85 F11 = FIT[11] 86 F12 = FIT[12] 87 F13 = FIT[13] 88 F14 = FIT[14] 89 F15 = FIT[15] 90 C0 = CON[0] 91 C1 = CON[1] 92 C2 = CON[2] 93 C3 = CON[3] 94 C4 = CON[4] 95 C5 = CON[5] 96 C6 = CON[6] 97 C7 = CON[7] 98 C8 = CON[8] 99 C9 = CON[9] 100 C10 = CON[10] 101 C11 = CON[11] 102 C12 = CON[12] 103 C13 = CON[13] 104 C14 = CON[14] 105 C15 = CON[15] 106 ASM_SVN_REV = 2158 1: ; DATE: 15.12.2003 2: ; This program performs full test of separate GIO-locations 3: ; The number of bits tested and the address of corresponding 4: ; initially and stored in IMEM1. The number of err_ors occur 5: ; finally stored in IMEM2 at the same position as encoded da 6: ; the test is performed, the result could be seen. 7: ; The format of the data stored in IMEM1 is 0xBBAAAA, where 8: ; tested while AAAA is the GIO-address of the tested locatio 9: ; The number of bits in the last data in IMEM1 have to be 0, 10: 11: ; DEFINITIONS, USED IN THE PROGRAM CODE: 12: 13: #def work=PRF[1] ; register for current operations (CO) 14: #def rdata=PRF[2] ; data red by test_programs and CO 15: #def tdata=PRF[3] ; test_vector to be writen 16: #def errnum=PRF[4] ; contains the number of err_ors 17: #def return1=PRF[5] ; return address (at first level) 18: #def return2=PRF[6] ; return address (at second level) 19: #def return3=PRF[7] ; return address (at third level) 20: #def tdgen=PRF[8] ; test data generator code label 21: #def itdgen=PRF[9] ; init tdgen code label 22: #def psrmask=PRF[10] ; mask for test_vector 23: #def bitnum=PRF[12] ; =32 minus the number of bits of the 24: ; prf11 and prf13 are used inside the testing routine 25: 26: #def ioaddr=PRF[14] ; contains the autoincrementing addres 27: 28: #def firstaddress=grf[1] ; first address of the tested area 29: #def lastaddress=grf[2] ; last address of the tested area 30: 31: #def MEMRW=0xD000 ; the address of the register, control 32: #def IAFIRST=0xE000 ; first address of IMEM 33: 34: nop 0000 : 0000_0000_0000_0000_0000_0000 35: #ifdef cpu0 36: start: nop 37: mov b0100_01_1, work ; initiate for Read 38: jmpr cc_busy, 0 39: iext MEMRW 40: sgio work , MEMRW 41: 42: iext 0x0000FFFF ; prepare a mask to 43: mov 0x0000FFFF grf[4] ; of the location to 44: ; in grf[4] 45: iext IAFIRST 46: mov IAFIRST grf[3] ; reading the data e 47: nxt: jmpr cc_busy, 0 ; in IMEM1 ... 48: lgio 0 grf[3] 49: jmpr cc_busy, 0 50: lpio 0x300, work 51: and work grf[4] firstaddress ; ... decoding 52: mov firstaddress errnum ; and initiatin 53: add errnum c1 lastaddress ; the full test 54: shl -16, work bitnum ; if the number 55: or bitnum bitnum bitnum ; then going to 56: jmp cc_zero lp 57: 58: mov c0 work ; in this code a mas 59: mov c1 psrmask ; for the testing of 60: up: add work c1 work ; with certain lengt 61: cmp bitnum work 62: jmp cc_zero bits 63: shl 1 psrmask psrmask 64: add psrmask c1 psrmask 65: jmp cc_uncond up 66: 67: bits: mov 32 work ; the input paramete 68: sub work bitnum bitnum ; is 32 minus bitnum 69: 70: mov c0, errnum 71: 72: lgio 0 firstaddress ; storing the initia 73: jmpr cc_busy 0 74: lpio 0x300 work ; NEW!!! 75: mov work g0 76: 77: mvpcr +2, return1 ; call testing rout 78: jmp cc_uncond cltst 79: 80: ;add errnum c1 errnum 81: 82: jmpr cc_busy 0 83: mov g0 work 84: sgio work firstaddress 85: 86: jmpr cc_busy, 0 87: sgio errnum grf[3] ; writing the resul 88: ; in IMEM2 at addre 89: mov grf[3] work ; ... geting the ne 90: add work c1 grf[3] ; go to decode and 91: jmp cc_uncond nxt 92: 93: lp: jmpr cc_busy, 0 ; ... transition in 94: mov 0xA21, work 95: mov c0 rdata 96: sgio rdata, work 97: mov 0x012, work 98: sgio work, 0xA04 ; ... low power mode 99: end: jmp cc_uncond, end ; END OF THE ENTIRE P 100: 101: 102: ; SUBROUTINES BELOW 103: 104: 105: ; BEGIN THE TESTING ROUTINE (uses testing subrout 106: cltst: mov 1, prf[11] 107: mvpcr +2, return3 108: jmp cc_uncond, iwlk0 109: nt0: mov wlk0, tdgen ; call walking 0 test 110: mvpcr +2, return2 111: jmp cc_uncond, tstgio 112: 113: shl 1, prf[11], prf[11] 114: jmp cc_carry, it1 115: sub bitnum c1 work 116: mov 15 rdata 117: mov prf[11] prf[0] 118: cmp rdata work 119: jmpr cc_ncarry 3 120: shl 15 prf[0] prf[0] 121: sub work rdata work 122: shlt work, prf[0] ; if MSB of the current 123: jmp cc_ncarry, nt0 124: 125: it1: mov 1, prf[11] 126: mvpcr +2, return3 127: jmp cc_uncond, iwlk1 128: nt1: mov wlk1, tdgen ; call walking 1 test 129: mvpcr +2, return2 130: jmp cc_uncond, tstgio 131: 132: shl 1, prf[11], prf[11] 133: jmp cc_carry, it2 134: sub bitnum c1 work 135: mov 15 rdata 136: mov prf[11] prf[0] 137: cmp rdata work 138: jmpr cc_ncarry 3 139: shl 15 prf[0] prf[0] 140: sub work rdata work 141: shlt work, prf[0] ; if MSB of the current 142: jmp cc_ncarry, nt1 143: 144: it2: mov 1, prf[11] 145: mvpcr +2, return3 146: jmp cc_uncond, ipsr 147: ; #ifdef psr_test 148: nt2: mov psr, tdgen ; call pseudo random 149: mvpcr +2, return2 150: jmp cc_uncond, tstgio 151: 152: shl 1, prf[11], prf[11] 153: jmp cc_carry, return1 154: sub bitnum c1 work 155: mov 15 rdata 156: mov prf[11] prf[0] 157: cmp rdata work 158: jmpr cc_ncarry 3 159: shl 15 prf[0] prf[0] 160: sub work rdata work 161: shlt work, prf[0] ; if MSB of the current 162: jmp cc_ncarry, nt2 163: ; #endif 164: jmp cc_uncond return1 165: ; END OF THE TESTING ROUTINE 166: 167: 168: ; BEGIN OF THE SUBROUTINE (used by testing routine 169: tstgio: sgio tdata, firstaddress ; writing the test d 170: ; BEGIN COMPARING PAR 171: jmpr cc_busy, 0 172: lgio 0, firstaddress 173: jmpr cc_busy, 0 ; here is the body of 174: lpio 0x300, rdata ; reading each address 175: and rdata psrmask rdata ; comparing the result 176: cmp rdata, tdata ; data stored befor 177: jmp cc_zero, nextt 178: add errnum, c1, errnum ; 179: nextt: mvpcr +2, return3 ; if err_or detected 180: jmp cc_uncond, tdgen ; errnum is incremente 181: jmp cc_uncond, return2 182: 183: ; prepares the next data - walking 1 184: wlk1: shl 1, tdata, tdata 185: and tdata, psrmask, tdata 186: jmp cc_nzero, return3 187: mov 1, tdata 188: jmp cc_uncond, return3 189: ; end of walking 1 190: 191: ; prepares the next data - walking 0 192: wlk0: com tdata, tdata 193: shl 1, tdata, tdata 194: and tdata, psrmask, tdata 195: jmpr cc_nzero, +2 196: mov 1, tdata 197: com tdata, tdata 198: and tdata, psrmask, tdata 199: jmp cc_uncond, return3 200: ; end of walking 0 201: 202: ; prepares the next data by pseudo random generator 203: psr: lpio 0x202, tdata 204: and tdata, psrmask, tdata 205: jmp cc_uncond, return3 206: ; end random generator 207: 208: ; init walking 1 209: iwlk1: and prf[11], psrmask, tdata 210: jmp cc_uncond, return3 211: 212: ; init walking 0 213: iwlk0: com prf[11], tdata 214: and tdata, psrmask, tdata 215: jmp cc_uncond, return3 216: 217: ; init psr 218: ;#ifdef trap3 219: ipsr: mov b1_0_0_00_01_11111, tdata 220: ;#else 221: ;ipsr: mov b1_0_0_00_01_1111, tdata 222: ;#endif 223: mov 31 work 224: sub work bitnum work 225: ;#ifdef trap3 226: ;#else 227: ; cmp work 16 228: ; jmpr cc_carry 2 229: ; mov 15 work 230: ;#endif 231: or tdata work tdata 232: spio tdata, 0x201 233: mov 0xABC, tdata 234: spio tdata, 0x200 235: nop 236: nop 237: lpio 0x202, tdata 238: and tdata, psrmask, tdata 239: jmp cc_uncond, return3 240: 241: 242: org 0xFFF ; this code is only fo 243: jmp cc_uncond start ; END of IMEM 244: #endif Source file read, 0 error(s), 0 warning(s).