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

Subversion Repositories m32632

[/] [m32632/] [trunk/] [rtl/] [STEUER_MISC.v] - Diff between revs 11 and 14

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

Rev 11 Rev 14
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: STEUER_MISC.v
// Filename: STEUER_MISC.v
// Version:  1.0
// Version:  1.1 bug fix
// Date:     30 May 2015
// History:  1.0 first release of 30 Mai 2015
 
// Date:     21 January 2016
//
//
// Copyright (C) 2015 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 
// removed from the file and that any derivative work contains 
// removed from the file and that any derivative work contains 
// the original copyright notice and the associated disclaimer.
// the original copyright notice and the associated disclaimer.
Line 429... Line 430...
                                  PHRD1, PHRD2, NXRD1, NXRW2, ACCA, OPERA,
                                  PHRD1, PHRD2, NXRD1, NXRW2, ACCA, OPERA,
                                  STATE_0, STATE_GROUP_50, STATE_GROUP_60 );
                                  STATE_0, STATE_GROUP_50, STATE_GROUP_60 );
 
 
 
 
        input                   BCLK,PHASE_0;
        input                   BCLK,PHASE_0;
        input   [13:0]   OPREG;
        input   [18:0]   OPREG;
        input    [3:0]   PHASE;  // nur die 4 LSBs
        input    [3:0]   PHASE;  // nur die 4 LSBs
        // Source 1 & 2 Inputs
        // Source 1 & 2 Inputs
        input    [6:0]   SRC_1,SRC_2,REGA1,REGA2,IRRW1,IRRW2;
        input    [6:0]   SRC_1,SRC_2,REGA1,REGA2,IRRW1,IRRW2;
        input   [18:0]   ADRD1,ADRD2,EXR12,EXR22;
        input   [18:0]   ADRD1,ADRD2,EXR12,EXR22;
        input    [3:0]   PHRD1,PHRD2;
        input    [3:0]   PHRD1,PHRD2;
Line 452... Line 453...
        reg              [7:0]   phsrc1,phsrc2;
        reg              [7:0]   phsrc1,phsrc2;
        reg              [5:0]   chkreg;
        reg              [5:0]   chkreg;
        reg              [1:0]   bwdreg;
        reg              [1:0]   bwdreg;
        reg                             tbit_flag,size_dw;
        reg                             tbit_flag,size_dw;
        reg                             inss_flag;
        reg                             inss_flag;
 
        reg                             ext_tos;
 
 
        wire    [18:0]   exoffset,re_wr;
        wire    [18:0]   exoffset,re_wr,rexwr;
        wire    [10:0]   op_kust,op_bwd;
        wire    [10:0]   op_kust,op_bwd;
        wire     [7:0]   phchk;
        wire     [7:0]   phchk;
        wire     [4:0]   op_reg;
        wire     [4:0]   op_reg;
        wire     [6:0]   src_1l,src_2l;
        wire     [6:0]   src_1l,src_2l;
        wire     [5:0]   dest_2;
        wire     [5:0]   dest_2;
Line 487... Line 489...
        parameter temp_h        = 6'h3D;        // Second last place for 8B TEMP Register
        parameter temp_h        = 6'h3D;        // Second last place for 8B TEMP Register
        parameter temp_1        = 6'h3E;
        parameter temp_1        = 6'h3E;
        parameter rtmpl         = 7'h3C;
        parameter rtmpl         = 7'h3C;
        parameter rtmph         = 7'h3D;
        parameter rtmph         = 7'h3D;
        parameter rtmp1         = 7'h3E;
        parameter rtmp1         = 7'h3E;
        parameter op_mov        = {3'bxxx,8'h45};
        parameter op_mov        = {3'bx1x,8'h45};
        parameter op_adr        = {3'bxxx,8'h49};
        parameter op_adr        = {3'bx1x,8'h49};
        parameter op_addl       = {3'b0xx,8'hB0};
        parameter op_addl       = {3'b01x,8'hB0};
        parameter op_addf       = {3'b1xx,8'hB0};
        parameter op_addf       = {3'b11x,8'hB0};
        parameter op_mull       = {3'b0xx,8'hBC};
        parameter op_mull       = {3'b01x,8'hBC};
        parameter op_mulf       = {3'b1xx,8'hBC};
        parameter op_mulf       = {3'b11x,8'hBC};
        parameter op_truf       = {3'b101,8'h9A};       // TRUNCFW for SCALBF
        parameter op_truf       = {3'b101,8'h9A};       // TRUNCFW for SCALBF
        parameter op_trul       = {3'b001,8'h9A};       // TRUNCLW for SCALBL
        parameter op_trul       = {3'b001,8'h9A};       // TRUNCLW for SCALBL
        parameter op_stpr       = {3'b1xx,8'h54};       // Special-Op for String opcodes
        parameter op_stpr       = {3'b11x,8'h54};       // Special-Op for String opcodes
        parameter op_lsh        = {3'b011,8'h65};       // EXT : shift to right : DOUBLE !
        parameter op_lsh        = {3'b011,8'h65};       // EXT : shift to right : DOUBLE !
        parameter op_msk        = {3'b011,8'h80};       // reuse of EXT Opcode at INS !
        parameter op_msk        = {3'b011,8'h80};       // reuse of EXT Opcode at INS !
        parameter op_mul        = {3'b011,8'h78};       // INDEX
        parameter op_mul        = {3'b011,8'h78};       // INDEX
        parameter op_rwv        = {3'bxxx,8'hE0};       // RDVAL+WRVAL
        parameter op_rwv        = {3'bx1x,8'hE0};       // RDVAL+WRVAL
 
 
        always @(OPREG) // whether the Opcode is valid is decided in DECODER !
        always @(OPREG) // whether the Opcode is valid is decided in DECODER !
          casex (OPREG) // [13:0]
          casex (OPREG[13:0])
                14'bxx_xxxx_1111_1110 : op_code = {2'b01,OPREG[11:10],OPREG[8]};        // DOT/POLY/SCALB
                14'bxx_xxxx_1111_1110 : op_code = {2'b01,OPREG[11:10],OPREG[8]};        // DOT/POLY/SCALB
                14'b00_0xxx_0000_1110 : op_code = 5'b1_0000;    // MOVS/CMPS
                14'b00_0xxx_0000_1110 : op_code = 5'b1_0000;    // MOVS/CMPS
                14'b00_11xx_0000_1110 : op_code = 5'b1_0000;    // SKPS
                14'b00_11xx_0000_1110 : op_code = 5'b1_0000;    // SKPS
                14'b00_0xxx_1100_1110 : op_code = 5'b1_0001;    // MOVM/CMPM
                14'b00_0xxx_1100_1110 : op_code = 5'b1_0001;    // MOVM/CMPM
                14'bxx_xx10_0111_11xx : op_code = 5'b1_0010;    // JUMP/JSR
                14'bxx_xx10_0111_11xx : op_code = 5'b1_0010;    // JUMP/JSR
Line 550... Line 552...
          endcase
          endcase
 
 
        assign get8b_d = (PHRD2 == 4'hB) ? 4'hC : 4'h0; // Special case 8B Immeadiate, is used in State 58
        assign get8b_d = (PHRD2 == 4'hB) ? 4'hC : 4'h0; // Special case 8B Immeadiate, is used in State 58
 
 
        assign src_1l = {SRC_1[6:1],1'b0};
        assign src_1l = {SRC_1[6:1],1'b0};
        assign src_2l = {SRC_2[6:1],1'b0};
        assign src_2l = {SRC_2[6:1],~SRC_2[0]};  // needed only for DEI/MEI
        assign dest_2 =  SRC_2[5:0];
        assign dest_2 =  SRC_2[5:0];
 
 
        assign phchk = {7'b0101_010,size_dw};   // Phase 54 or 55
        assign phchk = {7'b0101_010,size_dw};   // Phase 54 or 55
 
 
        assign op_kust = {1'bx,OPERA[9:8],8'h7A};       // Special-Opcode for MOVM/CMPM
        assign op_kust = {1'bx,OPERA[9:8],8'h7A};       // Special-Opcode for MOVM/CMPM
        assign op_bwd  = {1'bx,OPERA[9:8],8'h45};       // for CASE and Bit opcodes
        assign op_bwd  = {1'bx,OPERA[9:8],8'h45};       // for CASE and Bit opcodes
 
 
        assign re_wr   = {EXR22[18:17],4'b0101,4'h0, 9'h003};   // REUSE Address : Write of rmw , top 2 Bits contain size
        assign re_wr   = {EXR22[18:17],4'b0101,4'h0, 9'h003};   // REUSE Address : Write of rmw , top 2 Bits contain size
 
 
 
        always @(posedge BCLK) if (PHASE_0) ext_tos <= (OPREG[18:14] == 5'h17); // if TOS
 
        assign rexwr   = {EXR22[18:17],4'b0101,4'h0, ext_tos, 8'h03};   // REUSE Addresse : Write von rmw , only for EXT and EXTS !
 
 
        always @(posedge BCLK) tbit_flag <= ~OPERA[1];  // due to Timing ...
        always @(posedge BCLK) tbit_flag <= ~OPERA[1];  // due to Timing ...
        always @(posedge BCLK) size_dw   <=  OPERA[9];
        always @(posedge BCLK) size_dw   <=  OPERA[9];
 
 
        always @(posedge BCLK) if (PHASE_0) chkreg <= {3'b000,OPREG[13:11]};    // for CHECK
        always @(posedge BCLK) if (PHASE_0) chkreg <= {3'b000,OPREG[13:11]};    // for CHECK
        assign rd_reg = (PHASE_0) ? {4'b0,OPREG[13:11]} : {1'b0,chkreg};        // for read operation at EXT/INS
        assign rd_reg = (PHASE_0) ? {4'b0,OPREG[13:11]} : {1'b0,chkreg};        // for read operation at EXT/INS
Line 676... Line 681...
                                                 {       ADRD2,   phsrc2,IRRW2, REGA2, 1'b0,dest_x,op_mov,  2'b00,2'b00,NXRW2 }         // here Adr(DEST) => EA
                                                 {       ADRD2,   phsrc2,IRRW2, REGA2, 1'b0,dest_x,op_mov,  2'b00,2'b00,NXRW2 }         // here Adr(DEST) => EA
                                           : {   addr_nop,8'h59, src_x, src_x, 1'b0,dest_x,op_mov,      2'b00,2'b00,4'h8  };    // 1 Byte Immediate read
                                           : {   addr_nop,8'h59, src_x, src_x, 1'b0,dest_x,op_mov,      2'b00,2'b00,4'h8  };    // 1 Byte Immediate read
                          state_55 = dont_care;
                          state_55 = dont_care;
                          state_58 = {   addr_nop,8'h59, src_x, src_x, 1'b0,dest_x,op_mov,      2'b00,2'b00,4'h8  };    // 1 Byte Immediate read
                          state_58 = {   addr_nop,8'h59, src_x, src_x, 1'b0,dest_x,op_mov,      2'b00,2'b00,4'h8  };    // 1 Byte Immediate read
                          state_59 = ACCA[1] ?          // _..M.
                          state_59 = ACCA[1] ?          // _..M.
                                                 {       re_wr,   8'h27, imme,  rtmph, 1'b0,dest_x,OPERA,       2'b00,2'b10,4'h1  }             // result in memory
                                                 {       rexwr,   8'h27, imme,  rtmph, 1'b0,dest_x,OPERA,       2'b00,2'b10,4'h1  }             // result in memory
                                           : {   addr_nop,8'h00, imme,  rtmph, 1'b1,dest_2,OPERA,       2'b00,2'b00,4'h0  };    // result in Register
                                           : {   addr_nop,8'h00, imme,  rtmph, 1'b1,dest_2,OPERA,       2'b00,2'b00,4'h0  };    // result in Register
                          state_5A = dont_care;
                          state_5A = dont_care;
                        end
                        end
                5'b1_1010 : // EXT : BASE Operand => TEMP, calculate address of Destination
                5'b1_1010 : // EXT : BASE Operand => TEMP, calculate address of Destination
                        begin
                        begin
Line 698... Line 703...
                                           : {   addr_nop,8'h59, rd_reg,(ACCA[3] ? imme : rtmph),
                                           : {   addr_nop,8'h59, rd_reg,(ACCA[3] ? imme : rtmph),
                                                                                                                   1'b1,temp_h,op_lsh,  2'b00,2'b00,4'hE  };    // Displacement read
                                                                                                                   1'b1,temp_h,op_lsh,  2'b00,2'b00,4'hE  };    // Displacement read
                          state_55 = {   exoffset,8'h54, rd_reg,src_x, 1'b0,dest_x,op_mov,      2'b00,2'b00,4'h1  };    // Read Source, EA reuse
                          state_55 = {   exoffset,8'h54, rd_reg,src_x, 1'b0,dest_x,op_mov,      2'b00,2'b00,4'h1  };    // Read Source, EA reuse
                          state_58 = {   addr_nop,8'h59, rd_reg,rtmph, 1'b1,temp_h,op_lsh,      2'b00,2'b00,4'hE  };    // Displacement read
                          state_58 = {   addr_nop,8'h59, rd_reg,rtmph, 1'b1,temp_h,op_lsh,      2'b00,2'b00,4'hE  };    // Displacement read
                          state_59 = ACCA[1] ?          // _..M.
                          state_59 = ACCA[1] ?          // _..M.
                                                 {       re_wr,   8'h27, src_x, rtmph, 1'b0,dest_x,OPERA,       2'b00,2'b10,4'h1  }             // result in memory
                                                 {       rexwr,   8'h27, src_x, rtmph, 1'b0,dest_x,OPERA,       2'b00,2'b10,4'h1  }             // result in memory
                                           : {   addr_nop,8'h00, src_x, rtmph, 1'b1,dest_2,OPERA,       2'b00,2'b00,4'h0  };    // result in Register
                                           : {   addr_nop,8'h00, src_x, rtmph, 1'b1,dest_2,OPERA,       2'b00,2'b00,4'h0  };    // result in Register
                          state_5A = {   ADRD2,   phsrc2,IRRW2, REGA2, 1'b0,dest_x,op_mov,      2'b00,2'b00,NXRW2 };    // special case Mem-Mem
                          state_5A = {   ADRD2,   phsrc2,IRRW2, REGA2, 1'b0,dest_x,op_mov,      2'b00,2'b00,NXRW2 };    // special case Mem-Mem
                        end
                        end
                5'b1_1011 : // INS/INSS : BASE Operand => TEMP, SRC2 read as Double ! RMW not tested (Phase x'6A) but uncritical
                5'b1_1011 : // INS/INSS : BASE Operand => TEMP, SRC2 read as Double ! RMW not tested (Phase x'6A) but uncritical
                        begin
                        begin

powered by: WebSVN 2.1.0

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