OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [a29khif/] [sys/] [fpsymbol.h] - Blame information for rev 357

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
; @(#)fpsymbol.h        1.4 90/10/14 20:55:59, Copyright 1989, 1990 AMD 
2
; start of fpsymbol.h file
3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4
; Copyright 1989, 1990 Advanced Micro Devices, Inc.
5
;
6
; This software is the property of Advanced Micro Devices, Inc  (AMD)  which
7
; specifically  grants the user the right to modify, use and distribute this
8
; software provided this notice is not removed or altered.  All other rights
9
; are reserved by AMD.
10
;
11
; AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
12
; SOFTWARE.  IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
13
; DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
14
; USE OF THIS SOFTWARE.
15
;
16
; So that all may benefit from your experience, please report  any  problems
17
; or  suggestions about this software to the 29K Technical Support Center at
18
; 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131  in  the  UK,  or
19
; 0031-11-1129 in Japan, toll free.  The direct dial number is 512-462-4118.
20
;
21
; Advanced Micro Devices, Inc.
22
; 29K Support Products
23
; Mail Stop 573
24
; 5900 E. Ben White Blvd.
25
; Austin, TX 78741
26
; 800-292-9263
27
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28
;
29
; ______________________________________________________________________
30
;|______________________________________________________________________|
31
;|                                                                      |
32
;|             SYMBOLS FOR DEFINING THE INSTRUCTION WORD                |
33
;|                                                                      |
34
;|______________________________________________________________________|
35
;|______________________________________________________________________|
36
;
37
;
38
; Revision Information:
39
;------------------------------------------------------------------------
40
; Date: March 31, 1989
41
; Author: Roy Carlson per Bob Perlman and Richard Relph
42
;
43
; The symbols section describing transactions was modified to contain
44
; several new symbol values.  The reason for the change was to force the
45
; CA bit to be set--and remain set--once code accesses the coprocessor.
46
;
47
; Future operating systems will use the Coprocessor Active (CA) bit in
48
; the Old Processor Status Register to determine whether or not to save
49
; coprocessor state, etc..  This means that the instruction control field
50
; Set Coprocessor Active (SA) bit should be used as follows:
51
;
52
;       (1) any coprocessor STORE must have its SA bit set to 1,
53
;               so as to set CA,
54
;
55
; and   (2) any coprocessor LOAD must have its SA bit set to 0,
56
;               so as to prevent clearing CA.
57
;------------------------------------------------------------------------
58
; Date: 89/01/30 12:32:13;  author: jim;  lines added/del: 5/4
59
; Corrected CP_IEEE_GRADUAL_UFLOW_MODE and CP_RMS_MASK.
60
; Added CP_EXCPS_POSITION, the ls bit of the CP_XXX_EXCP ensemble.
61
; fixed a few typos in comments.
62
;------------------------------------------------------------------------
63
; Date: 89/01/23 18:00:26;  author: jim;  lines added/del: 488/468
64
; Richard O. Parker
65
; January 5, 1989
66
;
67
; 1) The _cp_prec_field in the "cp_build_inst", "cp_build_inst_h"
68
;    and "cp_build_inst_l" macros was not being defined in the case
69
;    of Am29K-supported floating-point instructions (e.g., FADD, FSUB,
70
;    DADD, etc.).
71
;
72
; 2) The multiplexor select codes in the opcode table entries
73
;    associated with the "cp_build_inst", "cp_build_inst_h" and
74
;    "cp_build_inst_l" macros, pertaining to the CONVERT_F_TO_D
75
;    and CONVERT_D_TO_F instructions were incorrect.
76
;------------------------------------------------------------------------
77
; Date: 88/12/20 14:28:26;  author: jim;  lines added/del: 1/1
78
; Larry Westerman corrected definition of CP_MOVE_P.
79
; Version required for Release 1.1 of the Intrinsics shipped 12/12/88.
80
;------------------------------------------------------------------------
81
; Date: 88/11/18 15:44:45;  author: law;
82
; Initial revision
83
;
84
;
85
;========================================================================
86
;
87
; The following mnemonics are used to specify the 14 LSBs of the
88
; instruction word (fields SIP, SIQ, SIT, SIF, IF, and CO).
89
;
90
;========================================================================
91
;
92
;  floating point operation codes.
93
;
94
   .equ  CP_PASS_P,               0x00000000  ;  pass P
95
   .equ  CP_MINUSP,               0x00000040  ; -P
96
   .equ  CP_ABSP,                 0x00000080  ; |P|
97
   .equ  CP_SIGNT_TIMES_ABSP,     0x00000C00  ; SIGN(T) * |P|
98
;
99
   .equ  CP_P_PLUS_T,             0x00000001  ;  P + T
100
   .equ  CP_P_MINUS_T,            0x00000101  ;  P - T
101
   .equ  CP_MINUSP_PLUS_T,        0x00001001  ; -P + T
102
   .equ  CP_MINUSP_MINUS_T,       0x00001101  ; -P - T
103
   .equ  CP_ABS_P_PLUS_T,         0x00000081  ; |P + T|
104
   .equ  CP_ABS_P_MINUS_T,        0x00000181  ; |P - T|
105
   .equ  CP_ABSP_PLUS_ABST,       0x00002201  ; |P| + |T|
106
   .equ  CP_ABSP_MINUS_ABST,      0x00002301  ; |P| - |T|
107
   .equ  CP_ABS_ABSP_MINUS_ABST,  0x00002381  ; ||P| - |T||
108
;
109
   .equ  CP_P_TIMES_Q,            0x00000002  ;  P * Q
110
   .equ  CP_MINUSP_TIMES_Q,       0x00001002  ; -P * Q
111
   .equ  CP_ABS_P_TIMES_Q,        0x00000082  ; |P * Q|
112
;
113
   .equ  CP_COMPARE_P_AND_T,      0x00000103  ; compare P and T
114
;
115
   .equ  CP_MAX_P_AND_T,          0x00000104  ; max P,T
116
   .equ  CP_MAX_ABSP_AND_ABST,    0x00002304  ; max |P|, |T|
117
;
118
   .equ  CP_MIN_P_AND_T,          0x00001005  ; min P,T
119
   .equ  CP_MIN_ABSP_AND_ABST,    0x00003205  ; min |P|,|T|
120
   .equ  CP_LIMIT_P_TO_MAGT,      0x00003A05  ; limit P to magnitude of T
121
;
122
   .equ  CP_CONVERT_T_TO_INT,     0x00000006  ; convert T to integer
123
;
124
   .equ  CP_SCALE_T_TO_INT_BY_Q,  0x00000007  ; scale T to integer by Q
125
;
126
   .equ  CP_PQ_PLUS_T,            0x00000008  ; (P * Q) + T
127
   .equ  CP_MINUSPQ_PLUS_T,       0x00001008  ; (-P * Q) + T
128
   .equ  CP_PQ_MINUS_T,           0x00000108  ; (P * Q) - T
129
   .equ  CP_MINUSPQ_MINUS_T,      0x00001108  ; (-P * Q) - T
130
   .equ  CP_ABSPQ_PLUS_ABST,      0x00002A08  ; |(P * Q)| + T
131
   .equ  CP_MINUSABSPQ_PLUS_ABST, 0x00003A08  ;-|(P * Q)| + T
132
   .equ  CP_ABSPQ_MINUS_ABST,     0x00002B08  ; |(P * Q)| - |T|
133
;
134
   .equ  CP_ROUND_T_TO_INT,       0x00000009  ; round T to integral value
135
;
136
   .equ  CP_RECIPROCAL_OF_P,      0x0000000A  ; reciprocal of P
137
;
138
   .equ  CP_CONVERT_T_TO_ALT,     0x0000000B  ; convert T to alt. f.p. format
139
   .equ  CP_CONVERT_T_FROM_ALT,   0x0000000C  ; convert T to alt. f.p. format
140
;
141
;
142
;  integer operation codes.
143
;
144
   .equ  CP_I_PASS_P,             0x00000020  ; integer pass P
145
   .equ  CP_I_MINUSP,             0x00000060  ; integer -P
146
   .equ  CP_I_ABSP,               0x000000A0  ; integer |P|
147
   .equ  CP_I_SIGNT_TIMES_ABSP,   0x00000C20  ; integer SIGN(T) * |P|
148
;
149
   .equ  CP_I_P_PLUS_T,           0x00000021  ; integer P + T
150
   .equ  CP_I_P_MINUS_T,          0x00000121  ; integer P - T
151
   .equ  CP_I_MINUSP_PLUS_T,      0x00001021  ; integer -P + T
152
   .equ  CP_I_ABS_P_PLUS_T,       0x000000A1  ; integer |P + T|
153
   .equ  CP_I_ABS_P_MINUS_T,      0x000001A1  ; integer |P - T|
154
;
155
   .equ  CP_I_P_TIMES_Q,          0x00000022  ; integer P * Q
156
;
157
   .equ  CP_I_COMPARE_P_AND_T,    0x00000123  ; integer compare P and T
158
;
159
   .equ  CP_I_MAX_P_AND_T,        0x00000124  ; integer max P,T
160
;
161
   .equ  CP_I_MIN_P_AND_T,        0x00001025  ; integer min P,T
162
;
163
   .equ  CP_I_CONVERT_T_TO_FLOAT, 0x00000026  ; integer convert T to f.p.
164
;
165
   .equ  CP_I_SCALE_T_TO_FLOAT_BY_Q, 0x00000027  ; integer scale T to f.p. by Q
166
;
167
   .equ  CP_I_P_OR_T,             0x00000030  ; integer P OR T
168
;
169
   .equ  CP_I_P_AND_T,            0x00000031  ; integer P AND T
170
;
171
   .equ  CP_I_P_XOR_T,            0x00000032  ; integer P XOR T
172
;
173
   .equ  CP_I_NOT_T,              0x00000032  ; integer NOT T
174
;
175
   .equ  CP_I_LSHIFT_P_BY_Q,      0x00000033  ; integer logical shift P by Q
176
;                                               places
177
;
178
   .equ  CP_I_ASHIFT_P_BY_Q,      0x00000034  ; integer arith. shift P by Q
179
;                                               places
180
;
181
   .equ  CP_I_FSHIFT_PT_BY_Q,     0x00000035  ; integer funnel shift PT by Q
182
;                                               places
183
;
184
;
185
; move instruction (f.p. or integer)
186
;
187
   .equ  CP_MOVE_P,               0x00000018  ; move operand P
188
;
189
;
190
;========================================================================
191
;
192
;  precision codes for the the operands in registers R and S, and for
193
;  the result (instruction word fields IPR, RPR).
194
;
195
;========================================================================
196
;
197
;
198
   .equ  CP_D_S,                  0x00008000  ;Double result, single input(s)
199
   .equ  CP_S_D,                  0x00004000  ;Single result, double input(s)
200
   .equ  CP_D_D,                  0x00000000  ;Double result, double input(s)
201
   .equ  CP_S_S,                  0x0000C000  ;Single result, single input(s)
202
;
203
;========================================================================
204
;
205
; The following mnemonics are used to specify the 16 LSBs of an Am29027
206
; instruction word for floating-point instructions supported by the
207
; Am29000 instruction set.
208
;
209
;========================================================================
210
;
211
   .equ  CP_FADD,                 0x0000C001
212
   .equ  CP_DADD,                 0x00000001
213
   .equ  CP_FSUB,                 0x0000C101
214
   .equ  CP_DSUB,                 0x00000101
215
   .equ  CP_FMUL,                 0x0000C002
216
   .equ  CP_DMUL,                 0x00000002
217
   .equ  CP_FEQ,                  0x0000C103
218
   .equ  CP_DEQ,                  0x00000103
219
   .equ  CP_FGE,                  0x0000C103
220
   .equ  CP_DGE,                  0x00000103
221
   .equ  CP_FGT,                  0x0000C103
222
   .equ  CP_DGT,                  0x00000103
223
   .equ  CP_CONVERT_I_TO_F,       0x0000C026  ; CONVERT (int -> s.p.)
224
   .equ  CP_CONVERT_I_TO_D,       0x00008026  ; CONVERT (int -> d.p.)
225
   .equ  CP_CONVERT_F_TO_I,       0x0000C006  ; CONVERT (s.p.-> int)
226
   .equ  CP_CONVERT_D_TO_I,       0x00004006  ; CONVERT (d.p.-> int)
227
   .equ  CP_CONVERT_F_TO_D,       0x00008000  ; CONVERT (s.p.-> d.p.)
228
   .equ  CP_CONVERT_D_TO_F,       0x00004000  ; CONVERT (d.p.-> s.p.)
229
;
230
;
231
;========================================================================
232
;
233
;  operand select codes (instruction word fields PMS, QMS, TMS).
234
;
235
;========================================================================
236
;
237
;
238
   .equ  CP_P_EQ_R,               0x00000000
239
   .equ  CP_P_EQ_S,               0x01000000
240
   .equ  CP_P_EQ_0,               0x02000000
241
   .equ  CP_P_EQ_ONE_HALF,        0x03000000
242
   .equ  CP_P_EQ_IMINUS1,         0x03000000
243
   .equ  CP_P_EQ_1,               0x04000000
244
   .equ  CP_P_EQ_2,               0x05000000
245
   .equ  CP_P_EQ_3,               0x06000000
246
   .equ  CP_P_EQ_PI,              0x07000000
247
   .equ  CP_P_EQ_IMINUSMAX,       0x07000000
248
   .equ  CP_P_EQ_RF0,             0x08000000
249
   .equ  CP_P_EQ_RF1,             0x09000000
250
   .equ  CP_P_EQ_RF2,             0x0A000000
251
   .equ  CP_P_EQ_RF3,             0x0B000000
252
   .equ  CP_P_EQ_RF4,             0x0C000000
253
   .equ  CP_P_EQ_RF5,             0x0D000000
254
   .equ  CP_P_EQ_RF6,             0x0E000000
255
   .equ  CP_P_EQ_RF7,             0x0F000000
256
;
257
   .equ  CP_Q_EQ_R,               0x00000000
258
   .equ  CP_Q_EQ_S,               0x00100000
259
   .equ  CP_Q_EQ_0,               0x00200000
260
   .equ  CP_Q_EQ_ONE_HALF,        0x00300000
261
   .equ  CP_Q_EQ_IMINUS1,         0x00300000
262
   .equ  CP_Q_EQ_1,               0x00400000
263
   .equ  CP_Q_EQ_2,               0x00500000
264
   .equ  CP_Q_EQ_3,               0x00600000
265
   .equ  CP_Q_EQ_PI,              0x00700000
266
   .equ  CP_Q_EQ_IMINUSMAX,       0x00700000
267
   .equ  CP_Q_EQ_RF0,             0x00800000
268
   .equ  CP_Q_EQ_RF1,             0x00900000
269
   .equ  CP_Q_EQ_RF2,             0x00A00000
270
   .equ  CP_Q_EQ_RF3,             0x00B00000
271
   .equ  CP_Q_EQ_RF4,             0x00C00000
272
   .equ  CP_Q_EQ_RF5,             0x00D00000
273
   .equ  CP_Q_EQ_RF6,             0x00E00000
274
   .equ  CP_Q_EQ_RF7,             0x00F00000
275
;
276
   .equ  CP_T_EQ_R,               0x00000000
277
   .equ  CP_T_EQ_S,               0x00010000
278
   .equ  CP_T_EQ_0,               0x00020000
279
   .equ  CP_T_EQ_ONE_HALF,        0x00030000
280
   .equ  CP_T_EQ_IMINUS1,         0x00030000
281
   .equ  CP_T_EQ_1,               0x00040000
282
   .equ  CP_T_EQ_2,               0x00050000
283
   .equ  CP_T_EQ_3,               0x00060000
284
   .equ  CP_T_EQ_PI,              0x00070000
285
   .equ  CP_T_EQ_IMINUSMAX,       0x00070000
286
   .equ  CP_T_EQ_RF0,             0x00080000
287
   .equ  CP_T_EQ_RF1,             0x00090000
288
   .equ  CP_T_EQ_RF2,             0x000A0000
289
   .equ  CP_T_EQ_RF3,             0x000B0000
290
   .equ  CP_T_EQ_RF4,             0x000C0000
291
   .equ  CP_T_EQ_RF5,             0x000D0000
292
   .equ  CP_T_EQ_RF6,             0x000E0000
293
   .equ  CP_T_EQ_RF7,             0x000F0000
294
;
295
;
296
;========================================================================
297
;
298
;  destination select codes (instruction word fields RF, RFS)
299
;
300
;========================================================================
301
;
302
;
303
   .equ  CP_DEST_EQ_GP,           0x00000000
304
   .equ  CP_DEST_EQ_RF0,          0x80000000
305
   .equ  CP_DEST_EQ_RF1,          0x90000000
306
   .equ  CP_DEST_EQ_RF2,          0xA0000000
307
   .equ  CP_DEST_EQ_RF3,          0xB0000000
308
   .equ  CP_DEST_EQ_RF4,          0xC0000000
309
   .equ  CP_DEST_EQ_RF5,          0xD0000000
310
   .equ  CP_DEST_EQ_RF6,          0xE0000000
311
   .equ  CP_DEST_EQ_RF7,          0xF0000000
312
;
313
;
314
; ______________________________________________________________________
315
;|______________________________________________________________________|
316
;|                                                                      |
317
;|    SYMBOLS FOR DEFINING THE MODE REGISTER DOUBLE WORD                |
318
;|                                                                      |
319
;|______________________________________________________________________|
320
;|______________________________________________________________________|
321
;
322
;
323
;
324
    .equ  CP_PFF_MASK,            0x00000003  ; primary f.p. format mask
325
    .equ  CP_PFF_EQ_IEEE,         0x00000000  ; primary f.p. format = IEEE
326
    .equ  CP_PFF_EQ_DECD,         0x00000001  ; primary f.p. format = DEC D
327
    .equ  CP_PFF_EQ_DECG,         0x00000002  ; primary f.p. format = DEC G
328
    .equ  CP_PFF_EQ_IBM,          0x00000003  ; primary f.p. format = IBM
329
    .equ  CP_PFF_POSITION,        0
330
;
331
    .equ  CP_AFF_MASK,            0x0000000C  ; alternate f.p. format mask
332
    .equ  CP_AFF_EQ_IEEE,         0x00000000  ; alternate f.p. format = IEEE
333
    .equ  CP_AFF_EQ_DECD,         0x00000004  ; alternate f.p. format = DEC D
334
    .equ  CP_AFF_EQ_DECG,         0x00000008  ; alternate f.p. format = DEC G
335
    .equ  CP_AFF_EQ_IBM,          0x0000000C  ; alternate f.p. format = IBM
336
    .equ  CP_AFF_POSITION,        2
337
;
338
    .equ  CP_SAT_MASK,            0x00000010  ; saturate mode (SAT) mask
339
    .equ  CP_SATURATE_MODE,       0x00000010  ; enable saturate mode (SAT=1)
340
    .equ  CP_SAT_POSITION,        4
341
;
342
    .equ  CP_AP_MASK,             0x00000020  ; affine/proj. mode (AP) mask
343
    .equ  CP_AFFINE_MODE,         0x00000020  ; enable affine mode (AP=1)
344
    .equ  CP_PROJECTIVE_MODE,     0x00000000  ; enable projective mode (AP=0)
345
    .equ  CP_AP_POSITION,         5
346
;
347
    .equ  CP_TRP_MASK,            0x00000040  ; IEEE trap mode (TRP) mask
348
    .equ  CP_IEEE_TRAPS_ENABLED,  0x00000040  ; IEEE trap mode enabled (TRP=1)
349
    .equ  CP_IEEE_TRAPS_DISABLED, 0x00000000  ; IEEE trap mode disabled (TRP=0)
350
    .equ  CP_TRP_POSITION,        6
351
;
352
    .equ  CP_SU_MASK,                0x00000080  ; IEEE sud. uflow (SU) mask
353
    .equ  CP_IEEE_SUDDEN_UFLOW_MODE, 0x00000080  ; IEEE sud. uflow mode (SU=1)
354
    .equ  CP_IEEE_GRADUAL_UFLOW_MODE,0x00000000  ; IEEE grad uflow mode (SU=0)
355
    .equ  CP_SU_POSITION,            7
356
;
357
    .equ  CP_BS_MASK,             0x00000100  ; IBM sig. mask (BS)
358
    .equ  CP_BS_POSITION,         8
359
;
360
    .equ  CP_BU_MASK,             0x00000200  ; IBM underflow mask (BU)
361
    .equ  CP_BU_POSITION,         9
362
;
363
    .equ  CP_MS_MASK,                0x00000800  ; signed int. mpy (MS) mask
364
    .equ  CP_SIGNED_INT_MPY_MODE,    0x00000800  ; signed int. mpy mode (MS=1)
365
    .equ  CP_UNSIGNED_INT_MPY_MODE,  0x00000000  ; unsigned int. mpy mode (MS=0)
366
    .equ  CP_MS_POSITION,            11
367
;
368
    .equ  CP_MF_MASK,             0x00003000  ; int. mult. fmt. mode (MF) mask
369
    .equ  CP_MF_EQ_LSBS,          0x00000000  ; int. mult. fmt. = LSBs
370
    .equ  CP_MF_EQ_LSBSFA,        0x00001000  ; int. mult. fmt. = LSBs,fmt. adj.
371
    .equ  CP_MF_EQ_MSBS,          0x00002000  ; int. mult. fmt. = MSBs
372
    .equ  CP_MF_EQ_MSBSFA,        0x00003000  ; int. mult. fmt. = MSBs,fmt. adj.
373
    .equ  CP_MF_POSITION,         12
374
;
375
    .equ  CP_RMS_MASK,            0x0001C000  ; round mode (RMS) mask
376
    .equ  CP_RMS_EQ_NEAREST,      0x00000000  ; round mode = to nearest
377
    .equ  CP_RMS_EQ_MINUS_INF,    0x00004000  ; round mode = toward -oo
378
    .equ  CP_RMS_EQ_PLUS_INF,     0x00008000  ; round mode = toward +oo
379
    .equ  CP_RMS_EQ_ZERO,         0x0000C000  ; round mode = toward zero
380
    .equ  CP_RMS_POSITION,        14
381
;
382
    .equ  CP_PL_MASK,             0x00100000  ; pipeline mode (PL) mask
383
    .equ  CP_FLOWTHROUGH_MODE,    0x00000000  ; select flow-through mode
384
    .equ  CP_PIPELINE_MODE,       0x00100000  ; select pipeline mode
385
    .equ  CP_PL_POSITION,         20
386
;
387
    .equ  CP_INVALID_OP_EXCP_MASK, 0x00400000  ; invalid operation excp. mask(IM)
388
    .equ  CP_RESERVED_OP_EXCP_MASK,0x00800000  ; reserved operand excp. mask(RM)
389
    .equ  CP_OVERFLOW_EXCP_MASK,   0x01000000  ; overflow exception mask (VM)
390
    .equ  CP_UNDERFLOW_EXCP_MASK,  0x02000000  ; underflow exception mask(UM)
391
    .equ  CP_INEXACT_EXCP_MASK,    0x04000000  ; inexact result excp. mask(XM)
392
    .equ  CP_ZERO_EXCP_MASK,       0x08000000  ; zero result exception mask (ZM)
393
    .equ  CP_EXCPS_POSITION,       22
394
;
395
    .equ  CP_PLTC_MASK,           0x0000000F  ; pipeline timer count (PLTC) mask
396
    .equ  CP_PLTC_EQ_2,           0x00000002  ; pipeline timer count = 2
397
    .equ  CP_PLTC_EQ_3,           0x00000003  ; pipeline timer count = 3
398
    .equ  CP_PLTC_EQ_4,           0x00000004  ; pipeline timer count = 4
399
    .equ  CP_PLTC_EQ_5,           0x00000005  ; pipeline timer count = 5
400
    .equ  CP_PLTC_EQ_6,           0x00000006  ; pipeline timer count = 6
401
    .equ  CP_PLTC_EQ_7,           0x00000007  ; pipeline timer count = 7
402
    .equ  CP_PLTC_EQ_8,           0x00000008  ; pipeline timer count = 8
403
    .equ  CP_PLTC_EQ_9,           0x00000009  ; pipeline timer count = 9
404
    .equ  CP_PLTC_EQ_10,          0x0000000A  ; pipeline timer count = 10
405
    .equ  CP_PLTC_EQ_11,          0x0000000B  ; pipeline timer count = 11
406
    .equ  CP_PLTC_EQ_12,          0x0000000C  ; pipeline timer count = 12
407
    .equ  CP_PLTC_EQ_13,          0x0000000D  ; pipeline timer count = 13
408
    .equ  CP_PLTC_EQ_14,          0x0000000E  ; pipeline timer count = 14
409
    .equ  CP_PLTC_EQ_15,          0x0000000F  ; pipeline timer count = 15
410
    .equ  CP_PLTC_POSITION,       0
411
;
412
    .equ  CP_MATC_MASK,           0x000000F0  ; mpy-acc timer count (MATC) mask
413
    .equ  CP_MATC_EQ_2,           0x00000020  ; mpy-acc timer count = 2
414
    .equ  CP_MATC_EQ_3,           0x00000030  ; mpy-acc timer count = 3
415
    .equ  CP_MATC_EQ_4,           0x00000040  ; mpy-acc timer count = 4
416
    .equ  CP_MATC_EQ_5,           0x00000050  ; mpy-acc timer count = 5
417
    .equ  CP_MATC_EQ_6,           0x00000060  ; mpy-acc timer count = 6
418
    .equ  CP_MATC_EQ_7,           0x00000070  ; mpy-acc timer count = 7
419
    .equ  CP_MATC_EQ_8,           0x00000080  ; mpy-acc timer count = 8
420
    .equ  CP_MATC_EQ_9,           0x00000090  ; mpy-acc timer count = 9
421
    .equ  CP_MATC_EQ_10,          0x000000A0  ; mpy-acc timer count = 10
422
    .equ  CP_MATC_EQ_11,          0x000000B0  ; mpy-acc timer count = 11
423
    .equ  CP_MATC_EQ_12,          0x000000C0  ; mpy-acc timer count = 12
424
    .equ  CP_MATC_EQ_13,          0x000000D0  ; mpy-acc timer count = 13
425
    .equ  CP_MATC_EQ_14,          0x000000E0  ; mpy-acc timer count = 14
426
    .equ  CP_MATC_EQ_15,          0x000000F0  ; mpy-acc timer count = 15
427
    .equ  CP_MATC_POSITION,       4
428
;
429
    .equ  CP_MVTC_MASK,           0x00000F00  ; MOVE P timer count (MVTC) mask
430
    .equ  CP_MVTC_EQ_2,           0x00000200  ; MOVE P timer count = 2
431
    .equ  CP_MVTC_EQ_3,           0x00000300  ; MOVE P timer count = 3
432
    .equ  CP_MVTC_EQ_4,           0x00000400  ; MOVE P timer count = 4
433
    .equ  CP_MVTC_EQ_5,           0x00000500  ; MOVE P timer count = 5
434
    .equ  CP_MVTC_EQ_6,           0x00000600  ; MOVE P timer count = 6
435
    .equ  CP_MVTC_EQ_7,           0x00000700  ; MOVE P timer count = 7
436
    .equ  CP_MVTC_EQ_8,           0x00000800  ; MOVE P timer count = 8
437
    .equ  CP_MVTC_EQ_9,           0x00000900  ; MOVE P timer count = 9
438
    .equ  CP_MVTC_EQ_10,          0x00000A00  ; MOVE P timer count = 10
439
    .equ  CP_MVTC_EQ_11,          0x00000B00  ; MOVE P timer count = 11
440
    .equ  CP_MVTC_EQ_12,          0x00000C00  ; MOVE P timer count = 12
441
    .equ  CP_MVTC_EQ_13,          0x00000D00  ; MOVE P timer count = 13
442
    .equ  CP_MVTC_EQ_14,          0x00000E00  ; MOVE P timer count = 14
443
    .equ  CP_MVTC_EQ_15,          0x00000F00  ; MOVE P timer count = 15
444
    .equ  CP_MVTC_POSITION,       8
445
;
446
    .equ  CP_AD_MASK,             0x00001000  ;
447
    .equ  CP_ADVANCE_DRDY_MODE,   0x00001000  ;
448
    .equ  CP_NORMAL_DRDY_MODE,    0x00000000  ;
449
    .equ  CP_AD_POSITION,         12
450
;
451
    .equ  CP_HE_MASK,               0x00002000  ; Halt-on-error mask (HE)
452
    .equ  CP_HALT_ON_ERROR_ENABLED, 0x00002000  ; Halt-on-error enabled (HE=1)
453
    .equ  CP_HALT_ON_ERROR_DISABLED,0x00000000  ; Halt-on-error disabled (HE=0)
454
    .equ  CP_HE_POSITION,           13
455
;
456
    .equ  CP_EX_MASK,             0x00004000  ; EXCP enable mask (EX)
457
    .equ  CP_EXCP_ENABLED,        0x00004000  ; EXCP enabled (EX=1)
458
    .equ  CP_EXCP_DISABLED,       0x00000000  ; EXCP disabled (EX=0)
459
    .equ  CP_EX_POSITION,         14
460
;
461
;
462
;
463
; ______________________________________________________________________
464
;|______________________________________________________________________|
465
;|                                                                      |
466
;|      SYMBOLS FOR DEFINING THE STATUS REGISTER WORD                   |
467
;|                                                                      |
468
;|______________________________________________________________________|
469
;|______________________________________________________________________|
470
;
471
;
472
   .equ CP_INVALID_OP_EXCP,           0x00000001
473
   .equ CP_INVALID_OP_EXCP_POSITION,  0
474
;
475
   .equ CP_RESERVED_OP_EXCP,          0x00000002
476
   .equ CP_RESERVED_OP_EXCP_POSITION, 1
477
;
478
   .equ CP_OVERFLOW_EXCP,             0x00000004
479
   .equ CP_OVERFLOW_EXCP_POSITION,    2
480
;
481
   .equ CP_UNDERFLOW_EXCP,            0x00000008
482
   .equ CP_UNDERFLOW_EXCP_POSITION,   3
483
;
484
   .equ CP_INEXACT_EXCP,              0x00000010
485
   .equ CP_INEXACT_EXCP_POSITION,     4
486
;
487
   .equ CP_ZERO_EXCP,                 0x00000020
488
   .equ CP_ZERO_EXCP_POSITION,        5
489
;
490
   .equ CP_EXCP_STATUS_MASK,          0x00000040
491
   .equ CP_EXCP_STATUS_FLAG_POSITION, 6
492
;
493
   .equ CP_R_TEMP_VALID_MASK,         0x00000080
494
   .equ R_TEMP_VALID_POSITION,        7
495
;
496
   .equ CP_S_TEMP_VALID_MASK,         0x00000100
497
   .equ CP_S_TEMP_VALID_POSITION,     8
498
;
499
   .equ CP_I_TEMP_VALID_FLAG,         0x00000200
500
   .equ CP_I_TEMP_VALID_POSITION,     9
501
;
502
   .equ CP_OPERATION_PENDING_MASK,    0x00000400
503
   .equ CP_OPERATION_PENDING_POSITION,10
504
;
505
;
506
; ______________________________________________________________________
507
;|______________________________________________________________________|
508
;|                                                                      |
509
;|      SYMBOLS FOR DEFINING THE FLAG REGISTER WORD                     |
510
;|                                                                      |
511
;|______________________________________________________________________|
512
;|______________________________________________________________________|
513
;
514
;
515
   .equ CP_INVALID_OP_FLAG,           0x00000001
516
   .equ CP_INVALID_OP_FLAG_POSITION,  0
517
;
518
   .equ CP_CARRY_FLAG,                0x00000001
519
   .equ CP_CARRY_FLAG_POSITION,       0
520
;
521
   .equ CP_RESERVED_OP_FLAG,          0x00000002
522
   .equ CP_RESERVED_OP_FLAG_POSITION, 1
523
;
524
   .equ CP_OVERFLOW_FLAG,             0x00000004
525
   .equ CP_OVERFLOW_FLAG_POSITION,    2
526
;
527
   .equ CP_UNORDERED_FLAG,            0x00000004
528
   .equ CP_UNORDERED_FLAG_POSITION,   2
529
;
530
   .equ CP_UNDERFLOW_FLAG,            0x00000008
531
   .equ CP_UNDERFLOW_FLAG_POSITION,   3
532
;
533
   .equ CP_LESS_THAN_FLAG,            0x00000008
534
   .equ CP_LESS_THAN_POSITION,        3
535
;
536
   .equ CP_WINNER_FLAG,               0x00000008
537
   .equ CP_WINNER_FLAG_POSITION,      3
538
;
539
   .equ CP_INEXACT_FLAG,              0x00000010
540
   .equ CP_INEXACT_FLAG_POSITION,     4
541
;
542
   .equ CP_GREATER_THAN_FLAG,         0x00000010
543
   .equ CP_GREATER_THAN_FLAG_POSITION,4
544
;
545
   .equ CP_ZERO_FLAG,                 0x00000020
546
   .equ CP_ZERO_FLAG_POSITION,        5
547
;
548
   .equ CP_EQUAL_FLAG,                0x00000020
549
   .equ CP_EQUAL_FLAG_POSITION,       5
550
;
551
   .equ CP_SIGN_FLAG,                 0x00000040
552
   .equ CP_SIGN_FLAG_POSITION,        6
553
;
554
;
555
; ______________________________________________________________________
556
;|______________________________________________________________________|
557
;|                                                                      |
558
;|                 SYMBOLS FOR TRANSACTION REQUEST TYPES                |
559
;|                                                                      |
560
;|______________________________________________________________________|
561
;|______________________________________________________________________|
562
;
563
;
564
; write requests
565
;
566
; Note: Each WRITE_* transaction request, plus ADV_TEMPS sets the CA
567
; (Coprocessor Active) bit in the 29000 Current Processor Status Register.
568
;
569
   .equ  CP_WRITE_R,              0x20  ;write sing or doub to R register
570
   .equ  CP_WRITE_S,              0x21  ;write sing or doub to S register
571
   .equ  CP_WRITE_RS,             0x22  ;write sing operands to R and S
572
   .equ  CP_WRITE_MODE,           0x23  ;write mode double word to 29027
573
   .equ  CP_WRITE_STATUS,         0x24  ;write status word to 29027
574
   .equ  CP_WRITE_PREC,           0x25  ;write reg. file precision word
575
                                        ; to 29027
576
   .equ  CP_WRITE_INST,           0x26  ;write instruction to 29027
577
   .equ  CP_ADV_TEMPS,            0x27  ;move R-Temp, S-Temp into R,S
578
;
579
; read requests
580
;
581
   .equ  CP_READ_MSBS,            0x00  ;read sing result or MSB of doub
582
   .equ  CP_READ_LSBS,            0x01  ;read LSB of doub result
583
   .equ  CP_READ_FLAGS,           0x02  ;read 29027 flag register
584
   .equ  CP_READ_STATUS,          0x03  ;read 29027 status register
585
   .equ  CP_SAVE_STATE,           0x04  ;read one word of 29027 state
586
;
587
; "start operation" symbol; this is "OR"ed with a WRITE_R, WRITE_S,
588
;    WRITE_RS, or WRITE_INST symbol.
589
;
590
 
591
   .equ  CP_START,                0b1000000  ;bit to start 29027 operation
592
;
593
; "suppress exceptions reporting" symbol; this is "OR"ed with a ed
594
;
595
;
596
 
597
   .equ  CP_NO_ERR,               0b1000000  ;suppress exception reporting
598
;                                            ;   during load.
599
;       cp_write_r       - transfers 32- or 64-bit operand to Am29027
600
;                          register R
601
;       cp_write_s       - transfers 32- or 64-bit operand to Am29027
602
;                          register S
603
;       cp_write_rs      - transfers two 32-bit floating-point operands to
604
;                          Am29027 registers R and S
605
;       cp_write_prec    - transfers a word to the Am29027 precision register
606
;       cp_write_status  - transfers a word to the Am29027 status register
607
;       cp_write_inst    - transfers an instruction to the Am29027
608
;                          instruction register
609
;       cp_advance_temps - transfers the contents of the Am29027 temporary
610
;                          registers to the corresponding working registers
611
;       cp_write_mode    - transfers a mode specification the the Am29027
612
;                          mode register
613
;       cp_read_dp       - read a double-precision floating-point result
614
;                          from the Am29027
615
;       cp_read_sp       - read a single-precision floating-point result
616
;                          from the Am29027
617
;       cp_read_int      - read an integer result from the Am29027
618
;       cp_read_flags    - read the contents of the Am29027 flag register
619
;       cp_read_status   - read the contents of the Am29027 status register
620
;       cp_read_state_wd - read a single Am29027 state word
621
;       cp_save_state    - save Am29027 state
622
;       cp_restore_state - restore Am29027 state
623
;       cp_build_inst    - build an Am29027 instruction
624
;       cp_build_inst_h  - build 16 MSBs of an Am29027 instruction
625
;       cp_build_inst_l  - build 16 LSBs of an Am29027 instruction
626
;
627
;
628
;
629
;============================================================================
630
;  MACRO NAME: cp_write_r
631
;
632
;  WRITTEN BY: Bob Perlman
633
;
634
;  MOST RECENT UPDATE:  April 16, 1988
635
;
636
;  FUNCTION:   Transfers a 32- or 64-bit operand to Am29027 input register R
637
;
638
;  PARAMETERS:
639
;    reg      - the Am29000 g.p. register containing the 32-bit operand to be
640
;               transferred, or the 32 MSBs of the 64-bit operand to be
641
;               transferred.
642
;
643
;    LSB_reg  - the Am29000 g.p. register containing the 32 LSBs of the
644
;               64-bit operand to be transferred
645
;
646
;    INT      - indicates that the operand to be transferred is a 32-bit
647
;               integer
648
;
649
;    START    - indicates that a new Am29027 operation is to be started
650
;               once the operand has been transferred
651
;
652
;
653
;  USAGE:
654
;
655
;    cp_write_r  reg [,LSB_reg] [,START]       for floating-point operands
656
; or cp_write_r  reg, INT [,START]             for integer operands
657
;
658
;    Transferring double-precision floating-point operands - Either of
659
;       two forms is acceptable:
660
;
661
;               cp_write_r   reg
662
;          or   cp_write_r   reg, LSB_reg
663
;
664
;       If LSB_reg is omitted, the LSBs are taken from the next g.p.
665
;       register.
666
;
667
;       Ex:     cp_write_r   lr2     Transfers the contents of lr2 to
668
;                                    the most-significant half of Am29027
669
;                                    register R, and the contents of lr3
670
;                                    to the least-significant half.
671
;
672
;               cp_write_r   lr2,lr5 Transfers the contents of lr2 to
673
;                                    the most-significant half of Am29027
674
;                                    register R, and the contents of lr5
675
;                                    to the least-significant half.
676
;
677
;
678
;    Transferring single-precision floating-point operands - Use the
679
;       form:
680
;
681
;               cp_write_r   reg
682
;
683
;
684
;       Ex:     cp_write_r   lr2     Transfers the contents of lr2 to
685
;                                    the most-significant half of Am29027
686
;                                    register R, (the contents of lr3
687
;                                    will be transferred to the least-
688
;                                    significant half of register R, but
689
;                                    these bits are don't cares).
690
;
691
;
692
;    Transferring integer operands - Use the form:
693
;
694
;               cp_write_r   reg,INT
695
;
696
;
697
;       Ex:     cp_write_r   lr2,INT Transfers the contents of lr2 to
698
;                                    the least-significant half of Am29027
699
;                                    register R, (the contents of lr2
700
;                                    will also be transferred to the most-
701
;                                    significant half of register R, but
702
;                                    these bits are don't cares).
703
;
704
;
705
;    Starting an Am29027 operation - Any of the forms above may be
706
;       appended with parameter START, e.g.:
707
;
708
;               cp_write_r   lr2,START
709
;
710
;               cp_write_r   lr2,lr5,START
711
;
712
;               cp_write_r   lr2,INT,START
713
;
714
;
715
;============================================================================
716
;
717
 .macro cp_write_r,p1,p2,p3
718
;
719
   .if $narg==0
720
     .err
721
     .print "cp_WRITE_R: missing parameter(s)"
722
   .endif
723
;
724
;
725
   .if $narg==1
726
     store 1,CP_WRITE_R,p1,%%((&p1)+1)
727
     .exitm
728
   .endif
729
;
730
;
731
   .if $narg==2
732
;
733
     .ifeqs "@p2@","INT"
734
       store 1,CP_WRITE_R,p1,p1
735
       .exitm
736
     .endif
737
;
738
     .ifeqs "@p2@","START"
739
       store 1,CP_WRITE_R|CP_START,p1,%%((&p1)+1)
740
       .exitm
741
     .endif
742
;
743
     store 1,CP_WRITE_R,p1,p2
744
     .exitm
745
;
746
   .endif
747
;
748
;
749
   .if $narg==3
750
;
751
     .ifeqs "@p2@","START"
752
       .ifeqs "@p3@","INT"
753
         store 1,CP_WRITE_R|CP_START,p1,p1
754
       .else
755
         .err
756
         .print "cp_write_r: bad parameter list"
757
       .endif
758
       .exitm
759
     .endif
760
;
761
     .ifeqs "@p2@","INT"
762
       .ifeqs "@p3@","START"
763
         store 1,CP_WRITE_R|CP_START,p1,p1
764
       .else
765
         .err
766
         .print "cp_write_r: bad parameter list"
767
       .endif
768
       .exitm
769
     .endif
770
;
771
     .ifeqs "@p3@","START"
772
       store 1,CP_WRITE_R|CP_START,p1,p2
773
     .else
774
       .err
775
       .print "cp_write_r: bad parameter list"
776
     .endif
777
     .exitm
778
;
779
   .endif
780
;
781
;
782
   .if $narg>=4
783
     .err
784
     .print "cp_write_r: too many parameters"
785
   .endif
786
;
787
 .endm
788
;
789
;
790
;
791
;
792
;
793
;============================================================================
794
;  MACRO NAME: cp_write_s
795
;
796
;  WRITTEN BY: Bob Perlman
797
;
798
;  MOST RECENT UPDATE:  April 16, 1988
799
;
800
;  FUNCTION:   Transfers a 32- or 64-bit operand to Am29027 input register S
801
;
802
;  PARAMETERS:
803
;    reg      - the Am29000 g.p. register containing the 32-bit operand to be
804
;               transferred, or the 32 MSBs of the 64-bit operand to be
805
;               transferred.
806
;
807
;    LSB_reg  - the Am29000 g.p. register containing the 32 LSBs of the
808
;               64-bit operand to be transferred
809
;
810
;    INT      - indicates that the operand to be transferred is a 32-bit
811
;               integer
812
;
813
;    START    - indicates that a new Am29027 operation is to be started
814
;               once the operand has been transferred
815
;
816
;
817
;  USAGE:
818
;
819
;    cp_write_s  reg [,LSB_reg] [,START]       for floating-point operands
820
; or cp_write_s  reg, INT [,START]             for integer operands
821
;
822
;    Transferring double-precision floating-point operands - Either of
823
;       two forms is acceptable:
824
;
825
;               cp_write_s   reg
826
;          or   cp_write_s   reg, LSB_reg
827
;
828
;       If LSB_reg is omitted, the LSBs are taken from the next g.p.
829
;       register.
830
;
831
;       Ex:     cp_write_s   lr2     Transfers the contents of lr2 to
832
;                                    the most-significant half of Am29027
833
;                                    register S, and the contents of lr3
834
;                                    to the least-significant half.
835
;
836
;               cp_write_s   lr2,lr5 Transfers the contents of lr2 to
837
;                                    the most-significant half of Am29027
838
;                                    register S, and the contents of lr5
839
;                                    to the least-significant half.
840
;
841
;
842
;    Transferring single-precision floating-point operands - Use the
843
;       form:
844
;
845
;               cp_write_s   reg
846
;
847
;
848
;       Ex:     cp_write_s   lr2     Transfers the contents of lr2 to
849
;                                    the most-significant half of Am29027
850
;                                    register S, (the contents of lr3
851
;                                    will be transferred to the least-
852
;                                    significant half of register S, but
853
;                                    these bits are don't cares).
854
;
855
;
856
;    Transferring integer operands - Use the form:
857
;
858
;               cp_write_s   reg,INT
859
;
860
;
861
;       Ex:     cp_write_s   lr2,INT Transfers the contents of lr2 to
862
;                                    the least-significant half of Am29027
863
;                                    register S, (the contents of lr2
864
;                                    will also be transferred to the most-
865
;                                    significant half of register S, but
866
;                                    these bits are don't cares).
867
;
868
;
869
;    Starting an Am29027 operation - Any of the forms above may be
870
;       appended with parameter START, e.g.:
871
;
872
;               cp_write_s   lr2,START
873
;
874
;               cp_write_s   lr2,lr5,START
875
;
876
;               cp_write_s   lr2,INT,START
877
;
878
;
879
;============================================================================
880
;
881
 .macro cp_write_s,p1,p2,p3
882
;
883
   .if $narg==0
884
     .err
885
     .print "cp_write_s: missing parameter(s)"
886
   .endif
887
;
888
;
889
   .if $narg==1
890
     store 1,CP_WRITE_S,p1,%%((&p1)+1)
891
     .exitm
892
   .endif
893
;
894
;
895
   .if $narg==2
896
;
897
     .ifeqs "@p2@","INT"
898
       store 1,CP_WRITE_S,p1,p1
899
       .exitm
900
     .endif
901
;
902
     .ifeqs "@p2@","START"
903
       store 1,CP_WRITE_S|CP_START,p1,%%((&p1)+1)
904
       .exitm
905
     .endif
906
;
907
     store 1,CP_WRITE_S,p1,p2
908
     .exitm
909
;
910
   .endif
911
;
912
;
913
   .if $narg==3
914
;
915
     .ifeqs "@p2@","START"
916
       .ifeqs "@p3@","INT"
917
         store 1,CP_WRITE_S|CP_START,p1,p1
918
       .else
919
         .err
920
         .print "cp_write_s: bad parameter list"
921
       .endif
922
       .exitm
923
     .endif
924
;
925
     .ifeqs "@p2@","INT"
926
       .ifeqs "@p3@","START"
927
         store 1,CP_WRITE_S|CP_START,p1,p1
928
       .else
929
         .err
930
         .print "cp_write_s: bad parameter list"
931
       .endif
932
       .exitm
933
     .endif
934
;
935
     .ifeqs "@p3@","START"
936
       store 1,CP_WRITE_S|CP_START,p1,p2
937
     .else
938
       .err
939
       .print "cp_write_s: bad parameter list"
940
     .endif
941
     .exitm
942
;
943
   .endif
944
;
945
;
946
   .if $narg>=4
947
     .err
948
     .print "cp_write_s: too many parameters"
949
   .endif
950
;
951
 .endm
952
;
953
;
954
;
955
;
956
;============================================================================
957
;  MACRO NAME: cp_write_rs
958
;
959
;  WRITTEN BY: Bob Perlman
960
;
961
;  MOST RECENT UPDATE:  April 16, 1988
962
;
963
;  FUNCTION:   Transfers two 32-bit floating-point operands to Am29027
964
;              input registers R and S
965
;
966
;  PARAMETERS:
967
;    reg1     - the Am29000 g.p. register containing the 32-bit operand to be
968
;               transferred to register R
969
;
970
;    reg2     - the Am29000 g.p. register containing the 32-bit operand to be
971
;               transferred to register S
972
;
973
;    START    - indicates that a new Am29027 operation is to be started
974
;               once the operands have been transferred
975
;
976
;
977
;  USAGE:
978
;
979
;    cp_write_rs  reg1, reg2 [,START]
980
;
981
;       Ex: cp_write_rs  lr2,lr5       Transfers the contents of lr2 to
982
;                                      the most-significant half of Am29027
983
;                                      register R, and the contents of lr5
984
;                                      to the most-significant half of Am29027
985
;                                      register S.
986
;
987
;           cp_write_rs  lr2,lr5,START Transfers the contents of lr2 to
988
;                                      the most-significant half of Am29027
989
;                                      register R, and the contents of lr5
990
;                                      to the most-significant half of Am29027
991
;                                      register S; a new operation is started
992
;                                      once the transfer is complete.
993
;
994
;
995
;
996
;============================================================================
997
;
998
 .macro cp_write_rs,p1,p2,p3
999
;
1000
;
1001
   .if $narg<=1
1002
     .err
1003
     .print "cp_write_rs: missing parameter(s)"
1004
     .exitm
1005
   .endif
1006
;
1007
;
1008
   .if $narg==2
1009
     .ifeqs "@p2@","START"
1010
       .err
1011
       .print "cp_write_rs: bad parameter list"
1012
     .else
1013
       store 1,CP_WRITE_RS,p1,p2
1014
     .endif
1015
     .exitm
1016
   .endif
1017
;
1018
;
1019
   .if $narg==3
1020
     .ifeqs "@p3@","START"
1021
       store 1,CP_WRITE_RS|CP_START,p1,p2
1022
     .else
1023
       .err
1024
       .print "cp_write_rs: bad parameter list"
1025
     .endif
1026
     .exitm
1027
   .endif
1028
;
1029
;
1030
   .if $narg>=4
1031
     .err
1032
     .print "cp_write_rs: too many parameters"
1033
     .exitm
1034
   .endif
1035
;
1036
 .endm
1037
;
1038
;
1039
;
1040
;
1041
;
1042
;
1043
;============================================================================
1044
;  MACRO NAME: cp_write_prec
1045
;
1046
;  WRITTEN BY: Bob Perlman
1047
;
1048
;  MOST RECENT UPDATE:  April 16, 1988
1049
;
1050
;  FUNCTION:   Transfers a word to the Am29027 precision register
1051
;
1052
;  PARAMETERS:
1053
;    reg      - the Am29000 g.p. register containing the word to be
1054
;               transferred to the Am29027 precision register
1055
;
1056
;  USAGE:
1057
;
1058
;    cp_write_prec  reg
1059
;
1060
;       Ex: cp_write_prec  lr2         Transfers the contents of lr2 to
1061
;                                      the Am29027 precision register.
1062
;
1063
;
1064
;============================================================================
1065
;
1066
 .macro cp_write_prec,p1
1067
;
1068
;
1069
   .if $narg!=1
1070
     .err
1071
     .print "cp_write_prec: bad parameter list"
1072
   .else
1073
     store 1,CP_WRITE_PREC,p1,0
1074
   .endif
1075
;
1076
 .endm
1077
;
1078
;
1079
;
1080
;
1081
;
1082
;
1083
;============================================================================
1084
;  MACRO NAME: cp_write_status
1085
;
1086
;  WRITTEN BY: Bob Perlman
1087
;
1088
;  MOST RECENT UPDATE:  April 16, 1988
1089
;
1090
;  FUNCTION:   Transfers a word to the Am29027 precision register
1091
;
1092
;  PARAMETERS:
1093
;    reg        - the Am29000 g.p. register containing the word to be
1094
;                 transferred to the Am29027 status register
1095
;
1096
;    RESTORE    - indicates that this is the last step of a state restoration
1097
;                 sequence (flow-through mode only)
1098
;
1099
;    INVALIDATE - indicates that the current contents of the ALU pipeline
1100
;                 register are to be invalidated (pipeline mode only)
1101
;
1102
;  USAGE:
1103
;
1104
;    cp_write_status  reg [,RESTORE|INVALIDATE]
1105
;
1106
;       Ex: cp_write_status  lr2            Transfers the contents of lr2 to
1107
;                                           the Am29027 status register.
1108
;
1109
;
1110
;           cp_write_status  lr2,RESTORE    Transfers the contents of lr2 to
1111
;                                           the Am29027 status register, and
1112
;                                           completes the state restore
1113
;                                           sequence
1114
;
1115
;           cp_write_status  lr2,INVALIDATE Transfers the contents of lr2 to
1116
;                                           the Am29027 status register, and
1117
;                                           invalidates the contents of the
1118
;                                           ALU pipeline.
1119
;
1120
;
1121
;============================================================================
1122
;
1123
 .macro cp_write_status,p1,p2
1124
;
1125
   .if $narg==0
1126
     .err
1127
     .print "cp_write_status: missing parameter(s)"
1128
   .endif
1129
;
1130
;
1131
   .if $narg==1
1132
     store 1,CP_WRITE_STATUS,p1,0
1133
     .exitm
1134
   .endif
1135
;
1136
;
1137
   .if $narg==2
1138
;
1139
     .ifeqs "@p2@","RESTORE"
1140
       store 1,CP_WRITE_STATUS|CP_START,p1,0
1141
       .exitm
1142
     .endif
1143
;
1144
     .ifeqs "@p2@","INVALIDATE"
1145
       store 1,CP_WRITE_STATUS|CP_START,p1,0
1146
       .exitm
1147
     .endif
1148
;
1149
     .err
1150
     .print "cp_write_status: bad parameter list"
1151
     .exitm
1152
;
1153
   .endif
1154
;
1155
;
1156
   .if $narg >=3
1157
     .err
1158
     .print "cp_write_status: too many parameters"
1159
     .exitm
1160
   .endif
1161
;
1162
 .endm
1163
;
1164
;
1165
;
1166
;
1167
;
1168
;============================================================================
1169
;  MACRO NAME: cp_write_inst
1170
;
1171
;  WRITTEN BY: Bob Perlman
1172
;
1173
;  MOST RECENT UPDATE:  April 16, 1988
1174
;
1175
;  FUNCTION:   Transfers an instruction word to the Am29027 instruction
1176
;              register
1177
;
1178
;  PARAMETERS:
1179
;    reg     - the Am29000 g.p. register containing the word to be
1180
;              transferred to the Am29027 instruction register
1181
;
1182
;    START   - indicates that a new Am29027 operation is to be started
1183
;              once the instruction word has been transferred
1184
;
1185
;  USAGE:
1186
;
1187
;    cp_write_inst  reg [,START]
1188
;
1189
;       Ex: cp_write_inst  lr2            Transfers the contents of lr2 to
1190
;                                         the Am29027 instruction register.
1191
;
1192
;
1193
;           cp_write_inst  lr2,START      Transfers the contents of lr2 to
1194
;                                         the Am29027 status register; a
1195
;                                         new operation is started once the
1196
;                                         transfer is complete.
1197
;
1198
;
1199
;============================================================================
1200
;
1201
 .macro cp_write_inst,p1,p2
1202
;
1203
   .if $narg==0
1204
     .err
1205
     .print "cp_write_inst: missing parameter(s)"
1206
   .endif
1207
;
1208
;
1209
   .if $narg==1
1210
     store 1,CP_WRITE_INST,p1,p1
1211
     .exitm
1212
   .endif
1213
;
1214
;
1215
   .if $narg==2
1216
;
1217
     .ifeqs "@p2@","START"
1218
       store 1,CP_WRITE_INST|CP_START,p1,p1
1219
     .else
1220
       .err
1221
       .print "cp_write_inst: bad parameter list"
1222
     .endif
1223
     .exitm
1224
;
1225
   .endif
1226
;
1227
;
1228
   .if $narg >=3
1229
     .err
1230
     .print "cp_write_inst: too many parameters"
1231
     .exitm
1232
   .endif
1233
;
1234
 .endm
1235
;
1236
;
1237
;
1238
;
1239
;
1240
;
1241
;============================================================================
1242
;  MACRO NAME: cp_advance_temps
1243
;
1244
;  WRITTEN BY: Bob Perlman
1245
;
1246
;  MOST RECENT UPDATE:  April 17, 1988
1247
;
1248
;  FUNCTION:   Transfers the contents of Am29027 registers R-Temp, S-Temp,
1249
;              and I-Temp to register R, register S, and the instruction
1250
;              register, respectively.
1251
;
1252
;  PARAMETERS: none
1253
;
1254
;  USAGE:
1255
;
1256
;    cp_advance_temps
1257
;
1258
;
1259
;
1260
;============================================================================
1261
;
1262
 .macro cp_advance_temps
1263
;
1264
;
1265
   .if $narg!=0
1266
     .err
1267
     .print "cp_advance_temp: takes no parameters"
1268
   .else
1269
     store 1,CP_ADV_TEMPS,gr1,0 ; use gr1 because it's never protected
1270
   .endif
1271
;
1272
 .endm
1273
;
1274
;
1275
;
1276
;
1277
;============================================================================
1278
;  MACRO NAME:  cp_write_mode
1279
;
1280
;  WRITTEN BY:  Bob Perlman
1281
;
1282
;  MOST RECENT UPDATE:  April 17, 1988
1283
;
1284
;  FUNCTION:    Transfers a 64-bit mode specification to the Am29027 mode
1285
;               register
1286
;
1287
;  PARAMETERS:
1288
;    reg      - the Am29000 g.p. register containing the 32 MSBs of the
1289
;               64-bit mode specification to be transferred.
1290
;
1291
;    LSB_reg  - the Am29000 g.p. register containing the 32 LSBs of the
1292
;               64-bit mode specification to be transferred.
1293
;
1294
;  USAGE:
1295
;
1296
;    cp_write_mode  reg [,LSB_reg]
1297
;
1298
;    Either of two forms is acceptable:
1299
;
1300
;               cp_write_mode   reg
1301
;          or   cp_write_mode   reg, LSB_reg
1302
;
1303
;       If LSB_reg is omitted, the LSBs are taken from the next g.p.
1304
;       register.
1305
;
1306
;       Ex:     cp_write_mode  lr2     Transfers the contents of lr2 to
1307
;                                      the most-significant half of the Am29027
1308
;                                      mode register, and the contents of lr3
1309
;                                      to the least-significant half.
1310
;
1311
;               cp_write_mode  lr2,lr5 Transfers the contents of lr2 to
1312
;                                      the most-significant half of the Am29027
1313
;                                      mode register, and the contents of lr5
1314
;                                      to the least-significant half.
1315
;
1316
;
1317
;
1318
;============================================================================
1319
;
1320
 .macro cp_write_mode,p1,p2
1321
;
1322
   .if $narg==0
1323
     .err
1324
     .print "cp_write_mode: missing parameter(s)"
1325
   .endif
1326
;
1327
;
1328
   .if $narg==1
1329
     store 1,CP_WRITE_MODE,%%((&p1)+1),p1
1330
     .exitm
1331
   .endif
1332
;
1333
;
1334
   .if $narg==2
1335
     store 1,CP_WRITE_MODE,p2,p1
1336
     .exitm
1337
   .endif
1338
;
1339
;
1340
   .if $narg>=3
1341
     .err
1342
     .print "cp_write_mode: too many parameters"
1343
   .endif
1344
;
1345
 .endm
1346
;
1347
;
1348
;
1349
;============================================================================
1350
;  MACRO NAME: cp_read_dp
1351
;
1352
;  WRITTEN BY: Bob Perlman
1353
;
1354
;  MOST RECENT UPDATE:  April 17, 1988
1355
;
1356
;  FUNCTION:   Transfers the current Am29027 double-precison floating-point
1357
;              result to the Am29000
1358
;
1359
;  PARAMETERS:
1360
;    reg     - the Am29000 g.p. register into which the 32 MSBs of the
1361
;              current Am29027 result are to be written.
1362
;
1363
;    LSB_reg - the Am29000 g.p. register into which the 32 LSBs of the
1364
;              current Am29027 result are to be written.
1365
;
1366
;    NO_ERR  - indicates that exception reporting is to be suppressed for this
1367
;              transfer.
1368
;
1369
;  USAGE:
1370
;
1371
;    cp_read_dp  reg [,LSB_reg] [,START]
1372
;
1373
;    Either of two forms is acceptable:
1374
;
1375
;               cp_read_dp   reg
1376
;          or   cp_read_dp   reg, LSB_reg
1377
;
1378
;     If LSB_reg is omitted, the LSBs are written to the next g.p. register.
1379
;
1380
;       Ex:     cp_read_dp   lr2     Transfers the 32 MSBs of the current
1381
;                                    Am29027 result to lr2, and the 32 LSBs
1382
;                                    to lr3.
1383
;
1384
;               cp_read_dp   lr2,lr5 Transfers the 32 MSBs of the current
1385
;                                    Am29027 result to lr2, and the 32 LSBs
1386
;                                    to lr5.
1387
;
1388
;    Exception reporting can be suppressed by appending NO_ERR to either
1389
;    of the above, e.g.:
1390
;
1391
;               cp_read_dp   lr2,NO_ERR
1392
;               cp_read_dp   lr2,lr5,NO_ERR
1393
;
1394
;
1395
;============================================================================
1396
;
1397
 .macro cp_read_dp,p1,p2,p3
1398
;
1399
   .if $narg==0
1400
     .err
1401
     .print "cp_read_dp: missing parameter(s)"
1402
   .endif
1403
;
1404
;
1405
   .if $narg==1
1406
     load 1,CP_READ_LSBS,%%((&p1)+1),0
1407
     load 1,CP_READ_MSBS,p1,0
1408
     .exitm
1409
   .endif
1410
;
1411
;
1412
   .if $narg==2
1413
;
1414
     .ifeqs "@p2@","NO_ERR"
1415
       load 1,CP_READ_LSBS|CP_NO_ERR,%%((&p1)+1),0
1416
       load 1,CP_READ_MSBS|CP_NO_ERR,p1,0
1417
       .exitm
1418
     .endif
1419
;
1420
     load 1,CP_READ_LSBS,p2,0
1421
     load 1,CP_READ_MSBS,p1,0
1422
     .exitm
1423
;
1424
   .endif
1425
;
1426
;
1427
   .if $narg==3
1428
;
1429
     .ifeqs "@p3@","NO_ERR"
1430
       load 1,CP_READ_LSBS|CP_NO_ERR,p2,0
1431
       load 1,CP_READ_MSBS|CP_NO_ERR,p1,0
1432
     .else
1433
       .err
1434
       .print "cp_read_dp: bad parameter list"
1435
     .endif
1436
     .exitm
1437
;
1438
   .endif
1439
;
1440
;
1441
   .if $narg>=4
1442
     .err
1443
     .print "cp_read_dp: too many parameters"
1444
   .endif
1445
;
1446
 .endm
1447
;
1448
;
1449
;
1450
;============================================================================
1451
;  MACRO NAME: cp_read_sp
1452
;
1453
;  WRITTEN BY: Bob Perlman
1454
;
1455
;  MOST RECENT UPDATE:  April 17, 1988
1456
;
1457
;  FUNCTION:   Transfers the current Am29027 single-precison floating-point
1458
;              result to the Am29000
1459
;
1460
;  PARAMETERS:
1461
;    reg     - the Am29000 g.p. register into which the current Am29027
1462
;              result is to be written.
1463
;
1464
;    NO_ERR  - indicates that exception reporting is to be suppressed for this
1465
;              transfer.
1466
;
1467
;  USAGE:
1468
;
1469
;    cp_read_sp  reg [,START]
1470
;
1471
;       Ex:     cp_read_sp   lr2        Transfers the current Am29027 result
1472
;                                       to lr2.
1473
;
1474
;               cp_read_sp   lr2,NO_ERR Transfers the current Am29027 result
1475
;                                       to lr2, and suppresses exception
1476
;                                       reporting for this transfer.
1477
;
1478
;
1479
;============================================================================
1480
;
1481
 .macro cp_read_sp,p1,p2
1482
;
1483
   .if $narg==0
1484
     .err
1485
     .print "cp_read_sp: missing parameter(s)"
1486
   .endif
1487
;
1488
;
1489
   .if $narg==1
1490
     load 1,CP_READ_MSBS,p1,0
1491
     .exitm
1492
   .endif
1493
;
1494
;
1495
   .if $narg==2
1496
;
1497
     .ifeqs "@p2@","NO_ERR"
1498
       load 1,CP_READ_MSBS|CP_NO_ERR,p1,0
1499
     .else
1500
       .err
1501
       .print "cp_read_sp: bad parameter list"
1502
     .endif
1503
     .exitm
1504
;
1505
   .endif
1506
;
1507
;
1508
   .if $narg>=3
1509
     .err
1510
     .print "cp_read_sp: too many parameters"
1511
   .endif
1512
;
1513
 .endm
1514
;
1515
;
1516
;
1517
;============================================================================
1518
;  MACRO NAME: cp_read_int
1519
;
1520
;  WRITTEN BY: Bob Perlman
1521
;
1522
;  MOST RECENT UPDATE:  April 17, 1988
1523
;
1524
;  FUNCTION:   Transfers the current Am29027 integer result to the Am29000
1525
;
1526
;  PARAMETERS:
1527
;    reg     - the Am29000 g.p. register into which the current Am29027
1528
;              result is to be written.
1529
;
1530
;    NO_ERR  - indicates that exception reporting is to be suppressed for this
1531
;              transfer.
1532
;
1533
;  USAGE:
1534
;
1535
;    cp_read_int  reg [,START]
1536
;
1537
;       Ex:     cp_read_int  lr2        Transfers the current Am29027 result
1538
;                                       to lr2.
1539
;
1540
;               cp_read_int  lr2,NO_ERR Transfers the current Am29027 result
1541
;                                       to lr2, and suppresses exception
1542
;                                       reporting for this transfer.
1543
;
1544
;
1545
;============================================================================
1546
;
1547
 .macro cp_read_int,p1,p2
1548
;
1549
   .if $narg==0
1550
     .err
1551
     .print "cp_read_int: missing parameter(s)"
1552
   .endif
1553
;
1554
;
1555
   .if $narg==1
1556
     load 1,CP_READ_LSBS,p1,0
1557
     nop                    ; leave a cycle for the MSBs to come out
1558
     .exitm
1559
   .endif
1560
;
1561
;
1562
   .if $narg==2
1563
;
1564
     .ifeqs "@p2@","NO_ERR"
1565
       load 1,CP_READ_LSBS|CP_NO_ERR,p1,0
1566
       nop                    ; leave a cycle for the MSBs to come out
1567
     .else
1568
       .err
1569
       .print "cp_read_int: bad parameter list"
1570
     .endif
1571
     .exitm
1572
;
1573
   .endif
1574
;
1575
;
1576
   .if $narg>=3
1577
     .err
1578
     .print "cp_read_int: too many parameters"
1579
   .endif
1580
;
1581
 .endm
1582
;
1583
;
1584
;
1585
;============================================================================
1586
;  MACRO NAME: cp_read_flags
1587
;
1588
;  WRITTEN BY: Bob Perlman
1589
;
1590
;  MOST RECENT UPDATE:  April 17, 1988
1591
;
1592
;  FUNCTION:   Transfers the contents of the Am29027 flag register
1593
;              to the Am29000
1594
;
1595
;  PARAMETERS:
1596
;    reg     - the Am29000 g.p. register into which the current Am29027
1597
;              flag register contents are to be written.
1598
;
1599
;    NO_ERR  - indicates that exception reporting is to be suppressed for this
1600
;              transfer.
1601
;
1602
;  USAGE:
1603
;
1604
;    cp_read_flags  reg [,START]
1605
;
1606
;       Ex:     cp_read_flags  lr2        Transfers the Am29027 flag register
1607
;                                         contents to lr2.
1608
;
1609
;               cp_read_flags  lr2,NO_ERR Transfers the Am29027 flag register
1610
;                                         contents to lr2, and suppresses
1611
;                                         exception reporting for this
1612
;                                         transfer.
1613
;
1614
;
1615
;============================================================================
1616
;
1617
 .macro cp_read_flags,p1,p2
1618
;
1619
   .if $narg==0
1620
     .err
1621
     .print "cp_read_flags: missing parameter(s)"
1622
   .endif
1623
;
1624
;
1625
   .if $narg==1
1626
     load 1,CP_READ_FLAGS,p1,0
1627
     .exitm
1628
   .endif
1629
;
1630
;
1631
   .if $narg==2
1632
;
1633
     .ifeqs "@p2@","NO_ERR"
1634
       load 1,CP_READ_FLAGS|CP_NO_ERR,p1,0
1635
     .else
1636
       .err
1637
       .print "cp_read_flags: bad parameter list"
1638
     .endif
1639
     .exitm
1640
;
1641
   .endif
1642
;
1643
;
1644
   .if $narg>=3
1645
     .err
1646
     .print "cp_read_flags: too many parameters"
1647
   .endif
1648
;
1649
 .endm
1650
;
1651
;
1652
;
1653
;============================================================================
1654
;  MACRO NAME: cp_read_status
1655
;
1656
;  WRITTEN BY: Bob Perlman
1657
;
1658
;  MOST RECENT UPDATE:  April 18, 1988
1659
;
1660
;  FUNCTION:   Transfers the contents of the Am29027 status register
1661
;              to the Am29000
1662
;
1663
;  PARAMETERS:
1664
;    reg     - the Am29000 g.p. register into which the current Am29027
1665
;              status register contents are to be written.
1666
;
1667
;    NO_ERR  - indicates that exception reporting is to be suppressed for this
1668
;              transfer.
1669
;
1670
;  USAGE:
1671
;
1672
;    cp_read_status  reg [,START]
1673
;
1674
;       Ex:     cp_read_status  lr2        Transfers the Am29027 status register
1675
;                                          contents to lr2.
1676
;
1677
;               cp_read_status  lr2,NO_ERR Transfers the Am29027 status register
1678
;                                          contents to lr2, and suppresses
1679
;                                          exception reporting for this
1680
;                                          transfer.
1681
;
1682
;
1683
;============================================================================
1684
;
1685
 .macro cp_read_status,p1,p2
1686
;
1687
   .if $narg==0
1688
     .err
1689
     .print "cp_read_status: missing parameter(s)"
1690
   .endif
1691
;
1692
;
1693
   .if $narg==1
1694
     load 1,CP_READ_STATUS,p1,0
1695
     .exitm
1696
   .endif
1697
;
1698
;
1699
   .if $narg==2
1700
;
1701
     .ifeqs "@p2@","NO_ERR"
1702
       load 1,CP_READ_STATUS|CP_NO_ERR,p1,0
1703
     .else
1704
       .err
1705
       .print "cp_read_status: bad parameter list"
1706
     .endif
1707
     .exitm
1708
;
1709
   .endif
1710
;
1711
;
1712
   .if $narg>=3
1713
     .err
1714
     .print "cp_read_status: too many parameters"
1715
   .endif
1716
;
1717
 .endm
1718
;
1719
;
1720
;
1721
;============================================================================
1722
;  MACRO NAME: cp_read_state_wd
1723
;
1724
;  WRITTEN BY: Bob Perlman
1725
;
1726
;  MOST RECENT UPDATE:  April 18, 1988
1727
;
1728
;  FUNCTION:   Transfers the next Am29027 state word to the Am29000
1729
;
1730
;  PARAMETERS:
1731
;    reg     - the Am29000 g.p. register into which the next Am29027
1732
;              state word contents are to be written.
1733
;
1734
;  USAGE:
1735
;
1736
;    cp_read_state_wd  reg
1737
;
1738
;       Ex:     cp_read_state_wd  lr2  Transfers the next Am29027 state word
1739
;                                      to lr2.
1740
;
1741
;============================================================================
1742
;
1743
 .macro cp_read_state_wd,p1
1744
;
1745
   .if $narg==0
1746
     .err
1747
     .print "cp_read_state_wd: missing parameter"
1748
   .endif
1749
;
1750
;
1751
   .if $narg==1
1752
     load 1,CP_SAVE_STATE,p1,0
1753
     .exitm
1754
   .endif
1755
;
1756
;
1757
   .if $narg>=2
1758
     .err
1759
     .print "cp_read_state_wd: too many parameters"
1760
   .endif
1761
;
1762
 .endm
1763
;
1764
;
1765
;
1766
;============================================================================
1767
;  MACRO NAME: cp_save_state
1768
;
1769
;  WRITTEN BY: Bob Perlman
1770
;
1771
;  MOST RECENT UPDATE:  April 18, 1988
1772
;
1773
;  FUNCTION:   Transfers the current Am29027 state to the Am29000
1774
;
1775
;  PARAMETERS:
1776
;    reg     - the first of 30 Am29000 g.p. registers in which Am29027 state
1777
;              is saved.
1778
;
1779
;  USAGE:
1780
;
1781
;    cp_save_state  reg
1782
;
1783
;    This macro transfers the current Am29027 state to a block of 30 Am29000
1784
;    registers.  State is stored in the following order:
1785
;
1786
;              reg      instruction register
1787
;              reg+1    I-Temp
1788
;              reg+2    R MSBs
1789
;              reg+3    R LSBs
1790
;              reg+4    S MSBs
1791
;              reg+5    S LSBs
1792
;              reg+6    R-Temp MSBs
1793
;              reg+7    R-Temp LSBs
1794
;              reg+8    S-Temp MSBs
1795
;              reg+9    S-Temp LSBs
1796
;              reg+10   status
1797
;              reg+11   precision
1798
;              reg+12   RF0 MSBs
1799
;              reg+13   RF0 LSBs
1800
;                .         .
1801
;                .         .
1802
;                .         .
1803
;              reg+26   RF7 MSBs
1804
;              reg+27   RF7 LSBs
1805
;              reg+28   mode MSBs
1806
;              reg+29   mode LSBs
1807
;
1808
;
1809
;       Ex:     cp_save_state  lr2     Transfers the current Am29027 state to
1810
;                                      the Am29000, starting at lr2.
1811
;
1812
;  NOTES:
1813
;       1) This macro stores all 64-bit quantities in "big-endian" order,
1814
;          i.e. MSBs first.  For example, the 32 MSBs of register R are
1815
;          stored in reg+2, and the 32 LSBs are stored in reg+3.  The Am29027
1816
;          transfers these quantites in "little-endian" order; the macro
1817
;          is responsible for swapping MS and LS words.
1818
;
1819
;============================================================================
1820
;
1821
 .macro cp_save_state,p1
1822
;
1823
   .if $narg==0
1824
     .err
1825
     .print "cp_save_state: missing parameter"
1826
   .endif
1827
;
1828
;
1829
   .if $narg==1
1830
     cp_read_sp p1,NO_ERR
1831
                                    ;guarantee that we're at beginning of
1832
                                    ; save state sequence
1833
     cp_read_state_wd %%((&p1)+ 0)  ; instruction
1834
     cp_read_state_wd %%((&p1)+ 1)  ; I-Temp
1835
     cp_read_state_wd %%((&p1)+ 3)  ; R MSBs
1836
     cp_read_state_wd %%((&p1)+ 2)  ; R LSBs
1837
     cp_read_state_wd %%((&p1)+ 5)  ; S MSBs
1838
     cp_read_state_wd %%((&p1)+ 4)  ; S LSBs
1839
     cp_read_state_wd %%((&p1)+ 7)  ; R-Temp MSBs
1840
     cp_read_state_wd %%((&p1)+ 6)  ; R-Temp LSBs
1841
     cp_read_state_wd %%((&p1)+ 9)  ; S-Temp MSBs
1842
     cp_read_state_wd %%((&p1)+ 8)  ; S-Temp LSBs
1843
     cp_read_state_wd %%((&p1)+10)  ; status
1844
     cp_read_state_wd %%((&p1)+11)  ; precision
1845
     cp_read_state_wd %%((&p1)+13)  ; RF0 MSBs
1846
     cp_read_state_wd %%((&p1)+12)  ; RF0 LSBs
1847
     cp_read_state_wd %%((&p1)+15)  ; RF1 MSBs
1848
     cp_read_state_wd %%((&p1)+14)  ; RF1 LSBs
1849
     cp_read_state_wd %%((&p1)+17)  ; RF2 MSBs
1850
     cp_read_state_wd %%((&p1)+16)  ; RF2 LSBs
1851
     cp_read_state_wd %%((&p1)+19)  ; RF3 MSBs
1852
     cp_read_state_wd %%((&p1)+18)  ; RF3 LSBs
1853
     cp_read_state_wd %%((&p1)+21)  ; RF4 MSBs
1854
     cp_read_state_wd %%((&p1)+20)  ; RF4 LSBs
1855
     cp_read_state_wd %%((&p1)+23)  ; RF5 MSBs
1856
     cp_read_state_wd %%((&p1)+22)  ; RF5 LSBs
1857
     cp_read_state_wd %%((&p1)+25)  ; RF6 MSBs
1858
     cp_read_state_wd %%((&p1)+24)  ; RF6 LSBs
1859
     cp_read_state_wd %%((&p1)+27)  ; RF7 MSBs
1860
     cp_read_state_wd %%((&p1)+26)  ; RF7 LSBs
1861
     cp_read_state_wd %%((&p1)+29)  ; mode MSBs
1862
     cp_read_state_wd %%((&p1)+28)  ; mode LSBs
1863
     .exitm
1864
   .endif
1865
;
1866
;
1867
   .if $narg>=2
1868
     .err
1869
     .print "cp_save_state: too many parameters"
1870
   .endif
1871
;
1872
 .endm
1873
;
1874
;
1875
;
1876
;
1877
;
1878
;============================================================================
1879
;  MACRO NAME: cp_restore_state
1880
;
1881
;  WRITTEN BY: Bob Perlman
1882
;
1883
;  MOST RECENT UPDATE:  April 18, 1988
1884
;
1885
;  FUNCTION:   Restores Am29027 state
1886
;
1887
;  PARAMETERS:
1888
;    reg     - the first of 30 Am29000 g.p. registers containing Am29027
1889
;              state.
1890
;
1891
;    temp    - a scratch register used by cp_restore_state
1892
;
1893
;  USAGE:
1894
;
1895
;    cp_restore_state  reg,temp
1896
;
1897
;    This macro restores Am29027 state by transferring 30 words to the
1898
;    Am29027; these words are taken from a block of Am29000 g.p. registers
1899
;    starting at "reg."  The words are assumed to be stored in the following
1900
;    order:
1901
;
1902
;              reg      instruction register
1903
;              reg+1    I-Temp
1904
;              reg+2    R MSBs
1905
;              reg+3    R LSBs
1906
;              reg+4    S MSBs
1907
;              reg+5    S LSBs
1908
;              reg+6    R-Temp MSBs
1909
;              reg+7    R-Temp LSBs
1910
;              reg+8    S-Temp MSBs
1911
;              reg+9    S-Temp LSBs
1912
;              reg+10   status
1913
;              reg+11   precision
1914
;              reg+12   RF0 MSBs
1915
;              reg+13   RF0 LSBs
1916
;                .         .
1917
;                .         .
1918
;                .         .
1919
;              reg+26   RF7 MSBs
1920
;              reg+27   RF7 LSBs
1921
;              reg+28   mode MSBs
1922
;              reg+29   mode LSBs
1923
;
1924
;
1925
;       Ex:     cp_restore_state  lr2,gr70  Restores Am29027 state by
1926
;                                           transferring a block of 30 words
1927
;                                           that begins at lr2.  Register gr70
1928
;                                           is used as scratch storage by this
1929
;                                           macro.
1930
;
1931
;
1932
;============================================================================
1933
;
1934
 .macro cp_restore_state,p1,p2
1935
;
1936
   .if $narg<=1
1937
     .err
1938
     .print "cp_restore_state: missing parameter(s)"
1939
   .endif
1940
;
1941
;
1942
   .if $narg==2
1943
 
1944
     const p2,0                     ;clear the status register
1945
     cp_write_status p2
1946
;
1947
     cp_write_mode %%((&p1)+28)     ;restore the mode register
1948
;
1949
     const  p2,0x80000018           ; restore RF0
1950
     consth p2,0x80000018
1951
     cp_write_inst p2
1952
     cp_write_r %%((&p1)+12),START
1953
;
1954
     consth p2,0x90000018           ; restore RF1
1955
     cp_write_inst p2
1956
     cp_write_r %%((&p1)+14),START
1957
;
1958
     consth p2,0xA0000018           ; restore RF2
1959
     cp_write_inst p2
1960
     cp_write_r %%((&p1)+16),START
1961
;
1962
     consth p2,0xB0000018           ; restore RF3
1963
     cp_write_inst p2
1964
     cp_write_r %%((&p1)+18),START
1965
;
1966
     consth p2,0xC0000018           ; restore RF4
1967
     cp_write_inst p2
1968
     cp_write_r %%((&p1)+20),START
1969
;
1970
     consth p2,0xD0000018           ; restore RF5
1971
     cp_write_inst p2
1972
     cp_write_r %%((&p1)+22),START
1973
;
1974
     consth p2,0xE0000018           ; restore RF6
1975
     cp_write_inst p2
1976
     cp_write_r %%((&p1)+24),START
1977
;
1978
     consth p2,0xF0000018           ; restore RF7
1979
     cp_write_inst p2
1980
     cp_write_r %%((&p1)+26),START
1981
;
1982
     cp_read_sp p2                  ; do a dummy read, to guarantee that
1983
                                    ; the last operation is complete
1984
;
1985
     cp_write_prec %%((&p1)+11)     ; restore precision
1986
;
1987
     cp_write_r %%((&p1)+2)         ; restore R
1988
     cp_write_s %%((&p1)+4)         ; restore S
1989
     cp_write_inst %%((&p1)+0)      ; restore instruction
1990
     cp_advance_temps               ; move R,S, and inst. to working registers
1991
;
1992
     cp_write_r %%((&p1)+6)         ; restore R-Temp
1993
     cp_write_s %%((&p1)+8)         ; restore S-Temp
1994
     cp_write_inst %%((&p1)+1)      ; restore I-Temp
1995
;
1996
; restore the status register, retime last operation
1997
;
1998
     cp_write_status %%((&p1)+10),RESTORE
1999
;
2000
     .exitm
2001
   .endif
2002
;
2003
;
2004
   .if $narg>=3
2005
     .err
2006
     .print "cp_restore_state: too many parameters"
2007
   .endif
2008
;
2009
 .endm
2010
;
2011
;
2012
;
2013
;============================================================================
2014
;  MACRO NAME: cp_build_inst
2015
;
2016
;  WRITTEN BY: Bob Perlman
2017
;
2018
;  MOST RECENT UPDATE:  April 24, 1988
2019
;                    :  January 4, 1989 Rich Parker
2020
;
2021
;  FUNCTION:   Builds a 32-bit Am29027 instruction in an Am29000 g.p.
2022
;              register.
2023
;
2024
;  PARAMETERS:
2025
;    reg       - the Am29000 g.p. register into which the instruction word
2026
;                is to be written
2027
;
2028
;    op_code   - mnemonic specifying the operation to be performed
2029
;                (e.g. FADD, P_TIMES_Q)
2030
;
2031
;    precision - precision specification for destination, source operands:
2032
;                  D_S - double-prec. result, single-prec. input(s)
2033
;                  D_D - double-prec. result, double-prec. input(s)
2034
;                  S_S - single-prec. result, single-prec. input(s)
2035
;                  S_D - single-prec. result, double-prec. input(s)
2036
;
2037
;    dest      - destination for the operation result:
2038
;                  RF0 - store result in Am29027 register file location RF0
2039
;                  RF1 - store result in Am29027 register file location RF1
2040
;                  RF2 - store result in Am29027 register file location RF2
2041
;                  RF3 - store result in Am29027 register file location RF3
2042
;                  RF4 - store result in Am29027 register file location RF4
2043
;                  RF5 - store result in Am29027 register file location RF5
2044
;                  RF6 - store result in Am29027 register file location RF6
2045
;                  RF7 - store result in Am29027 register file location RF7
2046
;                  GP  - result is to be stored in an Am29000 g.p. register
2047
;                          with a read_dp, read_sp, or read_int macro.
2048
;
2049
;    source1,
2050
;    source2,
2051
;    source3   - source operand specifications:
2052
;                  R    - take source from Am29027 register R
2053
;                  S    - take source from Am29027 register S
2054
;                  RF0  - take source from Am29027 register file location RF0
2055
;                  RF1  - take source from Am29027 register file location RF1
2056
;                  RF2  - take source from Am29027 register file location RF2
2057
;                  RF3  - take source from Am29027 register file location RF3
2058
;                  RF4  - take source from Am29027 register file location RF4
2059
;                  RF5  - take source from Am29027 register file location RF5
2060
;                  RF6  - take source from Am29027 register file location RF6
2061
;                  RF7  - take source from Am29027 register file location RF7
2062
;                  0    - source is 0
2063
;                  ONE_HALF - source is constant .5 (f.p. operations only)
2064
;                  IMINUS1 - source is constant -1 (integer operations only)
2065
;                  1    - source is constant 1
2066
;                  2    - source is constant 2
2067
;                  3    - source is constant 3
2068
;                  PI   - source is constant pi (f.p. operations only)
2069
;                  IMINUSMAX - source is -(2**63) (integer operations only)
2070
;
2071
;
2072
;  USAGE:
2073
;
2074
;    cp_build_inst  reg,op_code,[precision,]dest,source1[,source2][,source3]
2075
;
2076
;    Op-codes fall into two categories: those that correspond to Am29000
2077
;    floating-point op-codes, and for which the precision is implicit (e.g.
2078
;    FADD, DMUL); and those that correspond to Am29027 base operations
2079
;    (e.g. P_PLUS_T, P_TIMES_Q), and which require an explicit precision
2080
;    specification.
2081
;
2082
;    Every operation specified must have a destination; if the operation
2083
;    does not write a result to the Am29027 register file, destination GP
2084
;    must be specified.  The number of source operands specified must agree
2085
;    with the number of source operands required by the operation specified.
2086
;
2087
;    Ex:
2088
;
2089
;       cp_build_inst lr2,FADD,RF7,R,S
2090
;                                         Builds an instruction word to
2091
;                                         perform the operation:
2092
;                                            RF7 <- R + S
2093
;                                         where R, S, and RF7 are single-
2094
;                                         precision f.p. operands.  The
2095
;                                         instruction word is placed in lr2.
2096
;
2097
;       cp_build_inst gr119,DMUL,GP,R,ONE_HALF
2098
;                                         Builds an instruction word to
2099
;                                         perform the operation:
2100
;                                                R * .5
2101
;                                         where R, .5, and the result
2102
;                                         are double-precision f.p. operands.
2103
;                                         The result is not written to the
2104
;                                         Am29027 register file.  The
2105
;                                         instruction word is written to
2106
;                                         gr119.
2107
;
2108
;
2109
;       cp_build_inst lr3,MIN_P_AND_T,S_D,RF7,R,S
2110
;                                         Builds an instruction word to
2111
;                                         perform the operation:
2112
;                                            RF7 <- smaller of(R,S)
2113
;                                         where R and S are double-precision
2114
;                                         f.p. operands, and RF7 is a single-
2115
;                                         precison f.p. operand.  The
2116
;                                         instruction word is written to
2117
;                                         lr3.
2118
;
2119
;
2120
;       cp_build_inst gr97,I_P_TIMES_Q,S_S,GP,R,2
2121
;                                         Builds an instruction word to
2122
;                                         perform the operation:
2123
;                                                R * 2
2124
;                                         where R, .5, and the result
2125
;                                         are single-precision integer operands.
2126
;                                         The result is not written to the
2127
;                                         Am29027 register file.  The
2128
;                                         instruction word is written to
2129
;                                         gr97
2130
;
2131
;
2132
;       cp_build_inst lr7,ABS_P,D_D,RF6,S
2133
;                                         Builds an instruction word to
2134
;                                         perform the operation:
2135
;                                                RF6 <- |S|
2136
;                                         where S and RF7 are double-precision
2137
;                                         f.p. operands.  The instruction
2138
;                                         word is written to gr7.
2139
;
2140
;
2141
;       cp_build_inst gr127,PQ_PLUS_T,D_D,RF6,R,S,RF6
2142
;                                         Builds an instruction word to
2143
;                                         perform the operation:
2144
;                                           RF6 <- (R * S) + RF6
2145
;                                         where R, S and the result are
2146
;                                         double-precision f.p. operands.
2147
;                                         The instruction word is written
2148
;                                         to gr127.
2149
;
2150
;
2151
;
2152
;============================================================================
2153
;
2154
 .macro cp_build_inst,p1,p2,p3,p4,p5,p6,p7
2155
;
2156
   .if $narg<=3
2157
     .err
2158
     .print "cp_build_inst: missing parameter(s)"
2159
     .exitm
2160
   .endif
2161
;
2162
; classify operation type
2163
;
2164
   .set _cp_op_type,255
2165
 
2166
   _cp_set_op_params  p2,FADD,1,5,4,0,5
2167
   _cp_set_op_params  p2,DADD,1,5,4,0,5
2168
   _cp_set_op_params  p2,FSUB,1,5,4,0,5
2169
   _cp_set_op_params  p2,DSUB,1,5,4,0,5
2170
   _cp_set_op_params  p2,FMUL,1,5,4,5,0
2171
   _cp_set_op_params  p2,DMUL,1,5,4,5,0
2172
   _cp_set_op_params  p2,FEQ,1,5,4,0,5
2173
   _cp_set_op_params  p2,DEQ,1,5,4,0,5
2174
   _cp_set_op_params  p2,FGE,1,5,4,0,5
2175
   _cp_set_op_params  p2,DGE,1,5,4,0,5
2176
   _cp_set_op_params  p2,FGT,1,5,4,0,5
2177
   _cp_set_op_params  p2,DGT,1,5,4,0,5
2178
   _cp_set_op_params  p2,CONVERT_I_TO_F,1,4,0,0,4
2179
   _cp_set_op_params  p2,CONVERT_I_TO_D,1,4,0,0,4
2180
   _cp_set_op_params  p2,CONVERT_F_TO_I,1,4,0,0,4
2181
   _cp_set_op_params  p2,CONVERT_D_TO_I,1,4,0,0,4
2182
;
2183
; The next two lines were corrected on 1-4-89, Rich Parker
2184
;
2185
   _cp_set_op_params  p2,CONVERT_F_TO_D,1,4,4,0,0
2186
   _cp_set_op_params  p2,CONVERT_D_TO_F,1,4,4,0,0
2187
;
2188
   _cp_set_op_params  p2,PASS_P,0,5,5,0,0
2189
   _cp_set_op_params  p2,MINUSP,0,5,5,0,0
2190
   _cp_set_op_params  p2,ABSP,0,5,5,0,0
2191
   _cp_set_op_params  p2,SIGNT_TIMES_ABSP,0,6,6,0,5
2192
   _cp_set_op_params  p2,P_PLUS_T,0,6,5,0,6
2193
   _cp_set_op_params  p2,P_MINUS_T,0,6,5,0,6
2194
   _cp_set_op_params  p2,MINUSP_PLUS_T,0,6,5,0,6
2195
   _cp_set_op_params  p2,MINUSP_MINUS_T,0,6,5,0,6
2196
   _cp_set_op_params  p2,ABS_P_PLUS_T,0,6,5,0,6
2197
   _cp_set_op_params  p2,ABS_P_MINUS_T,0,6,5,0,6
2198
   _cp_set_op_params  p2,ABSP_PLUS_ABST,0,6,5,0,6
2199
   _cp_set_op_params  p2,ABSP_MINUS_ABST,0,6,5,0,6
2200
   _cp_set_op_params  p2,ABS_ABSP_MINUS_ABST,0,6,5,0,6
2201
   _cp_set_op_params  p2,P_TIMES_Q,0,6,5,6,0
2202
   _cp_set_op_params  p2,MINUSP_TIMES_Q,0,6,5,6,0
2203
   _cp_set_op_params  p2,ABS_P_TIMES_Q,0,6,5,6,0
2204
   _cp_set_op_params  p2,COMPARE_P_AND_T,0,6,5,0,6
2205
   _cp_set_op_params  p2,MAX_P_AND_T,0,6,5,0,6
2206
   _cp_set_op_params  p2,MAX_ABSP_AND_ABST,0,6,5,0,6
2207
   _cp_set_op_params  p2,MIN_P_AND_T,0,6,5,0,6
2208
   _cp_set_op_params  p2,MIN_ABSP_AND_ABST,0,6,5,0,6
2209
   _cp_set_op_params  p2,LIMIT_P_TO_MAGT,0,6,5,0,6
2210
   _cp_set_op_params  p2,CONVERT_T_TO_INT,0,5,0,0,5
2211
   _cp_set_op_params  p2,SCALE_T_TO_INT_BY_Q,0,6,0,6,5
2212
   _cp_set_op_params  p2,PQ_PLUS_T,0,7,5,6,7
2213
   _cp_set_op_params  p2,MINUSPQ_PLUS_T,0,7,5,6,7
2214
   _cp_set_op_params  p2,PQ_MINUS_T,0,7,5,6,7
2215
   _cp_set_op_params  p2,MINUSPQ_MINUS_T,0,7,5,6,7
2216
   _cp_set_op_params  p2,ABSPQ_PLUS_ABST,0,7,5,6,7
2217
   _cp_set_op_params  p2,MINUSABSPQ_PLUS_ABST,0,7,5,6,7
2218
   _cp_set_op_params  p2,ABSPQ_MINUS_ABST,0,7,5,6,7
2219
   _cp_set_op_params  p2,ROUND_T_TO_INT,0,5,0,0,5
2220
   _cp_set_op_params  p2,RECIPROCAL_OF_P,0,5,5,0,0
2221
   _cp_set_op_params  p2,CONVERT_T_TO_ALT,0,5,0,0,5
2222
   _cp_set_op_params  p2,CONVERT_T_FROM_ALT,0,5,0,0,5
2223
   _cp_set_op_params  p2,I_PASS_P,0,5,5,0,0
2224
   _cp_set_op_params  p2,I_MINUSP,0,5,5,0,0
2225
   _cp_set_op_params  p2,I_ABSP,0,5,5,0,0
2226
   _cp_set_op_params  p2,I_SIGNT_TIMES_ABSP,0,6,6,0,5
2227
   _cp_set_op_params  p2,I_P_PLUS_T,0,6,5,0,6
2228
   _cp_set_op_params  p2,I_P_MINUS_T,0,6,5,0,6
2229
   _cp_set_op_params  p2,I_MINUSP_PLUS_T,0,6,5,0,6
2230
   _cp_set_op_params  p2,I_ABS_P_PLUS_T,0,6,5,0,6
2231
   _cp_set_op_params  p2,I_ABS_P_MINUS_T,0,6,5,0,6
2232
   _cp_set_op_params  p2,I_P_TIMES_Q,0,6,5,6,0
2233
   _cp_set_op_params  p2,I_COMPARE_P_AND_T,0,6,5,0,6
2234
   _cp_set_op_params  p2,I_MAX_P_AND_T,0,6,5,0,6
2235
   _cp_set_op_params  p2,I_MIN_P_AND_T,0,6,5,0,6
2236
   _cp_set_op_params  p2,I_CONVERT_T_TO_FLOAT,0,5,0,0,5
2237
   _cp_set_op_params  p2,I_SCALE_T_TO_FLOAT_BY_Q,0,6,0,6,5
2238
   _cp_set_op_params  p2,I_P_OR_T,0,6,5,0,6
2239
   _cp_set_op_params  p2,I_P_AND_T,0,6,5,0,6
2240
   _cp_set_op_params  p2,I_P_XOR_T,0,6,5,0,6
2241
   _cp_set_op_params  p2,I_NOT_T,0,5,0,0,5
2242
   _cp_set_op_params  p2,I_LSHIFT_P_BY_Q,0,6,5,6,0
2243
   _cp_set_op_params  p2,I_ASHIFT_P_BY_Q,0,6,5,6,0
2244
   _cp_set_op_params  p2,I_FSHIFT_PT_BY_Q,0,7,5,7,6
2245
   _cp_set_op_params  p2,MOVE_P,0,5,5,0,0
2246
;
2247
;
2248
; if we couldn't find the op_code, flag an error
2249
;
2250
    .if _cp_op_type>=2
2251
      .err
2252
      .print "cp_build_inst: invalid Am29027 instruction mnemonic"
2253
      .exitm
2254
    .endif
2255
;
2256
; if number of parameters is incorrect, flag error
2257
;
2258
    .if $narg!=_cp_no_params
2259
      .err
2260
      .print "cp_build_inst: incorrect number of parameters"
2261
      .exitm
2262
    .endif
2263
;
2264
; find correct value for precision field, if appropriate
2265
;
2266
    .set _cp_prec_field,0 ; ** CORRECTION (1/4/89 ROP)
2267
    .if _cp_op_type==0    ; need to look for precision
2268
      .set _cp_found_precision,0
2269
      .ifeqs "@p3@","D_D"
2270
        .set _cp_prec_field,CP_@p3
2271
        .set _cp_found_precision,1
2272
      .endif
2273
      .ifeqs "@p3@","D_S"
2274
        .set _cp_prec_field,CP_@p3
2275
        .set _cp_found_precision,1
2276
      .endif
2277
      .ifeqs "@p3@","S_D"
2278
        .set _cp_prec_field,CP_@p3
2279
        .set _cp_found_precision,1
2280
      .endif
2281
      .ifeqs "@p3@","S_S"
2282
        .set _cp_prec_field,CP_@p3
2283
        .set _cp_found_precision,1
2284
      .endif
2285
      .if _cp_found_precision==0
2286
        .err
2287
        .print "cp_build_inst: missing precision field"
2288
        .exitm
2289
      .endif
2290
    .endif
2291
;
2292
; find value for destination field
2293
;
2294
    .if _cp_op_type==0
2295
      .set _cp_dest_field_val,CP_DEST_EQ_@p4
2296
    .else
2297
      .set _cp_dest_field_val,CP_DEST_EQ_@p3
2298
    .endif
2299
;
2300
; find correct value for p select field
2301
;
2302
     .if _cp_p_paramno==0
2303
       .set _cp_p_field_val,0x00000000
2304
     .endif
2305
     .if _cp_p_paramno==4
2306
       .set _cp_p_field_val,CP_P_EQ_@p4
2307
     .endif
2308
     .if _cp_p_paramno==5
2309
       .set _cp_p_field_val,CP_P_EQ_@p5
2310
     .endif
2311
     .if _cp_p_paramno==6
2312
       .set _cp_p_field_val,CP_P_EQ_@p6
2313
     .endif
2314
     .if _cp_p_paramno==7
2315
       .set _cp_p_field_val,CP_P_EQ_@p7
2316
     .endif
2317
     .ifeqs "@p2@","I_NOT_T"
2318
       .set _cp_p_field_val,CP_P_EQ_IMINUS1
2319
     .endif
2320
;
2321
; find correct value for q select field
2322
;
2323
     .if _cp_q_paramno==0
2324
       .set _cp_q_field_val,0x00000000
2325
     .endif
2326
     .if _cp_q_paramno==4
2327
       .set _cp_q_field_val,CP_Q_EQ_@p4
2328
     .endif
2329
     .if _cp_q_paramno==5
2330
       .set _cp_q_field_val,CP_Q_EQ_@p5
2331
     .endif
2332
     .if _cp_q_paramno==6
2333
       .set _cp_q_field_val,CP_Q_EQ_@p6
2334
     .endif
2335
     .if _cp_q_paramno==7
2336
       .set _cp_q_field_val,CP_Q_EQ_@p7
2337
     .endif
2338
;
2339
; find correct value for t select field
2340
;
2341
     .if _cp_t_paramno==0
2342
       .set _cp_t_field_val,0x00000000
2343
     .endif
2344
     .if _cp_t_paramno==4
2345
       .set _cp_t_field_val,CP_T_EQ_@p4
2346
     .endif
2347
     .if _cp_t_paramno==5
2348
       .set _cp_t_field_val,CP_T_EQ_@p5
2349
     .endif
2350
     .if _cp_t_paramno==6
2351
       .set _cp_t_field_val,CP_T_EQ_@p6
2352
     .endif
2353
     .if _cp_t_paramno==7
2354
       .set _cp_t_field_val,CP_T_EQ_@p7
2355
     .endif
2356
;
2357
;
2358
     .set _cp_inst_word,CP_@p2@|_cp_prec_field|_cp_dest_field_val
2359
     .set _cp_inst_word,_cp_inst_word|_cp_p_field_val
2360
     .set _cp_inst_word,_cp_inst_word|_cp_q_field_val
2361
     .set _cp_inst_word,_cp_inst_word|_cp_t_field_val
2362
 
2363
     const  p1,_cp_inst_word
2364
     consth p1,_cp_inst_word
2365
;
2366
 .endm
2367
;
2368
;
2369
;
2370
 .macro _cp_set_op_params,par1,par2,par3,par4,par5,par6,par7
2371
   .ifeqs "@par1@","@par2@"
2372
     .set _cp_op_type,par3
2373
     .set _cp_no_params,par4
2374
     .set _cp_p_paramno,par5
2375
     .set _cp_q_paramno,par6
2376
     .set _cp_t_paramno,par7
2377
    .endif
2378
 .endm
2379
;
2380
;
2381
;
2382
;============================================================================
2383
;  MACRO NAME: cp_build_inst_h
2384
;
2385
;  WRITTEN BY: Bob Perlman
2386
;
2387
;  MOST RECENT UPDATE:  April 24, 1988
2388
;                    :  January 4, 1989 Rich Parker
2389
;
2390
;  FUNCTION:   Builds a 16 MSBs of a 32-bit Am29027 instruction in an
2391
;              Am29000 g.p. register.
2392
;
2393
;  PARAMETERS:
2394
;    reg       - the Am29000 g.p. register into which the instruction word
2395
;                is to be written
2396
;
2397
;    op_code   - mnemonic specifying the operation to be performed
2398
;                (e.g. FADD, P_TIMES_Q)
2399
;
2400
;    precision - precision specification for destination, source operands:
2401
;                  D_S - double-prec. result, single-prec. input(s)
2402
;                  D_D - double-prec. result, double-prec. input(s)
2403
;                  S_S - single-prec. result, single-prec. input(s)
2404
;                  S_D - single-prec. result, double-prec. input(s)
2405
;
2406
;    dest      - destination for the operation result:
2407
;                  RF0 - store result in Am29027 register file location RF0
2408
;                  RF1 - store result in Am29027 register file location RF1
2409
;                  RF2 - store result in Am29027 register file location RF2
2410
;                  RF3 - store result in Am29027 register file location RF3
2411
;                  RF4 - store result in Am29027 register file location RF4
2412
;                  RF5 - store result in Am29027 register file location RF5
2413
;                  RF6 - store result in Am29027 register file location RF6
2414
;                  RF7 - store result in Am29027 register file location RF7
2415
;                  GP  - result is to be stored in an Am29000 g.p. register
2416
;                          with a read_dp, read_sp, or read_int macro.
2417
;
2418
;    source1,
2419
;    source2,
2420
;    source3   - source operand specifications:
2421
;                  R    - take source from Am29027 register R
2422
;                  S    - take source from Am29027 register S
2423
;                  RF0  - take source from Am29027 register file location RF0
2424
;                  RF1  - take source from Am29027 register file location RF1
2425
;                  RF2  - take source from Am29027 register file location RF2
2426
;                  RF3  - take source from Am29027 register file location RF3
2427
;                  RF4  - take source from Am29027 register file location RF4
2428
;                  RF5  - take source from Am29027 register file location RF5
2429
;                  RF6  - take source from Am29027 register file location RF6
2430
;                  RF7  - take source from Am29027 register file location RF7
2431
;                  0    - source is 0
2432
;                  ONE_HALF - source is constant .5 (f.p. operations only)
2433
;                  IMINUS1 - source is constant -1 (integer operations only)
2434
;                  1    - source is constant 1
2435
;                  2    - source is constant 2
2436
;                  3    - source is constant 3
2437
;                  PI   - source is constant pi (f.p. operations only)
2438
;                  IMINUSMAX - source is -(2**63) (integer operations only)
2439
;
2440
;
2441
;  USAGE:
2442
;
2443
;    cp_build_inst_h reg,op_code,[precision,]dest,source1[,source2][,source3]
2444
;
2445
;    This macro is similar to cp_build_inst, but creates only the 16 MSBs
2446
;    of the 32-bit Am29027 instruction word.  This macro is useful in cases
2447
;    where the 16 LSBs of instruction word, which specify the operation
2448
;    to be performed, already exist in an Am29000 g.p. register, but where
2449
;    the 16 MSBs, which specify operand sources and destination, must be
2450
;    changed.  In such cases, one Am29000 instruction can be saved by using
2451
;    cp_build_inst_h instead of cp_build_inst.
2452
;
2453
;    Syntax and usage are identical to that of cp_build_inst.
2454
;
2455
;    NOTE: This macro references macro _cp_set_op_params, which appears
2456
;          in the assembly listing for macro _cp_build_inst.
2457
;
2458
;
2459
;
2460
;
2461
;============================================================================
2462
;
2463
 .macro cp_build_inst_h,p1,p2,p3,p4,p5,p6,p7
2464
;
2465
   .if $narg<=3
2466
     .err
2467
     .print "cp_build_inst_h: missing parameter(s)"
2468
     .exitm
2469
   .endif
2470
;
2471
; classify operation type
2472
;
2473
   .set _cp_op_type,255
2474
 
2475
   _cp_set_op_params  p2,FADD,1,5,4,0,5
2476
   _cp_set_op_params  p2,DADD,1,5,4,0,5
2477
   _cp_set_op_params  p2,FSUB,1,5,4,0,5
2478
   _cp_set_op_params  p2,DSUB,1,5,4,0,5
2479
   _cp_set_op_params  p2,FMUL,1,5,4,5,0
2480
   _cp_set_op_params  p2,DMUL,1,5,4,5,0
2481
   _cp_set_op_params  p2,FEQ,1,5,4,0,5
2482
   _cp_set_op_params  p2,DEQ,1,5,4,0,5
2483
   _cp_set_op_params  p2,FGE,1,5,4,0,5
2484
   _cp_set_op_params  p2,DGE,1,5,4,0,5
2485
   _cp_set_op_params  p2,FGT,1,5,4,0,5
2486
   _cp_set_op_params  p2,DGT,1,5,4,0,5
2487
   _cp_set_op_params  p2,CONVERT_I_TO_F,1,4,0,0,4
2488
   _cp_set_op_params  p2,CONVERT_I_TO_D,1,4,0,0,4
2489
   _cp_set_op_params  p2,CONVERT_F_TO_I,1,4,0,0,4
2490
   _cp_set_op_params  p2,CONVERT_D_TO_I,1,4,0,0,4
2491
;
2492
; The next two lines were corrected on 1-4-89, Rich Parker
2493
;
2494
   _cp_set_op_params  p2,CONVERT_F_TO_D,1,4,4,0,0
2495
   _cp_set_op_params  p2,CONVERT_D_TO_F,1,4,4,0,0
2496
;
2497
   _cp_set_op_params  p2,PASS_P,0,5,5,0,0
2498
   _cp_set_op_params  p2,MINUSP,0,5,5,0,0
2499
   _cp_set_op_params  p2,ABSP,0,5,5,0,0
2500
   _cp_set_op_params  p2,SIGNT_TIMES_ABSP,0,6,6,0,5
2501
   _cp_set_op_params  p2,P_PLUS_T,0,6,5,0,6
2502
   _cp_set_op_params  p2,P_MINUS_T,0,6,5,0,6
2503
   _cp_set_op_params  p2,MINUSP_PLUS_T,0,6,5,0,6
2504
   _cp_set_op_params  p2,MINUSP_MINUS_T,0,6,5,0,6
2505
   _cp_set_op_params  p2,ABS_P_PLUS_T,0,6,5,0,6
2506
   _cp_set_op_params  p2,ABS_P_MINUS_T,0,6,5,0,6
2507
   _cp_set_op_params  p2,ABSP_PLUS_ABST,0,6,5,0,6
2508
   _cp_set_op_params  p2,ABSP_MINUS_ABST,0,6,5,0,6
2509
   _cp_set_op_params  p2,ABS_ABSP_MINUS_ABST,0,6,5,0,6
2510
   _cp_set_op_params  p2,P_TIMES_Q,0,6,5,6,0
2511
   _cp_set_op_params  p2,MINUSP_TIMES_Q,0,6,5,6,0
2512
   _cp_set_op_params  p2,ABS_P_TIMES_Q,0,6,5,6,0
2513
   _cp_set_op_params  p2,COMPARE_P_AND_T,0,6,5,0,6
2514
   _cp_set_op_params  p2,MAX_P_AND_T,0,6,5,0,6
2515
   _cp_set_op_params  p2,MAX_ABSP_AND_ABST,0,6,5,0,6
2516
   _cp_set_op_params  p2,MIN_P_AND_T,0,6,5,0,6
2517
   _cp_set_op_params  p2,MIN_ABSP_AND_ABST,0,6,5,0,6
2518
   _cp_set_op_params  p2,LIMIT_P_TO_MAGT,0,6,5,0,6
2519
   _cp_set_op_params  p2,CONVERT_T_TO_INT,0,5,0,0,5
2520
   _cp_set_op_params  p2,SCALE_T_TO_INT_BY_Q,0,6,0,6,5
2521
   _cp_set_op_params  p2,PQ_PLUS_T,0,7,5,6,7
2522
   _cp_set_op_params  p2,MINUSPQ_PLUS_T,0,7,5,6,7
2523
   _cp_set_op_params  p2,PQ_MINUS_T,0,7,5,6,7
2524
   _cp_set_op_params  p2,MINUSPQ_MINUS_T,0,7,5,6,7
2525
   _cp_set_op_params  p2,ABSPQ_PLUS_ABST,0,7,5,6,7
2526
   _cp_set_op_params  p2,MINUSABSPQ_PLUS_ABST,0,7,5,6,7
2527
   _cp_set_op_params  p2,ABSPQ_MINUS_ABST,0,7,5,6,7
2528
   _cp_set_op_params  p2,ROUND_T_TO_INT,0,5,0,0,5
2529
   _cp_set_op_params  p2,RECIPROCAL_OF_P,0,5,5,0,0
2530
   _cp_set_op_params  p2,CONVERT_T_TO_ALT,0,5,0,0,5
2531
   _cp_set_op_params  p2,CONVERT_T_FROM_ALT,0,5,0,0,5
2532
   _cp_set_op_params  p2,I_PASS_P,0,5,5,0,0
2533
   _cp_set_op_params  p2,I_MINUSP,0,5,5,0,0
2534
   _cp_set_op_params  p2,I_ABSP,0,5,5,0,0
2535
   _cp_set_op_params  p2,I_SIGNT_TIMES_ABSP,0,6,6,0,5
2536
   _cp_set_op_params  p2,I_P_PLUS_T,0,6,5,0,6
2537
   _cp_set_op_params  p2,I_P_MINUS_T,0,6,5,0,6
2538
   _cp_set_op_params  p2,I_MINUSP_PLUS_T,0,6,5,0,6
2539
   _cp_set_op_params  p2,I_ABS_P_PLUS_T,0,6,5,0,6
2540
   _cp_set_op_params  p2,I_ABS_P_MINUS_T,0,6,5,0,6
2541
   _cp_set_op_params  p2,I_P_TIMES_Q,0,6,5,6,0
2542
   _cp_set_op_params  p2,I_COMPARE_P_AND_T,0,6,5,0,6
2543
   _cp_set_op_params  p2,I_MAX_P_AND_T,0,6,5,0,6
2544
   _cp_set_op_params  p2,I_MIN_P_AND_T,0,6,5,0,6
2545
   _cp_set_op_params  p2,I_CONVERT_T_TO_FLOAT,0,5,0,0,5
2546
   _cp_set_op_params  p2,I_SCALE_T_TO_FLOAT_BY_Q,0,6,0,6,5
2547
   _cp_set_op_params  p2,I_P_OR_T,0,6,5,0,6
2548
   _cp_set_op_params  p2,I_P_AND_T,0,6,5,0,6
2549
   _cp_set_op_params  p2,I_P_XOR_T,0,6,5,0,6
2550
   _cp_set_op_params  p2,I_NOT_T,0,5,0,0,5
2551
   _cp_set_op_params  p2,I_LSHIFT_P_BY_Q,0,6,5,6,0
2552
   _cp_set_op_params  p2,I_ASHIFT_P_BY_Q,0,6,5,6,0
2553
   _cp_set_op_params  p2,I_FSHIFT_PT_BY_Q,0,7,5,7,6
2554
   _cp_set_op_params  p2,MOVE_P,0,5,5,0,0
2555
;
2556
;
2557
; if we couldn't find the op_code, flag an error
2558
;
2559
    .if _cp_op_type>=2
2560
      .err
2561
      .print "cp_build_inst_h: invalid Am29027 instruction mnemonic"
2562
      .exitm
2563
    .endif
2564
;
2565
; if number of parameters is incorrect, flag error
2566
;
2567
    .if $narg!=_cp_no_params
2568
      .err
2569
      .print "cp_build_inst_h: incorrect number of parameters"
2570
      .exitm
2571
    .endif
2572
;
2573
; find correct value for precision field, if appropriate
2574
;
2575
    .set _cp_prec_field,0 ; ** CORRECTION (1-4-89 Rich Parker)
2576
    .if _cp_op_type==0    ; need to look for precision
2577
      .set _cp_found_precision,0
2578
      .ifeqs "@p3@","D_D"
2579
        .set _cp_prec_field,CP_@p3
2580
        .set _cp_found_precision,1
2581
      .endif
2582
      .ifeqs "@p3@","D_S"
2583
        .set _cp_prec_field,CP_@p3
2584
        .set _cp_found_precision,1
2585
      .endif
2586
      .ifeqs "@p3@","S_D"
2587
        .set _cp_prec_field,CP_@p3
2588
        .set _cp_found_precision,1
2589
      .endif
2590
      .ifeqs "@p3@","S_S"
2591
        .set _cp_prec_field,CP_@p3
2592
        .set _cp_found_precision,1
2593
      .endif
2594
      .if _cp_found_precision==0
2595
        .err
2596
        .print "cp_build_inst_h: missing precision field"
2597
        .exitm
2598
      .endif
2599
    .endif
2600
;
2601
; find value for destination field
2602
;
2603
    .if _cp_op_type==0
2604
      .set _cp_dest_field_val,CP_DEST_EQ_@p4
2605
    .else
2606
      .set _cp_dest_field_val,CP_DEST_EQ_@p3
2607
    .endif
2608
;
2609
; find correct value for p select field
2610
;
2611
     .if _cp_p_paramno==0
2612
       .set _cp_p_field_val,0x00000000
2613
     .endif
2614
     .if _cp_p_paramno==4
2615
       .set _cp_p_field_val,CP_P_EQ_@p4
2616
     .endif
2617
     .if _cp_p_paramno==5
2618
       .set _cp_p_field_val,CP_P_EQ_@p5
2619
     .endif
2620
     .if _cp_p_paramno==6
2621
       .set _cp_p_field_val,CP_P_EQ_@p6
2622
     .endif
2623
     .if _cp_p_paramno==7
2624
       .set _cp_p_field_val,CP_P_EQ_@p7
2625
     .endif
2626
     .ifeqs "@p2@","I_NOT_T"
2627
       .set _cp_p_field_val,CP_P_EQ_IMINUS1
2628
     .endif
2629
;
2630
; find correct value for q select field
2631
;
2632
     .if _cp_q_paramno==0
2633
       .set _cp_q_field_val,0x00000000
2634
     .endif
2635
     .if _cp_q_paramno==4
2636
       .set _cp_q_field_val,CP_Q_EQ_@p4
2637
     .endif
2638
     .if _cp_q_paramno==5
2639
       .set _cp_q_field_val,CP_Q_EQ_@p5
2640
     .endif
2641
     .if _cp_q_paramno==6
2642
       .set _cp_q_field_val,CP_Q_EQ_@p6
2643
     .endif
2644
     .if _cp_q_paramno==7
2645
       .set _cp_q_field_val,CP_Q_EQ_@p7
2646
     .endif
2647
;
2648
; find correct value for t select field
2649
;
2650
     .if _cp_t_paramno==0
2651
       .set _cp_t_field_val,0x00000000
2652
     .endif
2653
     .if _cp_t_paramno==4
2654
       .set _cp_t_field_val,CP_T_EQ_@p4
2655
     .endif
2656
     .if _cp_t_paramno==5
2657
       .set _cp_t_field_val,CP_T_EQ_@p5
2658
     .endif
2659
     .if _cp_t_paramno==6
2660
       .set _cp_t_field_val,CP_T_EQ_@p6
2661
     .endif
2662
     .if _cp_t_paramno==7
2663
       .set _cp_t_field_val,CP_T_EQ_@p7
2664
     .endif
2665
;
2666
;
2667
     .set _cp_inst_word,CP_@p2@|_cp_prec_field|_cp_dest_field_val
2668
     .set _cp_inst_word,_cp_inst_word|_cp_p_field_val
2669
     .set _cp_inst_word,_cp_inst_word|_cp_q_field_val
2670
     .set _cp_inst_word,_cp_inst_word|_cp_t_field_val
2671
;
2672
     consth p1,_cp_inst_word
2673
;
2674
 .endm
2675
;
2676
;
2677
;
2678
;
2679
;============================================================================
2680
;  MACRO NAME: cp_build_inst_l
2681
;
2682
;  WRITTEN BY: Bob Perlman
2683
;
2684
;  MOST RECENT UPDATE:  April 24, 1988
2685
;                    :  January 4, 1989 Rich Parker
2686
;
2687
;  FUNCTION:   Builds a 16 LSBs of a 32-bit Am29027 instruction in an
2688
;              Am29000 g.p. register; the 16 MSBs of the register are
2689
;              set to 0..
2690
;
2691
;  PARAMETERS:
2692
;    reg       - the Am29000 g.p. register into which the instruction word
2693
;                is to be written
2694
;
2695
;    op_code   - mnemonic specifying the operation to be performed
2696
;                (e.g. FADD, P_TIMES_Q)
2697
;
2698
;    precision - precision specification for destination, source operands:
2699
;                  D_S - double-prec. result, single-prec. input(s)
2700
;                  D_D - double-prec. result, double-prec. input(s)
2701
;                  S_S - single-prec. result, single-prec. input(s)
2702
;                  S_D - single-prec. result, double-prec. input(s)
2703
;
2704
;    dest      - destination for the operation result:
2705
;                  RF0 - store result in Am29027 register file location RF0
2706
;                  RF1 - store result in Am29027 register file location RF1
2707
;                  RF2 - store result in Am29027 register file location RF2
2708
;                  RF3 - store result in Am29027 register file location RF3
2709
;                  RF4 - store result in Am29027 register file location RF4
2710
;                  RF5 - store result in Am29027 register file location RF5
2711
;                  RF6 - store result in Am29027 register file location RF6
2712
;                  RF7 - store result in Am29027 register file location RF7
2713
;                  GP  - result is to be stored in an Am29000 g.p. register
2714
;                          with a read_dp, read_sp, or read_int macro.
2715
;
2716
;    source1,
2717
;    source2,
2718
;    source3   - source operand specifications:
2719
;                  R    - take source from Am29027 register R
2720
;                  S    - take source from Am29027 register S
2721
;                  RF0  - take source from Am29027 register file location RF0
2722
;                  RF1  - take source from Am29027 register file location RF1
2723
;                  RF2  - take source from Am29027 register file location RF2
2724
;                  RF3  - take source from Am29027 register file location RF3
2725
;                  RF4  - take source from Am29027 register file location RF4
2726
;                  RF5  - take source from Am29027 register file location RF5
2727
;                  RF6  - take source from Am29027 register file location RF6
2728
;                  RF7  - take source from Am29027 register file location RF7
2729
;                  0    - source is 0
2730
;                  ONE_HALF - source is constant .5 (f.p. operations only)
2731
;                  IMINUS1 - source is constant -1 (integer operations only)
2732
;                  1    - source is constant 1
2733
;                  2    - source is constant 2
2734
;                  3    - source is constant 3
2735
;                  PI   - source is constant pi (f.p. operations only)
2736
;                  IMINUSMAX - source is -(2**63) (integer operations only)
2737
;
2738
;
2739
;  USAGE:
2740
;
2741
;    cp_build_inst_l reg,op_code,[precision,]dest,source1[,source2][,source3]
2742
;
2743
;    This macro is similar to cp_build_inst, but creates only the 16 LSBs
2744
;    of the 32-bit Am29027 instruction word; the 16 MSBs of the target
2745
;    register are set to 0.  This macro is useful in cases
2746
;    where it is helpful to specify instruction LSBs and MSBs separately,
2747
;    to improve instruction scheduling.
2748
;
2749
;    Syntax and usage are identical to that of cp_build_inst.
2750
;
2751
;    NOTE: This macro references macro _cp_set_op_params, which appears
2752
;          in the assembly listing for macro _cp_build_inst.
2753
;
2754
;
2755
;============================================================================
2756
;
2757
 .macro cp_build_inst_l,p1,p2,p3,p4,p5,p6,p7
2758
;
2759
   .if $narg<=3
2760
     .err
2761
     .print "cp_build_inst_h: missing parameter(s)"
2762
     .exitm
2763
   .endif
2764
;
2765
; classify operation type
2766
;
2767
   .set _cp_op_type,255
2768
 
2769
   _cp_set_op_params  p2,FADD,1,5,4,0,5
2770
   _cp_set_op_params  p2,DADD,1,5,4,0,5
2771
   _cp_set_op_params  p2,FSUB,1,5,4,0,5
2772
   _cp_set_op_params  p2,DSUB,1,5,4,0,5
2773
   _cp_set_op_params  p2,FMUL,1,5,4,5,0
2774
   _cp_set_op_params  p2,DMUL,1,5,4,5,0
2775
   _cp_set_op_params  p2,FEQ,1,5,4,0,5
2776
   _cp_set_op_params  p2,DEQ,1,5,4,0,5
2777
   _cp_set_op_params  p2,FGE,1,5,4,0,5
2778
   _cp_set_op_params  p2,DGE,1,5,4,0,5
2779
   _cp_set_op_params  p2,FGT,1,5,4,0,5
2780
   _cp_set_op_params  p2,DGT,1,5,4,0,5
2781
   _cp_set_op_params  p2,CONVERT_I_TO_F,1,4,0,0,4
2782
   _cp_set_op_params  p2,CONVERT_I_TO_D,1,4,0,0,4
2783
   _cp_set_op_params  p2,CONVERT_F_TO_I,1,4,0,0,4
2784
   _cp_set_op_params  p2,CONVERT_D_TO_I,1,4,0,0,4
2785
;
2786
; The next two lines were corrected on 1-4-89, Rich Parker
2787
;
2788
   _cp_set_op_params  p2,CONVERT_F_TO_D,1,4,4,0,0
2789
   _cp_set_op_params  p2,CONVERT_D_TO_F,1,4,4,0,0
2790
;
2791
   _cp_set_op_params  p2,PASS_P,0,5,5,0,0
2792
   _cp_set_op_params  p2,MINUSP,0,5,5,0,0
2793
   _cp_set_op_params  p2,ABSP,0,5,5,0,0
2794
   _cp_set_op_params  p2,SIGNT_TIMES_ABSP,0,6,6,0,5
2795
   _cp_set_op_params  p2,P_PLUS_T,0,6,5,0,6
2796
   _cp_set_op_params  p2,P_MINUS_T,0,6,5,0,6
2797
   _cp_set_op_params  p2,MINUSP_PLUS_T,0,6,5,0,6
2798
   _cp_set_op_params  p2,MINUSP_MINUS_T,0,6,5,0,6
2799
   _cp_set_op_params  p2,ABS_P_PLUS_T,0,6,5,0,6
2800
   _cp_set_op_params  p2,ABS_P_MINUS_T,0,6,5,0,6
2801
   _cp_set_op_params  p2,ABSP_PLUS_ABST,0,6,5,0,6
2802
   _cp_set_op_params  p2,ABSP_MINUS_ABST,0,6,5,0,6
2803
   _cp_set_op_params  p2,ABS_ABSP_MINUS_ABST,0,6,5,0,6
2804
   _cp_set_op_params  p2,P_TIMES_Q,0,6,5,6,0
2805
   _cp_set_op_params  p2,MINUSP_TIMES_Q,0,6,5,6,0
2806
   _cp_set_op_params  p2,ABS_P_TIMES_Q,0,6,5,6,0
2807
   _cp_set_op_params  p2,COMPARE_P_AND_T,0,6,5,0,6
2808
   _cp_set_op_params  p2,MAX_P_AND_T,0,6,5,0,6
2809
   _cp_set_op_params  p2,MAX_ABSP_AND_ABST,0,6,5,0,6
2810
   _cp_set_op_params  p2,MIN_P_AND_T,0,6,5,0,6
2811
   _cp_set_op_params  p2,MIN_ABSP_AND_ABST,0,6,5,0,6
2812
   _cp_set_op_params  p2,LIMIT_P_TO_MAGT,0,6,5,0,6
2813
   _cp_set_op_params  p2,CONVERT_T_TO_INT,0,5,0,0,5
2814
   _cp_set_op_params  p2,SCALE_T_TO_INT_BY_Q,0,6,0,6,5
2815
   _cp_set_op_params  p2,PQ_PLUS_T,0,7,5,6,7
2816
   _cp_set_op_params  p2,MINUSPQ_PLUS_T,0,7,5,6,7
2817
   _cp_set_op_params  p2,PQ_MINUS_T,0,7,5,6,7
2818
   _cp_set_op_params  p2,MINUSPQ_MINUS_T,0,7,5,6,7
2819
   _cp_set_op_params  p2,ABSPQ_PLUS_ABST,0,7,5,6,7
2820
   _cp_set_op_params  p2,MINUSABSPQ_PLUS_ABST,0,7,5,6,7
2821
   _cp_set_op_params  p2,ABSPQ_MINUS_ABST,0,7,5,6,7
2822
   _cp_set_op_params  p2,ROUND_T_TO_INT,0,5,0,0,5
2823
   _cp_set_op_params  p2,RECIPROCAL_OF_P,0,5,5,0,0
2824
   _cp_set_op_params  p2,CONVERT_T_TO_ALT,0,5,0,0,5
2825
   _cp_set_op_params  p2,CONVERT_T_FROM_ALT,0,5,0,0,5
2826
   _cp_set_op_params  p2,I_PASS_P,0,5,5,0,0
2827
   _cp_set_op_params  p2,I_MINUSP,0,5,5,0,0
2828
   _cp_set_op_params  p2,I_ABSP,0,5,5,0,0
2829
   _cp_set_op_params  p2,I_SIGNT_TIMES_ABSP,0,6,6,0,5
2830
   _cp_set_op_params  p2,I_P_PLUS_T,0,6,5,0,6
2831
   _cp_set_op_params  p2,I_P_MINUS_T,0,6,5,0,6
2832
   _cp_set_op_params  p2,I_MINUSP_PLUS_T,0,6,5,0,6
2833
   _cp_set_op_params  p2,I_ABS_P_PLUS_T,0,6,5,0,6
2834
   _cp_set_op_params  p2,I_ABS_P_MINUS_T,0,6,5,0,6
2835
   _cp_set_op_params  p2,I_P_TIMES_Q,0,6,5,6,0
2836
   _cp_set_op_params  p2,I_COMPARE_P_AND_T,0,6,5,0,6
2837
   _cp_set_op_params  p2,I_MAX_P_AND_T,0,6,5,0,6
2838
   _cp_set_op_params  p2,I_MIN_P_AND_T,0,6,5,0,6
2839
   _cp_set_op_params  p2,I_CONVERT_T_TO_FLOAT,0,5,0,0,5
2840
   _cp_set_op_params  p2,I_SCALE_T_TO_FLOAT_BY_Q,0,6,0,6,5
2841
   _cp_set_op_params  p2,I_P_OR_T,0,6,5,0,6
2842
   _cp_set_op_params  p2,I_P_AND_T,0,6,5,0,6
2843
   _cp_set_op_params  p2,I_P_XOR_T,0,6,5,0,6
2844
   _cp_set_op_params  p2,I_NOT_T,0,5,0,0,5
2845
   _cp_set_op_params  p2,I_LSHIFT_P_BY_Q,0,6,5,6,0
2846
   _cp_set_op_params  p2,I_ASHIFT_P_BY_Q,0,6,5,6,0
2847
   _cp_set_op_params  p2,I_FSHIFT_PT_BY_Q,0,7,5,7,6
2848
   _cp_set_op_params  p2,MOVE_P,0,5,5,0,0
2849
;
2850
;
2851
; if we couldn't find the op_code, flag an error
2852
;
2853
    .if _cp_op_type>=2
2854
      .err
2855
      .print "cp_build_inst_h: invalid Am29027 instruction mnemonic"
2856
      .exitm
2857
    .endif
2858
;
2859
; if number of parameters is incorrect, flag error
2860
;
2861
    .if $narg!=_cp_no_params
2862
      .err
2863
      .print "cp_build_inst_h: incorrect number of parameters"
2864
      .exitm
2865
    .endif
2866
;
2867
; find correct value for precision field, if appropriate
2868
;
2869
    .set _cp_prec_field,0 ; CORRECTION (1-4-89 Rich Parker)
2870
    .if _cp_op_type==0    ; need to look for precision
2871
      .set _cp_found_precision,0
2872
      .ifeqs "@p3@","D_D"
2873
        .set _cp_prec_field,CP_@p3
2874
        .set _cp_found_precision,1
2875
      .endif
2876
      .ifeqs "@p3@","D_S"
2877
        .set _cp_prec_field,CP_@p3
2878
        .set _cp_found_precision,1
2879
      .endif
2880
      .ifeqs "@p3@","S_D"
2881
        .set _cp_prec_field,CP_@p3
2882
        .set _cp_found_precision,1
2883
      .endif
2884
      .ifeqs "@p3@","S_S"
2885
        .set _cp_prec_field,CP_@p3
2886
        .set _cp_found_precision,1
2887
      .endif
2888
      .if _cp_found_precision==0
2889
        .err
2890
        .print "cp_build_inst_h: missing precision field"
2891
        .exitm
2892
      .endif
2893
    .endif
2894
;
2895
; find value for destination field
2896
;
2897
    .if _cp_op_type==0
2898
      .set _cp_dest_field_val,CP_DEST_EQ_@p4
2899
    .else
2900
      .set _cp_dest_field_val,CP_DEST_EQ_@p3
2901
    .endif
2902
;
2903
; find correct value for p select field
2904
;
2905
     .if _cp_p_paramno==0
2906
       .set _cp_p_field_val,0x00000000
2907
     .endif
2908
     .if _cp_p_paramno==4
2909
       .set _cp_p_field_val,CP_P_EQ_@p4
2910
     .endif
2911
     .if _cp_p_paramno==5
2912
       .set _cp_p_field_val,CP_P_EQ_@p5
2913
     .endif
2914
     .if _cp_p_paramno==6
2915
       .set _cp_p_field_val,CP_P_EQ_@p6
2916
     .endif
2917
     .if _cp_p_paramno==7
2918
       .set _cp_p_field_val,CP_P_EQ_@p7
2919
     .endif
2920
     .ifeqs "@p2@","I_NOT_T"
2921
       .set _cp_p_field_val,CP_P_EQ_IMINUS1
2922
     .endif
2923
;
2924
; find correct value for q select field
2925
;
2926
     .if _cp_q_paramno==0
2927
       .set _cp_q_field_val,0x00000000
2928
     .endif
2929
     .if _cp_q_paramno==4
2930
       .set _cp_q_field_val,CP_Q_EQ_@p4
2931
     .endif
2932
     .if _cp_q_paramno==5
2933
       .set _cp_q_field_val,CP_Q_EQ_@p5
2934
     .endif
2935
     .if _cp_q_paramno==6
2936
       .set _cp_q_field_val,CP_Q_EQ_@p6
2937
     .endif
2938
     .if _cp_q_paramno==7
2939
       .set _cp_q_field_val,CP_Q_EQ_@p7
2940
     .endif
2941
;
2942
; find correct value for t select field
2943
;
2944
     .if _cp_t_paramno==0
2945
       .set _cp_t_field_val,0x00000000
2946
     .endif
2947
     .if _cp_t_paramno==4
2948
       .set _cp_t_field_val,CP_T_EQ_@p4
2949
     .endif
2950
     .if _cp_t_paramno==5
2951
       .set _cp_t_field_val,CP_T_EQ_@p5
2952
     .endif
2953
     .if _cp_t_paramno==6
2954
       .set _cp_t_field_val,CP_T_EQ_@p6
2955
     .endif
2956
     .if _cp_t_paramno==7
2957
       .set _cp_t_field_val,CP_T_EQ_@p7
2958
     .endif
2959
;
2960
;
2961
     .set _cp_inst_word,CP_@p2@|_cp_prec_field|_cp_dest_field_val
2962
     .set _cp_inst_word,_cp_inst_word|_cp_p_field_val
2963
     .set _cp_inst_word,_cp_inst_word|_cp_q_field_val
2964
     .set _cp_inst_word,_cp_inst_word|_cp_t_field_val
2965
;
2966
     const p1,_cp_inst_word
2967
;
2968
 .endm
2969
;
2970
; end of file fpsymbol.h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.