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

Subversion Repositories aemb

[/] [aemb/] [trunk/] [rtl/] [verilog/] [aeMB2_intu.v] - Diff between revs 205 and 209

Show entire file | Details | Blame | View Log

Rev 205 Rev 209
Line 29... Line 29...
 
 
module aeMB2_intu (/*AUTOARG*/
module aeMB2_intu (/*AUTOARG*/
   // Outputs
   // Outputs
   mem_ex, bpc_ex, alu_ex, alu_mx, msr_ex, sfr_mx,
   mem_ex, bpc_ex, alu_ex, alu_mx, msr_ex, sfr_mx,
   // Inputs
   // Inputs
   opc_of, opa_of, opb_of, opd_of, imm_of, rd_of, ra_of, gclk, grst,
   exc_dwb, exc_ill, rpc_ex, opc_of, opa_of, opb_of, opd_of, imm_of,
   dena, gpha
   rd_of, ra_of, gclk, grst, dena, gpha
   );
   );
   parameter AEMB_DWB = 32;
   parameter AEMB_DWB = 32;
   parameter AEMB_IWB = 32;
   parameter AEMB_IWB = 32;
   parameter AEMB_HTX = 1;
   parameter AEMB_HTX = 1;
 
 
Line 42... Line 42...
   output [31:2] bpc_ex;
   output [31:2] bpc_ex;
 
 
   output [31:0] alu_ex,
   output [31:0] alu_ex,
                 alu_mx;
                 alu_mx;
 
 
 
   input [1:0]    exc_dwb;
 
   input         exc_ill;
 
 
 
   input [31:2]  rpc_ex;
 
 
   //input [2:0]         mux_of;   
   //input [2:0]         mux_of;   
   input [5:0]    opc_of;
   input [5:0]    opc_of;
   input [31:0]  opa_of;
   input [31:0]  opa_of;
   input [31:0]  opb_of;
   input [31:0]  opb_of;
   input [31:0]  opd_of;
   input [31:0]  opd_of;
Line 88... Line 93...
                        rMSR_ITE,
                        rMSR_ITE,
                        rMSR_BIP,
                        rMSR_BIP,
                        rMSR_IE,
                        rMSR_IE,
                        rMSR_BE;
                        rMSR_BE;
 
 
 
   reg [31:0]            rEAR,
 
                        rEAR_C;
 
   reg [1:0]             rESR,
 
                        rESR_C;
 
 
   // Infer a ADD with carry cell because ADDSUB cannot be inferred
   // Infer a ADD with carry cell because ADDSUB cannot be inferred
   // across technologies.
   // across technologies.
 
 
   reg [31:0]            add_ex;
   reg [31:0]            add_ex;
   reg                  add_c;
   reg                  add_c;
Line 171... Line 181...
    MSR bits
    MSR bits
    31 - CC (carry copy)
    31 - CC (carry copy)
    30 - HTE (hardware thread enabled)
    30 - HTE (hardware thread enabled)
    29 - PHA (current phase)
    29 - PHA (current phase)
 
 
 
    9  - EIP (exception in progress)
 
    8  - EE (exception enable)
    7  - DTE (data cache enable)
    7  - DTE (data cache enable)
    5  - ITE (instruction cache enable)
    5  - ITE (instruction cache enable)
    4  - MTX (hardware mutex bit)
    4  - MTX (hardware mutex bit)
    3  - BIP (break in progress)
    3  - BIP (break in progress)
    2  - C (carry flag)
    2  - C (carry flag)
Line 218... Line 230...
   wire       fBRKE = (opc_of == 6'o56) & (ra_of[4:0] == 5'hE);
   wire       fBRKE = (opc_of == 6'o56) & (ra_of[4:0] == 5'hE);
 
 
   wire       fMOV = (opc_of == 6'o45);
   wire       fMOV = (opc_of == 6'o45);
   wire       fMTS = fMOV & &imm_of[15:14];
   wire       fMTS = fMOV & &imm_of[15:14];
   wire       fMOP = fMOV & ~|imm_of[15:14];
   wire       fMOP = fMOV & ~|imm_of[15:14];
 
   wire       fMFS = fMOV & imm_of[15] & !imm_of[14];
 
 
   reg [31:0] sfr_ex;
   reg [31:0] sfr_ex;
 
   reg [2:0]  sfr_sel;
 
 
   always @(posedge gclk)
   always @(posedge gclk)
     if (grst) begin
     if (grst) begin
        /*AUTORESET*/
        /*AUTORESET*/
        // Beginning of autoreset for uninitialized flops
        // Beginning of autoreset for uninitialized flops
        rMSR_BE <= 1'h0;
 
        rMSR_BIP <= 1'h0;
 
        rMSR_DTE <= 1'h0;
 
        rMSR_EE <= 1'h0;
 
        rMSR_EIP <= 1'h0;
 
        rMSR_IE <= 1'h0;
 
        rMSR_ITE <= 1'h0;
 
        rMSR_MTX <= 1'h0;
 
        sfr_ex <= 32'h0;
        sfr_ex <= 32'h0;
        sfr_mx <= 32'h0;
        sfr_mx <= 32'h0;
 
        sfr_sel <= 3'h0;
        // End of automatics
        // End of automatics
     end else if (dena) begin // if (grst)
     end else if (dena) begin
        sfr_mx <= #1 sfr_ex;
 
 
        case (sfr_sel[2:0])
 
          //3'o0: sfr_mx <= #1 {rpc_ex[31:2], 2'o0};
 
          3'o5: sfr_mx <= #1 {30'd0, rESR_C};
 
          3'o3: sfr_mx <= #1 rEAR_C;
 
          3'o1: sfr_mx <= #1 {rMSR_C,
 
                              AEMB_HTX[0],
 
                              gpha,
 
                              19'd0,
 
                              rMSR_EIP,
 
                              rMSR_EE,
 
                              rMSR_DTE,
 
                              1'b0,
 
                              rMSR_ITE,
 
                              rMSR_MTX,
 
                              rMSR_BIP,
 
                              rMSR_C,
 
                              rMSR_IE,
 
                              rMSR_BE
 
                              };
 
          default: sfr_mx <= #1 sfr_ex;
 
        endcase // case (imm_of[2:0])   
 
 
        sfr_ex <= #1
        sfr_ex <= #1
                  {rMSR_CC,
                  {rMSR_CC,
                   AEMB_HTX[0],
                   AEMB_HTX[0],
                   gpha,
                   gpha,
                   21'd0,
                   19'd0,
 
                   rMSR_EIP,
 
                   rMSR_EE,
                   rMSR_DTE,
                   rMSR_DTE,
                   1'b0,
                   1'b0,
                   rMSR_ITE,
                   rMSR_ITE,
                   rMSR_MTX,
                   rMSR_MTX,
                   rMSR_BIP,
                   rMSR_BIP,
                   rMSR_CC,
                   rMSR_CC,
                   rMSR_IE,
                   rMSR_IE,
                   rMSR_BE
                   rMSR_BE
                   };
                   };
 
 
 
        sfr_sel <= #1 imm_of[2:0];
 
 
 
     end
 
 
 
   always @(posedge gclk)
 
     if (grst) begin
 
        /*AUTORESET*/
 
        // Beginning of autoreset for uninitialized flops
 
        rMSR_BE <= 1'h0;
 
        rMSR_BIP <= 1'h0;
 
        rMSR_DTE <= 1'h0;
 
        rMSR_EE <= 1'h0;
 
        rMSR_EIP <= 1'h0;
 
        rMSR_IE <= 1'h0;
 
        rMSR_ITE <= 1'h0;
 
        rMSR_MTX <= 1'h0;
 
        // End of automatics
 
     end else if (dena) begin // if (grst)              
        rMSR_DTE <= #1
        rMSR_DTE <= #1
                   (fMTS) ? opa_of[7] :
                   (fMTS) ? opa_of[7] :
                   (fMOP) ? wRES[7] :
                   (fMOP) ? wRES[7] :
                   rMSR_DTE;
                   rMSR_DTE;
 
 
Line 301... Line 350...
                    (fRTED) ? 1'b0 :
                    (fRTED) ? 1'b0 :
                    (fMTS) ? opa_of[9] :
                    (fMTS) ? opa_of[9] :
                    (fMOP) ? wRES[9] :
                    (fMOP) ? wRES[9] :
                    rMSR_EIP;
                    rMSR_EIP;
 
 
        /*
 
 
 
        case ({fMTS, fMOP})
 
          2'o2: {rMSR_DTE,
 
                 rMSR_ITE,
 
                 rMSR_MTX,
 
                 rMSR_BE} <= #1 {opa_of[7],
 
                                 opa_of[5],
 
                                 opa_of[4],
 
                                 opa_of[0]};
 
          2'o1: {rMSR_DTE,
 
                 rMSR_ITE,
 
                 rMSR_MTX,
 
                 rMSR_BE} <= #1 {wRES[7],
 
                                 wRES[5],
 
                                 wRES[4],
 
                                 wRES[0]};
 
          default: {rMSR_DTE,
 
                    rMSR_ITE,
 
                    rMSR_MTX,
 
                    rMSR_BE} <= #1 {rMSR_DTE,
 
                                    rMSR_ITE,
 
                                    rMSR_MTX,
 
                                    rMSR_BE};
 
        endcase // case ({fMTS, fMOP})
 
 
 
        case ({fMTS, fMOP})
 
          2'o2: {rMSR_BIP,
 
                 rMSR_IE} <= #1 {opa_of[3],
 
                                 opa_of[1]};
 
          2'o1: {rMSR_BIP,
 
                 rMSR_IE} <= #1 {wRES[3],
 
                                 wRES[1]};
 
          default: begin
 
             rMSR_BIP <= #1 (fBRKB | fRTBD) ? !rMSR_BIP : rMSR_BIP;
 
             rMSR_IE <= #1 (fBRKI | fRTID) ? !rMSR_IE : rMSR_IE;
 
          end
 
        endcase // case ({fMTS, fMOP})
 
         */
 
     end // if (dena)
     end // if (dena)
 
 
   // BARREL C
   // BARREL C
   wire fADDSUB = !opc_of[5] & !opc_of[4] & !opc_of[2];
   wire fADDSUB = !opc_of[5] & !opc_of[4] & !opc_of[2];
   // (opc_of[5:2] == 4'h0) | (opc_of[5:2] == 4'h2);
   // (opc_of[5:2] == 4'h0) | (opc_of[5:2] == 4'h2);
   wire fSHIFT  = (opc_of == 6'o44) & &imm_of[6:5];
   wire fSHIFT  = (opc_of == 6'o44) & &imm_of[6:5];
 
 
   always @(posedge gclk)
   always @(posedge gclk)
     if (grst) begin
     if (grst) begin
        /*AUTORESET*/
        /*AUTORESET*/
 
        // Beginning of autoreset for uninitialized flops
 
        rEAR_C <= 32'h0;
 
        rESR_C <= 2'h0;
 
        rMSR_CC <= 1'h0;
 
        // End of automatics
     end else if (dena) begin
     end else if (dena) begin
 
        rEAR_C <= #1 rEAR;
 
        rESR_C <= #1 rESR;
 
        rMSR_CC <= #1 rMSR_C;
 
        //sfr_mx <= #1 sfr_ex;
     end
     end
 
 
   always @(posedge gclk)
   always @(posedge gclk)
     if (grst) begin
     if (grst) begin
        /*AUTORESET*/
        /*AUTORESET*/
        // Beginning of autoreset for uninitialized flops
        // Beginning of autoreset for uninitialized flops
 
        rEAR <= 32'h0;
 
        rESR <= 2'h0;
        rMSR_C <= 1'h0;
        rMSR_C <= 1'h0;
        rMSR_CC <= 1'h0;
 
        // End of automatics
        // End of automatics
     end else if (dena) begin
     end else if (dena) begin
        rMSR_CC <= #1 rMSR_C;
        rEAR <= #1 (exc_dwb[1]) ? {mem_ex, 2'o0} : rEAR_C; // LXX/SXX
 
 
 
        rESR <= #1 (exc_ill | exc_dwb[1]) ?
 
                {exc_ill, exc_dwb[1]} : rESR_C; // ESR  
 
 
        rMSR_C <= #1
        rMSR_C <= #1
                  (fMTS) ? opa_of[2] :
                  (fMTS) ? opa_of[2] :
                  (fMOP) ? wRES[2] :
                  (fMOP) ? wRES[2] :
                  (fSHIFT) ? opa_of[0] : // SRA/SRL/SRC
                  (fSHIFT) ? opa_of[0] : // SRA/SRL/SRC
                  (fADDSUB) ? add_c : // ADD/SUB/ADDC/SUBC
                  (fADDSUB) ? add_c : // ADD/SUB/ADDC/SUBC
                  rMSR_CC;
                  rMSR_CC;
 
 
        /*
     end // if (dena)
        case ({fMTS,fMOP,fSHIFT,fADDSUB})
 
          4'h8: rMSR_C <= #1 opa_of[2];
 
          4'h4: rMSR_C <= #1 wRES[2];
 
          4'h2: rMSR_C <= #1 opa_of[0];
 
          4'h1: rMSR_C <= #1 add_c;
 
          default: rMSR_C <= #1 rMSR_CC;
 
        endcase // case ({fMTS,fMOP,fSHIFT,fADDSUB})
 
        */
 
     end
 
 
 
endmodule // aeMB2_intu
endmodule // aeMB2_intu
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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