c_seq_dec_raise_pushpop.S 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. //Original:/proj/frio/dv/testcases/core/c_seq_dec_raise_pushpop/c_seq_dec_raise_pushpop.dsp
  2. // Spec Reference: sequencer stage DEC (raise + pushpopmultiple)
  3. # mach: bfin
  4. # sim: --environment operating
  5. #include "test.h"
  6. .include "testutils.inc"
  7. start
  8. include(std.inc)
  9. include(selfcheck.inc)
  10. include(gen_int.inc)
  11. INIT_R_REGS(0);
  12. INIT_P_REGS(0);
  13. INIT_I_REGS(0); // initialize the dsp address regs
  14. INIT_M_REGS(0);
  15. INIT_L_REGS(0);
  16. INIT_B_REGS(0);
  17. //CHECK_INIT(p5, 0xe0000000);
  18. include(symtable.inc)
  19. CHECK_INIT_DEF(p5);
  20. #ifndef STACKSIZE
  21. #define STACKSIZE 0x10
  22. #endif
  23. #ifndef EVT
  24. #define EVT 0xFFE02000
  25. #endif
  26. #ifndef EVT15
  27. #define EVT15 0xFFE0203C
  28. #endif
  29. #ifndef EVT_OVERRIDE
  30. #define EVT_OVERRIDE 0xFFE02100
  31. #endif
  32. #ifndef ITABLE
  33. #define ITABLE DATA_ADDR_1
  34. #endif
  35. GEN_INT_INIT(ITABLE) // set location for interrupt table
  36. //
  37. // Reset/Bootstrap Code
  38. // (Here we should set the processor operating modes, initialize registers,
  39. //
  40. BOOT:
  41. // in reset mode now
  42. LD32_LABEL(sp, KSTACK); // setup the stack pointer
  43. FP = SP; // and frame pointer
  44. LD32(p0, EVT); // Setup Event Vectors and Handlers
  45. LD32_LABEL(r0, EHANDLE); // Emulation Handler (Int0)
  46. [ P0 ++ ] = R0;
  47. LD32_LABEL(r0, RHANDLE); // Reset Handler (Int1)
  48. [ P0 ++ ] = R0;
  49. LD32_LABEL(r0, NHANDLE); // NMI Handler (Int2)
  50. [ P0 ++ ] = R0;
  51. LD32_LABEL(r0, XHANDLE); // Exception Handler (Int3)
  52. [ P0 ++ ] = R0;
  53. [ P0 ++ ] = R0; // IVT4 not used
  54. LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
  55. [ P0 ++ ] = R0;
  56. LD32_LABEL(r0, THANDLE); // Timer Handler (Int6)
  57. [ P0 ++ ] = R0;
  58. LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
  59. [ P0 ++ ] = R0;
  60. LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
  61. [ P0 ++ ] = R0;
  62. LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
  63. [ P0 ++ ] = R0;
  64. LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
  65. [ P0 ++ ] = R0;
  66. LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
  67. [ P0 ++ ] = R0;
  68. LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
  69. [ P0 ++ ] = R0;
  70. LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
  71. [ P0 ++ ] = R0;
  72. LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
  73. [ P0 ++ ] = R0;
  74. LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
  75. [ P0 ++ ] = R0;
  76. LD32(p0, EVT_OVERRIDE);
  77. R0 = 0;
  78. [ P0 ++ ] = R0;
  79. R0 = -1; // Change this to mask interrupts (*)
  80. [ P0 ] = R0; // IMASK
  81. CSYNC;
  82. DUMMY:
  83. R0 = 0 (Z);
  84. LT0 = r0; // set loop counters to something deterministic
  85. LB0 = r0;
  86. LC0 = r0;
  87. LT1 = r0;
  88. LB1 = r0;
  89. LC1 = r0;
  90. ASTAT = r0; // reset other internal regs
  91. // The following code sets up the test for running in USER mode
  92. LD32_LABEL(r0, STARTUSER);// One gets to user mode by doing a
  93. // ReturnFromInterrupt (RTI)
  94. RETI = r0; // We need to load the return address
  95. // Comment the following line for a USER Mode test
  96. JUMP STARTSUP; // jump to code start for SUPERVISOR mode
  97. RTI;
  98. STARTSUP:
  99. LD32_LABEL(p1, BEGIN);
  100. LD32(p0, EVT15);
  101. [ P0 ] = P1; // IVG15 (General) handler (Int 15) load with start
  102. RAISE 15; // after we RTI, INT 15 should be taken,& return to BEGIN in
  103. // SUPERVISOR MODE & go to different RAISE in supervisor mode
  104. // until the end of the test.
  105. NOP; // Workaround for Bug 217
  106. RTI;
  107. //
  108. // The Main Program
  109. //
  110. STARTUSER:
  111. LD32_LABEL(sp, USTACK); // setup the stack pointer
  112. FP = SP; // set frame pointer
  113. JUMP BEGIN;
  114. //*********************************************************************
  115. BEGIN:
  116. // COMMENT the following line for USER MODE tests
  117. [ -- SP ] = RETI; // enable interrupts in supervisor mode
  118. // **** YOUR CODE GOES HERE ****
  119. // PUT YOUR TEST HERE!
  120. // PUSH
  121. R0 = 0x01;
  122. R1 = 0x02;
  123. R2 = 0x03;
  124. R3 = 0x04;
  125. R4 = 0x05;
  126. R5 = 0x06;
  127. R6 = 0x07;
  128. R7 = 0x08;
  129. RAISE 2; // RTN
  130. [ -- SP ] = ( R7:0 );
  131. R1 = 0x12;
  132. R2 = 0x13;
  133. R3 = 0x14;
  134. R4 = 0x15;
  135. R5 = 0x16;
  136. R6 = 0x17;
  137. R7 = 0x18;
  138. RAISE 5; // RTI
  139. [ -- SP ] = ( R7:1 );
  140. R2 = 0x23;
  141. R3 = 0x24;
  142. R4 = 0x25;
  143. R5 = 0x26;
  144. R6 = 0x27;
  145. R7 = 0x28;
  146. RAISE 6; // RTI
  147. [ -- SP ] = ( R7:2 );
  148. // POP
  149. R0 = 0x00;
  150. R1 = 0x00;
  151. R2 = 0x00;
  152. R3 = 0x00;
  153. R4 = 0x00;
  154. R5 = 0x00;
  155. R6 = 0x00;
  156. R7 = 0x00;
  157. RAISE 7; // RTI
  158. ( R7:2 ) = [ SP ++ ];
  159. CHECKREG(r0, 0x00000000);
  160. CHECKREG(r1, 0x00000000);
  161. CHECKREG(r2, 0x00000023);
  162. CHECKREG(r3, 0x00000024);
  163. CHECKREG(r4, 0x00000025);
  164. CHECKREG(r5, 0x00000026);
  165. CHECKREG(r6, 0x00000027);
  166. CHECKREG(r7, 0x00000028);
  167. RAISE 8; // RTI
  168. ( R7:1 ) = [ SP ++ ];
  169. CHECKREG(r0, 0x00000000);
  170. CHECKREG(r1, 0x00000012);
  171. CHECKREG(r2, 0x00000013);
  172. CHECKREG(r3, 0x00000014);
  173. CHECKREG(r4, 0x00000015);
  174. CHECKREG(r5, 0x00000016);
  175. CHECKREG(r6, 0x00000017);
  176. CHECKREG(r7, 0x00000018);
  177. RAISE 9; // RTI
  178. ( R7:0 ) = [ SP ++ ];
  179. CHECKREG(r0, 0x00000001);
  180. CHECKREG(r1, 0x00000002);
  181. CHECKREG(r2, 0x00000003);
  182. CHECKREG(r3, 0x00000004);
  183. CHECKREG(r4, 0x00000005);
  184. CHECKREG(r5, 0x00000006);
  185. CHECKREG(r6, 0x00000007);
  186. CHECKREG(r7, 0x00000008);
  187. R0 = I0;
  188. R1 = I1;
  189. R2 = I2;
  190. R3 = I3;
  191. CHECKREG(r0, 0x00000006);
  192. CHECKREG(r1, 0x00000002);
  193. CHECKREG(r2, 0x00000002);
  194. CHECKREG(r3, 0x00000002);
  195. END:
  196. dbg_pass; // End the test
  197. //*********************************************************************
  198. //
  199. // Handlers for Events
  200. //
  201. EHANDLE: // Emulation Handler 0
  202. RTE;
  203. RHANDLE: // Reset Handler 1
  204. RTI;
  205. NHANDLE: // NMI Handler 2
  206. I0 += 2;
  207. RTN;
  208. XHANDLE: // Exception Handler 3
  209. R1 = 3;
  210. RTX;
  211. HWHANDLE: // HW Error Handler 5
  212. I1 += 2;
  213. RTI;
  214. THANDLE: // Timer Handler 6
  215. I2 += 2;
  216. RTI;
  217. I7HANDLE: // IVG 7 Handler
  218. I3 += 2;
  219. RTI;
  220. I8HANDLE: // IVG 8 Handler
  221. I0 += 2;
  222. RTI;
  223. I9HANDLE: // IVG 9 Handler
  224. I0 += 2;
  225. RTI;
  226. I10HANDLE: // IVG 10 Handler
  227. R7 = 10;
  228. RTI;
  229. I11HANDLE: // IVG 11 Handler
  230. I0 = R0;
  231. I1 = R1;
  232. I2 = R2;
  233. I3 = R3;
  234. M0 = R4;
  235. R0 = 11;
  236. RTI;
  237. I12HANDLE: // IVG 12 Handler
  238. R1 = 12;
  239. RTI;
  240. I13HANDLE: // IVG 13 Handler
  241. R2 = 13;
  242. RTI;
  243. I14HANDLE: // IVG 14 Handler
  244. R3 = 14;
  245. RTI;
  246. I15HANDLE: // IVG 15 Handler
  247. R4 = 15;
  248. RTI;
  249. NOP;NOP;NOP;NOP;NOP;NOP;NOP; // needed for icache bug
  250. //
  251. // Data Segment
  252. //
  253. .data
  254. DATA:
  255. .space (0x10);
  256. // Stack Segments (Both Kernel and User)
  257. .space (STACKSIZE);
  258. KSTACK:
  259. .space (STACKSIZE);
  260. USTACK: