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

Subversion Repositories y80e

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

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

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

powered by: WebSVN 2.1.0

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