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

Subversion Repositories y80e

[/] [y80e/] [trunk/] [rtl/] [control.v] - Blame information for rev 4

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

Line No. Rev Author Line
1 2 bsa
/*******************************************************************************************/
2
/**                                                                                       **/
3 4 bsa
/** COPYRIGHT (C) 2011, SYSTEMYDE INTERNATIONAL CORPORATION, ALL RIGHTS RESERVED          **/
4 2 bsa
/**                                                                                       **/
5 4 bsa
/** control module                                                   Rev  0.0  08/22/2011 **/
6 2 bsa
/**                                                                                       **/
7
/*******************************************************************************************/
8
module control (add_sel, alua_sel, alub_sel, aluop_sel, cflg_en, di_ctl, do_ctl, ex_af_pls,
9
                ex_bank_pls, ex_dehl_inst, halt_nxt, hflg_ctl, ief_ctl, if_frst, inta_frst,
10
                imd_ctl, ld_dmaa, ld_inst, ld_inta, ld_page, ld_wait, nflg_ctl, output_inh,
11 4 bsa
                page_sel, pc_sel, pflg_ctl, rd_frst, rd_nxt, reti_nxt, rreg_en, sflg_en, state_nxt,
12 2 bsa
                tflg_ctl, tran_sel, wr_addr, wr_frst, zflg_en, carry_bit, dmar_reg, inst_reg,
13
                intr_reg, page_reg, par_bit, sign_bit, state_reg, tflg_reg, vector_int,
14
                xhlt_reg, zero_bit);
15
 
16
  input         carry_bit;     /* carry flag                                               */
17
  input         dmar_reg;      /* latched dma request                                      */
18
  input         intr_reg;      /* latched interrupt request                                */
19
  input         par_bit;       /* parity flag                                              */
20
  input         sign_bit;      /* sign flag                                                */
21
  input         tflg_reg;      /* temporary flag                                           */
22
  input         vector_int;    /* int vector enable                                        */
23
  input         xhlt_reg;      /* halt exit                                                */
24
  input         zero_bit;      /* zero flag                                                */
25
  input   [3:0] page_reg;      /* instruction decode "page"                                */
26
  input   [7:0] inst_reg;      /* instruction register                                     */
27
  input   [`STATE_IDX:0] state_reg;     /* current processor state                         */
28
  output        cflg_en;       /* carry flag control                                       */
29
  output        ex_af_pls;     /* exchange af,af'                                          */
30
  output        ex_bank_pls;   /* exchange register bank                                   */
31
  output        ex_dehl_inst;  /* exchange de,hl                                           */
32
  output        halt_nxt;      /* halt cycle next                                          */
33
  output        if_frst;       /* ifetch first cycle                                       */
34
  output        inta_frst;     /* intack first cycle                                       */
35
  output        ld_dmaa;       /* load dma request                                         */
36
  output        ld_inst;       /* load instruction register                                */
37
  output        ld_inta;       /* load interrupt request                                   */
38
  output        ld_page;       /* load page register                                       */
39
  output        ld_wait;       /* load wait request                                        */
40
  output        output_inh;    /* disable cpu outputs                                      */
41
  output        rd_frst;       /* read first cycle                                         */
42
  output        rd_nxt;        /* read cycle identifier                                    */
43
  output        reti_nxt;      /* reti identifier                                          */
44 4 bsa
  output        rreg_en;       /* update refresh register                                  */
45 2 bsa
  output        sflg_en;       /* sign flag control                                        */
46
  output        wr_frst;       /* write first cycle                                        */
47
  output        zflg_en;       /* zero flag control                                        */
48
  output  [3:0] page_sel;      /* instruction decode "page" control                        */
49
  output [`ADCTL_IDX:0] add_sel;     /* address output mux control                         */
50
  output  [`ALUA_IDX:0] alua_sel;    /* alu input a mux control                            */
51
  output  [`ALUB_IDX:0] alub_sel;    /* alu input b mux control                            */
52
  output [`ALUOP_IDX:0] aluop_sel;   /* alu operation control                              */
53
  output    [`DI_IDX:0] di_ctl;      /* data input control                                 */
54
  output    [`DO_IDX:0] do_ctl;      /* data output control                                */
55
  output  [`HFLG_IDX:0] hflg_ctl;    /* half-carry flag control                            */
56
  output   [`IEF_IDX:0] ief_ctl;     /* interrupt enable control                           */
57
  output   [`IMD_IDX:0] imd_ctl;     /* interrupt mode control                             */
58
  output  [`NFLG_IDX:0] nflg_ctl;    /* negate flag control                                */
59
  output [`PCCTL_IDX:0] pc_sel;      /* program counter source control                     */
60
  output  [`PFLG_IDX:0] pflg_ctl;    /* parity/overflow flag control                       */
61
  output [`STATE_IDX:0] state_nxt;   /* next processor state                               */
62
  output  [`TFLG_IDX:0] tflg_ctl;    /* temp flag control                                  */
63
  output [`TTYPE_IDX:0] tran_sel;    /* transaction type select                            */
64
  output  [`WREG_IDX:0] wr_addr;     /* register write address bus                         */
65
 
66
  /*****************************************************************************************/
67
  /*                                                                                       */
68
  /* signal declarations                                                                   */
69
  /*                                                                                       */
70
  /*****************************************************************************************/
71
  reg           cflg_en;                                   /* carry flag control           */
72
  reg           ex_af_pls;                                 /* exchange af,af'              */
73
  reg           ex_bank_pls;                               /* exchange register bank       */
74
  reg           ex_dehl_inst;                              /* exchange de,hl               */
75
  reg           halt_nxt;                                  /* halt transaction             */
76
  reg           if_frst;                                   /* first clock if ifetch        */
77
  reg           inta_frst;                                 /* first clock of intack        */
78
  reg           ld_inst;                                   /* load instruction register    */
79
  reg           ld_inta;                                   /* sample latched int           */
80
  reg           ld_dmaa;                                   /* sample latched dma           */
81
  reg           ld_page;                                   /* load page register           */
82
  reg           ld_wait;                                   /* sample wait input            */
83
  reg           output_inh;                                /* disable cpu outputs          */
84
  reg           rd_frst;                                   /* first clock of read          */
85
  reg           rd_nxt;                                    /* read trans next              */
86 4 bsa
  reg           reti_nxt;                                  /* reti trans next              */
87
`ifdef RREG_EMU
88
  reg           rreg_en;                                   /* update refresh register      */
89
`endif
90 2 bsa
  reg           sflg_en;                                   /* sign flag control            */
91
  reg           wr_frst;                                   /* first clock of write         */
92
  reg           zflg_en;                                   /* zero flag control            */
93
  reg     [3:0] page_sel;                                  /* inst decode page control     */
94
  reg   [`ADCTL_IDX:0] add_sel;                            /* address output mux control   */
95
  reg    [`ALUA_IDX:0] alua_sel;                           /* alu input a mux control      */
96
  reg    [`ALUB_IDX:0] alub_sel;                           /* alu input b mux control      */
97
  reg   [`ALUOP_IDX:0] aluop_sel;                          /* alu operation control        */
98
  reg      [`DI_IDX:0] di_ctl;                             /* data input control           */
99
  reg      [`DO_IDX:0] do_ctl;                             /* data output control          */
100
  reg    [`HFLG_IDX:0] hflg_ctl;                           /* half-carry flag control      */
101
  reg     [`IEF_IDX:0] ief_ctl;                            /* interrupt enable control     */
102
  reg     [`IMD_IDX:0] imd_ctl;                            /* interrupt mode control       */
103
  reg    [`NFLG_IDX:0] nflg_ctl;                           /* negate flag control          */
104
  reg   [`PCCTL_IDX:0] pc_sel;                             /* pc source control            */
105
  reg    [`PFLG_IDX:0] pflg_ctl;                           /* parity/overflow flag control */
106
  reg   [`STATE_IDX:0] state_nxt;                          /* machine state                */
107
  reg    [`TFLG_IDX:0] tflg_ctl;                           /* temp flag control            */
108
  reg   [`TTYPE_IDX:0] tran_sel;                           /* transaction type             */
109
  reg    [`WREG_IDX:0] wr_addr;                            /* register write address bus   */
110 4 bsa
 
111
  /*****************************************************************************************/
112
  /*                                                                                       */
113
  /* refresh register control                                                              */
114
  /*                                                                                       */
115
  /*****************************************************************************************/
116
`ifdef RREG_EMU
117
  always @ (inst_reg or page_reg or state_reg or dmar_reg) begin
118
    casex (state_reg) //sysnopsys parallel_case
119
      `IF1B,
120
      `IF2B,
121
      `IF3B:                rreg_en = 1'b1;
122
      `WR1B,
123
      `WR2B: begin
124
        casex ({page_reg, inst_reg}) //sysnopsys parallel_case
125
          12'b1xxx10111001,
126
          12'b1xxx10110001,
127
          12'b1xxx10111010,
128
          12'b1xxx10110010,
129
          12'b1xxx10111000,
130
          12'b1xxx10110000,
131
          12'b1xxx10111011,
132
          12'b1xxx10110011,
133
          12'b0001xxxxxxxx: rreg_en = 1'b1;
134
          default:          rreg_en = 1'b0;
135
        endcase
136
      end
137
      default:              rreg_en = 1'b0;
138
    endcase
139
  end
140
`endif
141 2 bsa
 
142
  /*****************************************************************************************/
143
  /*                                                                                       */
144
  /* exchange instruction control                                                          */
145
  /*                                                                                       */
146
  /*****************************************************************************************/
147
  always @ (inst_reg or page_reg or state_reg) begin
148
    casex (state_reg)
149
      `IF1B: begin
150
        case ({page_reg, inst_reg})
151
          12'b000000001000: ex_af_pls = 1'b1;
152
          default:          ex_af_pls = 1'b0;
153
          endcase
154
        end
155
      default:              ex_af_pls = 1'b0;
156
      endcase
157
    end
158
 
159
  always @ (inst_reg or page_reg or state_reg) begin
160
    casex (state_reg)
161
      `IF1B: begin
162
        case ({page_reg, inst_reg})
163
          12'b000011011001: ex_bank_pls = 1'b1;
164
          default:          ex_bank_pls = 1'b0;
165
          endcase
166
        end
167
      default:              ex_bank_pls = 1'b0;
168
      endcase
169
    end
170
 
171
  always @ (inst_reg or page_reg or state_reg) begin
172
    casex (state_reg)
173
      `DEC1: begin
174
        case (inst_reg)
175
          8'b11101011:      ex_dehl_inst = 1'b1;
176
          default:          ex_dehl_inst = 1'b0;
177
          endcase
178
        end
179
      default:              ex_dehl_inst = 1'b0;
180
      endcase
181
    end
182
 
183
  /*****************************************************************************************/
184
  /*                                                                                       */
185
  /* interrupt control                                                                     */
186
  /*                                                                                       */
187
  /*****************************************************************************************/
188
  always @ (inst_reg or page_reg or state_reg) begin
189
    casex (state_reg)
190
      `IF1B: begin
191
        casex ({page_reg, inst_reg})
192
          12'b000011110011: ief_ctl = `IEF_0;
193
          12'b000011111011: ief_ctl = `IEF_1;
194
          12'b0001xxxxxxxx: ief_ctl = `IEF_NMI;
195
          12'b1xxx01000101: ief_ctl = `IEF_RTN;
196
          default:          ief_ctl = `IEF_NUL;
197
          endcase
198
        end
199
      default:              ief_ctl = `IEF_NUL;
200
      endcase
201
    end
202
 
203
  always @ (inst_reg or page_reg or state_reg) begin
204
    casex (state_reg)
205
      `IF1B: begin
206
        casex ({page_reg, inst_reg})
207
          12'b1xxx01000110: imd_ctl = `IMD_0;
208
          12'b1xxx01010110: imd_ctl = `IMD_1;
209
          12'b1xxx01011110: imd_ctl = `IMD_2;
210
          default:          imd_ctl = `IMD_NUL;
211
          endcase
212
        end
213
      default:              imd_ctl = `IMD_NUL;
214
      endcase
215
    end
216
 
217
  /*****************************************************************************************/
218
  /*                                                                                       */
219
  /* identifiers to create timing signals                                                  */
220
  /*                                                                                       */
221
  /*****************************************************************************************/
222
  always @ (state_reg) begin
223
    casex (state_reg) //synopsys parallel_case
224
      `DEC1,
225
      `DEC2,
226
      `OF2A,
227
      `IF3A,
228
      `IF1A:                if_frst = 1'b1;
229
      default:              if_frst = 1'b0;
230
      endcase
231
    end
232
 
233
  always @ (state_reg) begin
234
    casex (state_reg) //synopsys parallel_case
235
      `INTA,
236
      `RSTE:                inta_frst = 1'b1;
237
      default:              inta_frst = 1'b0;
238
      endcase
239
    end
240
 
241
  always @ (inst_reg or page_reg or state_nxt) begin
242
    casex (state_nxt) //synopsys parallel_case
243
      `RD1A,
244
      `RD2A:                rd_nxt = 1'b1;
245
      default:              rd_nxt = 1'b0;
246
      endcase
247
    end
248
 
249
  always @ (inst_reg or page_reg or state_reg) begin
250
    casex (state_reg) //synopsys parallel_case
251
      `RD1A,
252
      `RD2A:                rd_frst = 1'b1;
253
      default:              rd_frst = 1'b0;
254
      endcase
255
    end
256
 
257
  always @ (state_reg) begin
258
    casex (state_reg) //synopsys parallel_case
259
      `WR1A,
260
      `WR2A:                wr_frst = 1'b1;
261
      default:              wr_frst = 1'b0;
262
      endcase
263
    end
264
 
265
  /*****************************************************************************************/
266
  /*                                                                                       */
267
  /* wait sample                                                                           */
268
  /*                                                                                       */
269
  /*****************************************************************************************/
270
  always @ (inst_reg or page_reg or state_reg or carry_bit or par_bit or
271
            sign_bit or zero_bit) begin
272
    casex (state_reg) //synopsys parallel_case
273
      `DEC1: begin
274
        casex (inst_reg) //synopsys parallel_case
275
          8'b00000010,
276
          8'b00001010,
277
          8'b00010010,
278
          8'b00011010,
279
          8'b00110100,
280
          8'b00110101,
281
          8'b011100xx,
282
          8'b0111010x,
283
          8'b01110111,
284
          8'b010xx110,
285
          8'b0110x110,
286
          8'b01111110,
287
          8'b10000110,
288
          8'b10001110,
289
          8'b10010110,
290
          8'b10011110,
291
          8'b10100110,
292
          8'b10101110,
293
          8'b10110110,
294
          8'b10111110,
295
          8'b11001001,
296
          8'b11100011,
297
          8'b11xx0001,
298
          8'b11xx0101,
299
          8'b11xxx111,
300
          8'b01110110,
301
          8'b11101001:      ld_wait = 1'b0;
302
          8'b11000000:      ld_wait =   zero_bit;
303
          8'b11001000:      ld_wait =  !zero_bit;
304
          8'b11010000:      ld_wait =  carry_bit;
305
          8'b11011000:      ld_wait = !carry_bit;
306
          8'b11100000:      ld_wait =    par_bit;
307
          8'b11101000:      ld_wait =   !par_bit;
308
          8'b11110000:      ld_wait =   sign_bit;
309
          8'b11111000:      ld_wait =  !sign_bit;
310
          default:          ld_wait = 1'b1;
311
          endcase
312
        end
313
      `DEC2: begin
314
        casex ({page_reg, inst_reg}) //synopsys parallel_case
315
          12'b0010xxxxx110,
316
          12'b010x11100001,
317
          12'b010x11100011,
318
          12'b010x11100101,
319
          12'b1xxx0100x101,
320
          12'b1xxx0110x111,
321
          12'b1xxx01xxx00x,
322
          12'b1xxx101xx0xx,
323
          12'b010x11101001: ld_wait = 1'b0;
324
          default:          ld_wait = 1'b1;
325
          endcase
326
        end
327
      `OF2A,
328
      `IF3A,
329
      `RD1A,
330
      `RD2A,
331
      `WR1A,
332
      `WR2A,
333
      `IF1A,
334
      `INTA:                ld_wait = 1'b1;
335
      default:              ld_wait = 1'b0;
336
      endcase
337
    end
338
 
339
  /*****************************************************************************************/
340
  /*                                                                                       */
341
  /* instruction register and page register control                                        */
342
  /*                                                                                       */
343
  /*****************************************************************************************/
344
  always @ (inst_reg or page_reg or state_reg) begin
345
    casex (state_reg) //synopsys parallel_case
346
      `IF2B,
347
      `IF3B,
348
      `IF1B:                ld_inst = 1'b1;
349
      default:              ld_inst = 1'b0;
350
      endcase
351
    end
352
 
353
  always @ (inst_reg or page_reg or state_reg) begin
354
    casex (state_reg)
355
      `DEC1: begin
356
        case (inst_reg)
357
          8'b11001011:      page_sel = `CB_PAGE;
358
          8'b11011101:      page_sel = `DD_PAGE;
359
          8'b11101101:      page_sel = `ED_PAGE;
360
          8'b11111101:      page_sel = `FD_PAGE;
361
          default:          page_sel = `MAIN_PG;
362
          endcase
363
        end
364
      `DEC2: begin
365
        casex ({page_reg, inst_reg})
366
          12'bx10011001011: page_sel = `DDCB_PG;
367
          12'bx10111001011: page_sel = `FDCB_PG;
368
          default:          page_sel = `MAIN_PG;
369
          endcase
370
        end
371
      `INTA:                page_sel = `INTR_PG;
372
      `DMA1:                page_sel = `DMA_PG;
373
      default:              page_sel = `MAIN_PG;
374
      endcase
375
    end
376
 
377
  always @ (inst_reg or page_reg or state_reg) begin
378
    casex (state_reg) //synopsys parallel_case
379
      `DEC1:                ld_page = 1'b1;
380
      `DEC2: begin
381
        casex ({page_reg, inst_reg})
382
          12'bx10x11001011: ld_page = 1'b1;
383
          default:          ld_page = 1'b0;
384
          endcase
385
        end
386
      `INTA,
387
      `DMA1:                ld_page = 1'b1;
388
      default:              ld_page = 1'b0;
389
      endcase
390
    end
391
 
392
  /*****************************************************************************************/
393
  /*                                                                                       */
394
  /*  next state control                                                                   */
395
  /*                                                                                       */
396
  /*****************************************************************************************/
397
  always @ (inst_reg or page_reg or state_reg or carry_bit or dmar_reg or intr_reg or
398
            par_bit or sign_bit or tflg_reg or vector_int or xhlt_reg or zero_bit) begin
399
    casex (state_reg) //synopsys parallel_case
400
      `DEC1: begin
401
        casex (inst_reg) //synopsys parallel_case
402
          8'b00000010,
403
          8'b00001010,
404
          8'b00010010,
405
          8'b00011010,
406
          8'b00110100,
407
          8'b00110101,
408
          8'b011100xx,
409
          8'b0111010x,
410
          8'b01110111,
411
          8'b010xx110,
412
          8'b0110x110,
413
          8'b01111110,
414
          8'b10000110,
415
          8'b10001110,
416
          8'b10010110,
417
          8'b10011110,
418
          8'b10100110,
419
          8'b10101110,
420
          8'b10110110,
421
          8'b10111110,
422
          8'b11001001,
423
          8'b11100011,
424
          8'b11xx0001,
425
          8'b11xx0101,
426
          8'b11xxx111:      state_nxt = `sADR2;
427
          8'b11000000:      state_nxt = ( !zero_bit) ? `sADR2 : `sIF1B;
428
          8'b11001000:      state_nxt = (  zero_bit) ? `sADR2 : `sIF1B;
429
          8'b11010000:      state_nxt = (!carry_bit) ? `sADR2 : `sIF1B;
430
          8'b11011000:      state_nxt = ( carry_bit) ? `sADR2 : `sIF1B;
431
          8'b11100000:      state_nxt = (  !par_bit) ? `sADR2 : `sIF1B;
432
          8'b11101000:      state_nxt = (   par_bit) ? `sADR2 : `sIF1B;
433
          8'b11110000:      state_nxt = ( !sign_bit) ? `sADR2 : `sIF1B;
434
          8'b11111000:      state_nxt = (  sign_bit) ? `sADR2 : `sIF1B;
435
          8'b11001011,
436
          8'b11011101,
437
          8'b11101101,
438
          8'b11111101:      state_nxt = `sIF2B;
439
          8'b00010000,
440
          8'b00011000,
441
          8'b00100010,
442
          8'b00101010,
443
          8'b00110010,
444
          8'b00111010,
445
          8'b001xx000,
446
          8'b00xx0001,
447
          8'b00xxx110,
448
          8'b11000011,
449
          8'b11000110,
450
          8'b11001101,
451
          8'b11001110,
452
          8'b11010011,
453
          8'b11010110,
454
          8'b11011011,
455
          8'b11011110,
456
          8'b11100110,
457
          8'b11101110,
458
          8'b11110110,
459
          8'b11111110,
460
          8'b11xxx010,
461
          8'b11xxx100:      state_nxt = `sOF1B;
462
          8'b01110110,
463
          8'b11101001:      state_nxt = `sPCO;
464
          default:          state_nxt = `sIF1B;
465
          endcase
466
        end
467
      `IF2B:                state_nxt = `sDEC2;
468
      `DEC2: begin
469 4 bsa
        casex ({page_reg, inst_reg}) //synopsys parallel_case
470
          12'b001000110110,
471 2 bsa
          12'b001000000110,
472
          12'b001000001110,
473
          12'b001000010110,
474
          12'b001000011110,
475
          12'b001000100110,
476
          12'b001000101110,
477
          12'b001000111110,
478
          12'b001001xxx110,
479
          12'b001010xxx110,
480
          12'b001011xxx110,
481
          12'b010011100001,
482
          12'b010011100011,
483
          12'b010011100101,
484
          12'b010111100001,
485
          12'b010111100011,
486
          12'b010111100101,
487
          12'b1xxx01000101,
488
          12'b1xxx01001101,
489
          12'b1xxx01100111,
490
          12'b1xxx01101111,
491
          12'b1xxx01xxx000,
492
          12'b1xxx01xxx001,
493
          12'b1xxx10100000,
494
          12'b1xxx10100001,
495
          12'b1xxx10100010,
496
          12'b1xxx10100011,
497
          12'b1xxx10101000,
498
          12'b1xxx10101001,
499
          12'b1xxx10101010,
500
          12'b1xxx10101011,
501
          12'b1xxx10110000,
502
          12'b1xxx10110001,
503
          12'b1xxx10110010,
504
          12'b1xxx10110011,
505
          12'b1xxx10111000,
506
          12'b1xxx10111001,
507
          12'b1xxx10111010,
508 4 bsa
          12'b1xxx10111011: state_nxt = `sADR2;
509
          12'b010010001100,
510
          12'b010010001101,
511
          12'b010110001100,
512
          12'b010110001101,
513
          12'b010010000100,
514
          12'b010010000101,
515
          12'b010110000100,
516
          12'b010110000101,
517
          12'b010010100100,
518
          12'b010010100101,
519
          12'b010110100100,
520
          12'b010110100101,
521
          12'b010010111100,
522
          12'b010010111101,
523
          12'b010110111100,
524
          12'b010110111101,
525
          12'b010000100101,
526
          12'b010000101101,
527
          12'b010100100101,
528
          12'b010100101101,
529
          12'b010000100100,
530
          12'b010000101100,
531
          12'b010100100100,
532
          12'b010100101100,
533
          12'b0100011000xx,12'b01000110010x,12'b010001100111,
534
          12'b0100011010xx,12'b01000110110x,12'b010001101111,
535
          12'b0101011000xx,12'b01010110010x,12'b010101100111,
536
          12'b0101011010xx,12'b01010110110x,12'b010101101111,
537
          12'b0100010xx100,12'b01000110x100,12'b010001111100,
538
          12'b0100010xx101,12'b01000110x101,12'b010001111101,
539
          12'b0101010xx100,12'b01010110x100,12'b010101111100,
540
          12'b0101010xx101,12'b01010110x101,12'b010101111101,
541
          12'b010010110100,
542
          12'b010010110101,
543
          12'b010110110100,
544
          12'b010110110101,
545
          12'b010010011100,
546
          12'b010010011101,
547
          12'b010110011100,
548
          12'b010110011101,
549
          12'b010010010100,
550
          12'b010010010101,
551
          12'b010110010100,
552
          12'b010110010101,
553
          12'b010010101100,
554
          12'b010010101101,
555
          12'b010110101100,
556
          12'b010110101101,
557
          12'b001000110xxx,
558 2 bsa
          12'b001000000xxx,
559
          12'b001000001xxx,
560
          12'b001000010xxx,
561
          12'b001000011xxx,
562
          12'b001000100xxx,
563
          12'b001000101xxx,
564
          12'b001000111xxx,
565
          12'b001001xxxxxx,
566
          12'b001010xxxxxx,
567
          12'b001011xxxxxx,
568
          12'b010000100011,
569
          12'b010000101011,
570
          12'b010000xx1001,
571
          12'b010011111001,
572
          12'b010100100011,
573
          12'b010100101011,
574
          12'b010100xx1001,
575
          12'b010111111001,
576
          12'b1xxx01000100,
577
          12'b1xxx01000110,
578
          12'b1xxx01000111,
579
          12'b1xxx01001111,
580
          12'b1xxx01010110,
581
          12'b1xxx01010111,
582
          12'b1xxx01011110,
583
          12'b1xxx01011111,
584
          12'b1xxx01xx0010,
585
          12'b1xxx01xx1010: state_nxt = `sIF1B;
586
          12'b010011101001,
587
          12'b010111101001: state_nxt = `sPCO;
588
          default:          state_nxt = `sOF1B;
589
        endcase
590
      end
591
      `OF1B: begin
592
        casex ({page_reg, inst_reg}) //synopsys parallel_case
593
          12'b000011010011,
594
          12'b000011011011,
595
          12'b010000110100,
596
          12'b010000110101,
597
          12'b010001110xxx,
598
          12'b010001xxx110,
599
          12'b010010000110,
600
          12'b010010001110,
601
          12'b010010010110,
602
          12'b010010011110,
603
          12'b010010100110,
604
          12'b010010101110,
605
          12'b010010110110,
606
          12'b010010111110,
607
          12'b010100110100,
608
          12'b010100110101,
609
          12'b010101110xxx,
610
          12'b010101xxx110,
611
          12'b010110000110,
612
          12'b010110001110,
613
          12'b010110010110,
614
          12'b010110011110,
615
          12'b010110100110,
616
          12'b010110101110,
617
          12'b010110110110,
618 4 bsa
          12'b010110111110: state_nxt = `sADR1;
619
          12'b010000100110,
620
          12'b010000101110,
621
          12'b010100100110,
622
          12'b010100101110,
623
          12'b0000000xx110,12'b00000010x110,12'b000000111110,
624 2 bsa
          12'b000011000110,
625
          12'b000011001110,
626
          12'b000011010110,
627
          12'b000011011110,
628
          12'b000011100110,
629
          12'b000011101110,
630
          12'b000011110110,
631
          12'b000011111110: state_nxt = `sIF1A;
632
          12'b000000100000: state_nxt = ( !zero_bit) ? `sPCA : `sIF1A;
633
          12'b000000101000: state_nxt = (  zero_bit) ? `sPCA : `sIF1A;
634
          12'b000000110000: state_nxt = (!carry_bit) ? `sPCA : `sIF1A;
635
          12'b000000111000: state_nxt = ( carry_bit) ? `sPCA : `sIF1A;
636
          12'b000000100010,
637
          12'b000000101010,
638
          12'b000000110010,
639
          12'b000000111010,
640
          12'b000000xx0001,
641
          12'b000011000011,
642
          12'b000011001101,
643
          12'b000011xxx010,
644
          12'b000011xxx100,
645
          12'b010000100001,
646
          12'b010000100010,
647
          12'b010000101010,
648
          12'b010000110110,
649
          12'b010100100001,
650
          12'b010100100010,
651
          12'b010100101010,
652
          12'b010100110110,
653
          12'b1xxx01xx0011,
654
          12'b1xxx01xx1011: state_nxt = `sOF2A;
655
          12'b000000010000,
656
          12'b000000011000: state_nxt = `sPCA;
657
          12'b000000110110: state_nxt = `sWR2A;
658
          default:          state_nxt = `sIF3A;
659
        endcase
660
      end
661
      `OF2A:                state_nxt = `sOF2B;
662
      `OF2B: begin
663
        casex ({page_reg, inst_reg}) //synopsys parallel_case
664
          12'b000000xx0001,
665
          12'b010000100001,
666
          12'b010100100001: state_nxt = `sIF1A;
667
          12'b000011000010: state_nxt = ( !zero_bit) ? `sPCA : `sIF1A;
668
          12'b000011001010: state_nxt = (  zero_bit) ? `sPCA : `sIF1A;
669
          12'b000011010010: state_nxt = (!carry_bit) ? `sPCA : `sIF1A;
670
          12'b000011011010: state_nxt = ( carry_bit) ? `sPCA : `sIF1A;
671
          12'b000011100010: state_nxt = (  !par_bit) ? `sPCA : `sIF1A;
672
          12'b000011101010: state_nxt = (   par_bit) ? `sPCA : `sIF1A;
673
          12'b000011110010: state_nxt = ( !sign_bit) ? `sPCA : `sIF1A;
674
          12'b000011111010: state_nxt = (  sign_bit) ? `sPCA : `sIF1A;
675
          12'b000011000100: state_nxt = ( !zero_bit) ? `sWR1A : `sIF1A;
676
          12'b000011001100: state_nxt = (  zero_bit) ? `sWR1A : `sIF1A;
677
          12'b000011010100: state_nxt = (!carry_bit) ? `sWR1A : `sIF1A;
678
          12'b000011011100: state_nxt = ( carry_bit) ? `sWR1A : `sIF1A;
679
          12'b000011100100: state_nxt = (  !par_bit) ? `sWR1A : `sIF1A;
680
          12'b000011101100: state_nxt = (   par_bit) ? `sWR1A : `sIF1A;
681
          12'b000011110100: state_nxt = ( !sign_bit) ? `sWR1A : `sIF1A;
682
          12'b000011111100: state_nxt = (  sign_bit) ? `sWR1A : `sIF1A;
683
          12'b000011000011: state_nxt = `sPCA;
684
          12'b000011001101: state_nxt = `sWR1A;
685
          12'b010000110110,
686
          12'b010100110110: state_nxt = `sWR2A;
687
          default:          state_nxt = `sADR1;
688
        endcase
689
      end
690
      `IF3A:                state_nxt = `sIF3B;
691
      `IF3B:                state_nxt = `sRD2A;
692
      `ADR1:                state_nxt = `sADR2;
693
      `ADR2: begin
694
        casex ({page_reg, inst_reg}) //synopsys parallel_case
695
          12'b000000101010,
696
          12'b000011001001,
697
          12'b000011100011,
698
          12'b000011xxx000,
699
          12'b000011xx0001,
700
          12'b0001xxxxxxxx,
701
          12'b010000101010,
702
          12'b010011100001,
703
          12'b010011100011,
704
          12'b010100101010,
705
          12'b010111100001,
706
          12'b010111100011,
707
          12'b1xxx01000101,
708
          12'b1xxx01001101,
709
          12'b1xxx01xx1011,
710
          12'b1xxx10100000,
711
          12'b1xxx10100001,
712
          12'b1xxx10100010,
713
          12'b1xxx10100011,
714
          12'b1xxx10101000,
715
          12'b1xxx10101001,
716
          12'b1xxx10101010,
717
          12'b1xxx10101011,
718
          12'b1xxx10110000,
719
          12'b1xxx10110001,
720
          12'b1xxx10110010,
721
          12'b1xxx10110011,
722
          12'b1xxx10111000,
723
          12'b1xxx10111001,
724
          12'b1xxx10111010,
725
          12'b1xxx10111011: state_nxt = `sRD1A;
726
          12'b000000100010,
727
          12'b000011xxx111,
728
          12'b000011xx0101,
729
          12'b010000100010,
730
          12'b010011100101,
731
          12'b010100100010,
732
          12'b010111100101,
733
          12'b1xxx01xx0011: state_nxt = `sWR1A;
734
          12'b000000000010,
735
          12'b000000010010,
736
          12'b000000110010,
737
          12'b000001110xxx,
738
          12'b000011010011,
739
          12'b010001110xxx,
740
          12'b010101110xxx,
741
          12'b1xxx01xxx001: state_nxt = `sWR2A;
742
          default:          state_nxt = `sRD2A;
743
        endcase
744
      end
745
      `RD1A:                state_nxt = `sRD1B;
746
      `RD1B: begin
747
        casex ({page_reg, inst_reg}) //synopsys parallel_case
748
          12'b1xxx10100001,
749
          12'b1xxx10101001,
750
          12'b1xxx10110001,
751
          12'b1xxx10111001: state_nxt = `sBLK1;
752
          12'b1xxx10100000,
753
          12'b1xxx10100010,
754
          12'b1xxx10100011,
755
          12'b1xxx10101000,
756
          12'b1xxx10101010,
757
          12'b1xxx10101011,
758
          12'b1xxx10110000,
759
          12'b1xxx10110010,
760
          12'b1xxx10110011,
761
          12'b1xxx10111000,
762
          12'b1xxx10111010,
763
          12'b1xxx10111011: state_nxt = `sWR1A;
764
          default:          state_nxt = `sRD2A;
765
        endcase
766
      end
767
      `RD2A:                state_nxt = `sRD2B;
768
      `RD2B: begin
769
        casex ({page_reg, inst_reg}) //synopsys parallel_case
770
          12'b1xxx10100001,
771
          12'b1xxx10101001,
772
          12'b1xxx10110001,
773
          12'b1xxx10111001: state_nxt = `sBLK1;
774
          12'b000000001010,
775
          12'b000000011010,
776
          12'b000000101010,
777
          12'b000000111010,
778
          12'b000001xxxxxx,
779
          12'b000001xxx110,
780
          12'b000010000110,
781
          12'b000010000xxx,
782
          12'b000010001110,
783
          12'b000010001xxx,
784
          12'b000010010110,
785
          12'b000010011110,
786
          12'b000010100110,
787
          12'b000010100xxx,
788
          12'b000010101110,
789
          12'b000010110110,
790
          12'b000010110xxx,
791
          12'b000010111110,
792
          12'b000010111xxx,
793
          12'b000011011011,
794
          12'b000011xx0001,
795
          12'b001001xxx110,
796
          12'b001001xxxxxx,
797
          12'b010000101010,
798
          12'b010001xxx110,
799
          12'b010010000110,
800
          12'b010010001110,
801
          12'b010010010110,
802
          12'b010010011110,
803
          12'b010010100110,
804
          12'b010010101110,
805
          12'b010010110110,
806
          12'b010010111110,
807
          12'b010011100001,
808
          12'b010100101010,
809
          12'b010101xxx110,
810
          12'b010110000110,
811
          12'b010110001110,
812
          12'b010110010110,
813
          12'b010110011110,
814
          12'b010110100110,
815
          12'b010110101110,
816
          12'b010110110110,
817
          12'b010110111110,
818
          12'b010111100001,
819
          12'b011001xxx110,
820
          12'b011101xxx110,
821
          12'b1xxx01xxx000,
822
          12'b1xxx01xx1011: state_nxt = `sIF1A;
823
          12'b000011001001,
824
          12'b000011xxx000,
825
          12'b1xxx01000101,
826
          12'b1xxx01001101: state_nxt = `sPCA;
827
          12'b000011100011,
828
          12'b0001xxxxxxxx,
829
          12'b010011100011,
830
          12'b010111100011: state_nxt = `sWR1A;
831
          default:          state_nxt = `sWR2A;
832
        endcase
833
      end
834
      `WR1A:                state_nxt = `sWR1B;
835
      `WR1B: begin
836
        casex ({page_reg, inst_reg}) //synopsys parallel_case
837
          12'b1xxx10100000,
838
          12'b1xxx10100010,
839
          12'b1xxx10100011,
840
          12'b1xxx10101000,
841
          12'b1xxx10101010,
842
          12'b1xxx10101011: state_nxt = `sIF1A;
843
          12'b1xxx10110010,
844
          12'b1xxx10111010,
845
          12'b1xxx10110011,
846
          12'b1xxx10111011,
847
          12'b1xxx10110000,
848
          12'b1xxx10111000: state_nxt = (tflg_reg || intr_reg || dmar_reg) ? `sPCA : `sRD2A;
849
          default:          state_nxt = `sWR2A;
850
        endcase
851
      end
852
      `WR2A:                state_nxt = `sWR2B;
853
      `WR2B: begin
854
        casex ({page_reg, inst_reg}) //synopsys parallel_case
855
          12'b1xxx10110010,
856
          12'b1xxx10111010,
857
          12'b1xxx10110011,
858
          12'b1xxx10111011,
859
          12'b1xxx10110000,
860
          12'b1xxx10111000: state_nxt = (tflg_reg || intr_reg || dmar_reg) ? `sPCA : `sRD2A;
861
          default:          state_nxt = `sIF1A;
862
        endcase
863
      end
864
      `BLK1:                state_nxt = `sBLK2;
865
      `BLK2: begin
866
        casex ({page_reg, inst_reg}) //synopsys parallel_case
867
          12'b1xxx10110001,
868
          12'b1xxx10111001: state_nxt = (tflg_reg || intr_reg || dmar_reg) ? `sPCA : `sRD2A;
869
          default:          state_nxt = `sIF1A;
870
        endcase
871
      end
872
      `PCA:                 state_nxt = `sPCO;
873
      `PCO: begin
874
        casex ({page_reg, inst_reg}) //synopsys parallel_case
875
          12'b000001110110: state_nxt = `sHLTA;
876
          default:          state_nxt = `sIF1A;
877
          endcase
878
        end
879
      `HLTA:                state_nxt = `sHLTB;
880
      `HLTB:                state_nxt = (xhlt_reg) ? `sIF1A : `sHLTA;
881
      `IF1A:                state_nxt = `sIF1B;
882
      `IF1B:                state_nxt = `sDEC1;
883
      `INTA:                state_nxt = `sINTB;
884
      `INTB:                state_nxt = (vector_int) ? `sADR1 : `sWR1A;
885
      `DMA1:                state_nxt = `sDMA2;
886
      `DMA2:                state_nxt = (dmar_reg) ? `sDMA1 : `sIF1A;
887
      `RSTE:                state_nxt = `sIF1A;
888
      default:              state_nxt = `sRSTE;
889
      endcase
890
    end
891
 
892
  /*****************************************************************************************/
893
  /*                                                                                       */
894
  /*  transaction type control                                                             */
895
  /*                                                                                       */
896
  /*****************************************************************************************/
897
  always @ (inst_reg or page_reg or state_reg or carry_bit or dmar_reg or intr_reg or
898
            par_bit or sign_bit or tflg_reg or vector_int or xhlt_reg or zero_bit) begin
899
    casex (state_reg) //synopsys parallel_case
900
      `IF2B:                tran_sel = `TRAN_IF;
901
      `OF1B: begin
902
        casex ({page_reg, inst_reg}) //synopsys parallel_case
903
          12'b000000010000,
904
          12'b000000011000,
905
          12'b000011010011,
906
          12'b000011011011,
907
          12'b010x00110100,
908
          12'b010x00110101,
909
          12'b010x011100xx,
910
          12'b010x0111010x,
911
          12'b010x01110111,
912
          12'b010x010xx110,
913
          12'b010x0110x110,
914
          12'b010x01111110,
915
          12'b010x10000110,
916
          12'b010x10001110,
917
          12'b010x10010110,
918
          12'b010x10011110,
919
          12'b010x10100110,
920
          12'b010x10101110,
921
          12'b010x10110110,
922
          12'b010x10111110: tran_sel = `TRAN_IDL;
923
          12'b000000100000: tran_sel = (  zero_bit) ? `TRAN_IF : `TRAN_IDL;
924
          12'b000000101000: tran_sel = ( !zero_bit) ? `TRAN_IF : `TRAN_IDL;
925
          12'b000000110000: tran_sel = ( carry_bit) ? `TRAN_IF : `TRAN_IDL;
926
          12'b000000111000: tran_sel = (!carry_bit) ? `TRAN_IF : `TRAN_IDL;
927
          12'b000000110110: tran_sel = `TRAN_MEM;
928
          default:          tran_sel = `TRAN_IF;
929
          endcase
930
        end
931
      `OF2B: begin
932
        casex ({page_reg, inst_reg}) //synopsys parallel_case
933
          12'b000000xx0001,
934
          12'b010000100001,
935
          12'b010100100001: tran_sel = `TRAN_IF;
936
          12'b010000110110,
937
          12'b010100110110: tran_sel = `TRAN_MEM;
938
          12'b000011001101: tran_sel = `TRAN_STK;
939
          12'b000011000010: tran_sel = ( !zero_bit) ? `TRAN_IDL : `TRAN_IF;
940
          12'b000011001010: tran_sel = (  zero_bit) ? `TRAN_IDL : `TRAN_IF;
941
          12'b000011010010: tran_sel = (!carry_bit) ? `TRAN_IDL : `TRAN_IF;
942
          12'b000011011010: tran_sel = ( carry_bit) ? `TRAN_IDL : `TRAN_IF;
943
          12'b000011100010: tran_sel = (  !par_bit) ? `TRAN_IDL : `TRAN_IF;
944
          12'b000011101010: tran_sel = (   par_bit) ? `TRAN_IDL : `TRAN_IF;
945
          12'b000011110010: tran_sel = ( !sign_bit) ? `TRAN_IDL : `TRAN_IF;
946
          12'b000011111010: tran_sel = (  sign_bit) ? `TRAN_IDL : `TRAN_IF;
947
          12'b000011000100: tran_sel = ( !zero_bit) ? `TRAN_STK : `TRAN_IF;
948
          12'b000011001100: tran_sel = (  zero_bit) ? `TRAN_STK : `TRAN_IF;
949
          12'b000011010100: tran_sel = (!carry_bit) ? `TRAN_STK : `TRAN_IF;
950
          12'b000011011100: tran_sel = ( carry_bit) ? `TRAN_STK : `TRAN_IF;
951
          12'b000011100100: tran_sel = (  !par_bit) ? `TRAN_STK : `TRAN_IF;
952
          12'b000011101100: tran_sel = (   par_bit) ? `TRAN_STK : `TRAN_IF;
953
          12'b000011110100: tran_sel = ( !sign_bit) ? `TRAN_STK : `TRAN_IF;
954
          12'b000011111100: tran_sel = (  sign_bit) ? `TRAN_STK : `TRAN_IF;
955
          default:          tran_sel = `TRAN_IDL;
956
        endcase
957
      end
958
      `IF3B:                tran_sel = `TRAN_MEM;
959
      `ADR2: begin
960
        casex ({page_reg, inst_reg}) //synopsys parallel_case
961
          12'b000011010011,
962
          12'b000011011011,
963
          12'b1xxx01xxx000,
964
          12'b1xxx01xxx001,
965
          12'b1xxx10100010,
966
          12'b1xxx10101010,
967
          12'b1xxx10110010,
968
          12'b1xxx10111010: tran_sel = `TRAN_IO;
969
          12'b000011001001,
970
          12'b000011xxx000,
971
          12'b000011xxx111,
972
          12'b000011xx0001,
973
          12'b000011xx0101,
974
          12'b010011100001,
975
          12'b010011100101,
976
          12'b010111100001,
977
          12'b010111100101,
978
          12'b1xxx01000101,
979
          12'b1xxx01001101: tran_sel = `TRAN_STK;
980
          default:          tran_sel = `TRAN_MEM;
981
        endcase
982
      end
983
      `RD1B: begin
984
        casex ({page_reg, inst_reg}) //synopsys parallel_case
985
          12'b1xxx10100001,
986
          12'b1xxx10101001,
987
          12'b1xxx10110001,
988
          12'b1xxx10111001: tran_sel = `TRAN_IDL;
989
          12'b1xxx10100011,
990
          12'b1xxx10101011,
991
          12'b1xxx10110011,
992
          12'b1xxx10111011: tran_sel = `TRAN_IO;
993
          12'b000011001001,
994
          12'b000011xxx000,
995
          12'b000011xx0001,
996
          12'b010011100001,
997
          12'b010111100001,
998
          12'b1xxx01000101,
999
          12'b1xxx01001101: tran_sel = `TRAN_STK;
1000
          default:          tran_sel = `TRAN_MEM;
1001
        endcase
1002
      end
1003
      `RD2B: begin
1004
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1005
          12'b000011001001,
1006
          12'b000011xxx000,
1007
          12'b1xxx01000101,
1008
          12'b1xxx01001101,
1009
          12'b1xxx10100001,
1010
          12'b1xxx10101001,
1011
          12'b1xxx10110001,
1012
          12'b1xxx10111001: tran_sel = `TRAN_IDL;
1013
          12'b000000001010,
1014
          12'b000000011010,
1015
          12'b000000101010,
1016
          12'b000000111010,
1017
          12'b000001xxx110,
1018
          12'b000010000110,
1019
          12'b000010001110,
1020
          12'b000010010110,
1021
          12'b000010011110,
1022
          12'b000010100110,
1023
          12'b000010101110,
1024
          12'b000010110110,
1025
          12'b000010111110,
1026
          12'b000011011011,
1027
          12'b000011xx0001,
1028
          12'b001001xxx110,
1029
          12'b010000101010,
1030
          12'b010001xxx110,
1031
          12'b010010000110,
1032
          12'b010010001110,
1033
          12'b010010010110,
1034
          12'b010010011110,
1035
          12'b010010100110,
1036
          12'b010010101110,
1037
          12'b010010110110,
1038
          12'b010010111110,
1039
          12'b010011100001,
1040
          12'b010100101010,
1041
          12'b010101xxx110,
1042
          12'b010110000110,
1043
          12'b010110001110,
1044
          12'b010110010110,
1045
          12'b010110011110,
1046
          12'b010110100110,
1047
          12'b010110101110,
1048
          12'b010110110110,
1049
          12'b010110111110,
1050
          12'b010111100001,
1051
          12'b011001xxx110,
1052
          12'b011101xxx110,
1053
          12'b1xxx01xxx000,
1054
          12'b1xxx01xx1011: tran_sel = `TRAN_IF;
1055
          12'b1xxx10100011,
1056
          12'b1xxx10101011,
1057
          12'b1xxx10110011,
1058
          12'b1xxx10111011: tran_sel = `TRAN_IO;
1059
          12'b000011100011,
1060
          12'b0001xxxxxxxx,
1061
          12'b010011100011,
1062
          12'b010111100011: tran_sel = `TRAN_STK;
1063
          default:          tran_sel = `TRAN_MEM;
1064
        endcase
1065
      end
1066
      `WR1B: begin
1067
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1068
          12'b1xxx10110010,
1069
          12'b1xxx10111010: tran_sel = (tflg_reg || intr_reg || dmar_reg) ? `TRAN_IDL : `TRAN_IO;
1070
          12'b1xxx10110000,
1071
          12'b1xxx10111000,
1072
          12'b1xxx10110011,
1073
          12'b1xxx10111011: tran_sel = (tflg_reg || intr_reg || dmar_reg) ? `TRAN_IDL : `TRAN_MEM;
1074
          12'b1xxx10100000,
1075
          12'b1xxx10100010,
1076
          12'b1xxx10100011,
1077
          12'b1xxx10101000,
1078
          12'b1xxx10101010,
1079
          12'b1xxx10101011: tran_sel = `TRAN_IF;
1080
          12'b000000100010,
1081
          12'b010000100010,
1082
          12'b010100100010,
1083
          12'b1xxx01xx0011: tran_sel = `TRAN_MEM;
1084
          default:          tran_sel = `TRAN_STK;
1085
        endcase
1086
      end
1087
      `WR2B: begin
1088
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1089
          12'b1xxx10110010,
1090
          12'b1xxx10111010: tran_sel = (tflg_reg || intr_reg || dmar_reg) ? `TRAN_IDL : `TRAN_IO;
1091
          12'b1xxx10110000,
1092
          12'b1xxx10111000,
1093
          12'b1xxx10110011,
1094
          12'b1xxx10111011: tran_sel = (tflg_reg || intr_reg || dmar_reg) ? `TRAN_IDL : `TRAN_MEM;
1095
          default:          tran_sel = `TRAN_IF;
1096
        endcase
1097
      end
1098
      `BLK2: begin
1099
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1100
          12'b1xxx10110001,
1101
          12'b1xxx10111001: tran_sel = (tflg_reg || intr_reg || dmar_reg) ? `TRAN_IDL : `TRAN_MEM;
1102
          default:          tran_sel = `TRAN_IF;
1103
        endcase
1104
      end
1105
      `PCO: begin
1106
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1107
          12'b000001110110: tran_sel = `TRAN_IDL;
1108
          default:          tran_sel = `TRAN_IF;
1109
          endcase
1110
        end
1111
      `IF1B: begin
1112
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1113
          12'b1xxx01000101,
1114
          12'b1xxx01001101,
1115
          12'b000011110011,
1116
          12'b0001xxxxxxxx: tran_sel = `TRAN_IF;
1117
          default:          tran_sel = (dmar_reg) ? `TRAN_IDL :
1118
                                       (intr_reg) ? `TRAN_IAK : `TRAN_IF;
1119
          endcase
1120
        end
1121
      `HLTB:                tran_sel = (xhlt_reg)   ? `TRAN_IF  : `TRAN_IDL;
1122
      `INTB:                tran_sel = (vector_int) ? `TRAN_IDL : `TRAN_MEM;
1123
      `DMA2:                tran_sel = (dmar_reg)   ? `TRAN_IDL : `TRAN_IF;
1124
      `RSTE:                tran_sel = `TRAN_IF;
1125
      default:              tran_sel = `TRAN_RSTVAL;
1126
      endcase
1127
    end
1128
 
1129
  /*****************************************************************************************/
1130
  /*                                                                                       */
1131
  /*  special transaction identifiers                                                      */
1132
  /*                                                                                       */
1133
  /*****************************************************************************************/
1134
  always @ (inst_reg or page_reg or state_reg or xhlt_reg) begin
1135
    casex (state_reg)
1136
      `PCO,
1137
      `HLTB: begin
1138
        casex ({page_reg, inst_reg})
1139
          12'b000001110110: halt_nxt = !xhlt_reg;
1140
          default:          halt_nxt = 1'b0;
1141
          endcase
1142
        end
1143
      default:              halt_nxt = 1'b0;
1144
      endcase
1145
    end
1146
 
1147
  always @ (inst_reg or page_reg or state_reg) begin
1148
    casex (state_reg)
1149
      `RD2B: begin
1150
        casex ({page_reg, inst_reg})
1151
          12'b1xxx01001101: reti_nxt = 1'b1;
1152
          default:          reti_nxt = 1'b0;
1153
          endcase
1154
        end
1155
      default:              reti_nxt = 1'b0;
1156
      endcase
1157
    end
1158
 
1159
  /*****************************************************************************************/
1160
  /*                                                                                       */
1161
  /*  output inhibit                                                                       */
1162
  /*                                                                                       */
1163
  /*****************************************************************************************/
1164
  always @ (inst_reg or page_reg or state_reg or dmar_reg or xhlt_reg) begin
1165
    casex (state_reg)
1166
      `IF1B: begin
1167
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1168
          12'b1xxx01000101,
1169
          12'b1xxx01001101,
1170
          12'b000011110011,
1171
          12'b0001xxxxxxxx: output_inh = 1'b0;
1172
          default:          output_inh = dmar_reg;
1173
          endcase
1174
        end
1175
      `DMA2:                output_inh = dmar_reg;
1176
      `PCO,
1177
      `HLTB: begin
1178
        casex ({page_reg, inst_reg})
1179
          12'b000001110110: output_inh = !xhlt_reg;
1180
          default:          output_inh = 1'b0;
1181
          endcase
1182
        end
1183
      default:              output_inh = 1'b0;
1184
      endcase
1185
    end
1186
 
1187
  /*****************************************************************************************/
1188
  /*                                                                                       */
1189
  /*  address output control                                                               */
1190
  /*                                                                                       */
1191
  /*****************************************************************************************/
1192
  always @ (inst_reg or page_reg or state_reg or carry_bit or par_bit or sign_bit or
1193
            vector_int or zero_bit) begin
1194
    casex (state_reg) //synopsys parallel_case
1195
      `DEC1: begin
1196
        casex (inst_reg) //synopsys parallel_case
1197
          8'b00000010,
1198
          8'b00001010,
1199
          8'b00010010,
1200
          8'b00011010,
1201
          8'b11101001,
1202
          8'b11xx0101,
1203
          8'b11xxx111:      add_sel = `ADD_ALU;
1204
          8'b00110100,
1205
          8'b00110101,
1206
          8'b00110110,
1207
          8'b011100xx,
1208
          8'b0111010x,
1209
          8'b01110111,
1210
          8'b010xx110,
1211
          8'b0110x110,
1212
          8'b01111110,
1213
          8'b10000110,
1214
          8'b10001110,
1215
          8'b10010110,
1216
          8'b10011110,
1217
          8'b10100110,
1218
          8'b10101110,
1219
          8'b10110110,
1220
          8'b10111110:      add_sel = `ADD_HL;
1221
          8'b11000000:      add_sel = ( !zero_bit) ? `ADD_SP : `ADD_PC;
1222
          8'b11001000:      add_sel = (  zero_bit) ? `ADD_SP : `ADD_PC;
1223
          8'b11010000:      add_sel = (!carry_bit) ? `ADD_SP : `ADD_PC;
1224
          8'b11011000:      add_sel = ( carry_bit) ? `ADD_SP : `ADD_PC;
1225
          8'b11100000:      add_sel = (  !par_bit) ? `ADD_SP : `ADD_PC;
1226
          8'b11101000:      add_sel = (   par_bit) ? `ADD_SP : `ADD_PC;
1227
          8'b11110000:      add_sel = ( !sign_bit) ? `ADD_SP : `ADD_PC;
1228
          8'b11111000:      add_sel = (  sign_bit) ? `ADD_SP : `ADD_PC;
1229
          8'b11xx0001,
1230
          8'b11100011,
1231
          8'b11001001:      add_sel = `ADD_SP;
1232
          default:          add_sel = `ADD_PC;
1233
          endcase
1234
        end
1235
      `DEC2: begin
1236
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1237
          12'b010011100101,
1238
          12'b010011101001,
1239
          12'b010111100101,
1240
          12'b010111101001,
1241
          12'b1xxx01xxx000,
1242
          12'b1xxx01xxx001,
1243
          12'b1xxx10100000,
1244
          12'b1xxx10100001,
1245
          12'b1xxx10100010,
1246
          12'b1xxx10100011,
1247
          12'b1xxx10101000,
1248
          12'b1xxx10101001,
1249
          12'b1xxx10101010,
1250
          12'b1xxx10101011,
1251
          12'b1xxx10110000,
1252
          12'b1xxx10110001,
1253
          12'b1xxx10110010,
1254
          12'b1xxx10110011,
1255
          12'b1xxx10111000,
1256
          12'b1xxx10111001,
1257
          12'b1xxx10111010,
1258 4 bsa
          12'b1xxx10111011: add_sel = `ADD_ALU;
1259 2 bsa
          12'b001000000110,
1260
          12'b001000001110,
1261
          12'b001000010110,
1262
          12'b001000011110,
1263
          12'b001000100110,
1264
          12'b001000101110,
1265 4 bsa
          12'b001000110110,
1266 2 bsa
          12'b001000111110,
1267
          12'b001001xxx110,
1268
          12'b001010xxx110,
1269
          12'b001011xxx110,
1270
          12'b1xxx01100111,
1271
          12'b1xxx01101111: add_sel = `ADD_HL;
1272
          12'b010011100001,
1273
          12'b010011100011,
1274
          12'b010111100001,
1275
          12'b010111100011,
1276
          12'b1xxx01000101,
1277
          12'b1xxx01001101: add_sel = `ADD_SP;
1278
          default:          add_sel = `ADD_PC;
1279
        endcase
1280
      end
1281
      `OF2A: begin
1282
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1283
          12'b000011001101,
1284
          12'b010000110110,
1285
          12'b010100110110: add_sel = `ADD_ALU;
1286
          12'b000011000100: add_sel = ( !zero_bit) ? `ADD_ALU : `ADD_PC;
1287
          12'b000011001100: add_sel = (  zero_bit) ? `ADD_ALU : `ADD_PC;
1288
          12'b000011010100: add_sel = (!carry_bit) ? `ADD_ALU : `ADD_PC;
1289
          12'b000011011100: add_sel = ( carry_bit) ? `ADD_ALU : `ADD_PC;
1290
          12'b000011100100: add_sel = (  !par_bit) ? `ADD_ALU : `ADD_PC;
1291
          12'b000011101100: add_sel = (   par_bit) ? `ADD_ALU : `ADD_PC;
1292
          12'b000011110100: add_sel = ( !sign_bit) ? `ADD_ALU : `ADD_PC;
1293
          12'b000011111100: add_sel = (  sign_bit) ? `ADD_ALU : `ADD_PC;
1294
          default:          add_sel = `ADD_PC;
1295
        endcase
1296
      end
1297
      `IF3A,
1298
      `ADR1,
1299
      `RD1A:                add_sel = `ADD_ALU;
1300
      `RD2A: begin
1301
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1302
          12'b000011100011,
1303
          12'b0001xxxxxxxx,
1304
          12'b010000110100,
1305
          12'b010000110101,
1306
          12'b010011100011,
1307
          12'b010100110100,
1308
          12'b010100110101,
1309
          12'b010111100011,
1310 4 bsa
          12'b011x00xxxxxx,
1311
          12'b011x1xxxxxxx,
1312 2 bsa
          12'b1xxx10100000,
1313
          12'b1xxx10100001,
1314
          12'b1xxx10100010,
1315
          12'b1xxx10100011,
1316
          12'b1xxx10101000,
1317
          12'b1xxx10101001,
1318
          12'b1xxx10101010,
1319
          12'b1xxx10101011,
1320
          12'b1xxx10110000,
1321
          12'b1xxx10110001,
1322
          12'b1xxx10110010,
1323
          12'b1xxx10110011,
1324
          12'b1xxx10111000,
1325
          12'b1xxx10111001,
1326
          12'b1xxx10111010,
1327
          12'b1xxx10111011: add_sel = `ADD_ALU;
1328
          12'b000000110100,
1329
          12'b000000110101,
1330
          12'b000000xxx100,
1331
          12'b000000xxx101,
1332
          12'b001000000110,
1333
          12'b001000000xxx,
1334
          12'b001000001110,
1335
          12'b001000001xxx,
1336
          12'b001000010110,
1337
          12'b001000010xxx,
1338
          12'b001000011110,
1339
          12'b001000011xxx,
1340
          12'b001000100110,
1341
          12'b001000100xxx,
1342
          12'b001000101110,
1343
          12'b001000101xxx,
1344 4 bsa
          12'b001000110110,
1345
          12'b001000110xxx,
1346 2 bsa
          12'b001000111110,
1347
          12'b001000111xxx,
1348
          12'b001010xxx110,
1349
          12'b001010xxxxxx,
1350
          12'b001011xxx110,
1351
          12'b001011xxxxxx,
1352
          12'b1xxx01100111,
1353
          12'b1xxx01101111: add_sel = `ADD_HL;
1354
          default:          add_sel = `ADD_PC;
1355
        endcase
1356
      end
1357
      `WR1A: begin
1358
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1359
          12'b1xxx10100000,
1360
          12'b1xxx10100010,
1361
          12'b1xxx10100011,
1362
          12'b1xxx10101000,
1363
          12'b1xxx10101010,
1364 4 bsa
          12'b1xxx10101011: add_sel = `ADD_PC;
1365 2 bsa
          default:          add_sel = `ADD_ALU;
1366
        endcase
1367
      end
1368
      `WR2A: begin
1369
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1370
          12'b000011001101,
1371
          12'b000011xxx100,
1372
          12'b000011xxx111,
1373
          12'b0001xxxxxxxx,
1374
          12'b1xxx10100000,
1375
          12'b1xxx10100010,
1376
          12'b1xxx10100011,
1377
          12'b1xxx10101000,
1378
          12'b1xxx10101010,
1379
          12'b1xxx10101011,
1380
          12'b1xxx10110000,
1381
          12'b1xxx10110010,
1382
          12'b1xxx10110011,
1383
          12'b1xxx10111000,
1384
          12'b1xxx10111010,
1385 4 bsa
          12'b1xxx10111011: add_sel = `ADD_ALU;
1386 2 bsa
          default:          add_sel = `ADD_PC;
1387
        endcase
1388
      end
1389
      `BLK1: begin
1390
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1391
          12'b1xxx10110001,
1392 4 bsa
          12'b1xxx10111001: add_sel = `ADD_ALU;
1393 2 bsa
          default:          add_sel = `ADD_PC;
1394
        endcase
1395
      end
1396
      `PCA: begin
1397
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1398
          12'b000000010000,
1399
          12'b000000011000,
1400
          12'b0000001xx000,
1401
          12'b000011000011,
1402
          12'b000011001001,
1403
          12'b000011xxx000,
1404
          12'b000011xxx010,
1405
          12'b1xxx01000101,
1406
          12'b1xxx01001101: add_sel = `ADD_PC;
1407
          default:          add_sel = `ADD_ALU;
1408
        endcase
1409
      end
1410
      `IF1A:                add_sel = `ADD_PC;
1411
      `INTA:                add_sel = (vector_int) ? `ADD_PC : `ADD_ALU;
1412
      `DMA1:                add_sel = `ADD_PC;
1413
      default:              add_sel = `ADD_RSTVAL;
1414
      endcase
1415
    end
1416
 
1417
  /*****************************************************************************************/
1418
  /*                                                                                       */
1419
  /*  program counter control                                                              */
1420
  /*                                                                                       */
1421
  /*****************************************************************************************/
1422
  always @ (inst_reg or page_reg or state_reg or carry_bit or par_bit or sign_bit or
1423
            tflg_reg or zero_bit) begin
1424
    casex (state_reg) //synopsys parallel_case
1425
      `DEC1: begin
1426
        casex (inst_reg) //synopsys parallel_case
1427
          8'b00000000,
1428
          8'b00000111,
1429
          8'b00001000,
1430
          8'b00001111,
1431
          8'b00010111,
1432
          8'b00011111,
1433
          8'b00100111,
1434
          8'b00101111,
1435
          8'b00110111,
1436
          8'b00111111,
1437
          8'b000xx10x,
1438
          8'b0010x10x,
1439
          8'b0011110x,
1440
          8'b00xx0011,
1441
          8'b00xx1001,
1442
          8'b00xx1011,
1443
          8'b010xx0xx,
1444
          8'b0110x0xx,
1445
          8'b011110xx,
1446
          8'b010xx10x,
1447
          8'b0110x10x,
1448
          8'b0111110x,
1449
          8'b010xx111,
1450
          8'b0110x111,
1451
          8'b01111111,
1452
          8'b10xxx0xx,
1453
          8'b10xxx10x,
1454
          8'b10xxx111,
1455
          8'b11011001,
1456
          8'b11101011,
1457
          8'b11111001,
1458
          8'b11111011:      pc_sel = `PC_NILD;
1459
          8'b01110110,
1460
          8'b11xxx111,
1461
          8'b00000010,
1462
          8'b00001010,
1463
          8'b00010010,
1464
          8'b00011010,
1465
          8'b00110100,
1466
          8'b00110101,
1467
          8'b011100xx,
1468
          8'b0111010x,
1469
          8'b01110111,
1470
          8'b010xx110,
1471
          8'b0110x110,
1472
          8'b01111110,
1473
          8'b10000110,
1474
          8'b10001110,
1475
          8'b10010110,
1476
          8'b10011110,
1477
          8'b10100110,
1478
          8'b10101110,
1479
          8'b10110110,
1480
          8'b10111110,
1481
          8'b11xx0001,
1482
          8'b11xx0101,
1483
          8'b11100011:      pc_sel = `PC_NUL;
1484
          default:          pc_sel = `PC_LD;
1485
          endcase
1486
        end
1487
      `DEC2: begin
1488 4 bsa
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1489
          12'b010000100110,
1490
          12'b010000101110,
1491
          12'b010100100110,
1492
          12'b010100101110,
1493 2 bsa
          12'b010011001011, //DD+CB prefix
1494
          12'b010111001011, //FD+CB prefix
1495
          12'b010000100001,
1496
          12'b010000100010,
1497
          12'b010000101010,
1498
          12'b010000110100,
1499
          12'b010000110101,
1500
          12'b010000110110,
1501
          12'b010001110xxx,
1502
          12'b010001xxx110,
1503
          12'b010010000110,
1504
          12'b010010001110,
1505
          12'b010010010110,
1506
          12'b010010011110,
1507
          12'b010010100110,
1508
          12'b010010101110,
1509
          12'b010010110110,
1510
          12'b010010111110,
1511
          12'b010011101001,
1512
          12'b010100100001,
1513
          12'b010100100010,
1514
          12'b010100101010,
1515
          12'b010100110100,
1516
          12'b010100110101,
1517
          12'b010100110110,
1518
          12'b010101110xxx,
1519
          12'b010101xxx110,
1520
          12'b010110000110,
1521
          12'b010110001110,
1522
          12'b010110010110,
1523
          12'b010110011110,
1524
          12'b010110100110,
1525
          12'b010110101110,
1526
          12'b010110110110,
1527
          12'b010110111110,
1528
          12'b010111101001,
1529
          12'b1xxx01000101,
1530
          12'b1xxx01001101,
1531
          12'b1xxx01xx0011,
1532 4 bsa
          12'b1xxx01xx1011: pc_sel = `PC_LD;
1533
          12'b010010001100,
1534
          12'b010010001101,
1535
          12'b010110001100,
1536
          12'b010110001101,
1537
          12'b010010000100,
1538
          12'b010010000101,
1539
          12'b010110000100,
1540
          12'b010110000101,
1541
          12'b010010100100,
1542
          12'b010010100101,
1543
          12'b010110100100,
1544
          12'b010110100101,
1545
          12'b010010111100,
1546
          12'b010010111101,
1547
          12'b010110111100,
1548
          12'b010110111101,
1549
          12'b010000100101,
1550
          12'b010000101101,
1551
          12'b010100100101,
1552
          12'b010100101101,
1553
          12'b010000100100,
1554
          12'b010000101100,
1555
          12'b010100100100,
1556
          12'b010100101100,
1557
          12'b0100011000xx,12'b01000110010x,12'b010001100111,
1558
          12'b0100011010xx,12'b01000110110x,12'b010001101111,
1559
          12'b0101011000xx,12'b01010110010x,12'b010101100111,
1560
          12'b0101011010xx,12'b01010110110x,12'b010101101111,
1561
          12'b0100010xx100,12'b01000110x100,12'b010001111100,
1562
          12'b0100010xx101,12'b01000110x101,12'b010001111101,
1563
          12'b0101010xx100,12'b01010110x100,12'b010101111100,
1564
          12'b0101010xx101,12'b01010110x101,12'b010101111101,
1565
          12'b010010110100,
1566
          12'b010010110101,
1567
          12'b010110110100,
1568
          12'b010110110101,
1569
          12'b010010011100,
1570
          12'b010010011101,
1571
          12'b010110011100,
1572
          12'b010110011101,
1573
          12'b010010010100,
1574
          12'b010010010101,
1575
          12'b010110010100,
1576
          12'b010110010101,
1577
          12'b010010101100,
1578
          12'b010010101101,
1579
          12'b010110101100,
1580
          12'b010110101101,
1581
          12'b0010000000xx,12'b00100000010x,12'b001000000111,
1582
          12'b0010000010xx,12'b00100000110x,12'b001000001111,
1583
          12'b0010000100xx,12'b00100001010x,12'b001000010111,
1584
          12'b0010000110xx,12'b00100001110x,12'b001000011111,
1585
          12'b0010001000xx,12'b00100010010x,12'b001000100111,
1586
          12'b0010001010xx,12'b00100010110x,12'b001000101111,
1587
          12'b0010001100xx,12'b00100011010x,12'b001000110111,
1588
          12'b0010001110xx,12'b00100011110x,12'b001000111111,
1589
          12'b001001xxx0xx,12'b001001xxx10x,12'b001001xxx111,
1590
          12'b001010xxx0xx,12'b001010xxx10x,12'b001010xxx111,
1591
          12'b001011xxx0xx,12'b001011xxx10x,12'b001011xxx111,
1592 2 bsa
          12'b010000100011,
1593
          12'b010000101011,
1594
          12'b010000xx1001,
1595
          12'b010011111001,
1596
          12'b010100100011,
1597
          12'b010100101011,
1598
          12'b010100xx1001,
1599
          12'b010111111001,
1600
          12'b1xxx01000100,
1601
          12'b1xxx01000110,
1602
          12'b1xxx01000111,
1603
          12'b1xxx01001111,
1604
          12'b1xxx01010110,
1605
          12'b1xxx01010111,
1606
          12'b1xxx01011110,
1607
          12'b1xxx01011111,
1608
          12'b1xxx01xx0010,
1609
          12'b1xxx01xx1010: pc_sel = `PC_NILD;
1610
          default:          pc_sel = `PC_NUL;
1611
        endcase
1612
      end
1613
      `OF2A: begin
1614
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1615
          12'b000000100010,
1616
          12'b000000101010,
1617
          12'b000000110010,
1618
          12'b000000111010,
1619
          12'b000000xx0001,
1620
          12'b000011000011,
1621
          12'b000011001101,
1622
          12'b000011xxx010,
1623
          12'b000011xxx100,
1624
          12'b010000100001,
1625
          12'b010000100010,
1626
          12'b010000101010,
1627
          12'b010000110110,
1628
          12'b010100100001,
1629
          12'b010100100010,
1630
          12'b010100101010,
1631
          12'b010100110110,
1632
          12'b1xxx01xx0011,
1633
          12'b1xxx01xx1011: pc_sel = `PC_LD;
1634
          default:          pc_sel = `PC_NUL;
1635
        endcase
1636
      end
1637
      `IF3A: begin
1638
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1639
          12'b01xx11001011: pc_sel = `PC_LD;
1640
          default:          pc_sel = `PC_NUL;
1641
        endcase
1642
      end
1643
      `WR2B: begin
1644
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1645
          12'b000011001101,
1646
          12'b000011xxx100,
1647
          12'b000011xxx111,
1648
          12'b0001xxxxxxxx: pc_sel = `PC_LD;
1649
          default:          pc_sel = `PC_NUL;
1650
        endcase
1651
      end
1652
      `RD1B,
1653
      `RD2B: begin
1654
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1655
          12'b1xxx10110000,
1656
          12'b1xxx10110001,
1657
          12'b1xxx10110010,
1658
          12'b1xxx10110011,
1659
          12'b1xxx10111000,
1660
          12'b1xxx10111001,
1661
          12'b1xxx10111010,
1662
          12'b1xxx10111011: pc_sel = `PC_INT;
1663
          default:          pc_sel = `PC_NUL;
1664
        endcase
1665
      end
1666
      `PCA: begin
1667
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1668 4 bsa
          12'b000000010000: pc_sel = (tflg_reg) ? `PC_NUL : `PC_LD;
1669 2 bsa
          12'b000000011000,
1670
          12'b0000001xx000,
1671
          12'b000011000011,
1672
          12'b000011001001,
1673
          12'b000011xxx000,
1674
          12'b000011xxx010,
1675
          12'b1xxx01000101,
1676
          12'b1xxx01001101: pc_sel = `PC_LD;
1677
          default:          pc_sel = `PC_NUL;
1678
        endcase
1679
      end
1680
      `PCO: begin
1681
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1682
          12'b000011101001,
1683
          12'b010011101001,
1684
          12'b010111101001,
1685
          12'b1xxx10110000,
1686
          12'b1xxx10110001,
1687
          12'b1xxx10110010,
1688
          12'b1xxx10110011,
1689
          12'b1xxx10111000,
1690
          12'b1xxx10111001,
1691
          12'b1xxx10111010,
1692 4 bsa
          12'b1xxx10111011: pc_sel = `PC_LD;
1693 2 bsa
          default:          pc_sel = `PC_NUL;
1694
        endcase
1695
      end
1696
      `IF1A: begin
1697
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1698
          12'b1xxx01000101,
1699
          12'b1xxx01001101,
1700
          12'b0001xxxxxxxx: pc_sel = `PC_LD;
1701
          12'b1xxx10110000,
1702
          12'b1xxx10110001,
1703
          12'b1xxx10110010,
1704
          12'b1xxx10110011,
1705
          12'b1xxx10111000,
1706
          12'b1xxx10111001,
1707
          12'b1xxx10111010,
1708
          12'b1xxx10111011: pc_sel = `PC_NILD2;
1709
          default:          pc_sel = `PC_NILD;
1710
          endcase
1711
        end
1712
      `HLTA:                pc_sel = `PC_INT;
1713
      `DMA1:                pc_sel = `PC_DMA;
1714
      default:              pc_sel = `PC_NUL;
1715
      endcase
1716
    end
1717
 
1718
  /*****************************************************************************************/
1719
  /*                                                                                       */
1720
  /*  interrupt ack and dma ack                                                            */
1721
  /*                                                                                       */
1722
  /*****************************************************************************************/
1723
  always @ (inst_reg or page_reg or state_reg) begin
1724
    casex (state_reg) //synopsys parallel_case
1725
      `IF1B: begin
1726
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1727
          12'b1xxx01000101,
1728
          12'b1xxx01001101,
1729
          12'b000011110011,
1730
          12'b0001xxxxxxxx: ld_inta = 1'b0;
1731
          default:          ld_inta = 1'b1;
1732
          endcase
1733
        end
1734
      default:              ld_inta = 1'b0;
1735
      endcase
1736
    end
1737
 
1738
  always @ (inst_reg or page_reg or state_reg) begin
1739
    casex (state_reg) //synopsys parallel_case
1740
      `IF1B: begin
1741
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1742
          12'b1xxx01000101,
1743
          12'b1xxx01001101,
1744
          12'b000011110011,
1745
          12'b0001xxxxxxxx: ld_dmaa = 1'b0;
1746
          default:          ld_dmaa = 1'b1;
1747
          endcase
1748
        end
1749
      `HLTB,
1750
      `DMA2:                ld_dmaa = 1'b1;
1751
      default:              ld_dmaa = 1'b0;
1752
      endcase
1753
    end
1754
 
1755
  /*****************************************************************************************/
1756
  /*                                                                                       */
1757
  /*  data input register control                                                          */
1758
  /*                                                                                       */
1759
  /*****************************************************************************************/
1760
  always @ (inst_reg or page_reg or state_reg) begin
1761
    casex (state_reg) //synopsys parallel_case
1762
      `OF1B:                di_ctl = `DI_DI10;
1763
      `OF2B: begin
1764
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1765
          12'b010000110110,
1766
          12'b010100110110: di_ctl = `DI_DI0;
1767
          default:          di_ctl = `DI_DI1;
1768
          endcase
1769
        end
1770
      `RD1B:                di_ctl = `DI_DI0;
1771
      `RD2B: begin
1772
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1773
          12'b000000101010,
1774
          12'b000011001001,
1775
          12'b010x00101010,
1776
          12'b010x11100001,
1777
          12'b010x11100011,
1778
          12'b000011100011,
1779
          12'b1xxx01000101,
1780
          12'b1xxx01001101,
1781
          12'b1xxx01xx1011,
1782
          12'b000011xxx000,
1783
          12'b000011xx0001,
1784
          12'b0001xxxxxxxx: di_ctl = `DI_DI1;
1785
          default:          di_ctl = `DI_DI0;
1786
          endcase
1787
        end
1788
      `INTB:                di_ctl = `DI_DI0;
1789
      default:              di_ctl = `DI_NUL;
1790
      endcase
1791
    end
1792
 
1793
  /*****************************************************************************************/
1794
  /*                                                                                       */
1795
  /*  data output register control                                                         */
1796
  /*                                                                                       */
1797
  /*****************************************************************************************/
1798
  always @ (inst_reg or page_reg or state_reg) begin
1799
    casex (state_reg) //synopsys parallel_case
1800
      `WR1A: begin
1801
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1802
          12'b000011001101,
1803
          12'b010x11100101,
1804
          12'b000011xxx100,
1805
          12'b000011xx0101,
1806
          12'b000011xxx111,
1807
          12'b0001xxxxxxxx: do_ctl = `DO_MSB;
1808
          12'b1xxx10100011,
1809
          12'b1xxx10101011,
1810
          12'b1xxx10110011,
1811
          12'b1xxx10111011: do_ctl = `DO_IO;
1812
          default:          do_ctl = `DO_LSB;
1813
          endcase
1814
        end
1815
      `WR2A: begin
1816
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1817
          12'b000000100010,
1818
          12'b010x00100010,
1819
          12'b010x11100011,
1820
          12'b000011100011,
1821
          12'b1xxx01xx0011: do_ctl = `DO_MSB;
1822
          12'b000011010011,
1823
          12'b1xxx0x0xx001,
1824
          12'b1xxx0x10x001,
1825
          12'b1xxx0x111001,
1826
          12'b1xxx10100011,
1827
          12'b1xxx10101011,
1828
          12'b1xxx10110011,
1829
          12'b1xxx10111011: do_ctl = `DO_IO;
1830
          default:          do_ctl = `DO_LSB;
1831
          endcase
1832
        end
1833
      default:              do_ctl = `DO_NUL;
1834
      endcase
1835
    end
1836
 
1837
  /*****************************************************************************************/
1838
  /*                                                                                       */
1839
  /*  alu operation control                                                                */
1840
  /*                                                                                       */
1841
  /*****************************************************************************************/
1842
  always @ (inst_reg or page_reg or state_reg or carry_bit or par_bit or sign_bit or
1843
            zero_bit) begin
1844
    casex (state_reg) //synopsys parallel_case
1845
      `DEC1: begin
1846
        casex (inst_reg) //synopsys parallel_case
1847
          8'b00xx0011,
1848
          8'b00xx1001,
1849
          8'b00xx1011,
1850
          8'b11100011,
1851
          8'b11xx0101,
1852
          8'b11xxx111:      aluop_sel = `ALUOP_ADD;
1853
          8'b10001xxx:      aluop_sel = `ALUOP_BADC;
1854
          8'b00010000,
1855
          8'b00xxx100,
1856
          8'b10000xxx:      aluop_sel = `ALUOP_BADD;
1857
          8'b10100xxx:      aluop_sel = `ALUOP_BAND;
1858
          8'b00xxx101:      aluop_sel = `ALUOP_BDEC;
1859
          8'b10110xxx:      aluop_sel = `ALUOP_BOR;
1860
          8'b10011xxx:      aluop_sel = `ALUOP_BSBC;
1861
          8'b10010xxx,
1862
          8'b10111xxx:      aluop_sel = `ALUOP_BSUB;
1863
          8'b00101111,
1864
          8'b10101xxx:      aluop_sel = `ALUOP_BXOR;
1865
          8'b00111111:      aluop_sel = `ALUOP_CCF;
1866
          8'b00100111:      aluop_sel = `ALUOP_DAA;
1867
          8'b00010111:      aluop_sel = `ALUOP_RLA;
1868
          8'b00000111:      aluop_sel = `ALUOP_RLCA;
1869
          8'b00011111:      aluop_sel = `ALUOP_RRA;
1870
          8'b00001111:      aluop_sel = `ALUOP_RRCA;
1871
          8'b00110111:      aluop_sel = `ALUOP_SCF;
1872
          default:          aluop_sel = `ALUOP_PASS;
1873
          endcase
1874
        end
1875
      `IF2B:                aluop_sel = `ALUOP_ADD;
1876
      `DEC2: begin
1877
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1878
          12'b1xxx01xx1010:  aluop_sel = `ALUOP_ADC;
1879
          12'b010000100011,
1880
          12'b010000101011,
1881
          12'b010000xx1001,
1882
          12'b010011100101,
1883
          12'b010100100011,
1884
          12'b010100101011,
1885
          12'b010100xx1001,
1886 4 bsa
          12'b010111100101: aluop_sel = `ALUOP_ADD;
1887 2 bsa
          12'b1xxx01010111,
1888 4 bsa
          12'b1xxx01011111: aluop_sel = `ALUOP_APAS;
1889
          12'b010010001100,
1890
          12'b010010001101,
1891
          12'b010110001100,
1892
          12'b010110001101: aluop_sel = `ALUOP_BADC;
1893
          12'b010010000100,
1894
          12'b010010000101,
1895
          12'b010110000100,
1896
          12'b010110000101,
1897
          12'b010000100100,
1898
          12'b010000101100,
1899
          12'b010100100100,
1900
          12'b010100101100: aluop_sel = `ALUOP_BADD;
1901
          12'b010010100100,
1902
          12'b010010100101,
1903
          12'b010110100100,
1904
          12'b010110100101,
1905 2 bsa
          12'b001001xxxxxx,
1906
          12'b001010xxxxxx: aluop_sel = `ALUOP_BAND;
1907 4 bsa
          12'b010000100101,
1908
          12'b010000101101,
1909
          12'b010100100101,
1910
          12'b010100101101: aluop_sel = `ALUOP_BDEC;
1911
          12'b010010110100,
1912
          12'b010010110101,
1913
          12'b010110110100,
1914
          12'b010110110101,
1915 2 bsa
          12'b001011xxxxxx: aluop_sel = `ALUOP_BOR;
1916 4 bsa
          12'b010010011100,
1917
          12'b010010011101,
1918
          12'b010110011100,
1919
          12'b010110011101: aluop_sel = `ALUOP_BSBC;
1920
          12'b010010111100,
1921
          12'b010010111101,
1922
          12'b010110111100,
1923
          12'b010110111101,
1924
          12'b010010010100,
1925
          12'b010010010101,
1926
          12'b010110010100,
1927
          12'b010110010101,
1928 2 bsa
          12'b1xxx01000100: aluop_sel = `ALUOP_BSUB;
1929 4 bsa
          12'b010010101100,
1930
          12'b010010101101,
1931
          12'b010110101100,
1932
          12'b010110101101: aluop_sel = `ALUOP_BXOR;
1933 2 bsa
          12'b001000010xxx: aluop_sel = `ALUOP_RL;
1934
          12'b001000000xxx: aluop_sel = `ALUOP_RLC;
1935
          12'b001000011xxx: aluop_sel = `ALUOP_RR;
1936
          12'b001000001xxx: aluop_sel = `ALUOP_RRC;
1937
          12'b1xxx01xx0010: aluop_sel = `ALUOP_SBC;
1938
          12'b001000100xxx: aluop_sel = `ALUOP_SLA;
1939 4 bsa
          12'b001000110xxx: aluop_sel = `ALUOP_SLL;
1940 2 bsa
          12'b001000101xxx: aluop_sel = `ALUOP_SRA;
1941
          12'b001000111xxx: aluop_sel = `ALUOP_SRL;
1942
          default:          aluop_sel = `ALUOP_PASS;
1943
        endcase
1944
      end
1945
      `OF1B: begin
1946
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1947
          12'b000000100000: aluop_sel = ( !zero_bit) ? `ALUOP_ADS : `ALUOP_ADD;
1948
          12'b000000101000: aluop_sel = (  zero_bit) ? `ALUOP_ADS : `ALUOP_ADD;
1949
          12'b000000110000: aluop_sel = (!carry_bit) ? `ALUOP_ADS : `ALUOP_ADD;
1950
          12'b000000111000: aluop_sel = ( carry_bit) ? `ALUOP_ADS : `ALUOP_ADD;
1951
          12'b000000010000,
1952
          12'b000000011000: aluop_sel = `ALUOP_ADS;
1953
          12'b000000110110: aluop_sel = `ALUOP_PASS;
1954
          default:          aluop_sel = `ALUOP_ADD;
1955
        endcase
1956
      end
1957
      `OF2A: begin
1958
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1959
          12'b010000110110,
1960
          12'b010100110110: aluop_sel = `ALUOP_ADS;
1961
          default:          aluop_sel = `ALUOP_ADD;
1962
        endcase
1963
      end
1964
      `OF2B: begin
1965
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1966
          12'b000000xx0001,
1967
          12'b010000100001,
1968
          12'b010100100001: aluop_sel = `ALUOP_ADD;
1969
          12'b000011000010,
1970
          12'b000011000100: aluop_sel = ( !zero_bit) ? `ALUOP_PASS : `ALUOP_ADD;
1971
          12'b000011001010,
1972
          12'b000011001100: aluop_sel = (  zero_bit) ? `ALUOP_PASS : `ALUOP_ADD;
1973
          12'b000011010010,
1974
          12'b000011010100: aluop_sel = (!carry_bit) ? `ALUOP_PASS : `ALUOP_ADD;
1975
          12'b000011011010,
1976
          12'b000011011100: aluop_sel = ( carry_bit) ? `ALUOP_PASS : `ALUOP_ADD;
1977
          12'b000011100010,
1978
          12'b000011100100: aluop_sel = (  !par_bit) ? `ALUOP_PASS : `ALUOP_ADD;
1979
          12'b000011101010,
1980
          12'b000011101100: aluop_sel = (   par_bit) ? `ALUOP_PASS : `ALUOP_ADD;
1981
          12'b000011110010,
1982
          12'b000011110100: aluop_sel = ( !sign_bit) ? `ALUOP_PASS : `ALUOP_ADD;
1983
          12'b000011111010,
1984
          12'b000011111100: aluop_sel = (  sign_bit) ? `ALUOP_PASS : `ALUOP_ADD;
1985
          default:          aluop_sel = `ALUOP_PASS;
1986
        endcase
1987
      end
1988
      `IF3A:                aluop_sel = `ALUOP_ADS;
1989
      `ADR1: begin
1990
        casex ({page_reg, inst_reg}) //synopsys parallel_case
1991
          12'b000000100010,
1992
          12'b000000101010,
1993
          12'b000000110010,
1994
          12'b000000111010,
1995
          12'b000011010011,
1996
          12'b000011011011,
1997
          12'b0001xxxxxxxx,
1998
          12'b010000100010,
1999
          12'b010000101010,
2000
          12'b010100100010,
2001
          12'b010100101010,
2002
          12'b1xxx01xx0011,
2003
          12'b1xxx01xx1011: aluop_sel = `ALUOP_PASS;
2004
          default:          aluop_sel = `ALUOP_ADS;
2005
        endcase
2006
      end
2007
      `ADR2: begin
2008
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2009
          12'b1xxx10100000,
2010
          12'b1xxx10100001,
2011
          12'b1xxx10101000,
2012
          12'b1xxx10101001,
2013
          12'b1xxx10110000,
2014
          12'b1xxx10110001,
2015
          12'b1xxx10111000,
2016
          12'b1xxx10111001: aluop_sel = `ALUOP_ADD;
2017
          12'b1xxx10100010,
2018
          12'b1xxx10101010,
2019
          12'b1xxx10110010,
2020
          12'b1xxx10111010: aluop_sel = `ALUOP_BADD;
2021
          12'b1xxx10100011,
2022
          12'b1xxx10101011,
2023
          12'b1xxx10110011,
2024
          12'b1xxx10111011: aluop_sel = `ALUOP_BAND;
2025
          default:          aluop_sel = `ALUOP_PASS;
2026
        endcase
2027
      end
2028
      `RD1A: begin
2029
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2030
          12'b1xxx10100000,
2031
          12'b1xxx10100010,
2032
          12'b1xxx10100011,
2033
          12'b1xxx10101000,
2034
          12'b1xxx10101010,
2035
          12'b1xxx10101011,
2036
          12'b1xxx10110000,
2037
          12'b1xxx10110010,
2038
          12'b1xxx10110011,
2039
          12'b1xxx10111000,
2040
          12'b1xxx10111010,
2041
          12'b1xxx10111011: aluop_sel = `ALUOP_PASS;
2042
          default:          aluop_sel = `ALUOP_ADD;
2043
        endcase
2044
      end
2045
      `RD1B: begin
2046
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2047
          12'b1xxx10100001,
2048
          12'b1xxx10101001,
2049
          12'b1xxx10110001,
2050
          12'b1xxx10111001: aluop_sel = `ALUOP_BSUB;
2051
          12'b1xxx10100000,
2052
          12'b1xxx10101000,
2053
          12'b1xxx10110000,
2054
          12'b1xxx10111000: aluop_sel = `ALUOP_PASS;
2055
          default:          aluop_sel = `ALUOP_BAND;
2056
        endcase
2057
      end
2058
      `RD2A: begin
2059
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2060
          12'b000011001001,
2061
          12'b000011xxx000,
2062
          12'b000011xx0001,
2063
          12'b0001xxxxxxxx,
2064
          12'b010011100001,
2065
          12'b010111100001,
2066
          12'b1xxx01000101,
2067
          12'b1xxx01001101,
2068
          12'b1xxx10100000,
2069
          12'b1xxx10100010,
2070
          12'b1xxx10101000,
2071
          12'b1xxx10101010,
2072
          12'b1xxx10110000,
2073
          12'b1xxx10110010,
2074
          12'b1xxx10111000,
2075
          12'b1xxx10111010: aluop_sel = `ALUOP_ADD;
2076
          default:          aluop_sel = `ALUOP_PASS;
2077
        endcase
2078
      end
2079
      `RD2B: begin
2080
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2081 4 bsa
          12'b000000xxx100,
2082 2 bsa
          12'b010000110100,
2083
          12'b010100110100: aluop_sel = `ALUOP_BADD;
2084 4 bsa
          12'b0x1x10xxxxxx,
2085 2 bsa
          12'b1xxx10100010,
2086
          12'b1xxx10100011,
2087
          12'b1xxx10101010,
2088
          12'b1xxx10101011,
2089
          12'b1xxx10110010,
2090
          12'b1xxx10110011,
2091
          12'b1xxx10111010,
2092
          12'b1xxx10111011: aluop_sel = `ALUOP_BAND;
2093 4 bsa
          12'b000000xxx101,
2094 2 bsa
          12'b010000110101,
2095
          12'b010100110101: aluop_sel = `ALUOP_BDEC;
2096 4 bsa
          12'b0x1x11xxxxxx: aluop_sel = `ALUOP_BOR;
2097 2 bsa
          12'b1xxx10100001,
2098
          12'b1xxx10101001,
2099
          12'b1xxx10110001,
2100
          12'b1xxx10111001: aluop_sel = `ALUOP_BSUB;
2101
          12'b000011001001,
2102
          12'b000011100011,
2103
          12'b000011xxx000,
2104
          12'b0001xxxxxxxx,
2105
          12'b010011100011,
2106
          12'b010111100011,
2107
          12'b1xxx01000101,
2108
          12'b1xxx01001101,
2109
          12'b1xxx10100000,
2110
          12'b1xxx10101000,
2111
          12'b1xxx10110000,
2112
          12'b1xxx10111000: aluop_sel = `ALUOP_PASS;
2113 4 bsa
          12'b0x1x00000xxx: aluop_sel = `ALUOP_RLC;
2114
          12'b0x1x00001xxx: aluop_sel = `ALUOP_RRC;
2115
          12'b0x1x00010xxx: aluop_sel = `ALUOP_RL;
2116
          12'b0x1x00011xxx: aluop_sel = `ALUOP_RR;
2117
          12'b0x1x00100xxx: aluop_sel = `ALUOP_SLA;
2118
          12'b0x1x00101xxx: aluop_sel = `ALUOP_SRA;
2119
          12'b0x1x00110xxx: aluop_sel = `ALUOP_SLL;
2120
          12'b0x1x00111xxx: aluop_sel = `ALUOP_SRL;
2121
          12'b1xxx01101111: aluop_sel = `ALUOP_RLD1;
2122
          12'b1xxx01100111: aluop_sel = `ALUOP_RRD1;
2123 2 bsa
          default:          aluop_sel = `ALUOP_ADD;
2124
        endcase
2125
      end
2126
      `WR1A: begin
2127
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2128
          12'b1xxx10100010,
2129
          12'b1xxx10101010,
2130
          12'b1xxx10110010,
2131
          12'b1xxx10111010: aluop_sel = `ALUOP_PASS;
2132
          default:          aluop_sel = `ALUOP_ADD;
2133
        endcase
2134
      end
2135
      `WR1B: begin
2136
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2137
          12'b1xxx10100000,
2138
          12'b1xxx10100010,
2139
          12'b1xxx10100011,
2140
          12'b1xxx10101000,
2141
          12'b1xxx10101010,
2142
          12'b1xxx10101011,
2143
          12'b1xxx10110000,
2144
          12'b1xxx10111000: aluop_sel = `ALUOP_ADD;
2145
          12'b1xxx10110010,
2146
          12'b1xxx10110011,
2147
          12'b1xxx10111010,
2148
          12'b1xxx10111011: aluop_sel = `ALUOP_BADD;
2149
          default:          aluop_sel = `ALUOP_PASS;
2150
        endcase
2151
      end
2152
      `WR2A: begin
2153
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2154
          12'b1xxx10100000,
2155
          12'b1xxx10100011,
2156
          12'b1xxx10101000,
2157
          12'b1xxx10101011,
2158
          12'b1xxx10110000,
2159
          12'b1xxx10110011,
2160
          12'b1xxx10111000,
2161
          12'b1xxx10111011: aluop_sel = `ALUOP_ADD;
2162
          12'b000011xxx111,
2163
          12'b0001xxxxxxxx: aluop_sel = `ALUOP_APAS;
2164
          default:          aluop_sel = `ALUOP_PASS;
2165
        endcase
2166
      end
2167
      `WR2B: begin
2168
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2169
          12'b1xxx10100010,
2170
          12'b1xxx10100011,
2171
          12'b1xxx10101010,
2172
          12'b1xxx10101011,
2173
          12'b1xxx10110010,
2174
          12'b1xxx10110011,
2175
          12'b1xxx10111010,
2176
          12'b1xxx10111011: aluop_sel = `ALUOP_BADD;
2177
          default:          aluop_sel = `ALUOP_ADD;
2178
        endcase
2179
      end
2180
      `IF1A: begin
2181
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2182
          12'b1xxx10100000,
2183
          12'b1xxx10100010,
2184
          12'b1xxx10101000,
2185
          12'b1xxx10101010,
2186
          12'b1xxx10110000,
2187
          12'b1xxx10110010,
2188
          12'b1xxx10111000,
2189
          12'b1xxx10111010: aluop_sel = `ALUOP_ADD;
2190
          12'b000010001xxx,
2191
          12'b000011001110,
2192
          12'b010x10001110: aluop_sel = `ALUOP_BADC;
2193
          12'b000010000xxx,
2194
          12'b000011000110,
2195
          12'b010x10000110,
2196
          12'b1xxx10100011,
2197
          12'b1xxx10101011,
2198
          12'b1xxx10110011,
2199
          12'b1xxx10111011: aluop_sel = `ALUOP_BADD;
2200
          12'b000010100xxx,
2201 4 bsa
          12'b0x1x01xxxxxx,
2202 2 bsa
          12'b010x10100110,
2203
          12'b000011100110,
2204
          12'b1xxx01xxx000: aluop_sel = `ALUOP_BAND;
2205
          12'b000010110xxx,
2206
          12'b010x10110110,
2207
          12'b000011110110: aluop_sel = `ALUOP_BOR;
2208
          12'b000010011xxx,
2209
          12'b010x10011110,
2210
          12'b000011011110: aluop_sel = `ALUOP_BSBC;
2211
          12'b000010010xxx,
2212
          12'b000010111xxx,
2213
          12'b000011010110,
2214
          12'b010x10010110,
2215
          12'b010x10111110,
2216
          12'b000011111110: aluop_sel = `ALUOP_BSUB;
2217
          12'b000010101xxx,
2218
          12'b010x10101110,
2219
          12'b000011101110: aluop_sel = `ALUOP_BXOR;
2220
          12'b1xxx01101111: aluop_sel = `ALUOP_RLD2;
2221
          12'b1xxx01100111: aluop_sel = `ALUOP_RRD2;
2222
          default:          aluop_sel = `ALUOP_PASS;
2223
          endcase
2224
        end
2225
      `INTB:                aluop_sel = `ALUOP_PASS;
2226
      default:              aluop_sel = `ALUOP_ADD;
2227
      endcase
2228
    end
2229
 
2230
  /*****************************************************************************************/
2231
  /*                                                                                       */
2232
  /*  alu a input control                                                                  */
2233
  /*                                                                                       */
2234
  /*****************************************************************************************/
2235
  always @ (inst_reg or page_reg or state_reg or carry_bit or par_bit or sign_bit or
2236
            tflg_reg or zero_bit) begin
2237
    casex (state_reg) //synopsys parallel_case
2238
      `DEC1: begin
2239
        casex (inst_reg) //synopsys parallel_case
2240
          8'b10000xxx,
2241
          8'b10001xxx,
2242
          8'b10010xxx,
2243
          8'b10011xxx,
2244
          8'b10100xxx,
2245
          8'b10101xxx,
2246
          8'b10110xxx,
2247
          8'b10111xxx:      alua_sel = `ALUA_AA;
2248
          8'b00100111:      alua_sel = `ALUA_DAA;
2249
          8'b00xx1001:      alua_sel = `ALUA_HL;
2250
          8'b00010000,
2251
          8'b00101111,
2252
          8'b00xxx101,
2253
          8'b00xx1011,
2254
          8'b11xx0101,
2255
          8'b11xxx111:      alua_sel = `ALUA_M1;
2256
          default:          alua_sel = `ALUA_ONE;
2257
          endcase
2258
        end
2259
      `DEC2: begin
2260
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2261 4 bsa
          12'b001001xxxxxx,
2262
          12'b001010xxxxxx,
2263
          12'b001011xxxxxx: alua_sel = `ALUA_BIT;
2264 2 bsa
          12'b1xxx01xx0010,
2265
          12'b1xxx01xx1010: alua_sel = `ALUA_HL;
2266
          12'b1xxx01010111: alua_sel = `ALUA_II;
2267
          12'b010000xx1001: alua_sel = `ALUA_IX;
2268
          12'b010100xx1001: alua_sel = `ALUA_IY;
2269 4 bsa
          12'b010000100101,
2270 2 bsa
          12'b010000101011,
2271 4 bsa
          12'b010000101101,
2272 2 bsa
          12'b010011100101,
2273 4 bsa
          12'b010100100101,
2274 2 bsa
          12'b010100101011,
2275 4 bsa
          12'b010100101101,
2276 2 bsa
          12'b010111100101: alua_sel = `ALUA_M1;
2277 4 bsa
          12'b010000100100,
2278
          12'b010000101100,
2279 2 bsa
          12'b010000100011,
2280 4 bsa
          12'b010100100100,
2281
          12'b010100101100,
2282 2 bsa
          12'b010100100011: alua_sel = `ALUA_ONE;
2283
          12'b1xxx01011111: alua_sel = `ALUA_RR;
2284
          12'b1xxx01000100: alua_sel = `ALUA_ZER;
2285 4 bsa
          default:          alua_sel = `ALUA_AA;
2286 2 bsa
        endcase
2287
      end
2288
      `OF1B: begin
2289
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2290
          12'b000000100000: alua_sel = ( !zero_bit) ? `ALUA_PC : `ALUA_ONE;
2291
          12'b000000101000: alua_sel = (  zero_bit) ? `ALUA_PC : `ALUA_ONE;
2292
          12'b000000110000: alua_sel = (!carry_bit) ? `ALUA_PC : `ALUA_ONE;
2293
          12'b000000111000: alua_sel = ( carry_bit) ? `ALUA_PC : `ALUA_ONE;
2294
          12'b000000010000,
2295
          12'b000000011000: alua_sel = `ALUA_PC;
2296
          default:          alua_sel = `ALUA_ONE;
2297
        endcase
2298
      end
2299
      `OF2A: begin
2300
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2301
          12'b010000110110: alua_sel = `ALUA_IX;
2302
          12'b010100110110: alua_sel = `ALUA_IY;
2303
          default:          alua_sel = `ALUA_M1;
2304
        endcase
2305
      end
2306
      `IF3A:                alua_sel = (page_reg[0]) ? `ALUA_IY : `ALUA_IX;
2307
      `ADR1:                alua_sel = (page_reg[2]) ? ((page_reg[0]) ? `ALUA_IY : `ALUA_IX) : `ALUA_M1;
2308
      `ADR2:                alua_sel = `ALUA_M1;
2309
      `RD1B: begin
2310
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2311
          12'b1xxx10100001,
2312
          12'b1xxx10101001,
2313
          12'b1xxx10110001,
2314
          12'b1xxx10111001: alua_sel = `ALUA_AA;
2315
          default:          alua_sel = `ALUA_M1;
2316
        endcase
2317
      end
2318
      `RD2A: begin
2319
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2320
          12'b0001xxxxxxxx,
2321
          12'b1xxx10101000,
2322
          12'b1xxx10101010,
2323
          12'b1xxx10111000,
2324
          12'b1xxx10111010: alua_sel = `ALUA_M1;
2325
          default:          alua_sel = `ALUA_ONE;
2326
        endcase
2327
      end
2328
      `RD2B: begin
2329
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2330
          12'b1xxx01100111,
2331
          12'b1xxx01101111,
2332
          12'b1xxx10100001,
2333
          12'b1xxx10101001,
2334
          12'b1xxx10110001,
2335
          12'b1xxx10111001: alua_sel = `ALUA_AA;
2336 4 bsa
          12'b0x1x1xxxxxxx: alua_sel = `ALUA_BIT;
2337
          12'b000000xxx101,
2338 2 bsa
          12'b010000110101,
2339
          12'b010100110101,
2340
          12'b1xxx10100010,
2341
          12'b1xxx10100011,
2342
          12'b1xxx10101010,
2343
          12'b1xxx10101011,
2344
          12'b1xxx10110010,
2345
          12'b1xxx10110011,
2346
          12'b1xxx10111010,
2347
          12'b1xxx10111011: alua_sel = `ALUA_M1;
2348
          default:          alua_sel = `ALUA_ONE;
2349
        endcase
2350
      end
2351
      `WR1A: begin
2352
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2353
          12'b000000100010,
2354
          12'b000011100011,
2355
          12'b010000100010,
2356
          12'b010011100011,
2357
          12'b010100100010,
2358
          12'b010111100011,
2359
          12'b1xxx01xx0011,
2360
          12'b1xxx10100000,
2361
          12'b1xxx10100011,
2362
          12'b1xxx10110000,
2363
          12'b1xxx10110011: alua_sel = `ALUA_ONE;
2364
          default:          alua_sel = `ALUA_M1;
2365
        endcase
2366
      end
2367
      `WR1B: begin
2368
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2369
          12'b1xxx10110000,
2370
          12'b1xxx10110010,
2371
          12'b1xxx10110011,
2372
          12'b1xxx10111000,
2373
          12'b1xxx10111010,
2374
          12'b1xxx10111011: alua_sel = `ALUA_M1;
2375
          default:          alua_sel = `ALUA_ONE;
2376
        endcase
2377
      end
2378
      `WR2A: begin
2379
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2380
          12'b0001xxxxxxxx: alua_sel = `ALUA_INT;
2381
          12'b1xxx10101000,
2382
          12'b1xxx10101011,
2383
          12'b1xxx10111000,
2384
          12'b1xxx10111011: alua_sel = `ALUA_M1;
2385
          12'b000011xxx111: alua_sel = `ALUA_RST;
2386
          default:          alua_sel = `ALUA_ONE;
2387
        endcase
2388
      end
2389
      `WR2B: begin
2390
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2391
          12'b1xxx10100000,
2392
          12'b1xxx10100010,
2393
          12'b1xxx10100011,
2394
          12'b1xxx10101000,
2395
          12'b1xxx10101010,
2396
          12'b1xxx10101011,
2397
          12'b1xxx10110000,
2398
          12'b1xxx10110010,
2399
          12'b1xxx10110011,
2400
          12'b1xxx10111000,
2401
          12'b1xxx10111010,
2402
          12'b1xxx10111011: alua_sel = `ALUA_M1;
2403
          default:          alua_sel = `ALUA_ONE;
2404
        endcase
2405
      end
2406
      `BLK1: begin
2407
        alua_sel = (inst_reg[3]) ? `ALUA_M1 : `ALUA_ONE;
2408
      end
2409
      `BLK2: begin
2410
        alua_sel = (inst_reg[4]) ? `ALUA_M1 : `ALUA_ONE;
2411
      end
2412
      `PCA:                 alua_sel = (tflg_reg) ? `ALUA_ZER : `ALUA_M2;
2413
      `IF1A: begin
2414
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2415 4 bsa
          12'b0x1x01xxxxxx: alua_sel = `ALUA_BIT;
2416 2 bsa
          12'b1xxx01xxx000,
2417
          12'b1xxx10100011,
2418
          12'b1xxx10101000,
2419
          12'b1xxx10101010,
2420
          12'b1xxx10101011,
2421
          12'b1xxx10110011,
2422
          12'b1xxx10111000,
2423
          12'b1xxx10111010,
2424
          12'b1xxx10111011: alua_sel = `ALUA_M1;
2425
          12'b1xxx10100000,
2426
          12'b1xxx10100010,
2427
          12'b1xxx10110000,
2428
          12'b1xxx10110010: alua_sel = `ALUA_ONE;
2429
          default:          alua_sel = `ALUA_AA;
2430
          endcase
2431
        end
2432
      `INTA:                alua_sel = `ALUA_M1;
2433
      default:              alua_sel = `ALUA_ONE;
2434
      endcase
2435
    end
2436
 
2437
  /*****************************************************************************************/
2438
  /*                                                                                       */
2439
  /*  alu b input control                                                                  */
2440
  /*                                                                                       */
2441
  /*****************************************************************************************/
2442
  always @ (inst_reg or page_reg or state_reg or carry_bit or par_bit or sign_bit or
2443
            zero_bit) begin
2444
    casex (state_reg) //synopsys parallel_case
2445
      `DEC1: begin
2446
        casex (inst_reg) //synopsys parallel_case
2447
          8'b00000111,
2448
          8'b00001111,
2449
          8'b00010111,
2450
          8'b00011111,
2451
          8'b00100111,
2452
          8'b00101111:      alub_sel = `ALUB_AA;
2453
          8'b00010000:      alub_sel = `ALUB_BB;
2454
          8'b00000010,
2455
          8'b00001010:      alub_sel = `ALUB_BC;
2456
          8'b00010010,
2457
          8'b00011010,
2458
          8'b11101011:      alub_sel = `ALUB_DE;
2459
          8'b11101001,
2460
          8'b11111001:      alub_sel = `ALUB_HL;
2461
          8'b01xxx000,
2462
          8'b10xxx000:      alub_sel = `ALUB_BB;
2463
          8'b01xxx001,
2464
          8'b10xxx001:      alub_sel = `ALUB_CC;
2465
          8'b01xxx010,
2466
          8'b10xxx010:      alub_sel = `ALUB_DD;
2467
          8'b01xxx011,
2468
          8'b10xxx011:      alub_sel = `ALUB_EE;
2469
          8'b01xxx100,
2470
          8'b10xxx100:      alub_sel = `ALUB_HH;
2471
          8'b01xxx101,
2472
          8'b10xxx101:      alub_sel = `ALUB_LL;
2473
          8'b01xxx111,
2474
          8'b10xxx111:      alub_sel = `ALUB_AA;
2475
          8'b0000010x:      alub_sel = `ALUB_BB;
2476
          8'b0000110x:      alub_sel = `ALUB_CC;
2477
          8'b0001010x:      alub_sel = `ALUB_DD;
2478
          8'b0001110x:      alub_sel = `ALUB_EE;
2479
          8'b0010010x:      alub_sel = `ALUB_HH;
2480
          8'b0010110x:      alub_sel = `ALUB_LL;
2481
          8'b0011110x:      alub_sel = `ALUB_AA;
2482
          8'b00000011,
2483
          8'b00001001,
2484
          8'b00001011:      alub_sel = `ALUB_BC;
2485
          8'b00010011,
2486
          8'b00011001,
2487
          8'b00011011:      alub_sel = `ALUB_DE;
2488
          8'b00100011,
2489
          8'b00101001,
2490
          8'b00101011:      alub_sel = `ALUB_HL;
2491
          8'b00110011,
2492
          8'b00111001,
2493
          8'b00111011:      alub_sel = `ALUB_SP;
2494
          8'b11xx0101,
2495
          8'b11xxx111:      alub_sel = `ALUB_SP;
2496
          default:          alub_sel = `ALUB_PC;
2497
          endcase
2498
        end
2499
      `IF2B:                alub_sel = `ALUB_PC;
2500
      `DEC2: begin
2501
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2502
          12'b1xxx01000100,
2503
          12'b1xxx01000111,
2504
          12'b1xxx01001111: alub_sel = `ALUB_AA;
2505
          12'b1xxx01xxx000,
2506
          12'b1xxx01xxx001,
2507
          12'b1xxx10100010,
2508
          12'b1xxx10101010,
2509
          12'b1xxx10110010,
2510
          12'b1xxx10111010: alub_sel = `ALUB_BC;
2511
          12'b010000100011,
2512
          12'b010000101011,
2513
          12'b010011101001,
2514
          12'b010011111001: alub_sel = `ALUB_IX;
2515 4 bsa
          12'b010000100100,
2516
          12'b010000100101,
2517
          12'b0100010xx100,12'b01000110x100,12'b010001111100,
2518
          12'b010010000100,
2519
          12'b010010001100,
2520
          12'b010010010100,
2521
          12'b010010011100,
2522
          12'b010010100100,
2523
          12'b010010101100,
2524
          12'b010010110100,
2525
          12'b010010111100: alub_sel = `ALUB_IXH;
2526
          12'b010100100100,
2527
          12'b010100100101,
2528
          12'b0101010xx100,12'b01010110x100,12'b010101111100,
2529
          12'b010110000100,
2530
          12'b010110001100,
2531
          12'b010110010100,
2532
          12'b010110011100,
2533
          12'b010110100100,
2534
          12'b010110101100,
2535
          12'b010110110100,
2536
          12'b010110111100: alub_sel = `ALUB_IYH;
2537
          12'b010000101100,
2538
          12'b010000101101,
2539
          12'b0100010xx101,12'b01000110x101,12'b010001111101,
2540
          12'b010010000101,
2541
          12'b010010001101,
2542
          12'b010010010101,
2543
          12'b010010011101,
2544
          12'b010010100101,
2545
          12'b010010101101,
2546
          12'b010010110101,
2547
          12'b010010111101: alub_sel = `ALUB_IXL;
2548
          12'b010100101100,
2549
          12'b010100101101,
2550
          12'b0101010xx101,12'b01010110x101,12'b010101111101,
2551
          12'b010110000101,
2552
          12'b010110001101,
2553
          12'b010110010101,
2554
          12'b010110011101,
2555
          12'b010110100101,
2556
          12'b010110101101,
2557
          12'b010110110101,
2558
          12'b010110111101: alub_sel = `ALUB_IYL;
2559 2 bsa
          12'b010100100011,
2560
          12'b010100101011,
2561
          12'b010111101001,
2562
          12'b010111111001: alub_sel = `ALUB_IY;
2563
          12'b1xxx01000101,
2564
          12'b1xxx01001101: alub_sel = `ALUB_PC;
2565 4 bsa
          12'b010x0110x000,
2566
          12'b0010xxxxx000: alub_sel = `ALUB_BB;
2567
          12'b010x0110x001,
2568
          12'b0010xxxxx001: alub_sel = `ALUB_CC;
2569
          12'b010x0110x010,
2570
          12'b0010xxxxx010: alub_sel = `ALUB_DD;
2571
          12'b010x0110x011,
2572
          12'b0010xxxxx011: alub_sel = `ALUB_EE;
2573
          12'b0010xxxxx100: alub_sel = `ALUB_HH;
2574
          12'b0010xxxxx101: alub_sel = `ALUB_LL;
2575
          12'b010x0110x111,
2576
          12'b0010xxxxx111: alub_sel = `ALUB_AA;
2577 2 bsa
          12'b1xxx0100x010: alub_sel = `ALUB_BC;
2578
          12'b1xxx0101x010: alub_sel = `ALUB_DE;
2579
          12'b1xxx0111x010: alub_sel = `ALUB_SP;
2580
          12'b010011100101,
2581
          12'b010111100101: alub_sel = `ALUB_SP;
2582
          12'b010x00001001: alub_sel = `ALUB_BC;
2583
          12'b010x00011001: alub_sel = `ALUB_DE;
2584 4 bsa
          12'b010000101001: alub_sel = `ALUB_IX;
2585
          12'b010100101001: alub_sel = `ALUB_IY;
2586 2 bsa
          12'b010x00111001: alub_sel = `ALUB_SP;
2587
          default:          alub_sel = `ALUB_HL;
2588
        endcase
2589
      end
2590
      `OF1B: begin
2591
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2592
          12'b000000010000,
2593
          12'b000000011000,
2594
          12'b000000110110: alub_sel = `ALUB_DIN;
2595
          12'b000000100000: alub_sel = ( !zero_bit) ? `ALUB_DIN : `ALUB_PC;
2596
          12'b000000101000: alub_sel = (  zero_bit) ? `ALUB_DIN : `ALUB_PC;
2597
          12'b000000110000: alub_sel = (!carry_bit) ? `ALUB_DIN : `ALUB_PC;
2598
          12'b000000111000: alub_sel = ( carry_bit) ? `ALUB_DIN : `ALUB_PC;
2599
          default:          alub_sel = `ALUB_PC;
2600
        endcase
2601
      end
2602
      `OF2A: begin
2603
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2604
          12'b010000110110,
2605
          12'b010100110110: alub_sel = `ALUB_DIN;
2606
          default:          alub_sel = `ALUB_SP;
2607
        endcase
2608
      end
2609
      `OF2B: begin
2610
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2611
          12'b000011000011,
2612
          12'b010000110110,
2613
          12'b010100110110: alub_sel = `ALUB_DIN;
2614
          12'b000011000010: alub_sel = ( !zero_bit) ? `ALUB_DIN : `ALUB_PC;
2615
          12'b000011001010: alub_sel = (  zero_bit) ? `ALUB_DIN : `ALUB_PC;
2616
          12'b000011010010: alub_sel = (!carry_bit) ? `ALUB_DIN : `ALUB_PC;
2617
          12'b000011011010: alub_sel = ( carry_bit) ? `ALUB_DIN : `ALUB_PC;
2618
          12'b000011100010: alub_sel = (  !par_bit) ? `ALUB_DIN : `ALUB_PC;
2619
          12'b000011101010: alub_sel = (   par_bit) ? `ALUB_DIN : `ALUB_PC;
2620
          12'b000011110010: alub_sel = ( !sign_bit) ? `ALUB_DIN : `ALUB_PC;
2621
          12'b000011111010: alub_sel = (  sign_bit) ? `ALUB_DIN : `ALUB_PC;
2622
          12'b000011001101: alub_sel = `ALUB_PCH;
2623
          12'b000011000100: alub_sel = ( !zero_bit) ? `ALUB_PCH : `ALUB_PC;
2624
          12'b000011001100: alub_sel = (  zero_bit) ? `ALUB_PCH : `ALUB_PC;
2625
          12'b000011010100: alub_sel = (!carry_bit) ? `ALUB_PCH : `ALUB_PC;
2626
          12'b000011011100: alub_sel = ( carry_bit) ? `ALUB_PCH : `ALUB_PC;
2627
          12'b000011100100: alub_sel = (  !par_bit) ? `ALUB_PCH : `ALUB_PC;
2628
          12'b000011101100: alub_sel = (   par_bit) ? `ALUB_PCH : `ALUB_PC;
2629
          12'b000011110100: alub_sel = ( !sign_bit) ? `ALUB_PCH : `ALUB_PC;
2630
          12'b000011111100: alub_sel = (  sign_bit) ? `ALUB_PCH : `ALUB_PC;
2631
          default:          alub_sel = `ALUB_PC;
2632
        endcase
2633
      end
2634
      `IF3A:                alub_sel = `ALUB_DIN;
2635
      `ADR1: begin
2636
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2637
          12'b000011010011,
2638
          12'b000011011011: alub_sel = `ALUB_IO;
2639
          12'b0001xxxxxxxx: alub_sel = `ALUB_TMP;
2640
          default:          alub_sel = `ALUB_DIN;
2641
        endcase
2642
      end
2643
      `ADR2: begin
2644
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2645
          12'b000000000010,
2646
          12'b000000010010,
2647
          12'b000000110010,
2648
          12'b000011010011: alub_sel = `ALUB_AA;
2649
          12'b1xxx10100010,
2650
          12'b1xxx10100011,
2651
          12'b1xxx10101010,
2652
          12'b1xxx10101011,
2653
          12'b1xxx10110010,
2654
          12'b1xxx10110011,
2655
          12'b1xxx10111010,
2656
          12'b1xxx10111011: alub_sel = `ALUB_BB;
2657
          12'b1xxx10100000,
2658
          12'b1xxx10100001,
2659
          12'b1xxx10101000,
2660
          12'b1xxx10101001,
2661
          12'b1xxx10110000,
2662
          12'b1xxx10110001,
2663
          12'b1xxx10111000,
2664
          12'b1xxx10111001: alub_sel = `ALUB_BC;
2665
          12'b010000100010: alub_sel = `ALUB_IX;
2666
          12'b010011100101: alub_sel = `ALUB_IXH;
2667
          12'b010100100010: alub_sel = `ALUB_IY;
2668
          12'b010111100101: alub_sel = `ALUB_IYH;
2669
          12'b000011xxx111: alub_sel = `ALUB_PCH;
2670
          12'b000001xxx000,
2671
          12'b010x01110000,
2672
          12'b1xxx01000001: alub_sel = `ALUB_BB;
2673
          12'b000001xxx001,
2674
          12'b010x01110001,
2675
          12'b1xxx01001001: alub_sel = `ALUB_CC;
2676
          12'b000001xxx010,
2677
          12'b010x01110010,
2678
          12'b1xxx01010001: alub_sel = `ALUB_DD;
2679
          12'b000001xxx011,
2680
          12'b010x01110011,
2681
          12'b1xxx01011001: alub_sel = `ALUB_EE;
2682
          12'b000001xxx100,
2683
          12'b010x01110100,
2684
          12'b1xxx01100001: alub_sel = `ALUB_HH;
2685
          12'b000001xxx101,
2686
          12'b010x01110101,
2687
          12'b1xxx01101001: alub_sel = `ALUB_LL;
2688
          12'b000001xxx111,
2689
          12'b010x01110111,
2690
          12'b1xxx01111001: alub_sel = `ALUB_AA;
2691
          12'b1xxx01000011: alub_sel = `ALUB_BC;
2692
          12'b1xxx01010011: alub_sel = `ALUB_DE;
2693
          12'b1xxx01110011: alub_sel = `ALUB_SP;
2694
          12'b000011000101: alub_sel = `ALUB_BB;
2695
          12'b000011010101: alub_sel = `ALUB_DD;
2696
          12'b000011100101: alub_sel = `ALUB_HH;
2697
          12'b000011110101: alub_sel = `ALUB_AA;
2698
          default:          alub_sel = `ALUB_HL;
2699
        endcase
2700
      end
2701
      `RD1A: begin
2702
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2703
          12'b1xxx10100011,
2704
          12'b1xxx10101011,
2705
          12'b1xxx10110011,
2706
          12'b1xxx10111011: alub_sel = `ALUB_BC;
2707
          12'b1xxx10100000,
2708
          12'b1xxx10101000,
2709
          12'b1xxx10110000,
2710
          12'b1xxx10111000: alub_sel = `ALUB_DE;
2711
          12'b1xxx10100001,
2712
          12'b1xxx10100010,
2713
          12'b1xxx10101001,
2714
          12'b1xxx10101010,
2715
          12'b1xxx10110001,
2716
          12'b1xxx10110010,
2717
          12'b1xxx10111001,
2718
          12'b1xxx10111010: alub_sel = `ALUB_HL;
2719
          12'b000000101010,
2720
          12'b0001xxxxxxxx,
2721
          12'b010000101010,
2722
          12'b010100101010,
2723
          12'b1xxx01xx1011: alub_sel = `ALUB_TMP;
2724
          default:          alub_sel = `ALUB_SP;
2725
        endcase
2726
      end
2727
      `RD1B:                alub_sel = `ALUB_DIN;
2728
      `RD2A: begin
2729
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2730
          12'b1xxx10100011,
2731
          12'b1xxx10101011,
2732
          12'b1xxx10110011,
2733
          12'b1xxx10111011: alub_sel = `ALUB_BC;
2734
          12'b1xxx10100000,
2735
          12'b1xxx10101000,
2736
          12'b1xxx10110000,
2737
          12'b1xxx10111000: alub_sel = `ALUB_DE;
2738 4 bsa
          12'b001010xxxxxx,
2739 2 bsa
          12'b1xxx10100001,
2740
          12'b1xxx10100010,
2741
          12'b1xxx10101001,
2742
          12'b1xxx10101010,
2743
          12'b1xxx10110001,
2744
          12'b1xxx10110010,
2745
          12'b1xxx10111001,
2746
          12'b1xxx10111010: alub_sel = `ALUB_HL;
2747
          12'b000011001001,
2748
          12'b000011100011,
2749
          12'b000011xxx000,
2750
          12'b000011xx0001,
2751
          12'b0001xxxxxxxx,
2752
          12'b010011100001,
2753
          12'b010011100011,
2754
          12'b010111100001,
2755
          12'b010111100011,
2756
          12'b1xxx01000101,
2757
          12'b1xxx01001101: alub_sel = `ALUB_SP;
2758
          default:          alub_sel = `ALUB_TMP;
2759
        endcase
2760
      end
2761
      `RD2B: begin
2762
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2763
          12'b000011100011: alub_sel = `ALUB_HL;
2764
          12'b010011100011: alub_sel = `ALUB_IX;
2765
          12'b010111100011: alub_sel = `ALUB_IY;
2766
          12'b000000001010,
2767
          12'b000000011010,
2768
          12'b000000101010,
2769
          12'b000000111010,
2770 4 bsa
          12'b000001xxxxxx,
2771
          12'b000010000xxx,
2772
          12'b000010001xxx,
2773
          12'b000010010xxx,
2774
          12'b000010011xxx,
2775
          12'b000010100xxx,
2776
          12'b000010101xxx,
2777
          12'b000010110xxx,
2778
          12'b000010111xxx,
2779 2 bsa
          12'b000011011011,
2780
          12'b000011xx0001,
2781
          12'b001001xxx110,
2782
          12'b001001xxxxxx,
2783
          12'b010000101010,
2784
          12'b010001xxx110,
2785
          12'b010010000110,
2786
          12'b010010001110,
2787
          12'b010010010110,
2788
          12'b010010011110,
2789
          12'b010010100110,
2790
          12'b010010101110,
2791
          12'b010010110110,
2792
          12'b010010111110,
2793
          12'b010011100001,
2794
          12'b010100101010,
2795
          12'b010101xxx110,
2796
          12'b010110000110,
2797
          12'b010110001110,
2798
          12'b010110010110,
2799
          12'b010110011110,
2800
          12'b010110100110,
2801
          12'b010110101110,
2802
          12'b010110110110,
2803
          12'b010110111110,
2804
          12'b010111100001,
2805
          12'b011001xxx110,
2806
          12'b011101xxx110,
2807
          12'b1xxx01xxx000,
2808
          12'b1xxx01xx1011: alub_sel = `ALUB_PC;
2809
          12'b0001xxxxxxxx: alub_sel = `ALUB_PCH;
2810
          default:          alub_sel = `ALUB_DIN;
2811
        endcase
2812
      end
2813
      `WR1A: begin
2814
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2815
          12'b1xxx10100010,
2816
          12'b1xxx10101010,
2817
          12'b1xxx10110010,
2818
          12'b1xxx10111010: alub_sel = `ALUB_BC;
2819
          12'b1xxx10100000,
2820
          12'b1xxx10100011,
2821
          12'b1xxx10101000,
2822
          12'b1xxx10101011,
2823
          12'b1xxx10110000,
2824
          12'b1xxx10110011,
2825
          12'b1xxx10111000,
2826
          12'b1xxx10111011: alub_sel = `ALUB_HL;
2827
          12'b000000100010,
2828
          12'b010000100010,
2829
          12'b010100100010,
2830
          12'b1xxx01xx0011: alub_sel = `ALUB_TMP;
2831
          default:          alub_sel = `ALUB_SP;
2832
        endcase
2833
      end
2834
      `WR1B: begin
2835
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2836
          12'b1xxx10110010,
2837
          12'b1xxx10110011,
2838
          12'b1xxx10111010,
2839
          12'b1xxx10111011: alub_sel = `ALUB_BB;
2840
          12'b1xxx10110000,
2841
          12'b1xxx10111000: alub_sel = `ALUB_BC;
2842
          12'b000000100010,
2843
          12'b000011100011: alub_sel = `ALUB_HH;
2844
          12'b010011100101: alub_sel = `ALUB_IX;
2845
          12'b010000100010,
2846
          12'b010011100011: alub_sel = `ALUB_IXH;
2847
          12'b010111100101: alub_sel = `ALUB_IY;
2848
          12'b010100100010,
2849
          12'b010111100011: alub_sel = `ALUB_IYH;
2850
          12'b1xxx01000011: alub_sel = `ALUB_BC;
2851
          12'b1xxx01010011: alub_sel = `ALUB_DE;
2852
          12'b1xxx01100011: alub_sel = `ALUB_HL;
2853
          12'b1xxx01110011: alub_sel = `ALUB_SP;
2854
          12'b000011000101: alub_sel = `ALUB_BC;
2855
          12'b000011010101: alub_sel = `ALUB_DE;
2856
          12'b000011100101: alub_sel = `ALUB_HL;
2857
          12'b000011110101: alub_sel = `ALUB_AF;
2858
          default:          alub_sel = `ALUB_PC;
2859
        endcase
2860
      end
2861
      `WR2A: begin
2862
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2863
          12'b1xxx10100010,
2864
          12'b1xxx10101010,
2865
          12'b1xxx10110010,
2866
          12'b1xxx10111010: alub_sel = `ALUB_BC;
2867
          12'b000011001101,
2868
          12'b000011xxx100: alub_sel = `ALUB_DIN;
2869
          default:          alub_sel = `ALUB_HL;
2870
        endcase
2871
      end
2872
      `WR2B: begin
2873
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2874
          12'b1xxx10100010,
2875
          12'b1xxx10100011,
2876
          12'b1xxx10101010,
2877
          12'b1xxx10101011,
2878
          12'b1xxx10110010,
2879
          12'b1xxx10110011,
2880
          12'b1xxx10111010,
2881
          12'b1xxx10111011: alub_sel = `ALUB_BB;
2882
          12'b1xxx10100000,
2883
          12'b1xxx10101000,
2884
          12'b1xxx10110000,
2885
          12'b1xxx10111000: alub_sel = `ALUB_BC;
2886
          default:          alub_sel = `ALUB_PC;
2887
        endcase
2888
      end
2889
      `BLK1:                alub_sel = `ALUB_HL;
2890
      `BLK2:                alub_sel = (inst_reg[4]) ? `ALUB_BC : `ALUB_PC;
2891
      `PCA,
2892
      `PCO:                 alub_sel = `ALUB_PC;
2893
      `IF1A: begin
2894
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2895
          12'b1xxx10100011,
2896
          12'b1xxx10101011,
2897
          12'b1xxx10110011,
2898
          12'b1xxx10111011: alub_sel = `ALUB_BB;
2899
          12'b1xxx10100000,
2900
          12'b1xxx10101000,
2901
          12'b1xxx10110000,
2902
          12'b1xxx10111000: alub_sel = `ALUB_DE;
2903
          12'b1xxx10101010,
2904
          12'b1xxx10111010,
2905
          12'b1xxx10100010,
2906
          12'b1xxx10110010: alub_sel = `ALUB_HL;
2907
          default:          alub_sel = `ALUB_DIN;
2908
          endcase
2909
        end
2910
      `INTA:                alub_sel = `ALUB_SP;
2911
      `INTB:                alub_sel = `ALUB_PCH;
2912
      default:              alub_sel = `ALUB_PC;
2913
      endcase
2914
    end
2915
 
2916
  /*****************************************************************************************/
2917
  /*                                                                                       */
2918
  /*  register write control                                                               */
2919
  /*                                                                                       */
2920
  /*****************************************************************************************/
2921
  always @ (inst_reg or page_reg or state_reg or carry_bit or par_bit or sign_bit or
2922
            vector_int or zero_bit) begin
2923
    casex (state_reg) //synopsys parallel_case
2924
      `OF1B: begin
2925
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2926
          12'b000000010000: wr_addr = `WREG_BB;
2927
          default:          wr_addr = `WREG_NUL;
2928
          endcase
2929
        end
2930
      `OF2B: begin
2931
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2932
          12'b000011001101: wr_addr = `WREG_SP;
2933
          12'b000011000100: wr_addr = ( !zero_bit) ? `WREG_SP : `WREG_NUL;
2934
          12'b000011001100: wr_addr = (  zero_bit) ? `WREG_SP : `WREG_NUL;
2935
          12'b000011010100: wr_addr = (!carry_bit) ? `WREG_SP : `WREG_NUL;
2936
          12'b000011011100: wr_addr = ( carry_bit) ? `WREG_SP : `WREG_NUL;
2937
          12'b000011100100: wr_addr = (  !par_bit) ? `WREG_SP : `WREG_NUL;
2938
          12'b000011101100: wr_addr = (   par_bit) ? `WREG_SP : `WREG_NUL;
2939
          12'b000011110100: wr_addr = ( !sign_bit) ? `WREG_SP : `WREG_NUL;
2940
          12'b000011111100: wr_addr = (  sign_bit) ? `WREG_SP : `WREG_NUL;
2941
          default:          wr_addr = `WREG_NUL;
2942
          endcase
2943
        end
2944
      `IF3B:                wr_addr = `WREG_TMP;
2945
      `ADR2: begin
2946
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2947
          12'b000011xxx111,
2948
          12'b000011xx0101,
2949
          12'b010011100101,
2950
          12'b010111100101: wr_addr = `WREG_SP;
2951
          12'b000000100010,
2952
          12'b000000101010,
2953
          12'b010000100010,
2954
          12'b010000101010,
2955
          12'b010000110100,
2956
          12'b010000110101,
2957
          12'b010100100010,
2958
          12'b010100101010,
2959
          12'b010100110100,
2960
          12'b010100110101,
2961
          12'b1xxx01xx0011,
2962
          12'b1xxx01xx1011: wr_addr = `WREG_TMP;
2963
          default:          wr_addr = `WREG_NUL;
2964
        endcase
2965
      end
2966
      `RD1A: begin
2967
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2968
          12'b1xxx10100010,
2969
          12'b1xxx10100011,
2970
          12'b1xxx10101010,
2971
          12'b1xxx10101011,
2972
          12'b1xxx10110010,
2973
          12'b1xxx10110011,
2974
          12'b1xxx10111010,
2975
          12'b1xxx10111011: wr_addr = `WREG_BB;
2976
          12'b1xxx10100000,
2977
          12'b1xxx10100001,
2978
          12'b1xxx10101000,
2979
          12'b1xxx10101001,
2980
          12'b1xxx10110000,
2981
          12'b1xxx10110001,
2982
          12'b1xxx10111000,
2983
          12'b1xxx10111001: wr_addr = `WREG_BC;
2984
          default:          wr_addr = `WREG_NUL;
2985
        endcase
2986
      end
2987
      `RD1B: begin
2988
        casex ({page_reg, inst_reg}) //synopsys parallel_case
2989
          12'b000011001001,
2990
          12'b000011xxx000,
2991
          12'b000011xx0001,
2992
          12'b010011100001,
2993
          12'b010111100001,
2994
          12'b1xxx01000101,
2995
          12'b1xxx01001101: wr_addr = `WREG_SP;
2996
          default:          wr_addr = `WREG_NUL;
2997
        endcase
2998
      end
2999
      `RD2A: begin
3000
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3001
          12'b1xxx10100010,
3002
          12'b1xxx10100011,
3003
          12'b1xxx10101010,
3004
          12'b1xxx10101011,
3005
          12'b1xxx10110010,
3006
          12'b1xxx10110011,
3007
          12'b1xxx10111010,
3008
          12'b1xxx10111011: wr_addr = `WREG_BB;
3009
          12'b1xxx10100000,
3010
          12'b1xxx10100001,
3011
          12'b1xxx10101000,
3012
          12'b1xxx10101001,
3013
          12'b1xxx10110000,
3014
          12'b1xxx10110001,
3015
          12'b1xxx10111000,
3016
          12'b1xxx10111001: wr_addr = `WREG_BC;
3017
          default:          wr_addr = `WREG_NUL;
3018
        endcase
3019
      end
3020
      `RD2B: begin
3021
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3022
          12'b1xxx10100000,
3023
          12'b1xxx10101000,
3024
          12'b1xxx10110000,
3025
          12'b1xxx10111000: wr_addr = `WREG_DE;
3026
          12'b1xxx10100010,
3027
          12'b1xxx10101010,
3028
          12'b1xxx10110010,
3029
          12'b1xxx10111010: wr_addr = `WREG_HL;
3030
          12'b000011001001,
3031
          12'b000011xxx000,
3032
          12'b000011xx0001,
3033
          12'b0001xxxxxxxx,
3034
          12'b010011100001,
3035
          12'b010111100001,
3036
          12'b1xxx01000101,
3037
          12'b1xxx01001101: wr_addr = `WREG_SP;
3038
          default:          wr_addr = `WREG_NUL;
3039
        endcase
3040
      end
3041
      `WR1B: begin
3042
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3043
          12'b1xxx10100000,
3044
          12'b1xxx10100011,
3045
          12'b1xxx10101000,
3046
          12'b1xxx10101011,
3047
          12'b1xxx10110000,
3048
          12'b1xxx10110011,
3049
          12'b1xxx10111000,
3050
          12'b1xxx10111011: wr_addr = `WREG_HL;
3051
          12'b000011001101,
3052
          12'b000011xxx100,
3053
          12'b000011xxx111,
3054
          12'b000011xx0101,
3055
          12'b0001xxxxxxxx,
3056
          12'b010011100101,
3057
          12'b010111100101: wr_addr = `WREG_SP;
3058
          default:          wr_addr = `WREG_NUL;
3059
        endcase
3060
      end
3061
      `WR2B: begin
3062
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3063
          12'b1xxx10100000,
3064
          12'b1xxx10100011,
3065
          12'b1xxx10101000,
3066
          12'b1xxx10101011,
3067
          12'b1xxx10110000,
3068
          12'b1xxx10110011,
3069
          12'b1xxx10111000,
3070
          12'b1xxx10111011: wr_addr = `WREG_HL;
3071
          default:          wr_addr = `WREG_NUL;
3072
        endcase
3073
      end
3074
      `BLK2: begin
3075
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3076
          12'b1xxx10100001,
3077
          12'b1xxx10101001,
3078
          12'b1xxx10110001,
3079
          12'b1xxx10111001: wr_addr = `WREG_HL;
3080
          default:          wr_addr = `WREG_NUL;
3081
        endcase
3082
      end
3083
      `IF1B: begin
3084
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3085 4 bsa
          12'b000000000111,
3086
          12'b000000001010,
3087
          12'b000000001111,
3088
          12'b000000010111,
3089
          12'b000000011010,
3090
          12'b000000011111,
3091
          12'b000000100111,
3092
          12'b000000101111,
3093
          12'b000000111010,
3094
          12'b00000011110x,
3095
          12'b000000111110,
3096
          12'b000001111xxx,
3097
          12'b000010000xxx,
3098
          12'b000010001xxx,
3099
          12'b000010010xxx,
3100
          12'b000010011xxx,
3101
          12'b000010100xxx,
3102
          12'b000010101xxx,
3103
          12'b000010110xxx,
3104
          12'b000011000110,
3105
          12'b000011001110,
3106
          12'b000011010110,
3107
          12'b000011011011,
3108
          12'b000011011110,
3109
          12'b000011100110,
3110
          12'b000011101110,
3111
          12'b000011110110,
3112
          12'b001000xxx111,
3113
          12'b00101xxxx111,
3114
          //12'b011x00xxx111,
3115
          //12'b011x1xxxx111,
3116
          12'b010010000100,
3117
          12'b010010000101,
3118
          12'b010010000110,
3119
          12'b010010001100,
3120
          12'b010010001101,
3121
          12'b010010001110,
3122
          12'b010010010100,
3123
          12'b010010010101,
3124
          12'b010010010110,
3125
          12'b010010011100,
3126
          12'b010010011101,
3127
          12'b010010011110,
3128
          12'b010010100100,
3129
          12'b010010100101,
3130
          12'b010010100110,
3131
          12'b010010101100,
3132
          12'b010010101101,
3133
          12'b010010101110,
3134
          12'b010010110100,
3135
          12'b010010110101,
3136
          12'b010010110110,
3137
          12'b010110000100,
3138
          12'b010110000101,
3139
          12'b010110000110,
3140
          12'b010110001100,
3141
          12'b010110001101,
3142
          12'b010110001110,
3143
          12'b010110010100,
3144
          12'b010110010101,
3145
          12'b010110010110,
3146
          12'b010110011100,
3147
          12'b010110011101,
3148
          12'b010110011110,
3149
          12'b010110100100,
3150
          12'b010110100101,
3151
          12'b010110100110,
3152
          12'b010110101100,
3153
          12'b010110101101,
3154
          12'b010110101110,
3155
          12'b010110110100,
3156
          12'b010110110101,
3157
          12'b010110110110,
3158
          12'b010x0111110x,
3159
          12'b010x01111110,
3160
          12'b1xxx01000100,
3161
          12'b1xxx01010111,
3162
          12'b1xxx01011111,
3163
          12'b1xxx01100111,
3164
          12'b1xxx01101111,
3165
          12'b1xxx0x111000: wr_addr = `WREG_AA;
3166
          12'b000011110001: wr_addr = `WREG_AF;
3167
          12'b00000000010x,
3168
          12'b000000000110,
3169
          12'b000001000xxx,
3170
          12'b001000xxx000,
3171
          12'b00101xxxx000,
3172
          //12'b011x00xxx000,
3173
         // 12'b011x1xxxx000,
3174
          12'b010x0100010x,
3175
          12'b010x01000110,
3176
          12'b1xxx0x000000,
3177 2 bsa
          12'b1xxx10100011,
3178
          12'b1xxx10101011,
3179
          12'b1xxx10110011,
3180
          12'b1xxx10111011: wr_addr = `WREG_BB;
3181
          12'b000000000001,
3182 4 bsa
          12'b00000000x011,
3183
          12'b000011000001,
3184 2 bsa
          12'b1xxx01001011: wr_addr = `WREG_BC;
3185 4 bsa
          12'b00000000110x,
3186
          12'b000000001110,
3187
          12'b000001001xxx,
3188
          12'b001000xxx001,
3189
          12'b00101xxxx001,
3190
          //12'b011x00xxx001,
3191
          //12'b011x1xxxx001,
3192
          12'b010x0100110x,
3193
          12'b010x01001110,
3194
          12'b1xxx0x001000: wr_addr = `WREG_CC;
3195
          12'b00000001010x,
3196
          12'b000000010110,
3197
          12'b000001010xxx,
3198
          12'b001000xxx010,
3199
          12'b00101xxxx010,
3200
          //12'b011x00xxx010,
3201
          //12'b011x1xxxx010,
3202
          12'b010x0101010x,
3203
          12'b010x01010110,
3204
          12'b1xxx0x010000: wr_addr = `WREG_DD;
3205
          12'b000011010001,
3206
          12'b00000001x011,
3207 2 bsa
          12'b000000010001,
3208 4 bsa
          12'b1xxx01011011,
3209
          12'b1xxx10100000,
3210
          12'b1xxx10101000,
3211
          12'b1xxx10110000,
3212
          12'b1xxx10111000: wr_addr = `WREG_DE;
3213
          12'b000011101011: wr_addr = `WREG_DEHL;
3214
          12'b00000001110x,
3215
          12'b000000011110,
3216
          12'b000001011xxx,
3217
          12'b001000xxx011,
3218
          12'b00101xxxx011,
3219
          //12'b011x00xxx011,
3220
          //12'b011x1xxxx011,
3221
          12'b010x0101110x,
3222
          12'b010x01011110,
3223
          12'b1xxx0x011000: wr_addr = `WREG_EE;
3224
          12'b00000010010x,
3225
          12'b000000100110,
3226
          12'b000001100xxx,
3227
          12'b001000xxx100,
3228
          12'b00101xxxx100,
3229
          //12'b011x00xxx100,
3230
          //12'b011x1xxxx100,
3231
          12'b010x01100110,
3232
          12'b1xxx0x100000: wr_addr = `WREG_HH;
3233 2 bsa
          12'b000000100001,
3234 4 bsa
          12'b000000101010,
3235
          12'b00000010x011,
3236
          12'b000000xx1001,
3237
          12'b000011100001,
3238
          12'b000011100011,
3239
          12'b1xxx01101011,
3240
          12'b1xxx01xx0010,
3241
          12'b1xxx01xx1010,
3242
          12'b1xxx10100010,
3243
          12'b1xxx10101010,
3244
          12'b1xxx10110010,
3245
          12'b1xxx10111010: wr_addr = `WREG_HL;
3246
          12'b1xxx01000111: wr_addr = `WREG_II;
3247
          12'b010000100001,
3248
          12'b010000100011,
3249
          12'b010000101010,
3250
          12'b010000101011,
3251
          12'b010000xx1001,
3252
          12'b010011100001,
3253
          12'b010011100011: wr_addr = `WREG_IX;
3254
          12'b010000100100,
3255
          12'b010000100101,
3256
          12'b010000100110,
3257
          12'b0100011000xx,
3258
          12'b01000110010x,
3259
          12'b010001100111: wr_addr = `WREG_IXH;
3260
          12'b010000101100,
3261
          12'b010000101101,
3262
          12'b010000101110,
3263
          12'b0100011010xx,
3264
          12'b01000110110x,
3265
          12'b010001101111: wr_addr = `WREG_IXL;
3266
          12'b010100100001,
3267
          12'b010100100011,
3268
          12'b010100101010,
3269
          12'b010100101011,
3270
          12'b010100xx1001,
3271
          12'b010111100001,
3272
          12'b010111100011: wr_addr = `WREG_IY;
3273
          12'b010100100100,
3274
          12'b010100100101,
3275
          12'b010100100110,
3276
          12'b0101011000xx,
3277
          12'b01010110010x,
3278
          12'b010101100111: wr_addr = `WREG_IYH;
3279
          12'b010100101100,
3280
          12'b010100101101,
3281
          12'b010100101110,
3282
          12'b0101011010xx,
3283
          12'b01010110110x,
3284
          12'b010101101111: wr_addr = `WREG_IYL;
3285
          12'b00000010110x,
3286
          12'b000000101110,
3287
          12'b000001101xxx,
3288
          12'b001000xxx101,
3289
          12'b00101xxxx101,
3290
          //12'b011x00xxx101,
3291
          //12'b011x1xxxx101,
3292
          12'b010x01101110,
3293
          12'b1xxx0x101000: wr_addr = `WREG_LL;
3294
          12'b1xxx01001111: wr_addr = `WREG_RR;
3295 2 bsa
          12'b000000110001,
3296 4 bsa
          12'b00000011x011,
3297
          12'b000011111001,
3298
          12'b010x11111001,
3299 2 bsa
          12'b1xxx01111011: wr_addr = `WREG_SP;
3300
          default:          wr_addr = `WREG_NUL;
3301
          endcase
3302
        end
3303
      `INTB:                wr_addr = (vector_int) ? `WREG_TMP : `WREG_SP;
3304
      default:              wr_addr = `WREG_NUL;
3305
      endcase
3306
    end
3307
 
3308
  /*****************************************************************************************/
3309
  /*                                                                                       */
3310
  /*  s flag control                                                                       */
3311
  /*                                                                                       */
3312
  /*****************************************************************************************/
3313
  always @ (inst_reg or page_reg or state_reg) begin
3314
    casex (state_reg) //synopsys parallel_case
3315
      `WR2A: begin
3316
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3317 4 bsa
          12'b000000110100,
3318
          12'b000000110101,
3319
          12'b001000xxxxxx,
3320
          12'b010000110100,
3321
          12'b010000110101,
3322
          12'b010100110100,
3323
          12'b010100110101,
3324
          12'b011x00xxxxxx: sflg_en = 1'b1;
3325 2 bsa
          default:          sflg_en = 1'b0;
3326
          endcase
3327
        end
3328
      `BLK1: begin
3329
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3330
          12'b1xxx10100001,
3331
          12'b1xxx10101001,
3332
          12'b1xxx10110001,
3333
          12'b1xxx10111001: sflg_en = 1'b1;
3334
          default:          sflg_en = 1'b0;
3335
        endcase
3336
      end
3337
      `IF1B: begin
3338
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3339
          12'b000000100111,
3340 4 bsa
          12'b0000000xx100,12'b00000010x100,12'b000000111100,
3341
          12'b0000000xx101,12'b00000010x101,12'b000000111101,
3342
          12'b000010000110,
3343
          12'b000010000xxx,
3344
          12'b000010001110,
3345
          12'b000010001xxx,
3346
          12'b000010010110,
3347
          12'b000010010xxx,
3348
          12'b000010011110,
3349
          12'b000010011xxx,
3350
          12'b000010100110,
3351
          12'b000010100xxx,
3352
          12'b000010101110,
3353
          12'b000010101xxx,
3354
          12'b000010110110,
3355
          12'b000010110xxx,
3356
          12'b000010111110,
3357
          12'b000010111xxx,
3358
          12'b000011000110,
3359
          12'b000011001110,
3360
          12'b000011010110,
3361
          12'b000011011110,
3362
          12'b000011100110,
3363
          12'b000011101110,
3364
          12'b000011110110,
3365
          12'b000011111110,
3366
          12'b001000xxx0xx,
3367
          12'b001000xxx10x,
3368
          12'b001000xxx111,
3369
          12'b010000100100,
3370
          12'b010000100101,
3371
          12'b010000101100,
3372
          12'b010000101101,
3373
          12'b010010000100,
3374
          12'b010010000101,
3375
          12'b010010000110,
3376
          12'b010010001100,
3377
          12'b010010001101,
3378
          12'b010010001110,
3379
          12'b010010010100,
3380
          12'b010010010101,
3381
          12'b010010010110,
3382
          12'b010010011100,
3383
          12'b010010011101,
3384
          12'b010010011110,
3385
          12'b010010100100,
3386
          12'b010010100101,
3387
          12'b010010100110,
3388
          12'b010010101100,
3389
          12'b010010101101,
3390
          12'b010010101110,
3391
          12'b010010110100,
3392
          12'b010010110101,
3393
          12'b010010110110,
3394
          12'b010010111100,
3395
          12'b010010111101,
3396
          12'b010010111110,
3397
          12'b010100100100,
3398
          12'b010100100101,
3399
          12'b010100101100,
3400
          12'b010100101101,
3401
          12'b010110000100,
3402
          12'b010110000101,
3403
          12'b010110000110,
3404
          12'b010110001100,
3405
          12'b010110001101,
3406
          12'b010110001110,
3407
          12'b010110010100,
3408
          12'b010110010101,
3409
          12'b010110010110,
3410
          12'b010110011100,
3411
          12'b010110011101,
3412
          12'b010110011110,
3413
          12'b010110100100,
3414
          12'b010110100101,
3415
          12'b010110100110,
3416
          12'b010110101100,
3417
          12'b010110101101,
3418
          12'b010110101110,
3419
          12'b010110110100,
3420
          12'b010110110101,
3421
          12'b010110110110,
3422
          12'b010110111100,
3423
          12'b010110111101,
3424
          12'b010110111110,
3425
          12'b1xxx01000100,
3426
          12'b1xxx01010111,
3427
          12'b1xxx01011111,
3428
          12'b1xxx01100111,
3429
          12'b1xxx01101111,
3430
          12'b1xxx01xxx000,
3431
          12'b1xxx01xx0010,
3432 2 bsa
          12'b1xxx01xx1010: sflg_en = 1'b1;
3433
          default:          sflg_en = 1'b0;
3434
        endcase
3435
      end
3436
      default:              sflg_en = 1'b0;
3437
      endcase
3438
    end
3439
 
3440
  /*****************************************************************************************/
3441
  /*                                                                                       */
3442
  /*  z flag control                                                                       */
3443
  /*                                                                                       */
3444
  /*****************************************************************************************/
3445
  always @ (inst_reg or page_reg or state_reg) begin
3446
    casex (state_reg) //synopsys parallel_case
3447
      `RD1A,
3448
      `RD2A: begin
3449
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3450
          12'b1xxx10100010,
3451
          12'b1xxx10100011,
3452
          12'b1xxx10101010,
3453
          12'b1xxx10101011,
3454
          12'b1xxx10110010,
3455
          12'b1xxx10110011,
3456
          12'b1xxx10111010,
3457
          12'b1xxx10111011: zflg_en = 1'b1;
3458
          default:          zflg_en = 1'b0;
3459
          endcase
3460
        end
3461
      `WR2A: begin
3462
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3463 4 bsa
          12'b000000110100,
3464
          12'b000000110101,
3465
          12'b001000xxxxxx,
3466
          12'b010000110100,
3467
          12'b010000110101,
3468
          12'b010100110100,
3469
          12'b010100110101,
3470
          12'b011x00xxxxxx: zflg_en = 1'b1;
3471 2 bsa
          default:          zflg_en = 1'b0;
3472
        endcase
3473
      end
3474
      `BLK1: begin
3475
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3476
          12'b1xxx10100001,
3477
          12'b1xxx10101001,
3478
          12'b1xxx10110001,
3479
          12'b1xxx10111001: zflg_en = 1'b1;
3480
          default:          zflg_en = 1'b0;
3481
        endcase
3482
      end
3483
      `IF1B: begin
3484
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3485
          12'b000000100111,
3486 4 bsa
          12'b0000000xx100,12'b00000010x100,12'b000000111100,
3487
          12'b0000000xx101,12'b00000010x101,12'b000000111101,
3488 2 bsa
          12'b000010000110,
3489
          12'b000010000xxx,
3490
          12'b000010001110,
3491
          12'b000010001xxx,
3492
          12'b000010010110,
3493
          12'b000010010xxx,
3494
          12'b000010011110,
3495
          12'b000010011xxx,
3496
          12'b000010100110,
3497
          12'b000010100xxx,
3498
          12'b000010101110,
3499
          12'b000010101xxx,
3500
          12'b000010110110,
3501
          12'b000010110xxx,
3502
          12'b000010111110,
3503
          12'b000010111xxx,
3504
          12'b000011000110,
3505
          12'b000011001110,
3506
          12'b000011010110,
3507
          12'b000011011110,
3508
          12'b000011100110,
3509
          12'b000011101110,
3510
          12'b000011110110,
3511
          12'b000011111110,
3512 4 bsa
          12'b001000xxx0xx,12'b001000xxx10x,12'b001000xxx111,
3513 2 bsa
          12'b001001xxx110,
3514
          12'b001001xxxxxx,
3515 4 bsa
          12'b010000100100,
3516
          12'b010000100101,
3517
          12'b010000101100,
3518
          12'b010000101101,
3519
          12'b010010000100,
3520
          12'b010010000101,
3521 2 bsa
          12'b010010000110,
3522 4 bsa
          12'b010010001100,
3523
          12'b010010001101,
3524 2 bsa
          12'b010010001110,
3525 4 bsa
          12'b010010010100,
3526
          12'b010010010101,
3527 2 bsa
          12'b010010010110,
3528 4 bsa
          12'b010010011100,
3529
          12'b010010011101,
3530 2 bsa
          12'b010010011110,
3531 4 bsa
          12'b010010100100,
3532
          12'b010010100101,
3533 2 bsa
          12'b010010100110,
3534 4 bsa
          12'b010010101100,
3535
          12'b010010101101,
3536 2 bsa
          12'b010010101110,
3537 4 bsa
          12'b010010110100,
3538
          12'b010010110101,
3539 2 bsa
          12'b010010110110,
3540 4 bsa
          12'b010010111100,
3541
          12'b010010111101,
3542 2 bsa
          12'b010010111110,
3543 4 bsa
          12'b010100100100,
3544
          12'b010100100101,
3545
          12'b010100101100,
3546
          12'b010100101101,
3547
          12'b010110000100,
3548
          12'b010110000101,
3549 2 bsa
          12'b010110000110,
3550 4 bsa
          12'b010110001100,
3551
          12'b010110001101,
3552 2 bsa
          12'b010110001110,
3553 4 bsa
          12'b010110010100,
3554
          12'b010110010101,
3555 2 bsa
          12'b010110010110,
3556 4 bsa
          12'b010110011100,
3557
          12'b010110011101,
3558 2 bsa
          12'b010110011110,
3559 4 bsa
          12'b010110100100,
3560
          12'b010110100101,
3561 2 bsa
          12'b010110100110,
3562 4 bsa
          12'b010110101100,
3563
          12'b010110101101,
3564 2 bsa
          12'b010110101110,
3565 4 bsa
          12'b010110110100,
3566
          12'b010110110101,
3567 2 bsa
          12'b010110110110,
3568 4 bsa
          12'b010110111100,
3569
          12'b010110111101,
3570 2 bsa
          12'b010110111110,
3571
          12'b011001xxx110,
3572
          12'b011101xxx110,
3573
          12'b1xxx01000100,
3574
          12'b1xxx01010111,
3575
          12'b1xxx01011111,
3576
          12'b1xxx01100111,
3577
          12'b1xxx01101111,
3578
          12'b1xxx01xxx000,
3579
          12'b1xxx01xx0010,
3580
          12'b1xxx01xx1010,
3581
          12'b1xxx10100011,
3582
          12'b1xxx10101011,
3583
          12'b1xxx10110011,
3584
          12'b1xxx10111011: zflg_en = 1'b1;
3585
          default:          zflg_en = 1'b0;
3586
        endcase
3587
      end
3588
      default:              zflg_en = 1'b0;
3589
      endcase
3590
    end
3591
 
3592
  /*****************************************************************************************/
3593
  /*                                                                                       */
3594
  /*  h flag control                                                                       */
3595
  /*                                                                                       */
3596
  /*****************************************************************************************/
3597
  always @ (inst_reg or page_reg or state_reg) begin
3598
    casex (state_reg) //synopsys parallel_case
3599
      `WR2A: begin
3600
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3601 4 bsa
          12'b001000xxxxxx,
3602
          12'b011x00xxxxxx,
3603 2 bsa
          12'b1xxx01100111,
3604
          12'b1xxx01101111: hflg_ctl = `HFLG_0;
3605
          12'b000000110100,
3606
          12'b000000110101,
3607
          12'b010x00110100,
3608
          12'b010x00110101: hflg_ctl = `HFLG_H;
3609
          default:          hflg_ctl = `HFLG_NUL;
3610
          endcase
3611
        end
3612
      `BLK1: begin
3613
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3614
          12'b1xxx10100001,
3615
          12'b1xxx10101001,
3616
          12'b1xxx10110001,
3617
          12'b1xxx10111001: hflg_ctl = `HFLG_H;
3618
          default:          hflg_ctl = `HFLG_NUL;
3619
        endcase
3620
      end
3621
      `IF1B: begin
3622
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3623 4 bsa
          12'b000000000111,
3624
          12'b000000001111,
3625
          12'b000000010111,
3626
          12'b000000011111,
3627
          12'b000000110111,
3628
          12'b000010101110,
3629
          12'b000010101xxx,
3630
          12'b000010110110,
3631
          12'b000010110xxx,
3632
          12'b000011101110,
3633
          12'b000011110110,
3634
          12'b001000000xxx,
3635
          12'b001000001xxx,
3636
          12'b001000010xxx,
3637
          12'b001000011xxx,
3638
          12'b001000100xxx,
3639
          12'b001000101xxx,
3640
          12'b001000110xxx,
3641
          12'b001000111xxx,
3642
          12'b010010101100,
3643
          12'b010010101101,
3644
          12'b010010101110,
3645
          12'b010010110100,
3646
          12'b010010110101,
3647
          12'b010010110110,
3648
          12'b010110101100,
3649
          12'b010110101101,
3650
          12'b010110101110,
3651
          12'b010110110100,
3652
          12'b010110110101,
3653
          12'b010110110110,
3654
          12'b1xxx01010111,
3655
          12'b1xxx01011111,
3656
          12'b1xxx01xxx000,
3657
          12'b1xxx10100000,
3658
          12'b1xxx10101000,
3659
          12'b1xxx10110000,
3660 2 bsa
          12'b1xxx10111000: hflg_ctl = `HFLG_0;
3661 4 bsa
          12'b000000101111,
3662
          12'b000010100110,
3663
          12'b000010100xxx,
3664
          12'b000011100110,
3665
          12'b001001xxx110,
3666
          12'b001001xxxxxx,
3667
          12'b010010100100,
3668
          12'b010010100101,
3669
          12'b010010100110,
3670
          12'b010110100100,
3671
          12'b010110100101,
3672
          12'b010110100110,
3673
          12'b011001xxx110,
3674 2 bsa
          12'b011101xxx110: hflg_ctl = `HFLG_1;
3675 4 bsa
          12'b000000111111,
3676
          12'b000000100111,
3677
          12'b0000000xx100,12'b00000010x100,12'b000000111100,
3678
          12'b0000000xx101,12'b00000010x101,12'b000000111101,
3679
          12'b000000xx1001,
3680
          12'b000010000110,
3681
          12'b000010000xxx,
3682
          12'b000010001110,
3683
          12'b000010001xxx,
3684
          12'b000010010110,
3685
          12'b000010010xxx,
3686
          12'b000010011110,
3687
          12'b000010011xxx,
3688
          12'b000010111110,
3689
          12'b000010111xxx,
3690
          12'b000011000110,
3691
          12'b000011001110,
3692
          12'b000011010110,
3693
          12'b000011011110,
3694
          12'b000011111110,
3695
          12'b010000100100,
3696
          12'b010000100101,
3697
          12'b010000101100,
3698
          12'b010000101101,
3699
          12'b010000xx1001,
3700
          12'b010010000100,
3701
          12'b010010000101,
3702
          12'b010010000110,
3703
          12'b010010001100,
3704
          12'b010010001101,
3705
          12'b010010001110,
3706
          12'b010010010100,
3707
          12'b010010010101,
3708
          12'b010010010110,
3709
          12'b010010011100,
3710
          12'b010010011101,
3711
          12'b010010011110,
3712
          12'b010010111100,
3713
          12'b010010111101,
3714
          12'b010010111110,
3715
          12'b010100100100,
3716
          12'b010100100101,
3717
          12'b010100101100,
3718
          12'b010100101101,
3719
          12'b010100xx1001,
3720
          12'b010110000100,
3721
          12'b010110000101,
3722
          12'b010110000110,
3723
          12'b010110001100,
3724
          12'b010110001101,
3725
          12'b010110001110,
3726
          12'b010110010100,
3727
          12'b010110010101,
3728
          12'b010110010110,
3729
          12'b010110011100,
3730
          12'b010110011101,
3731
          12'b010110011110,
3732
          12'b010110111100,
3733
          12'b010110111101,
3734
          12'b010110111110,
3735
          12'b1xxx01000100,
3736
          12'b1xxx01xx0010,
3737 2 bsa
          12'b1xxx01xx1010: hflg_ctl = `HFLG_H;
3738
          default:          hflg_ctl = `HFLG_NUL;
3739
        endcase
3740
      end
3741
      default:              hflg_ctl = `HFLG_NUL;
3742
      endcase
3743
    end
3744
 
3745
  /*****************************************************************************************/
3746
  /*                                                                                       */
3747
  /*  pv flag control                                                                      */
3748
  /*                                                                                       */
3749
  /*****************************************************************************************/
3750
  always @ (inst_reg or page_reg or state_reg) begin
3751
    casex (state_reg) //synopsys parallel_case
3752
      `RD1A,
3753
      `RD2A: begin
3754
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3755
          12'b1xxx10100000,
3756
          12'b1xxx10100001,
3757
          12'b1xxx10101000,
3758
          12'b1xxx10101001,
3759
          12'b1xxx10110000,
3760
          12'b1xxx10110001,
3761
          12'b1xxx10111000,
3762
          12'b1xxx10111001: pflg_ctl = `PFLG_B;
3763
          default:          pflg_ctl = `PFLG_NUL;
3764
          endcase
3765
        end
3766
      `WR2A: begin
3767
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3768 4 bsa
          12'b001000xxxxxx,
3769
          12'b011x00xxxxxx: pflg_ctl = `PFLG_P;
3770 2 bsa
          12'b000000110100,
3771
          12'b000000110101,
3772
          12'b010000110100,
3773
          12'b010000110101,
3774
          12'b010100110100,
3775
          12'b010100110101: pflg_ctl = `PFLG_V;
3776
          default:          pflg_ctl = `PFLG_NUL;
3777
        endcase
3778
      end
3779
      `IF1B: begin
3780
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3781
          12'b1xxx01010111,
3782
          12'b1xxx01011111: pflg_ctl = `PFLG_F;
3783 4 bsa
          12'b000000100111,
3784
          12'b000010100110,
3785
          12'b000010100xxx,
3786
          12'b000010101110,
3787
          12'b000010101xxx,
3788
          12'b000010110110,
3789
          12'b000010110xxx,
3790
          12'b000011100110,
3791
          12'b000011101110,
3792
          12'b000011110110,
3793
          12'b001000xxx0xx,12'b001000xxx10x,12'b001000xxx111,
3794
          12'b010010100100,
3795
          12'b010010100101,
3796
          12'b010010100110,
3797
          12'b010010101100,
3798
          12'b010010101101,
3799
          12'b010010101110,
3800
          12'b010010110100,
3801
          12'b010010110101,
3802
          12'b010010110110,
3803
          12'b010110100100,
3804
          12'b010110100101,
3805
          12'b010110100110,
3806
          12'b010110101100,
3807
          12'b010110101101,
3808
          12'b010110101110,
3809
          12'b010110110100,
3810
          12'b010110110101,
3811
          12'b010110110110,
3812
          12'b1xxx01100111,
3813
          12'b1xxx01101111,
3814 2 bsa
          12'b1xxx01xxx000: pflg_ctl = `PFLG_P;
3815 4 bsa
          12'b0000000xx100,12'b00000010x100,12'b000000111100,
3816
          12'b0000000xx101,12'b00000010x101,12'b000000111101,
3817
          12'b000010000110,
3818
          12'b000010000xxx,
3819
          12'b000010001110,
3820
          12'b000010001xxx,
3821
          12'b000010010110,
3822
          12'b000010010xxx,
3823
          12'b000010011110,
3824
          12'b000010011xxx,
3825
          12'b000010111110,
3826
          12'b000010111xxx,
3827
          12'b000011000110,
3828
          12'b000011001110,
3829
          12'b000011010110,
3830
          12'b000011011110,
3831
          12'b000011111110,
3832
          12'b010000100100,
3833
          12'b010000100101,
3834
          12'b010000101100,
3835
          12'b010000101101,
3836
          12'b010010000100,
3837
          12'b010010000101,
3838
          12'b010010000110,
3839
          12'b010010001100,
3840
          12'b010010001101,
3841
          12'b010010001110,
3842
          12'b010010010100,
3843
          12'b010010010101,
3844
          12'b010010010110,
3845
          12'b010010011100,
3846
          12'b010010011101,
3847
          12'b010010011110,
3848
          12'b010010111100,
3849
          12'b010010111101,
3850
          12'b010010111110,
3851
          12'b010100100100,
3852
          12'b010100100101,
3853
          12'b010100101100,
3854
          12'b010100101101,
3855
          12'b010110000100,
3856
          12'b010110000101,
3857
          12'b010110000110,
3858
          12'b010110001100,
3859
          12'b010110001101,
3860
          12'b010110001110,
3861
          12'b010110010100,
3862
          12'b010110010101,
3863
          12'b010110010110,
3864
          12'b010110011100,
3865
          12'b010110011101,
3866
          12'b010110011110,
3867
          12'b010110111100,
3868
          12'b010110111101,
3869
          12'b010110111110,
3870
          12'b1xxx01000100,
3871
          12'b1xxx01xx0010,
3872 2 bsa
          12'b1xxx01xx1010: pflg_ctl = `PFLG_V;
3873
          default:          pflg_ctl = `PFLG_NUL;
3874
        endcase
3875
      end
3876
      default:              pflg_ctl = `PFLG_NUL;
3877
      endcase
3878
    end
3879
 
3880
  /*****************************************************************************************/
3881
  /*                                                                                       */
3882
  /*  n flag control                                                                       */
3883
  /*                                                                                       */
3884
  /*****************************************************************************************/
3885
  always @ (inst_reg or page_reg or state_reg) begin
3886
    casex (state_reg) //synopsys parallel_case
3887
      `WR1A,
3888
      `WR2A: begin
3889
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3890
          12'b1xxx10100010,
3891
          12'b1xxx10100011,
3892
          12'b1xxx10101010,
3893
          12'b1xxx10101011,
3894
          12'b1xxx10110010,
3895
          12'b1xxx10110011,
3896
          12'b1xxx10111010,
3897
          12'b1xxx10111011: nflg_ctl = `NFLG_S;
3898
          default:          nflg_ctl = `NFLG_NUL;
3899
          endcase
3900
        end
3901
      `IF1B: begin
3902
        casex ({page_reg, inst_reg}) //synopsys parallel_case
3903 4 bsa
          12'b000000000111,
3904
          12'b000000001111,
3905
          12'b000000010111,
3906
          12'b000000011111,
3907
          12'b000000110100,
3908
          12'b000000110111,
3909
          12'b000000111111,
3910
          12'b000000xxx100,
3911
          12'b000000xx1001,
3912
          12'b000010000110,
3913
          12'b000010000xxx,
3914
          12'b000010001110,
3915
          12'b000010001xxx,
3916
          12'b000010100110,
3917
          12'b000010100xxx,
3918
          12'b000010101110,
3919
          12'b000010101xxx,
3920
          12'b000010110110,
3921
          12'b000010110xxx,
3922
          12'b000011000110,
3923
          12'b000011001110,
3924
          12'b000011100110,
3925
          12'b000011101110,
3926
          12'b000011110110,
3927
          12'b010000100100,
3928
          12'b010000101100,
3929
          12'b010000110100,
3930
          12'b010000xx1001,
3931
          12'b010010000100,
3932
          12'b010010000101,
3933
          12'b010010000110,
3934
          12'b010010001100,
3935
          12'b010010001101,
3936
          12'b010010001110,
3937
          12'b010010100100,
3938
          12'b010010100101,
3939
          12'b010010100110,
3940
          12'b010010101100,
3941
          12'b010010101101,
3942
          12'b010010101110,
3943
          12'b010010110100,
3944
          12'b010010110101,
3945
          12'b010010110110,
3946
          12'b010100100100,
3947
          12'b010100101100,
3948
          12'b010100110100,
3949
          12'b010100xx1001,
3950
          12'b010110000100,
3951
          12'b010110000101,
3952
          12'b010110000110,
3953
          12'b010110001100,
3954
          12'b010110001101,
3955
          12'b010110001110,
3956
          12'b010110100100,
3957
          12'b010110100101,
3958
          12'b010110100110,
3959
          12'b010110101100,
3960
          12'b010110101101,
3961
          12'b010110101110,
3962
          12'b010110110100,
3963
          12'b010110110101,
3964
          12'b010110110110,
3965
          12'b00100xxxxxxx,
3966
          12'b011x0xxxxxxx,
3967
          12'b1xxx01010111,
3968
          12'b1xxx01011111,
3969
          12'b1xxx01100111,
3970
          12'b1xxx01101111,
3971
          12'b1xxx01xxx000,
3972
          12'b1xxx01xx1010,
3973
          12'b1xxx10100000,
3974
          12'b1xxx10101000,
3975
          12'b1xxx10110000,
3976 2 bsa
          12'b1xxx10111000: nflg_ctl = `NFLG_0;
3977 4 bsa
          12'b000000101111,
3978
          12'b000000110101,
3979
          12'b000000xxx101,
3980
          12'b000010010110,
3981
          12'b000010010xxx,
3982
          12'b000010011110,
3983
          12'b000010011xxx,
3984
          12'b000010111110,
3985
          12'b000010111xxx,
3986
          12'b000011010110,
3987
          12'b000011011110,
3988
          12'b000011111110,
3989
          12'b010000100101,
3990
          12'b010000101101,
3991
          12'b010000110101,
3992
          12'b010010010100,
3993
          12'b010010010101,
3994
          12'b010010010110,
3995
          12'b010010011100,
3996
          12'b010010011101,
3997
          12'b010010011110,
3998
          12'b010010111100,
3999
          12'b010010111101,
4000
          12'b010010111110,
4001
          12'b010100100101,
4002
          12'b010100101101,
4003
          12'b010100110101,
4004
          12'b010110010100,
4005
          12'b010110010101,
4006
          12'b010110010110,
4007
          12'b010110011100,
4008
          12'b010110011101,
4009
          12'b010110011110,
4010
          12'b010110111100,
4011
          12'b010110111101,
4012
          12'b010110111110,
4013
          12'b1xxx01000100,
4014
          12'b1xxx01xx0010,
4015
          12'b1xxx10100001,
4016
          12'b1xxx10101001,
4017
          12'b1xxx10110001,
4018 2 bsa
          12'b1xxx10111001: nflg_ctl = `NFLG_1;
4019
          default:          nflg_ctl = `NFLG_NUL;
4020
        endcase
4021
      end
4022
      default:              nflg_ctl = `NFLG_NUL;
4023
      endcase
4024
    end
4025
 
4026
  /*****************************************************************************************/
4027
  /*                                                                                       */
4028
  /*  c flag control                                                                       */
4029
  /*                                                                                       */
4030
  /*****************************************************************************************/
4031
  always @ (inst_reg or page_reg or state_reg) begin
4032
    casex (state_reg) //synopsys parallel_case
4033
      `WR2A: begin
4034
        casex ({page_reg, inst_reg}) //synopsys parallel_case
4035 4 bsa
          12'b001000xxxxxx,
4036
          12'b011x00xxxxxx: cflg_en = 1'b1;
4037 2 bsa
          default:          cflg_en = 1'b0;
4038
          endcase
4039
        end
4040
      `IF1B: begin
4041
        casex ({page_reg, inst_reg}) //synopsys parallel_case
4042 4 bsa
          12'b000010100110,
4043
          12'b000010100xxx,
4044
          12'b000010101110,
4045
          12'b000010101xxx,
4046
          12'b000010110110,
4047
          12'b000010110xxx,
4048
          12'b000011100110,
4049
          12'b000011101110,
4050
          12'b000011110110,
4051
          12'b010010100100,
4052
          12'b010010100101,
4053
          12'b010010100110,
4054
          12'b010010101100,
4055
          12'b010010101101,
4056
          12'b010010101110,
4057
          12'b010010110100,
4058
          12'b010010110101,
4059
          12'b010010110110,
4060
          12'b010110100100,
4061
          12'b010110100101,
4062
          12'b010110100110,
4063
          12'b010110101100,
4064
          12'b010110101101,
4065
          12'b010110101110,
4066
          12'b010110110100,
4067
          12'b010110110101,
4068
          12'b010110110110,
4069
          12'b000000110111,
4070
          12'b000000000111,
4071
          12'b000000001111,
4072
          12'b000000010111,
4073
          12'b000000011111,
4074
          12'b000000100111,
4075
          12'b000000111111,
4076
          12'b000000xx1001,
4077
          12'b000010000110,
4078
          12'b000010000xxx,
4079
          12'b000010001110,
4080
          12'b000010001xxx,
4081
          12'b000010010110,
4082
          12'b000010010xxx,
4083
          12'b000010011110,
4084
          12'b000010011xxx,
4085
          12'b000010111110,
4086
          12'b000010111xxx,
4087
          12'b000011000110,
4088
          12'b000011001110,
4089
          12'b000011010110,
4090
          12'b000011011110,
4091
          12'b000011111110,
4092
          12'b001000xxx0xx,12'b001000xxx10x,12'b001000xxx111,
4093
          12'b010000xx1001,
4094
          12'b010010000100,
4095
          12'b010010000101,
4096
          12'b010010000110,
4097
          12'b010010001100,
4098
          12'b010010001101,
4099
          12'b010010001110,
4100
          12'b010010010100,
4101
          12'b010010010101,
4102
          12'b010010010110,
4103
          12'b010010011100,
4104
          12'b010010011101,
4105
          12'b010010011110,
4106
          12'b010010111100,
4107
          12'b010010111101,
4108
          12'b010010111110,
4109
          12'b010100xx1001,
4110
          12'b010110000100,
4111
          12'b010110000101,
4112
          12'b010110000110,
4113
          12'b010110001100,
4114
          12'b010110001101,
4115
          12'b010110001110,
4116
          12'b010110010100,
4117
          12'b010110010101,
4118
          12'b010110010110,
4119
          12'b010110011100,
4120
          12'b010110011101,
4121
          12'b010110011110,
4122
          12'b010110111100,
4123
          12'b010110111101,
4124
          12'b010110111110,
4125
          12'b1xxx01000100,
4126
          12'b1xxx01xx0010,
4127 2 bsa
          12'b1xxx01xx1010: cflg_en = 1'b1;
4128
          default:          cflg_en = 1'b0;
4129
        endcase
4130
      end
4131
      default:              cflg_en = 1'b0;
4132
      endcase
4133
    end
4134
 
4135
  /*****************************************************************************************/
4136
  /*                                                                                       */
4137
  /* temporary flag control                                                                */
4138
  /*                                                                                       */
4139
  /*****************************************************************************************/
4140
  always @ (inst_reg or page_reg or state_reg) begin
4141
    casex (state_reg) //synopsys parallel_case
4142
      `OF1B:                tflg_ctl = `TFLG_Z;
4143
      `RD1A,
4144
      `RD2A: begin
4145
        casex ({page_reg, inst_reg})
4146
          12'b1xxx10100011,
4147
          12'b1xxx10101011,
4148
          12'b1xxx10110011,
4149
          12'b1xxx10111011: tflg_ctl = `TFLG_1;
4150
          default:          tflg_ctl = `TFLG_Z;
4151
          endcase
4152
        end
4153
      `BLK1:                tflg_ctl = `TFLG_B;
4154
      default:              tflg_ctl = `TFLG_NUL;
4155
      endcase
4156
    end
4157
 
4158
  endmodule
4159
 
4160
 
4161
 
4162
 
4163
 

powered by: WebSVN 2.1.0

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