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/cpu0.log Program memory size in words: 4096 Default constants, read from /usr/share/trap/asm_mimd.inc 1 CPU0 = 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 0001 : 0000_0000_0000_0000_0000_0000 37: mov b0100_01_1, work ; initiate for Read 0002 : 1100_0110_0000_0100_0110_0001 38: jmpr cc_busy, 0 0003 : 0000_0100_0000_0000_0111_0111 39: iext MEMRW 0004 : 0101_0000_0000_0000_0000_1101 40: sgio work , MEMRW 0005 : 0010_1000_0001_0000_0000_0000 41: 42: iext 0x0000FFFF ; prepare a mask to 0006 : 0101_0000_0000_0000_0000_1111 43: mov 0x0000FFFF grf[4] ; of the location to 0007 : 1100_0111_1111_1111_1111_0100 44: ; in grf[4] 45: iext IAFIRST 0008 : 0101_0000_0000_0000_0000_1110 46: mov IAFIRST grf[3] ; reading the data e 0009 : 1100_0110_0000_0000_0001_0011 47: nxt: jmpr cc_busy, 0 ; in IMEM1 ... 000A : 0000_0100_0000_0001_0101_0111 48: lgio 0 grf[3] 000B : 1110_1000_0000_0010_0110_0000 49: jmpr cc_busy, 0 000C : 0000_0100_0000_0001_1001_0111 50: lpio 0x300, work 000D : 1110_0110_0110_0000_0000_0001 51: and work grf[4] firstaddress ; ... decoding 000E : 1010_0110_0001_0010_1001_0001 52: mov firstaddress errnum ; and initiatin 000F : 1100_0010_0000_0010_0010_0100 53: add errnum c1 lastaddress ; the full test 0010 : 1000_0010_0100_0110_0011_0010 54: shl -16, work bitnum ; if the number 0011 : 1011_0011_0000_0000_0010_1100 55: or bitnum bitnum bitnum ; then going to 0012 : 1010_1010_1100_0001_1000_1100 56: jmp cc_zero lp 0013 : 0000_0100_0000_0000_0001_0001 57: 58: mov c0 work ; in this code a mas 0014 : 1100_0010_0000_0110_0000_0001 59: mov c1 psrmask ; for the testing of 0015 : 1100_0010_0000_0110_0010_1010 60: up: add work c1 work ; with certain lengt 0016 : 1000_0010_0001_0110_0010_0001 61: cmp bitnum work 0017 : 1000_1000_1100_0000_0010_0000 62: jmp cc_zero bits 0018 : 0000_0100_0000_0000_0001_0001 63: shl 1 psrmask psrmask 0019 : 1011_0010_0001_0001_0100_1010 64: add psrmask c1 psrmask 001A : 1000_0010_1010_0110_0010_1010 65: jmp cc_uncond up 001B : 0000_0100_0000_0000_0000_1111 66: 67: bits: mov 32 work ; the input paramete 001C : 1100_0110_0000_0100_0000_0001 68: sub work bitnum bitnum ; is 32 minus bitnum 001D : 1000_1010_0001_0001_1000_1100 69: 70: mov c0, errnum 001E : 1100_0010_0000_0110_0000_0100 71: 72: lgio 0 firstaddress ; storing the initia 001F : 1110_1000_0000_0010_0010_0000 73: jmpr cc_busy 0 0020 : 0000_0100_0000_0100_0001_0111 74: lpio 0x300 work ; NEW!!! 0021 : 1110_0110_0110_0000_0000_0001 75: mov work g0 0022 : 1100_0010_0000_0000_0011_0000 76: 77: mvpcr +2, return1 ; call testing rout 0023 : 1100_0110_0000_0100_1010_0101 78: jmp cc_uncond cltst 0024 : 0000_0100_0000_0000_0000_1111 79: 80: ;add errnum c1 errnum 81: 82: jmpr cc_busy 0 0025 : 0000_0100_0000_0100_1011_0111 83: mov g0 work 0026 : 1100_0010_0000_0010_0000_0001 84: sgio work firstaddress 0027 : 0010_0100_0001_0010_0010_0000 85: 86: jmpr cc_busy, 0 0028 : 0000_0100_0000_0101_0001_0111 87: sgio errnum grf[3] ; writing the resul 0029 : 0010_0100_0100_0010_0110_0000 88: ; in IMEM2 at addre 89: mov grf[3] work ; ... geting the ne 002A : 1100_0010_0000_0010_0110_0001 90: add work c1 grf[3] ; go to decode and 002B : 1000_0010_0001_0110_0011_0011 91: jmp cc_uncond nxt 002C : 0000_0100_0000_0000_0000_1111 92: 93: lp: jmpr cc_busy, 0 ; ... transition in 002D : 0000_0100_0000_0101_1011_0111 94: mov 0xA21, work 002E : 1100_0111_0100_0100_0010_0001 95: mov c0 rdata 002F : 1100_0010_0000_0110_0000_0010 96: sgio rdata, work 0030 : 0010_0100_0010_0000_0010_0000 97: mov 0x012, work 0031 : 1100_0110_0000_0010_0100_0001 98: sgio work, 0xA04 ; ... low power mode 0032 : 0010_1000_0001_1010_0000_0100 99: end: jmp cc_uncond, end ; END OF THE ENTIRE P 0033 : 0000_0100_0000_0000_0000_1111 100: 101: 102: ; SUBROUTINES BELOW 103: 104: 105: ; BEGIN THE TESTING ROUTINE (uses testing subrout 106: cltst: mov 1, prf[11] 0034 : 1100_0110_0000_0000_0010_1011 107: mvpcr +2, return3 0035 : 1100_0110_0000_0110_1110_0111 108: jmp cc_uncond, iwlk0 0036 : 0000_0100_0000_0000_0000_1111 109: nt0: mov wlk0, tdgen ; call walking 0 test 0037 : 1100_0110_0000_0000_0000_1000 110: mvpcr +2, return2 0038 : 1100_0110_0000_0111_0100_0110 111: jmp cc_uncond, tstgio 0039 : 0000_0100_0000_0000_0000_1111 112: 113: shl 1, prf[11], prf[11] 003A : 1011_0010_0001_0001_0110_1011 114: jmp cc_carry, it1 003B : 0000_0100_0000_0000_0001_0000 115: sub bitnum c1 work 003C : 1000_1010_1100_0110_0010_0001 116: mov 15 rdata 003D : 1100_0110_0000_0001_1110_0010 117: mov prf[11] prf[0] 003E : 1100_0010_0000_0001_0110_0000 118: cmp rdata work 003F : 1000_1000_0010_0000_0010_0000 119: jmpr cc_ncarry 3 0040 : 0000_0100_0000_1000_0110_0000 120: shl 15 prf[0] prf[0] 0041 : 1011_0010_1111_0000_0000_0000 121: sub work rdata work 0042 : 1000_1010_0001_0000_0100_0001 122: shlt work, prf[0] ; if MSB of the current 0043 : 0111_0000_0001_0000_0000_0000 123: jmp cc_ncarry, nt0 0044 : 0000_0100_0000_0000_0000_0000 124: 125: it1: mov 1, prf[11] 0045 : 1100_0110_0000_0000_0010_1011 126: mvpcr +2, return3 0046 : 1100_0110_0000_1001_0000_0111 127: jmp cc_uncond, iwlk1 0047 : 0000_0100_0000_0000_0000_1111 128: nt1: mov wlk1, tdgen ; call walking 1 test 0048 : 1100_0110_0000_0000_0000_1000 129: mvpcr +2, return2 0049 : 1100_0110_0000_1001_0110_0110 130: jmp cc_uncond, tstgio 004A : 0000_0100_0000_0000_0000_1111 131: 132: shl 1, prf[11], prf[11] 004B : 1011_0010_0001_0001_0110_1011 133: jmp cc_carry, it2 004C : 0000_0100_0000_0000_0001_0000 134: sub bitnum c1 work 004D : 1000_1010_1100_0110_0010_0001 135: mov 15 rdata 004E : 1100_0110_0000_0001_1110_0010 136: mov prf[11] prf[0] 004F : 1100_0010_0000_0001_0110_0000 137: cmp rdata work 0050 : 1000_1000_0010_0000_0010_0000 138: jmpr cc_ncarry 3 0051 : 0000_0100_0000_1010_1000_0000 139: shl 15 prf[0] prf[0] 0052 : 1011_0010_1111_0000_0000_0000 140: sub work rdata work 0053 : 1000_1010_0001_0000_0100_0001 141: shlt work, prf[0] ; if MSB of the current 0054 : 0111_0000_0001_0000_0000_0000 142: jmp cc_ncarry, nt1 0055 : 0000_0100_0000_0000_0000_0000 143: 144: it2: mov 1, prf[11] 0056 : 1100_0110_0000_0000_0010_1011 145: mvpcr +2, return3 0057 : 1100_0110_0000_1011_0010_0111 146: jmp cc_uncond, ipsr 0058 : 0000_0100_0000_0000_0000_1111 147: ; #ifdef psr_test 148: nt2: mov psr, tdgen ; call pseudo random 0059 : 1100_0110_0000_0000_0000_1000 149: mvpcr +2, return2 005A : 1100_0110_0000_1011_1000_0110 150: jmp cc_uncond, tstgio 005B : 0000_0100_0000_0000_0000_1111 151: 152: shl 1, prf[11], prf[11] 005C : 1011_0010_0001_0001_0110_1011 153: jmp cc_carry, return1 005D : 0000_1000_0101_0000_0001_0000 154: sub bitnum c1 work 005E : 1000_1010_1100_0110_0010_0001 155: mov 15 rdata 005F : 1100_0110_0000_0001_1110_0010 156: mov prf[11] prf[0] 0060 : 1100_0010_0000_0001_0110_0000 157: cmp rdata work 0061 : 1000_1000_0010_0000_0010_0000 158: jmpr cc_ncarry 3 0062 : 0000_0100_0000_1100_1010_0000 159: shl 15 prf[0] prf[0] 0063 : 1011_0010_1111_0000_0000_0000 160: sub work rdata work 0064 : 1000_1010_0001_0000_0100_0001 161: shlt work, prf[0] ; if MSB of the current 0065 : 0111_0000_0001_0000_0000_0000 162: jmp cc_ncarry, nt2 0066 : 0000_0100_0000_0000_0000_0000 163: ; #endif 164: jmp cc_uncond return1 0067 : 0000_1000_0101_0000_0000_1111 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 0068 : 0010_0100_0011_0010_0010_0000 170: ; BEGIN COMPARING PAR 171: jmpr cc_busy, 0 0069 : 0000_0100_0000_1101_0011_0111 172: lgio 0, firstaddress 006A : 1110_1000_0000_0010_0010_0000 173: jmpr cc_busy, 0 ; here is the body of 006B : 0000_0100_0000_1101_0111_0111 174: lpio 0x300, rdata ; reading each address 006C : 1110_0110_0110_0000_0000_0010 175: and rdata psrmask rdata ; comparing the result 006D : 1010_0110_0010_0001_0100_0010 176: cmp rdata, tdata ; data stored befor 006E : 1000_1000_0010_0000_0110_0000 177: jmp cc_zero, nextt 006F : 0000_0100_0000_0000_0001_0001 178: add errnum, c1, errnum ; 0070 : 1000_0010_0100_0110_0010_0100 179: nextt: mvpcr +2, return3 ; if err_or detected 0071 : 1100_0110_0000_1110_0110_0111 180: jmp cc_uncond, tdgen ; errnum is incremente 0072 : 0000_1000_1000_0000_0000_1111 181: jmp cc_uncond, return2 0073 : 0000_1000_0110_0000_0000_1111 182: 183: ; prepares the next data - walking 1 184: wlk1: shl 1, tdata, tdata 0074 : 1011_0010_0001_0000_0110_0011 185: and tdata, psrmask, tdata 0075 : 1010_0110_0011_0001_0100_0011 186: jmp cc_nzero, return3 0076 : 0000_1000_0111_0000_0000_0001 187: mov 1, tdata 0077 : 1100_0110_0000_0000_0010_0011 188: jmp cc_uncond, return3 0078 : 0000_1000_0111_0000_0000_1111 189: ; end of walking 1 190: 191: ; prepares the next data - walking 0 192: wlk0: com tdata, tdata 0079 : 1011_1110_0000_0000_0110_0011 193: shl 1, tdata, tdata 007A : 1011_0010_0001_0000_0110_0011 194: and tdata, psrmask, tdata 007B : 1010_0110_0011_0001_0100_0011 195: jmpr cc_nzero, +2 007C : 0000_0100_0000_1111_1100_0001 196: mov 1, tdata 007D : 1100_0110_0000_0000_0010_0011 197: com tdata, tdata 007E : 1011_1110_0000_0000_0110_0011 198: and tdata, psrmask, tdata 007F : 1010_0110_0011_0001_0100_0011 199: jmp cc_uncond, return3 0080 : 0000_1000_0111_0000_0000_1111 200: ; end of walking 0 201: 202: ; prepares the next data by pseudo random generator 203: psr: lpio 0x202, tdata 0081 : 1110_0110_0100_0000_0100_0011 204: and tdata, psrmask, tdata 0082 : 1010_0110_0011_0001_0100_0011 205: jmp cc_uncond, return3 0083 : 0000_1000_0111_0000_0000_1111 206: ; end random generator 207: 208: ; init walking 1 209: iwlk1: and prf[11], psrmask, tdata 0084 : 1010_0110_1011_0001_0100_0011 210: jmp cc_uncond, return3 0085 : 0000_1000_0111_0000_0000_1111 211: 212: ; init walking 0 213: iwlk0: com prf[11], tdata 0086 : 1011_1110_0000_0001_0110_0011 214: and tdata, psrmask, tdata 0087 : 1010_0110_0011_0001_0100_0011 215: jmp cc_uncond, return3 0088 : 0000_1000_0111_0000_0000_1111 216: 217: ; init psr 218: ;#ifdef trap3 219: ipsr: mov b1_0_0_00_01_11111, tdata 0089 : 1100_0111_0000_0111_1110_0011 220: ;#else 221: ;ipsr: mov b1_0_0_00_01_1111, tdata 222: ;#endif 223: mov 31 work 008A : 1100_0110_0000_0011_1110_0001 224: sub work bitnum work 008B : 1000_1010_0001_0001_1000_0001 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 008C : 1010_1010_0011_0000_0010_0011 232: spio tdata, 0x201 008D : 0010_0000_0011_0010_0000_0001 233: mov 0xABC, tdata 008E : 1100_0111_0101_0111_1000_0011 234: spio tdata, 0x200 008F : 0010_0000_0011_0010_0000_0000 235: nop 0090 : 0000_0000_0000_0000_0000_0000 236: nop 0091 : 0000_0000_0000_0000_0000_0000 237: lpio 0x202, tdata 0092 : 1110_0110_0100_0000_0100_0011 238: and tdata, psrmask, tdata 0093 : 1010_0110_0011_0001_0100_0011 239: jmp cc_uncond, return3 0094 : 0000_1000_0111_0000_0000_1111 240: 241: 242: org 0xFFF ; this code is only fo 243: jmp cc_uncond start ; END of IMEM 0FFF : 0000_0100_0000_0000_0000_1111 244: #endif Source file read, 0 error(s), 0 warning(s).