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

Subversion Repositories m32632

[/] [m32632/] [trunk/] [rtl/] [DECODER.v] - Diff between revs 14 and 23

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 14 Rev 23
Line 2... Line 2...
//
//
// This file is part of the M32632 project
// This file is part of the M32632 project
// http://opencores.org/project,m32632
// http://opencores.org/project,m32632
//
//
// Filename: DECODER.v
// Filename: DECODER.v
// Version:  1.1 bug fix
//      Version:        2.0
// History:  1.0 first release of 30 Mai 2015
// History:  1.0 first release of 30 Mai 2015
// Date:     21 January 2016
//      Date:           14 August 2016
//
//
// Copyright (C) 2016 Udo Moeller
// Copyright (C) 2016 Udo Moeller
// 
// 
// This source file may be used and distributed without 
// This source file may be used and distributed without 
// restriction provided that this copyright statement is not 
// restriction provided that this copyright statement is not 
Line 39... Line 39...
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 
module DECODER ( BCLK, BRESET, INT_N, NMI_N, ANZ_VAL, OPREG, CFG, PSR, ACC_DONE, DC_ABORT, IC_ABORT, ACB_ZERO, DONE,
module DECODER ( BCLK, BRESET, INT_N, NMI_N, ANZ_VAL, OPREG, CFG, PSR, ACC_DONE, DC_ABORT, IC_ABORT, ACB_ZERO, DONE,
                                 PC_SAVE, STRING, INIT_DONE, ILL, UNDEF, TRAPS, IC_READ, STOP_CINV,
                                 PC_SAVE, STRING, INIT_DONE, ILL, UNDEF, TRAPS, IC_READ, STOP_CINV,
                                 GENSTAT, DISP, IMME_Q, DISP_BR, USED, NEW, LOAD_PC, NEXT_PCA, RDAA, RDAB, OPER, START, LD_OUT, LD_DIN, LD_IMME,
                                 GENSTAT, DISP, IMME_Q, DISP_BR, USED, NEW, LOAD_PC, NEXT_PCA, RDAA, RDAB, OPER, START, LD_OUT, LD_DIN, LD_IMME,
                                 INFO_AU, ACC_FELD, WREN, WRADR, WMASKE, WR_REG, DETOIP, MMU_UPDATE, RESTART, STOP_IC, RWVAL, ENA_HK, ILO, COP_OP );
                                 INFO_AU, ACC_FELD, WREN, WRADR, WMASKE, WR_REG, DETOIP, MMU_UPDATE, RESTART, STOP_IC, RWVAL, ENA_HK, ILO, COP_OP,
 
                                 PHOUT );
 
 
        input                   BCLK,BRESET;
        input                   BCLK,BRESET;
        input                   INT_N,NMI_N;    // external inputs
        input                   INT_N,NMI_N;    // external inputs
        input    [2:0]   ANZ_VAL;
        input    [2:0]   ANZ_VAL;
        input   [55:0]   OPREG;                  // the OPREG contains the bytes to decode, OPREG[55:32] are don't care
        input   [55:0]   OPREG;                  // the OPREG contains the bytes to decode, OPREG[55:32] are don't care
Line 83... Line 84...
        output                  STOP_IC;
        output                  STOP_IC;
        output   [2:0]   RWVAL;
        output   [2:0]   RWVAL;
        output                  ENA_HK;
        output                  ENA_HK;
        output  reg             ILO;
        output  reg             ILO;
        output  [23:0]   COP_OP;
        output  [23:0]   COP_OP;
 
        output   [7:0]   PHOUT;          // for Debug purposes, phase_reg output
 
 
        reg             [31:0]   DISP,disp_val;
        reg             [31:0]   DISP,disp_val;
        reg             [10:0]   oper_i;
        reg             [10:0]   oper_i;
        reg              [2:0]   USED;
        reg              [2:0]   USED;
        reg             [14:0]   ACC_FELD;
        reg             [14:0]   ACC_FELD;
        reg              [1:0]   ldoreg;
        reg              [1:0]   ldoreg;
        reg                             wren_i;
        reg                             wren_i;
        reg              [5:0]   wradr_i;
        reg              [5:0]   wradr_i;
        reg              [1:0]   wmaske_i;
        reg              [1:0]   wmaske_i;
        reg              [1:0]   START;
        reg              [1:0]   start_i;
        reg             [23:0]   COP_OP;
        reg             [23:0]   COP_OP;
        reg                             spupd_i;
        reg                             spupd_i;
        reg              [3:0]   disp_sel;
        reg              [3:0]   disp_sel;
        reg             [52:0]   op1_feld;
        reg             [52:0]   op1_feld;
        reg             [47:0]   op2_feld;
        reg             [47:0]   op2_feld;
Line 172... Line 174...
        wire     [7:0]   new_ph,ppfp;
        wire     [7:0]   new_ph,ppfp;
        wire     [7:0]   new_nx;
        wire     [7:0]   new_nx;
        wire                    op_1byte,op_12byte,op_2byte,op_3byte;
        wire                    op_1byte,op_12byte,op_2byte,op_3byte;
        wire                    jump;
        wire                    jump;
        wire                    short_op,short_def;
        wire                    short_op,short_def;
 
        wire                    opt_imme;
 
        wire     [7:0]   opti_byte;
        wire                    acb_op,acb_flag;
        wire                    acb_op,acb_flag;
        wire                    zero,carry_psr,negativ,larger,flag;
        wire                    zero,carry_psr,negativ,larger,flag;
        wire                    valid_size;
        wire                    valid_size;
        wire                    op_ok;
        wire                    op_ok;
        wire                    stop;
        wire                    stop;
Line 253... Line 257...
        reg              [5:0]   hzr_c;  // CASE Statement
        reg              [5:0]   hzr_c;  // CASE Statement
        wire     [1:0]   hzl_a;
        wire     [1:0]   hzl_a;
        wire     [2:0]   hzl_b;
        wire     [2:0]   hzl_b;
        wire     [5:0]   hzr_a,hzr_b,hzr_s;
        wire     [5:0]   hzr_a,hzr_b,hzr_s;
        wire                    hdx_a;
        wire                    hdx_a;
        wire                    hdo_b;
 
        wire     [3:0]   hdo_a,hdo_c,hdo_e;
        wire     [3:0]   hdo_a,hdo_c,hdo_e;
        wire     [7:0]   hdo_d;
        wire     [7:0]   hdo_d;
        wire     [1:0]   hdl_b,hdl_d,hdl_f,hdl_g,hdl_h;
        wire     [1:0]   hdl_b,hdl_d,hdl_f,hdl_g,hdl_h;
        wire     [2:0]   hdl_a,hdl_c,hdl_e;
        wire     [2:0]   hdl_a,hdl_c,hdl_e;
        wire     [5:0]   hdr_a,hdr_b,hdr_c,hdr_d,hdr_e,hdr_f,hdr_g,hdr_m;
        wire     [5:0]   hdr_a,hdr_b,hdr_c,hdr_d,hdr_e,hdr_f,hdr_g,hdr_m;
Line 344... Line 347...
        always @(posedge BCLK or negedge BRESET)        // the central phase register
        always @(posedge BCLK or negedge BRESET)        // the central phase register
                if (!BRESET) phase_reg <= 8'h0;
                if (!BRESET) phase_reg <= 8'h0;
                  else
                  else
                        if (next) phase_reg <= new_op[47:40];
                        if (next) phase_reg <= new_op[47:40];
 
 
 
        assign PHOUT = phase_reg;       // only to debug
 
 
        always @(*)     // next switch of micro program counter
        always @(*)     // next switch of micro program counter
                casex ({PHASE_0,op_ok,dim_feld[3],di_stat[0]})
                casex ({PHASE_0,op_ok,dim_feld[3],di_stat[0]})
                  4'b11_xx : USED = {1'b0,~op_1byte,(op_1byte | op_3byte)};
                  4'b11_xx : USED = {1'b0,~op_1byte,(op_1byte | op_3byte)} + {2'd0,opt_imme};
                  4'b0x_11 : USED = di_stat[3:1];
                  4'b0x_11 : USED = di_stat[3:1];
                  default  : USED = 3'd0;
                  default  : USED = 3'd0;
                endcase
                endcase
 
 
        // Special phases
        // Special phases
Line 529... Line 534...
                        8'hD2 : op1_feld = {addr_nop, src_x, src_x, 2'b01,2'b00,8'h89,4'h0,4'h0};       // FLAG
                        8'hD2 : op1_feld = {addr_nop, src_x, src_x, 2'b01,2'b00,8'h89,4'h0,4'h0};       // FLAG
                  default : op1_feld = {19'hxxxxx,14'hxxxx,     2'b00,2'b00,16'hxxxx};
                  default : op1_feld = {19'hxxxxx,14'hxxxx,     2'b00,2'b00,16'hxxxx};
                endcase
                endcase
 
 
        assign op_1byte  = op1_feld[18] &  valid[0];
        assign op_1byte  = op1_feld[18] &  valid[0];
        assign op_12byte = op1_feld[19] & (valid[1:0] == 2'b11);
        assign op_12byte = op1_feld[19] & valid[1];
 
 
        assign new_addr = op1_feld[52:34];
        assign new_addr = op1_feld[52:34];
        assign new_regs = op1_feld[33:20];
        assign new_regs = op1_feld[33:20];
        assign new_ph   = op1_feld[15:8];
        assign new_ph   = op1_feld[15:8];
        assign new_nx   = op1_feld[7:0]; // at Bcond DISP read
        assign new_nx   = op1_feld[7:0]; // at Bcond DISP read
Line 648... Line 653...
        assign disp_ok = ld_disp ? di_stat[0] : 1'b1;
        assign disp_ok = ld_disp ? di_stat[0] : 1'b1;
 
 
        always @(dim_feld or OPREG or valid or ANZ_VAL) // Bit 0 is "Data ok", the upper 3 bits are for USED
        always @(dim_feld or OPREG or valid or ANZ_VAL) // Bit 0 is "Data ok", the upper 3 bits are for USED
                casex ({dim_feld[2:1],OPREG[7:6]})
                casex ({dim_feld[2:1],OPREG[7:6]})
                  4'b00_xx : di_stat = {3'b001,valid[0]};
                  4'b00_xx : di_stat = {3'b001,valid[0]};
                  4'b01_xx : di_stat = {3'b010,(valid[1] & valid[0])};
                  4'b01_xx : di_stat = {3'b010,valid[1]};
                  4'b10_xx : di_stat = {3'b100,ANZ_VAL[2]};
                  4'b10_xx : di_stat = {3'b100,ANZ_VAL[2]};
                  4'b11_0x : di_stat = {3'b001,valid[0]};
                  4'b11_0x : di_stat = {3'b001,valid[0]};
                  4'b11_10 : di_stat = {3'b010,(valid[1] & valid[0])};
                  4'b11_10 : di_stat = {3'b010,valid[1]};
                  4'b11_11 : di_stat = {3'b100,ANZ_VAL[2]};
                  4'b11_11 : di_stat = {3'b100,ANZ_VAL[2]};
                endcase
                endcase
 
 
        always @(OPREG)
        always @(OPREG)
                casex (OPREG[7:6])
                casex (OPREG[7:6])
Line 679... Line 684...
                  5'b0_1011 : DISP = 32'hFFFF_FFF8;             // PUSH QWord
                  5'b0_1011 : DISP = 32'hFFFF_FFF8;             // PUSH QWord
                  5'b0_01xx : DISP = {26'h0,exc_vector,2'b00};          // the exception vector as Offset for INTBASE
                  5'b0_01xx : DISP = {26'h0,exc_vector,2'b00};          // the exception vector as Offset for INTBASE
                  5'b0_00xx : DISP = {28'h0,disp_sel[1:0],2'b00};        // 0,+4,+8,+12 used with MOD, default is 0
                  5'b0_00xx : DISP = {28'h0,disp_sel[1:0],2'b00};        // 0,+4,+8,+12 used with MOD, default is 0
                endcase
                endcase
 
 
        always @(short_op or dim_feld or OPREG or op_setcfg or setcfg_lsb)
        always @(*)
                casex ({short_op,dim_feld[2:1]})
                casex ({short_op,dim_feld[2:1]})
                  3'b000 : imme_i = op_setcfg ? {28'h0000_00F,OPREG[2:0],setcfg_lsb} : {24'hxx_xxxx,OPREG[7:0]};
                  3'b000 : imme_i = op_setcfg ? {28'h0000_00F,OPREG[2:0],setcfg_lsb} : {24'hxx_xxxx,OPREG[7:0]};
                  3'b001 : imme_i =    {16'hxxxx,OPREG[7:0],OPREG[15:8]};
                  3'b001 : imme_i =    {16'hxxxx,OPREG[7:0],OPREG[15:8]};
                  3'b01x : imme_i = {OPREG[7:0],OPREG[15:8],OPREG[23:16],OPREG[31:24]};
                  3'b01x : imme_i = {OPREG[7:0],OPREG[15:8],OPREG[23:16],OPREG[31:24]};
                  3'b1xx : imme_i = {{29{OPREG[10]}},OPREG[9:7]};       // for MOVQ etc. only OPREG can be used
                  3'b1xx : imme_i = opt_imme ? {24'hxxxx_xx,opti_byte} : {{29{OPREG[10]}},OPREG[9:7]};  // for MOVQ etc. only OPREG can be used
                endcase
                endcase
 
 
        assign IMME_Q = store_pc ? PC_SAVE : imme_i;
        assign IMME_Q = store_pc ? PC_SAVE : imme_i;
 
 
        // ++++++++++++++  Stack Control  +++++++++++++++++
        // ++++++++++++++  Stack Control  +++++++++++++++++
Line 728... Line 733...
        // [12:11]      op_type 2 Bit for sort of opcode
        // [12:11]      op_type 2 Bit for sort of opcode
        //    [10]      FL : F=1/L=0
        //    [10]      FL : F=1/L=0
        //   [9:8]      original BWD : B=00/W=01/D=11
        //   [9:8]      original BWD : B=00/W=01/D=11
        //   [7:0]      opcode: operation code
        //   [7:0]      opcode: operation code
 
 
        assign valid_size = (OPREG[1:0] != 2'b10) & (valid[1:0] == 2'b11);        // valid size + valid OPREG-Bytes
        assign valid_size = (OPREG[1:0] != 2'b10) & valid[1];    // valid size + valid OPREG-Bytes
 
 
        assign hzl_a = (OPREG[1:0] == 2'b11) ? 2'b10 : OPREG[1:0];        // length field recoded
        assign hzl_a = (OPREG[1:0] == 2'b11) ? 2'b10 : OPREG[1:0];        // length field recoded
        assign hzl_b = {1'b0,OPREG[1:0]};                // standard Length field
        assign hzl_b = {1'b0,OPREG[1:0]};                // standard Length field
        assign hzr_a = {3'b000,OPREG[13:11]};   // SRC2 or SRC1 regfield
        assign hzr_a = {3'b000,OPREG[13:11]};   // SRC2 or SRC1 regfield
        assign hzr_b = {3'b000,OPREG[8:6]};             // SRC2 regfield
        assign hzr_b = {3'b000,OPREG[8:6]};             // SRC2 regfield
Line 745... Line 750...
                  4'b1100 : hzr_c = OPREG[6] ? temp_h : 6'h1C;  // CFG special case : LPR : SPR
                  4'b1100 : hzr_c = OPREG[6] ? temp_h : 6'h1C;  // CFG special case : LPR : SPR
                  default : hzr_c = {2'b01,OPREG[10:7]};
                  default : hzr_c = {2'b01,OPREG[10:7]};
                endcase
                endcase
 
 
        // Unfortunately SETCFG must be implemented : it is transformed to a two byte opcode with one byte IMM operand
        // Unfortunately SETCFG must be implemented : it is transformed to a two byte opcode with one byte IMM operand
        assign setcfg = (OPREG[13:0] == 14'h0B0E) & (valid[1:0] == 2'b11);
        assign setcfg = (OPREG[13:0] == 14'h0B0E) & valid[1];
 
 
        always @(*)
        always @(*)
          casex ({setcfg,OPREG[10:2]})
          casex ({setcfg,OPREG[10:2]})
                // Short-Op Codes , ACB is an ADD with following jump
                // Short-Op Codes , ACB is an ADD with following jump
                10'b0xxxx_x0011 : op2_feld = {6'o11,3'o3,6'hxx,hzr_a,hzl_a,hzl_a,5'h14,OPREG[15:11],2'b00,hzl_b,8'h40};  // ADDQ ACB
                10'b0xxxx_x0011 : op2_feld = {6'o11,3'o3,6'hxx,hzr_a,hzl_a,hzl_a,5'h14,OPREG[15:11],2'b00,hzl_b,8'h40};  // ADDQ ACB
Line 781... Line 786...
          endcase
          endcase
 
 
        assign op_2byte = (valid_size | setcfg) & ~op2_feld[7]; // it must be for sure shown "Invalid Opcode"
        assign op_2byte = (valid_size | setcfg) & ~op2_feld[7]; // it must be for sure shown "Invalid Opcode"
 
 
        // Special case : the quick opcodes with the exception SPR and LPR
        // Special case : the quick opcodes with the exception SPR and LPR
        assign short_op = ((~OPREG[5]) | (OPREG[6:4] == 3'b011)) & (OPREG[3:2] == 2'b11) & valid_size & PHASE_0;
        assign short_op = ((((~OPREG[5]) | (OPREG[6:4] == 3'b011)) & (OPREG[3:2] == 2'b11) & valid_size) | opt_imme) & PHASE_0;
        always @(posedge BCLK) if (PHASE_0) short_op_reg <= short_op;
        always @(posedge BCLK) if (PHASE_0) short_op_reg <= short_op;
        assign short_def =  PHASE_0 ? short_op : short_op_reg;                                                  // for the big state machine
        assign short_def =  PHASE_0 ? short_op : short_op_reg;                                                  // for the big state machine
        assign op_sho = (OPREG[6:4] == 3'b011) ? 11'h07A : op_mov;      // Special case Scond at Index as Dest. , used only in Phase 0
        assign op_sho = (OPREG[6:4] == 3'b011) ? 11'h07A : op_mov;      // Special case Scond at Index as Dest. , used only in Phase 0
 
 
        // 2. special case ACB
        // 2. special case ACB
Line 826... Line 831...
        always @(posedge BCLK) if (PHASE_0) setcfg_lsb <= OPREG[15];
        always @(posedge BCLK) if (PHASE_0) setcfg_lsb <= OPREG[15];
 
 
        always @(posedge BCLK) if (PHASE_0) jsr_flag <= (OPREG[10:2] == 9'b1100_11111);         // JSR : for PUSH
        always @(posedge BCLK) if (PHASE_0) jsr_flag <= (OPREG[10:2] == 9'b1100_11111);         // JSR : for PUSH
        always @(posedge BCLK)  // Bit opcodes to Register and EXT:SRC1 / INS:SRC2
        always @(posedge BCLK)  // Bit opcodes to Register and EXT:SRC1 / INS:SRC2
                if (PHASE_0) bit_reg  <= ((OPREG[3] ? ((OPREG[7:6] == 2'd0) ? OPREG[23:22] : OPREG[18:17]) : OPREG[10:9]) == 2'b00);
                if (PHASE_0) bit_reg  <= ((OPREG[3] ? ((OPREG[7:6] == 2'd0) ? OPREG[23:22] : OPREG[18:17]) : OPREG[10:9]) == 2'b00);
        always @(posedge BCLK) if (PHASE_0) exin_cmd <= (~OPREG[10] & (OPREG[6:0] == 7'h2E)) & (valid[2:0] == 3'b111);
        always @(posedge BCLK) if (PHASE_0) exin_cmd <= (~OPREG[10] & (OPREG[6:0] == 7'h2E)) & valid[2];
        always @(posedge BCLK) if (PHASE_0) extract <= ~OPREG[7];
        always @(posedge BCLK) if (PHASE_0) extract <= ~OPREG[7];
        always @(posedge BCLK) if (PHASE_0) inss_op <= (OPREG[13:10] == 4'h2) & (OPREG[7:0] == 8'hCE) & (valid[2:0] == 3'b111);   // INSS
        always @(posedge BCLK) if (PHASE_0) inss_op <= (OPREG[13:10] == 4'h2) & (OPREG[7:0] == 8'hCE) & valid[2];        // INSS
 
 
        // ++++++++++++++  3 byte opcodes  +++++++++++++++++
        // ++++++++++++++  3 byte opcodes  +++++++++++++++++
 
 
        // [47:45]      Source : [2] TOS=>(SP), [1] Ri => (Ri), [0] 1=access of memory
        // [47:45]      Source : [2] TOS=>(SP), [1] Ri => (Ri), [0] 1=access of memory
        // [44:42]      Destination : like [47:45]
        // [44:42]      Destination : like [47:45]
Line 850... Line 855...
        //   [9:8]      original BWD : B=00/W=01/D=11
        //   [9:8]      original BWD : B=00/W=01/D=11
        //   [7:0]      opcode: operation code
        //   [7:0]      opcode: operation code
 
 
        assign hdx_a = OPREG[7] ? OPREG[8] : OPREG[10];
        assign hdx_a = OPREG[7] ? OPREG[8] : OPREG[10];
        assign hdo_a = OPREG[13:10];
        assign hdo_a = OPREG[13:10];
        assign hdo_b = ~hdx_a;                          // long operation if L
 
        assign hdo_c = {1'b0,OPREG[10],OPREG[7:6]};     // Format 8 opcodes
        assign hdo_c = {1'b0,OPREG[10],OPREG[7:6]};     // Format 8 opcodes
        assign hdo_d = {6'b0101_00,OPREG[10],1'b0};     // CMPM/S or MOVM/S : 8'h52 or 8'h50
        assign hdo_d = {6'b0101_00,OPREG[10],1'b0};     // CMPM/S or MOVM/S : 8'h52 or 8'h50
        assign hdo_e = {3'b011,OPREG[10]};      // Special codes for LOGB and SCALB due to DP_OUT datapath
        assign hdo_e = {3'b011,OPREG[10]};      // Special codes for LOGB and SCALB due to DP_OUT datapath
        // Definitions of length
        // Definitions of length
        assign hdl_a = {1'b0,OPREG[9:8]};       // i size, is used in OPER
        assign hdl_a = {1'b0,OPREG[9:8]};       // i size, is used in OPER
Line 870... Line 874...
        assign hdr_b = {3'b000,OPREG[16:14]};   // SRC2 Integer Register
        assign hdr_b = {3'b000,OPREG[16:14]};   // SRC2 Integer Register
        assign hdr_c = hdx_a ? {2'b10,OPREG[21:20],1'b0,OPREG[19]} : {2'b10,OPREG[21:19],1'b1};
        assign hdr_c = hdx_a ? {2'b10,OPREG[21:20],1'b0,OPREG[19]} : {2'b10,OPREG[21:19],1'b1};
        assign hdr_d = hdx_a ? {2'b10,OPREG[16:15],1'b0,OPREG[14]} : {2'b10,OPREG[16:14],1'b1};
        assign hdr_d = hdx_a ? {2'b10,OPREG[16:15],1'b0,OPREG[14]} : {2'b10,OPREG[16:14],1'b1};
        assign hdr_e = OPREG[11] ? {2'b10,OPREG[21:20],1'b0,OPREG[19]} : {2'b10,OPREG[21:19],1'b1};
        assign hdr_e = OPREG[11] ? {2'b10,OPREG[21:20],1'b0,OPREG[19]} : {2'b10,OPREG[21:19],1'b1};
        assign hdr_f = OPREG[11] ? {2'b10,OPREG[16:14],1'b1}               : {2'b10,OPREG[16:15],1'b0,OPREG[14]};
        assign hdr_f = OPREG[11] ? {2'b10,OPREG[16:14],1'b1}               : {2'b10,OPREG[16:15],1'b0,OPREG[14]};
        assign hdr_g = {3'b000,OPREG[16:15],~OPREG[14]};        // exclusiv for DEI/MEI
        assign hdr_g = {3'b000,OPREG[16:15],~OPREG[14]};        // exclusiv for DEI and MEI
        assign hdr_m = {3'b001,OPREG[17:15]};   // MMU Register Index 8-15
        assign hdr_m = {3'b001,OPREG[17:15]};   // MMU Register Index 8-15
 
 
        always @(*)
        always @(*)
                casex (OPREG[13:3])
                casex (OPREG[13:3])
                  11'b1000_xx_1100x : op3_feld = {6'o11,3'o3,hdr_a,hdr_b, hdl_b,hdl_b,OPREG[23:14],2'b00,hdl_a,4'h7,hdo_a};     // MULi
                  11'b1000_xx_1100x : op3_feld = {6'o11,3'o3,hdr_a,hdr_b, hdl_b,hdl_b,OPREG[23:14],2'b00,hdl_a,4'h7,hdo_a};     // MULi
Line 883... Line 887...
                  11'b1x0x_xx_0100x : op3_feld = {6'o11,3'o1,hdr_a,hdr_b, hdl_b,hdl_b,OPREG[23:14],2'b00,hdl_a,4'h6,hdo_a};     // NEGi,NOTi,ABSi,COMi
                  11'b1x0x_xx_0100x : op3_feld = {6'o11,3'o1,hdr_a,hdr_b, hdl_b,hdl_b,OPREG[23:14],2'b00,hdl_a,4'h6,hdo_a};     // NEGi,NOTi,ABSi,COMi
                  11'b010x_xx_1100x : op3_feld = {6'o11,3'o1,hdr_a,hdr_b, hdl_b,2'b01,OPREG[23:14],2'b00,hdl_a,4'h7,hdo_a};     // MOVX/ZiW
                  11'b010x_xx_1100x : op3_feld = {6'o11,3'o1,hdr_a,hdr_b, hdl_b,2'b01,OPREG[23:14],2'b00,hdl_a,4'h7,hdo_a};     // MOVX/ZiW
                  11'b011x_xx_1100x : op3_feld = {6'o11,3'o1,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b00,hdl_a,4'h7,hdo_a};     // MOVX/ZiD
                  11'b011x_xx_1100x : op3_feld = {6'o11,3'o1,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b00,hdl_a,4'h7,hdo_a};     // MOVX/ZiD
                  11'b0001_xx_0110x : op3_feld = {6'o11,3'o3,hdr_a,hdr_b, hdl_b,2'b00,OPREG[23:14],2'b00,hdl_a,4'h8,hdo_c};     // FFSi
                  11'b0001_xx_0110x : op3_feld = {6'o11,3'o3,hdr_a,hdr_b, hdl_b,2'b00,OPREG[23:14],2'b00,hdl_a,4'h8,hdo_c};     // FFSi
        // Floating Point opcodes
        // Floating Point opcodes
                  11'b000x_xx_0011x : op3_feld = {6'o11,hdo_b,2'b01,hdr_a,hdr_d, hdl_b,hdl_d,OPREG[23:14],2'b00,hdl_c,4'h9,hdo_a};      // MOVif
                  11'b000x_xx_0011x : op3_feld = {6'o11,3'o5,hdr_a,hdr_d, hdl_b,hdl_d,OPREG[23:14],2'b00,hdl_c,4'h9,hdo_a};     // MOVif
                  11'b010x_xx_0011x : op3_feld = {6'o11,       3'o5,hdr_e,hdr_f, 2'b11,2'b10,OPREG[23:14],2'b00,hdl_c,4'h9,hdo_a};      // MOVLF
                  11'b010x_xx_0011x : op3_feld = {6'o11,       3'o5,hdr_e,hdr_f, 2'b11,2'b10,OPREG[23:14],2'b00,hdl_c,4'h9,hdo_a};      // MOVLF
                  11'b011x_xx_0011x : op3_feld = {6'o11,       3'o5,hdr_e,hdr_f, 2'b10,2'b11,OPREG[23:14],2'b00,hdl_c,4'h9,hdo_a};      // MOVFL
                  11'b011x_xx_0011x : op3_feld = {6'o11,       3'o5,hdr_e,hdr_f, 2'b10,2'b11,OPREG[23:14],2'b00,hdl_c,4'h9,hdo_a};      // MOVFL
                  11'b10xx_xx_0011x : op3_feld = {6'o11,hdo_b,2'b01,hdr_c,hdr_b, hdl_d,hdl_b,OPREG[23:14],2'b00,hdl_c,4'h9,hdo_a};      // ROUNDi,TRUNCi
                  11'b10xx_xx_0011x : op3_feld = {6'o11,3'o5,hdr_c,hdr_b, hdl_d,hdl_b,OPREG[23:14],2'b00,hdl_c,4'h9,hdo_a};     // ROUNDi,TRUNCi
                  11'b111x_xx_00111 : op3_feld = {6'o11,hdo_b,2'b01,hdr_c,hdr_b, hdl_d,hdl_b,OPREG[23:14],2'b00,hdl_c,4'h9,hdo_a};      // FLOORi
                  11'b111x_xx_00111 : op3_feld = {6'o11,3'o5,hdr_c,hdr_b, hdl_d,hdl_b,OPREG[23:14],2'b00,hdl_c,4'h9,hdo_a};     // FLOORi
                  11'b111x_xx_00110 : op3_feld = {6'o11,       3'o5,hdr_c,hdr_b, hdl_d,hdl_b,OPREG[23:14],2'b00,hdl_c,op_cop};          // SEARCH
                  11'b111x_xx_00110 : op3_feld = {6'o11,       3'o5,hdr_c,hdr_b, hdl_d,hdl_b,OPREG[23:14],2'b00,hdl_c,op_cop};          // SEARCH
                  11'b0x00_0x_10111 : op3_feld = {6'o11,hdo_b,2'b11,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};      // ADDf,SUBf
                  11'b0x00_0x_10111 : op3_feld = {6'o11,3'o7,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};     // ADDf,SUBf
                  11'bxx00_0x_10110 : op3_feld = {6'o11,       3'o7,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,op_cop};          // Coprocessor
                  11'bxx00_0x_10110 : op3_feld = {6'o11,       3'o7,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,op_cop};          // Coprocessor
                  11'b1000_0x_10111 : op3_feld = {6'o11,       3'o7,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};      // DIVf
                  11'b1000_0x_10111 : op3_feld = {6'o11,       3'o7,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};      // DIVf
                  11'b1100_0x_10111 : op3_feld = {6'o11,hdo_b,2'b11,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};      // MULf
                  11'b1100_0x_10111 : op3_feld = {6'o11,3'o7,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};     // MULf
                  11'b0010_0x_1011x : op3_feld = {6'o11,hdo_b,2'b10,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};      // CMPf
                  11'b0010_0x_1011x : op3_feld = {6'o11,3'o6,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};     // CMPf
                  11'b0001_0x_10111 : op3_feld = {6'o11,       3'o1,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};      // MOVf
                  11'b0001_0x_10111 : op3_feld = {6'o11,       3'o1,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};      // MOVf
                  11'bx101_0x_10111 : op3_feld = {6'o11,       3'o1,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};      // NEGf,ABSf
                  11'bx101_0x_10111 : op3_feld = {6'o11,       3'o1,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_a};      // NEGf,ABSf
                  11'b001x_11_00111 : op3_feld = {6'o11,3'o1,hdr_a,fsr_r, 2'b10,2'b10,OPREG[23:19],5'b0,2'b00,3'o3,8'h92};                      // LFSR
                  11'b001x_11_00111 : op3_feld = {6'o11,3'o1,hdr_a,fsr_r, 2'b10,2'b10,OPREG[23:19],5'b0,2'b00,3'o3,8'h92};                      // LFSR
                  11'b110x_11_00111 : op3_feld = {6'o11,3'o1,fsr_r,hdr_b, 2'b10,2'b10,5'b0,OPREG[18:14],2'b00,3'o3,8'h9C};                      // SFSR
                  11'b110x_11_00111 : op3_feld = {6'o11,3'o1,fsr_r,hdr_b, 2'b10,2'b10,5'b0,OPREG[18:14],2'b00,3'o3,8'h9C};                      // SFSR
        // MMU opcodes
        // MMU opcodes
Line 914... Line 918...
        // Gruppe 2 opcodes
        // Gruppe 2 opcodes
                  11'b0x11_xx_1010x : op3_feld = {6'o77,3'o1,hdr_a,hdr_b, hdl_b,hdl_b,OPREG[23:14],2'b00,hdl_a,8'h45};          // MOVUS,MOVSU
                  11'b0x11_xx_1010x : op3_feld = {6'o77,3'o1,hdr_a,hdr_b, hdl_b,hdl_b,OPREG[23:14],2'b00,hdl_a,8'h45};          // MOVUS,MOVSU
                  11'b000x_xx_1100x : op3_feld = {6'o66,3'o0,hdr_a,hdr_b, 2'bxx,2'b10,OPREG[23:14],2'b10,hdl_c, hdo_d};         // MOVM/CMPM
                  11'b000x_xx_1100x : op3_feld = {6'o66,3'o0,hdr_a,hdr_b, 2'bxx,2'b10,OPREG[23:14],2'b10,hdl_c, hdo_d};         // MOVM/CMPM
                  11'b001x_0x_1111x : op3_feld = {6'o11,3'o2,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b10,hdl_e,4'hC,hdo_a};     // DOTf,POLYf
                  11'b001x_0x_1111x : op3_feld = {6'o11,3'o2,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b10,hdl_e,4'hC,hdo_a};     // DOTf,POLYf
                  11'b0101_0x_1111x : op3_feld = {6'o11,3'o5,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_e};     // LOGB
                  11'b0101_0x_1111x : op3_feld = {6'o11,3'o5,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_e};     // LOGB
                  11'b0100_0x_1111x : op3_feld = {6'o11,3'o7,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b10,hdl_e,4'hB,hdo_e};     // SCALB
                  11'b0100_0x_1111x : op3_feld = {6'o11,3'o7,hdr_c,hdr_d, hdl_d,hdl_d,OPREG[23:14],2'b00,hdl_e,4'hB,hdo_e};     // SCALB
                  11'b0011_xx_1100x : op3_feld = {6'o50,3'o0,hdr_a,hdr_b, hdl_g,hdl_b,OPREG[23:14],2'b10,hdl_c,4'h7,hdo_a};     // EXTS
                  11'b0011_xx_1100x : op3_feld = {6'o50,3'o0,hdr_a,hdr_b, hdl_g,hdl_b,OPREG[23:14],2'b10,hdl_c,4'h7,hdo_a};     // EXTS
                  11'bxxx0_xx_1110x : op3_feld = {6'o71,3'o2,hdr_a,hdr_b, hdl_h,hdl_b,OPREG[23:14],2'b10,hdl_c,4'h8,hdo_c};     // CHECK
                  11'bxxx0_xx_1110x : op3_feld = {6'o71,3'o2,hdr_a,hdr_b, hdl_h,hdl_b,OPREG[23:14],2'b10,hdl_c,4'h8,hdo_c};     // CHECK
                  11'b0x1x_xx_0100x : op3_feld = (OPREG[18:17] == 2'b00) ?      // target is register => standard flow
                  11'b0x1x_xx_0100x : op3_feld = (OPREG[18:17] == 2'b00) ?      // target is register => standard flow
                                                                                 {6'o11,3'o3,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b00,hdl_a,4'h6,hdo_a}      // SBIT/CBIT
                                                                                 {6'o11,3'o3,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b00,hdl_a,4'h6,hdo_a}      // SBIT/CBIT
                                                                           : {6'o14,3'o3,hdr_a,hdr_b, hdl_b,2'b00,OPREG[23:14],2'b10,hdl_a,4'h6,hdo_a};
                                                                           : {6'o14,3'o3,hdr_a,hdr_b, hdl_b,2'b00,OPREG[23:14],2'b10,hdl_a,4'h6,hdo_a};
                  11'b1110_xx_0100x : op3_feld = (OPREG[18:17] == 2'b00) ?      // target is register => standard flow
                  11'b1110_xx_0100x : op3_feld = (OPREG[18:17] == 2'b00) ?      // target is register => standard flow
                                                                                 {6'o11,3'o3,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b00,hdl_a,4'h6,hdo_a}      // IBIT
                                                                                 {6'o11,3'o3,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b00,hdl_a,4'h6,hdo_a}      // IBIT
                                                                           : {6'o14,3'o3,hdr_a,hdr_b, hdl_b,2'b00,OPREG[23:14],2'b10,hdl_a,4'h6,hdo_a};
                                                                           : {6'o14,3'o3,hdr_a,hdr_b, hdl_b,2'b00,OPREG[23:14],2'b10,hdl_a,4'h6,hdo_a};
                  11'b1x11_xx_0100x : op3_feld = {6'o11,3'o7,hdr_a,hdr_b, hdl_b,hdl_b,OPREG[23:14],2'b00,hdl_a,4'h6,hdo_a}; // ADDP,SUBP
                  11'b1x11_xx_0100x : op3_feld = {6'o11,3'o7,hdr_a,hdr_b, hdl_b,hdl_b,OPREG[23:14],2'b00,hdl_a,4'h7,3'd0,OPREG[12]}; // ADDP,SUBP
                  11'bxxx0_xx_0010x : op3_feld = {6'o40,3'o0,hdr_a,hdr_b, hdl_g,hdl_b,OPREG[23:14],2'b10,hdl_c,4'h8,hdo_c}; // EXT
                  11'bxxx0_xx_0010x : op3_feld = {6'o40,3'o0,hdr_a,hdr_b, hdl_g,hdl_b,OPREG[23:14],2'b10,hdl_c,4'h8,hdo_c}; // EXT
                  11'bxxx0_xx_1010x : op3_feld = {6'o14,3'o0,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b10, 3'o3,4'h8,hdo_c}; // INS
                  11'bxxx0_xx_1010x : op3_feld = {6'o14,3'o0,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b10, 3'o3,4'h8,hdo_c}; // INS
                  11'b0010_xx_1100x : op3_feld = {6'o14,3'o0,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b10, 3'o3,4'h8,hdo_a}; // INSS
                  11'b0010_xx_1100x : op3_feld = {6'o14,3'o0,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b10, 3'o3,4'h8,hdo_a}; // INSS
                  11'bxxx0_xx_0110x : op3_feld = {6'o61,3'o0,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b10, 3'o3,4'h8,hdo_c}; // CVTP no Opcode
                  11'bxxx0_xx_0110x : op3_feld = {6'o61,3'o0,hdr_a,hdr_b, hdl_b,2'b10,OPREG[23:14],2'b10, 3'o3,4'h8,hdo_c}; // CVTP no Opcode
                  11'bxxx1_xx_0010x : op3_feld = {6'o11,3'o2,hdr_a,hdr_b, hdl_b,hdl_b,OPREG[23:14],2'b10, 3'o3,8'h84};          // INDEX
                  11'bxxx1_xx_0010x : op3_feld = {6'o11,3'o2,hdr_a,hdr_b, hdl_b,hdl_b,OPREG[23:14],2'b10, 3'o3,8'h84};          // INDEX
Line 936... Line 940...
                  11'b1001_11_0001x : op3_feld = {6'o11,3'o1,hdr_a,temp_h,2'b10,2'b10,OPREG[23:19],5'b0,2'b00,3'o3,8'h45};      // CINV
                  11'b1001_11_0001x : op3_feld = {6'o11,3'o1,hdr_a,temp_h,2'b10,2'b10,OPREG[23:19],5'b0,2'b00,3'o3,8'h45};      // CINV
 
 
                  default                   : op3_feld = {40'hxx_xxxx_xxxx,4'hA,4'hx};
                  default                   : op3_feld = {40'hxx_xxxx_xxxx,4'hA,4'hx};
                endcase
                endcase
 
 
        assign op_3byte = (valid[2:0] == 3'b111) & (OPREG[2:0] == 3'b110) & (op3_feld[7:4] != 4'hA);      // valid for all incl. CUSTOM
        assign op_3byte = valid[2] & (OPREG[2:0] == 3'b110) & (op3_feld[7:4] != 4'hA);   // valid for all incl. CUSTOM
 
 
        // +++++++++++++  Evaluation for 2 and 3 byte opcodes  ++++++++++++++++++
        // +++++++++++++  Evaluation for 2 and 3 byte opcodes  ++++++++++++++++++
 
 
        // for one byte opcodes special treatmant neccessary
        // for one byte opcodes special treatmant neccessary
        assign opc_bits = op_3byte ? op3_feld : op2_feld;
        assign opc_bits = op_3byte ? op3_feld : op2_feld;
Line 975... Line 979...
        assign opera    = op_feld[10:0];
        assign opera    = op_feld[10:0];
 
 
        assign dest_r   = src_2[5:0];
        assign dest_r   = src_2[5:0];
        assign dest_rl  = {dest_r[5:1],1'b0};
        assign dest_rl  = {dest_r[5:1],1'b0};
 
 
 
        // ++++++++++++++++++++++++++++ Immediate Optimization +++++++++++++++++++++++++++++++++++
 
 
 
        //                                              3               Byte                                    Immediate
 
        assign opt_imme =  (valid[2] & (OPREG[1:0] == 2'd0) & (OPREG[15:11] == 5'b10100) &
 
        //                                                       ADD,ADDC,SUB,SUBC,BIC,OR,AND,XOR               CMP                                     MOV
 
                                                ( ((OPREG[10:8] != 3'b111) & (~OPREG[2] | (OPREG[5:2] == 4'h1) | (OPREG[5:2] == 4'h5))) // not ADDR und TBIT
 
                                                 |((OPREG[6:2] == 5'b11111) & (OPREG[8:7] == 2'b10) & (OPREG[10:9] != 2'b11)))) // BICPSR,BISPSR,ADJSP and ~CASE
 
        //                                              4                       not Scaled Index                        Immediate
 
                                         | (ANZ_VAL[2] & (OPREG[18:16] != 3'b111) & (OPREG[23:19] == 5'b10100) &
 
                                                ( ((OPREG[7:0] == 8'h4E) & ~OPREG[13] & ~OPREG[11])              // ROT,ASH,LSH but not NEG,NOT,ABS,COM
 
                                                 |((OPREG[7:0] == 8'hCE) & (OPREG[13:12] == 2'b01) & (OPREG[9:8] == 2'd0))));    // MOVX/ZBi
 
 
 
        assign opti_byte = (OPREG[1:0] == 2'b10) ? OPREG[31:24] : OPREG[23:16];
 
 
        // +++++++++++++++++++++++++  Coprocessor operations field  ++++++++++++++++++++++++++++++
        // +++++++++++++++++++++++++  Coprocessor operations field  ++++++++++++++++++++++++++++++
 
 
        always @(posedge BCLK) if (PHASE_0) COP_OP <= OPREG[23:0];
        always @(posedge BCLK) if (PHASE_0) COP_OP <= OPREG[23:0];
 
 
        // +++++++++++++++++++++++++  Special signals for LMR and CINV  ++++++++++++++++++++++++++
        // +++++++++++++++++++++++++  Special signals for LMR and CINV  ++++++++++++++++++++++++++
Line 1374... Line 1392...
 {8'h1F,10'bxx_xxxx_xxx0}:       // CMP done -> phase 0
 {8'h1F,10'bxx_xxxx_xxx0}:       // CMP done -> phase 0
                                                        new_op = {addr_nop,8'h00, src_x,src_x, 1'b0,dest_r,             opera,  2'b00,2'b10,    4'h0};  // no ACB
                                                        new_op = {addr_nop,8'h00, src_x,src_x, 1'b0,dest_r,             opera,  2'b00,2'b10,    4'h0};  // no ACB
 {8'h1F,10'bxx_xxxx_x0x1}:       // operation closed , data into register
 {8'h1F,10'bxx_xxxx_x0x1}:       // operation closed , data into register
                                                        new_op = {addr_nop,8'h00, src_x,src_x, 1'b0,dest_r,             opera,  2'b00,2'b00,    4'h0};  // no ACB
                                                        new_op = {addr_nop,8'h00, src_x,src_x, 1'b0,dest_r,             opera,  2'b00,2'b00,    4'h0};  // no ACB
 {8'h1F,10'bxx_xxxx_x101}:       // operation closed , data into memory - first calculate address phase 32+x
 {8'h1F,10'bxx_xxxx_x101}:       // operation closed , data into memory - first calculate address phase 32+x
                                                        new_op = {adwr2,   phwr2, irrw2,rega2, 1'b0,dest_r,             opera,  2'b00,2'b00,    nxrw2};
                                                        new_op = {adwr2,   phwr2, irrw2,rega2, 1'b0,dest_r,             opera,  2'b00,2'b10,    nxrw2};
 {8'h1F,10'bxx_xxxx_x111}:       // operation closed , data into memory - address reuse phase 39 ACC_DONE
 {8'h1F,10'bxx_xxxx_x111}:       // operation closed , data into memory - address reuse phase 39 ACC_DONE
                                                        new_op = {re_wr,   8'h27, src_x,src_x, 1'b0,dest_r,             opera,  2'b00,2'b00,    4'b0001};
                                                        new_op = {re_wr,   8'h27, src_x,src_x, 1'b0,dest_r,             opera,  2'b00,2'b10,    4'b0001};
 
 
                // Destination address calculate
                // Destination address calculate
                // Phase 37 : wait for data and Disp2 for External addressing : part 2 EA = (MOD+4)+4*DISP1
                // Phase 37 : wait for data and Disp2 for External addressing : part 2 EA = (MOD+4)+4*DISP1
                //              next phase fix : 38
                //              next phase fix : 38
 {8'h25,10'bxx_xxxx_xxxx}:       new_op = {exr11,   8'h26, src_x,imme , 1'b0,dest_x,             opera,  2'b00,2'b00,    4'b1111};
 {8'h25,10'bxx_xxxx_xxxx}:       new_op = {exr11,   8'h26, src_x,imme , 1'b0,dest_x,             opera,  2'b00,2'b00,    4'b1111};
Line 1693... Line 1711...
 
 
        // WMASKE : SP always 32 Bit, opcodes in Format 1, Reg-Nr. >31 , INDEX opcodes and the CHECK operand too
        // WMASKE : SP always 32 Bit, opcodes in Format 1, Reg-Nr. >31 , INDEX opcodes and the CHECK operand too
        assign WMASKE = {(spupd | format1 | wradr_i[5] | wmaske_i[1] | index_cmd | (oper_i[7:0] == 8'h83)),wmaske_i[0]};
        assign WMASKE = {(spupd | format1 | wradr_i[5] | wmaske_i[1] | index_cmd | (oper_i[7:0] == 8'h83)),wmaske_i[0]};
        assign WRADR  = spupd ? {~stack[5],stack[4:0]} : wradr_i;
        assign WRADR  = spupd ? {~stack[5],stack[4:0]} : wradr_i;
        assign WREN   = (spupd | wren_i) & no_trap;
        assign WREN   = (spupd | wren_i) & no_trap;
 
        assign START  = no_trap ? start_i : 2'b0;
        assign OPER   = spupd ? op_adr                             : oper_i;
        assign OPER   = spupd ? op_adr                             : oper_i;
 
 
        always @(posedge BCLK) ACC_FELD[14] <= next & (new_op[64] | new_op[63] | new_op[62]);   // NEWACC is important
        always @(posedge BCLK) ACC_FELD[14] <= next & (new_op[64] | new_op[63] | new_op[62]);   // NEWACC is important
        always @(posedge BCLK) ACC_FELD[9]  <= next & new_op[62];       // LDEA is only one pulse
        always @(posedge BCLK) ACC_FELD[9]  <= next & new_op[62];       // LDEA is only one pulse
 
 
        always @(posedge BCLK) START  <= next ? new_op[7:6] : 2'b00;
        always @(posedge BCLK) start_i <= next ? new_op[7:6] : 2'b00;
        always @(posedge BCLK) ldoreg <= next ? new_op[5:4] : 2'b00;    // [1] = LD_OUT , [0] = LD_LDQ
        always @(posedge BCLK) ldoreg <= next ? new_op[5:4] : 2'b00;    // [1] = LD_OUT , [0] = LD_LDQ
        always @(posedge BCLK) wren_i <= next & new_op[25] & ~new_op[7];        // only if no START[1] from Long-Op
        always @(posedge BCLK) wren_i <= next & new_op[25] & ~new_op[7];        // only if no START[1] from Long-Op
 
 
        assign LD_OUT = {(ldoreg[1] & no_trap),ldoreg[0]};       // [1] = LD_OUT (for CMP too) , [0] = LD_LDQ
        assign LD_OUT = {(ldoreg[1] & no_trap),ldoreg[0]};       // [1] = LD_OUT (for CMP too) , [0] = LD_LDQ
 
 

powered by: WebSVN 2.1.0

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