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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [rtl/] [ao486/] [commands/] [CMD_JMP.txt] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
 
2
3
`define CMD_JMP         #AUTOGEN_NEXT_CMD
4
 
5
`define CMDEX_JMP_Ev_STEP_0             4'd0
6
`define CMDEX_JMP_Jv_STEP_0             4'd1
7
`define CMDEX_JMP_Ep_STEP_0             4'd2
8
`define CMDEX_JMP_Ap_STEP_0             4'd3
9
 
10
`define CMDEX_JMP_Ev_Jv_STEP_1          4'd4
11
 
12
`define CMDEX_JMP_Ep_STEP_1             4'd5
13
`define CMDEX_JMP_Ap_STEP_1             4'd6
14
 
15
`define CMDEX_JMP_real_v8086_STEP_0    4'd7
16
`define CMDEX_JMP_real_v8086_STEP_1    4'd8
17
 
18
`define CMDEX_JMP_protected_STEP_0     4'd9
19
`define CMDEX_JMP_protected_STEP_1     4'd10
20
 
21
`define CMDEX_JMP_protected_seg_STEP_0 4'd11
22
`define CMDEX_JMP_protected_seg_STEP_1 4'd12
23
 
24
`define CMDEX_JMP_task_switch_STEP_0   4'd13
25
 
26
`define CMDEX_JMP_task_gate_STEP_0     4'd14
27
`define CMDEX_JMP_task_gate_STEP_1     4'd15
28
 
29
//------------------------------------------------------------------------------
30
 
31
`define CMD_JMP_2       #AUTOGEN_NEXT_CMD
32
 
33
`define CMDEX_JMP_2_call_gate_STEP_0    4'd0
34
`define CMDEX_JMP_2_call_gate_STEP_1    4'd1
35
`define CMDEX_JMP_2_call_gate_STEP_2    4'd2
36
`define CMDEX_JMP_2_call_gate_STEP_3    4'd3
37
38
 
39
40
dec_ready_call_jmp_imm && (decoder[7:0] == 8'hEA || decoder[7:0] == 8'hE9 || decoder[7:0] == 8'hEB)
41
`CMD_JMP
42
IF(decoder[0] == 1'b0); SET(dec_cmdex, `CMDEX_JMP_Ap_STEP_0); ELSE(); SET(dec_cmdex, `CMDEX_JMP_Jv_STEP_0); ENDIF();
43
IF(decoder[3:0] == 4'hB); SET(dec_is_8bit); ENDIF();
44
SET(consume_call_jmp_imm);
45
SET(dec_is_complex);
46
47
 
48
49
dec_ready_modregrm_one && decoder[7:0] == 8'hFF && (decoder[13:11] == 3'd4 || decoder[13:11] == 3'd5)
50
prefix_group_1_lock || (decoder[13:11] == 3'd5 && `DEC_MODREGRM_IS_MOD_11)
51
`CMD_JMP
52
IF(decoder[11] == 1'b0); SET(dec_cmdex, `CMDEX_JMP_Ev_STEP_0); ELSE(); SET(dec_cmdex, `CMDEX_JMP_Ep_STEP_0); ENDIF();
53
SET(consume_modregrm_one);
54
SET(dec_is_complex);
55
56
 
57
58
IF(`CMDEX_JMP_Jv_STEP_0);
59
    LOOP(`CMDEX_JMP_Ev_Jv_STEP_1);
60
ENDIF();
61
 
62
IF(`CMDEX_JMP_Ev_STEP_0);
63
    LOOP(`CMDEX_JMP_Ev_Jv_STEP_1);
64
ENDIF();
65
 
66
IF(`CMDEX_JMP_Ep_STEP_0);
67
    `CMDEX_JMP_Ep_STEP_1
68
ENDIF();
69
 
70
IF(`CMDEX_JMP_Ap_STEP_0);
71
    `CMDEX_JMP_Ap_STEP_1
72
ENDIF();
73
 
74
IF(mc_cmd == `CMD_JMP && (mc_cmdex_last == `CMDEX_JMP_Ep_STEP_1 || mc_cmdex_last == `CMDEX_JMP_Ap_STEP_1) && (real_mode || v8086_mode));
75
    `CMDEX_JMP_real_v8086_STEP_0
76
    CALL(`CMDEX_load_seg_STEP_1);
77
    LOOP(`CMDEX_JMP_real_v8086_STEP_1);
78
ENDIF();
79
 
80
IF(mc_cmd == `CMD_JMP && (mc_cmdex_last == `CMDEX_JMP_Ep_STEP_1 || mc_cmdex_last == `CMDEX_JMP_Ap_STEP_1) && (protected_mode));
81
    `CMDEX_JMP_protected_STEP_0
82
    `CMDEX_JMP_protected_STEP_1
83
 
84
    IF(`CMDEX_JMP_protected_STEP_1 && glob_descriptor[`DESC_BIT_SEG]);
85
        `CMDEX_JMP_protected_seg_STEP_0
86
        LOOP(`CMDEX_JMP_protected_seg_STEP_1);
87
    ENDIF();
88
 
89
    IF(`CMDEX_JMP_protected_STEP_1 && glob_descriptor[`DESC_BIT_SEG] == `FALSE && (glob_descriptor[`DESC_BITS_TYPE] == `DESC_TSS_AVAIL_386 || glob_descriptor[`DESC_BITS_TYPE] == `DESC_TSS_AVAIL_286));
90
        `CMDEX_JMP_task_switch_STEP_0
91
 
92
        //zero length
93
        IF(`CMDEX_JMP_task_switch_STEP_0 && glob_param_3[21:18] == 4'd0);
94
            `CMDEX_JMP_task_switch_STEP_0
95
        ENDIF();
96
 
97
        //not zero length, task gate
98
        IF(`CMDEX_JMP_task_switch_STEP_0 && glob_param_3[21:18] != 4'd0);
99
            JMP(`CMDEX_task_switch_STEP_1);
100
        ENDIF();
101
    ENDIF();
102
 
103
    IF(`CMDEX_JMP_protected_STEP_1 && glob_descriptor[`DESC_BIT_SEG] == `FALSE && glob_descriptor[`DESC_BITS_TYPE] == `DESC_TASK_GATE);
104
        `CMDEX_JMP_task_gate_STEP_0
105
        `CMDEX_JMP_task_gate_STEP_1
106
        JMP(`CMDEX_task_switch_STEP_1);
107
    ENDIF();
108
 
109
    //call gate
110
    IF(`CMDEX_JMP_protected_STEP_1 && glob_descriptor[`DESC_BIT_SEG] == `FALSE && (glob_descriptor[`DESC_BITS_TYPE] == `DESC_CALL_GATE_386 || glob_descriptor[`DESC_BITS_TYPE] == `DESC_CALL_GATE_286));
111
        `CMDEX_JMP_2_call_gate_STEP_0
112
        `CMDEX_JMP_2_call_gate_STEP_1
113
        `CMDEX_JMP_2_call_gate_STEP_2
114
        LOOP(`CMDEX_JMP_2_call_gate_STEP_3);
115
    ENDIF();
116
ENDIF();
117
118
 
119
120
IF(rd_cmd == `CMD_JMP && rd_cmdex == `CMDEX_JMP_Jv_STEP_0);
121
    SET(rd_src_is_imm_se);
122
    SET(rd_dst_is_eip);
123
ENDIF();
124
125
 
126
127
IF(rd_cmd == `CMD_JMP  && rd_cmdex == `CMDEX_JMP_Ap_STEP_1);
128
    SET(rd_extra_wire, rd_decoder[55:24]);
129
ENDIF();
130
131
 
132
133
IF(rd_cmd == `CMD_JMP_2 && rd_cmdex == `CMDEX_JMP_2_call_gate_STEP_0);
134
 
135
    IF(rd_mutex_busy_active); SET(rd_waiting);  // wait for previous step -- loading glob_param_1
136
    ELSE();
137
        SET(rd_glob_param_1_set);
138
        SET(rd_glob_param_1_value, { 13'd0, `SEGMENT_CS, glob_descriptor[31:16] });
139
 
140
        SET(rd_glob_param_2_set);
141
        SET(rd_glob_param_2_value, (glob_descriptor[`DESC_BITS_TYPE] == `DESC_CALL_GATE_386)? { glob_descriptor[63:48], glob_descriptor[15:0] } : { 16'd0, glob_descriptor[15:0] });
142
    ENDIF();
143
ENDIF();
144
145
 
146
147
IF(rd_cmd == `CMD_JMP_2 && rd_cmdex == `CMDEX_JMP_2_call_gate_STEP_1);
148
 
149
    IF(glob_param_1[15:2] != 14'd0); // do not load null
150
 
151
        SET(rd_error_code, `SELECTOR_FOR_CODE(glob_param_1));
152
 
153
        SET(rd_glob_descriptor_set);
154
        SET(rd_glob_descriptor_value, read_8);
155
 
156
        SET(read_system_descriptor);
157
 
158
        IF(~(read_for_rd_ready)); SET(rd_waiting); ENDIF();
159
    ENDIF();
160
ENDIF();
161
162
 
163
164
IF(rd_cmd == `CMD_JMP  && rd_cmdex == `CMDEX_JMP_Ev_STEP_0);
165
 
166
    IF(rd_modregrm_mod == 2'b11);
167
 
168
        SET(rd_src_is_rm);
169
 
170
        IF(rd_mutex_busy_modregrm_rm); SET(rd_waiting); ENDIF();
171
    ENDIF();
172
 
173
    IF(rd_modregrm_mod != 2'b11);
174
 
175
        SET(rd_src_is_memory);
176
 
177
        IF(rd_mutex_busy_memory); SET(rd_waiting);
178
        ELSE();
179
            SET(read_virtual);
180
 
181
            IF(~(read_for_rd_ready)); SET(rd_waiting); ENDIF();
182
        ENDIF();
183
    ENDIF();
184
 
185
ENDIF();
186
187
 
188
189
IF(rd_cmd == `CMD_JMP  && (rd_cmdex == `CMDEX_JMP_Ep_STEP_0  || rd_cmdex == `CMDEX_JMP_Ep_STEP_1));
190
 
191
    IF(rd_cmdex == `CMDEX_JMP_Ep_STEP_1);
192
        SET(address_ea_buffer);
193
        SET(read_length_word);
194
    ENDIF();
195
 
196
    SET(rd_src_is_memory);
197
 
198
    IF(rd_mutex_busy_memory); SET(rd_waiting);
199
    ELSE();
200
        SET(read_virtual);
201
 
202
        IF(~(read_for_rd_ready)); SET(rd_waiting); ENDIF();
203
    ENDIF();
204
ENDIF();
205
206
 
207
208
IF(rd_cmd == `CMD_JMP  && rd_cmdex == `CMDEX_JMP_Ap_STEP_0);
209
    SET(rd_src_is_imm);
210
ENDIF();
211
212
 
213
214
IF(rd_cmd == `CMD_JMP && rd_cmdex == `CMDEX_JMP_protected_STEP_0);
215
 
216
    IF(rd_mutex_busy_active); SET(rd_waiting); // wait for previous step -- loading glob_param_1
217
    ELSE();
218
 
219
        IF(glob_param_1[15:2] != 14'd0); // load null
220
 
221
            SET(rd_error_code, `SELECTOR_FOR_CODE(glob_param_1));
222
 
223
            SET(rd_glob_descriptor_set);
224
            SET(rd_glob_descriptor_value, read_8);
225
 
226
            SET(rd_glob_param_3_set);
227
            SET(rd_glob_param_3_value, 32'd0);
228
 
229
            SET(read_system_descriptor);
230
 
231
            IF(~(read_for_rd_ready)); SET(rd_waiting); ENDIF();
232
        ENDIF();
233
    ENDIF();
234
ENDIF();
235
236
 
237
238
IF(rd_cmd == `CMD_JMP && rd_cmdex == `CMDEX_JMP_task_gate_STEP_0);
239
 
240
    IF(rd_mutex_busy_active); SET(rd_waiting);  // wait for previous step -- loading glob_param_1
241
    ELSE();
242
        SET(rd_glob_param_1_set);
243
        SET(rd_glob_param_1_value, { 16'd0, glob_descriptor[31:16] });
244
    ENDIF();
245
ENDIF();
246
247
 
248
249
IF(rd_cmd == `CMD_JMP && rd_cmdex == `CMDEX_JMP_task_gate_STEP_1);
250
 
251
//TODO: null not checked
252
    IF(glob_param_1[`SELECTOR_BIT_TI] == 1'b0); // skip if TI set
253
 
254
        SET(rd_error_code, `SELECTOR_FOR_CODE(glob_param_1));
255
 
256
        SET(rd_glob_descriptor_set);
257
        SET(rd_glob_descriptor_value, read_8);
258
 
259
        SET(read_system_descriptor);
260
 
261
        IF(~(read_for_rd_ready)); SET(rd_waiting); ENDIF();
262
    ENDIF();
263
ENDIF();
264
265
 
266
267
IF(exe_cmd == `CMD_JMP  && (exe_cmdex == `CMDEX_JMP_Ev_STEP_0  || exe_cmdex == `CMDEX_JMP_Ep_STEP_0  || exe_cmdex == `CMDEX_JMP_Ap_STEP_0));
268
 
269
    IF(exe_operand_32bit);
270
        SET(exe_glob_param_2_set);
271
        SET(exe_glob_param_2_value, src);
272
    ELSE();
273
        SET(exe_glob_param_2_set);
274
        SET(exe_glob_param_2_value, { 16'd0, src[15:0] });
275
    ENDIF();
276
ENDIF();
277
278
 
279
280
IF(exe_cmd == `CMD_JMP  && exe_cmdex == `CMDEX_JMP_Jv_STEP_0);
281
 
282
    IF(exe_cmd == `CMD_CALL && exe_mutex_current[`MUTEX_ESP_BIT]); SET(exe_waiting); ENDIF();
283
 
284
    IF(exe_operand_32bit);
285
        SET(exe_glob_param_2_set);
286
        SET(exe_glob_param_2_value, exe_arith_add[31:0]);
287
    ELSE();
288
        SET(exe_glob_param_2_set);
289
        SET(exe_glob_param_2_value, { 16'd0, exe_arith_add[15:0] });
290
    ENDIF();
291
ENDIF();
292
293
 
294
295
IF(exe_cmd == `CMD_JMP  && exe_cmdex == `CMDEX_JMP_Ev_Jv_STEP_1);
296
 
297
    SET(exe_eip_from_glob_param_2);
298
 
299
    IF(glob_param_2 > cs_limit);
300
        SET(exe_waiting);
301
        SET(exe_trigger_gp_fault); //exception GP(0)
302
    ENDIF();
303
ENDIF();
304
305
 
306
307
IF(exe_cmd == `CMD_JMP  && exe_cmdex == `CMDEX_JMP_Ep_STEP_1);
308
 
309
    SET(exe_glob_param_1_set);
310
    SET(exe_glob_param_1_value, { 13'd0, `SEGMENT_CS, src[15:0] });
311
ENDIF();
312
313
 
314
315
IF(exe_cmd == `CMD_JMP  && exe_cmdex == `CMDEX_JMP_Ap_STEP_1);
316
 
317
    IF(exe_operand_32bit);
318
        SET(exe_glob_param_1_set);
319
        SET(exe_glob_param_1_value, { 13'd0, `SEGMENT_CS, exe_extra[31:16] });
320
    ELSE();
321
        SET(exe_glob_param_1_set);
322
        SET(exe_glob_param_1_value, { 13'd0, `SEGMENT_CS, exe_extra[15:0] });
323
    ENDIF();
324
ENDIF();
325
326
 
327
328
IF(exe_cmd == `CMD_JMP && exe_cmdex == `CMDEX_JMP_real_v8086_STEP_0);
329
    IF(glob_param_2 > cs_limit);
330
        SET(exe_waiting);
331
        SET(exe_trigger_gp_fault); //exception GP(0)
332
    ENDIF();
333
ENDIF();
334
335
 
336
337
IF(exe_cmd == `CMD_JMP && exe_cmdex == `CMDEX_JMP_real_v8086_STEP_1);
338
    SET(exe_eip_from_glob_param_2);
339
ENDIF();
340
341
 
342
343
IF(exe_cmd == `CMD_JMP && exe_cmdex == `CMDEX_JMP_protected_seg_STEP_0);
344
 
345
    IF(glob_param_2 > glob_desc_limit);
346
        SET(exe_waiting);
347
        SET(exe_trigger_gp_fault); //exception GP(0)
348
    ENDIF();
349
ENDIF();
350
351
 
352
353
IF(exe_cmd == `CMD_JMP && exe_cmdex == `CMDEX_JMP_protected_seg_STEP_1);
354
    SET(exe_eip_from_glob_param_2);
355
ENDIF();
356
357
 
358
359
IF(exe_cmd == `CMD_JMP_2 && exe_cmdex == `CMDEX_JMP_2_call_gate_STEP_1);
360
 
361
    IF(glob_param_1[15:2] == 14'd0 || glob_descriptor[`DESC_BIT_SEG] == `FALSE || `DESC_IS_DATA(glob_descriptor) ||
362
       (`DESC_IS_CODE_NON_CONFORMING(exe_descriptor) && exe_descriptor[`DESC_BITS_DPL] != cpl) ||
363
       (`DESC_IS_CODE_CONFORMING(exe_descriptor)     && exe_descriptor[`DESC_BITS_DPL] > cpl)); //check_cs());
364
 
365
        SET(exe_waiting);
366
        SET(exe_trigger_gp_fault); //exception GP(val)
367
        SET(exe_error_code, `SELECTOR_FOR_CODE(glob_param_1));
368
    ENDIF();
369
 
370
    IF(~(exe_trigger_gp_fault) && exe_descriptor[`DESC_BIT_P] == `FALSE);
371
        SET(exe_waiting);
372
        SET(exe_trigger_np_fault); //exception GP(val)
373
        SET(exe_error_code, `SELECTOR_FOR_CODE(glob_param_1));
374
    ENDIF();
375
ENDIF();
376
377
 
378
379
IF(exe_cmd == `CMD_JMP_2 && exe_cmdex == `CMDEX_JMP_2_call_gate_STEP_2);
380
 
381
    IF(glob_param_2 > glob_desc_limit);
382
        SET(exe_waiting);
383
        SET(exe_trigger_gp_fault); //exception GP(0)
384
    ENDIF();
385
ENDIF();
386
387
 
388
389
IF(exe_cmd == `CMD_JMP_2 && exe_cmdex == `CMDEX_JMP_2_call_gate_STEP_3);
390
    SET(exe_eip_from_glob_param_2);
391
ENDIF();
392
393
 
394
395
IF(wr_cmd == `CMD_JMP && (wr_cmdex == `CMDEX_JMP_Jv_STEP_0 || wr_cmdex == `CMDEX_JMP_Ev_STEP_0));
396
    SET(wr_not_finished);
397
ENDIF();
398
399
 
400
401
IF(wr_cmd == `CMD_JMP && (wr_cmdex == `CMDEX_JMP_Ev_Jv_STEP_1 || wr_cmdex == `CMDEX_JMP_real_v8086_STEP_1));
402
 
403
    // clear pipeline
404
    SET(wr_req_reset_pr);
405
    SET(wr_req_reset_dec);
406
    SET(wr_req_reset_micro);
407
    SET(wr_req_reset_rd);
408
    SET(wr_req_reset_exe);
409
ENDIF();
410
411
 
412
413
IF(wr_cmd == `CMD_JMP && (wr_cmdex == `CMDEX_JMP_Ep_STEP_0 || wr_cmdex == `CMDEX_JMP_Ap_STEP_0 ||  +
414
                            wr_cmdex == `CMDEX_JMP_Ep_STEP_1 || wr_cmdex == `CMDEX_JMP_Ap_STEP_1));
415
 
416
    SET(wr_not_finished);
417
ENDIF();
418
419
 
420
421
IF(wr_cmd == `CMD_JMP && wr_cmdex == `CMDEX_JMP_real_v8086_STEP_0);
422
    SET(wr_not_finished);
423
ENDIF();
424
425
 
426
427
IF(wr_cmd == `CMD_JMP && wr_cmdex == `CMDEX_JMP_task_switch_STEP_0);
428
    SET(wr_not_finished);
429
ENDIF();
430
431
 
432
433
IF(wr_cmd == `CMD_JMP_2 && wr_cmdex == `CMDEX_JMP_2_call_gate_STEP_0);
434
    SET(wr_not_finished);
435
ENDIF();
436
437
 
438
439
IF(wr_cmd == `CMD_JMP_2 && wr_cmdex == `CMDEX_JMP_2_call_gate_STEP_1);
440
    SET(wr_not_finished);
441
ENDIF();
442

powered by: WebSVN 2.1.0

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