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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [vlog/] [amber23/] [a23_decode.v] - Diff between revs 71 and 82

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

Rev 71 Rev 82
Line 37... Line 37...
// You should have received a copy of the GNU Lesser General    //
// You should have received a copy of the GNU Lesser General    //
// Public License along with this source; if not, download it   //
// Public License along with this source; if not, download it   //
// from http://www.opencores.org/lgpl.shtml                     //
// from http://www.opencores.org/lgpl.shtml                     //
//                                                              //
//                                                              //
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
`include "global_defines.v"
`include "global_defines.vh"
 
 
module a23_decode
module a23_decode
(
(
input                       i_clk,
input                       i_clk,
input       [31:0]          i_read_data,
input       [31:0]          i_read_data,
Line 128... Line 128...
output      [7:0]           o_dabt_status
output      [7:0]           o_dabt_status
 
 
 
 
);
);
 
 
`include "a23_localparams.v"
`include "a23_localparams.vh"
`include "a23_functions.v"
`include "a23_functions.vh"
 
 
localparam [4:0] RST_WAIT1      = 5'd0,
localparam [4:0] RST_WAIT1      = 5'd0,
                 RST_WAIT2      = 5'd1,
                 RST_WAIT2      = 5'd1,
                 INT_WAIT1      = 5'd2,
                 INT_WAIT1      = 5'd2,
                 INT_WAIT2      = 5'd3,
                 INT_WAIT2      = 5'd3,
Line 665... Line 665...
                barrel_shift_amount_sel_nxt = 2'd1; // Shift amount from Rs registter
                barrel_shift_amount_sel_nxt = 2'd1; // Shift amount from Rs registter
 
 
            if ( !immediate_shifter_operand && !instruction[4] )
            if ( !immediate_shifter_operand && !instruction[4] )
                barrel_shift_amount_sel_nxt = 2'd2; // Shift immediate amount 
                barrel_shift_amount_sel_nxt = 2'd2; // Shift immediate amount 
 
 
 
            // regops that do not change the overflow flag
 
            if ( opcode == AND || opcode == EOR || opcode == TST || opcode == TEQ ||
 
                 opcode == ORR || opcode == MOV || opcode == BIC || opcode == MVN )
 
                status_bits_sel_nxt = 3'd5;
 
 
            if ( opcode == ADD || opcode == CMN )   // CMN is just like an ADD
            if ( opcode == ADD || opcode == CMN )   // CMN is just like an ADD
                begin
                begin
                alu_out_sel_nxt  = 4'd1; // Add
                alu_out_sel_nxt  = 4'd1; // Add
                end
                end
 
 
Line 850... Line 855...
            // Load or store ?
            // Load or store ?
            if ( !instruction[20] )  // Store
            if ( !instruction[20] )  // Store
                write_data_wen_nxt = 1'd1;
                write_data_wen_nxt = 1'd1;
 
 
            // LDM: load into user mode registers, when in priviledged mode  
            // LDM: load into user mode registers, when in priviledged mode  
            // DOnt use mtrans_r15 here because its not loaded yet   
            // Don't use mtrans_r15 here because its not loaded yet   
            if ( {instruction[22:20],instruction[15]} == 4'b1010 )
            if ( {instruction[22],instruction[20],instruction[15]} == 3'b110 )
                user_mode_regs_load_nxt = 1'd1;
                user_mode_regs_load_nxt = 1'd1;
 
 
            // SDM: store the user mode registers, when in priviledged mode     
            // SDM: store the user mode registers, when in priviledged mode     
            if ( {instruction[22:20]} == 3'b100 )
            if ( {instruction[22],instruction[20]} == 3'b10 )
                o_user_mode_regs_store_nxt = 1'd1;
                o_user_mode_regs_store_nxt = 1'd1;
 
 
            // update the base register ?
            // update the base register ?
            if ( instruction[21] )  // the W bit
            if ( instruction[21] )  // the W bit
                reg_bank_wsel_nxt  = o_rn_sel_nxt;
                reg_bank_wsel_nxt  = o_rn_sel_nxt;
Line 1052... Line 1057...
 
 
            if ( !instruction[20] ) // Store
            if ( !instruction[20] ) // Store
                write_data_wen_nxt = 1'd1;
                write_data_wen_nxt = 1'd1;
 
 
            // LDM: load into user mode registers, when in priviledged mode     
            // LDM: load into user mode registers, when in priviledged mode     
            if ( {instruction[22:20],mtrans_r15} == 4'b1010 )
            if ( {instruction[22],instruction[20],mtrans_r15} == 3'b110 )
                user_mode_regs_load_nxt = 1'd1;
                user_mode_regs_load_nxt = 1'd1;
 
 
            // SDM: store the user mode registers, when in priviledged mode     
            // SDM: store the user mode registers, when in priviledged mode     
            if ( {instruction[22:20]} == 3'b100 )
            if ( {instruction[22],instruction[20]} == 2'b10 )
                o_user_mode_regs_store_nxt = 1'd1;
                o_user_mode_regs_store_nxt = 1'd1;
            end
            end
        end
        end
 
 
 
 
Line 1083... Line 1088...
            end
            end
        else // Store
        else // Store
            write_data_wen_nxt = 1'd1;
            write_data_wen_nxt = 1'd1;
 
 
        // LDM: load into user mode registers, when in priviledged mode     
        // LDM: load into user mode registers, when in priviledged mode     
        if ( {instruction[22:20],mtrans_r15} == 4'b1010 )
        if ( {instruction[22],instruction[20],mtrans_r15} == 3'b110 )
            user_mode_regs_load_nxt = 1'd1;
            user_mode_regs_load_nxt = 1'd1;
 
 
        // SDM: store the user mode registers, when in priviledged mode     
        // SDM: store the user mode registers, when in priviledged mode     
        if ( {instruction[22:20]} == 3'b100 )
        if ( {instruction[22],instruction[20]} == 2'b10 )
            o_user_mode_regs_store_nxt = 1'd1;
            o_user_mode_regs_store_nxt = 1'd1;
        end
        end
 
 
 
 
        // second or fourth cycle of multiple load or store
        // second or fourth cycle of multiple load or store
Line 1105... Line 1110...
        // the last register in the set to be loaded
        // the last register in the set to be loaded
        if ( instruction[20] && !dabt ) // Load
        if ( instruction[20] && !dabt ) // Load
            reg_bank_wsel_nxt = mtrans_reg_d2;
            reg_bank_wsel_nxt = mtrans_reg_d2;
 
 
        // LDM: load into user mode registers, when in priviledged mode     
        // LDM: load into user mode registers, when in priviledged mode     
        if ( {instruction[22:20],mtrans_r15} == 4'b1010 )
        if ( {instruction[22],instruction[20],mtrans_r15} == 3'b110 )
            user_mode_regs_load_nxt = 1'd1;
            user_mode_regs_load_nxt = 1'd1;
 
 
        // SDM: store the user mode registers, when in priviledged mode     
        // SDM: store the user mode registers, when in priviledged mode     
        if ( {instruction[22:20]} == 3'b100 )
        //if ( {instruction[22:20]} == 3'b100 )  
 
        if ( {instruction[22],instruction[20]} == 2'b10 )
            o_user_mode_regs_store_nxt = 1'd1;
            o_user_mode_regs_store_nxt = 1'd1;
       end
       end
 
 
    // state is used for LMD/STM of a single register
    // state is used for LMD/STM of a single register
    if ( control_state == MTRANS_EXEC3B && instruction_execute )
    if ( control_state == MTRANS_EXEC3B && instruction_execute )
Line 1124... Line 1130...
 
 
        address_sel_nxt             = 4'd3;  // pc  (not pc + 4)
        address_sel_nxt             = 4'd3;  // pc  (not pc + 4)
        pc_wen_nxt                  = 1'd0;  // hold current PC value
        pc_wen_nxt                  = 1'd0;  // hold current PC value
 
 
        // LDM: load into user mode registers, when in priviledged mode     
        // LDM: load into user mode registers, when in priviledged mode     
        if ( {instruction[22:20],mtrans_r15} == 4'b1010 )
        if ( {instruction[22],instruction[20],mtrans_r15} == 3'b110 )
            user_mode_regs_load_nxt = 1'd1;
            user_mode_regs_load_nxt = 1'd1;
 
 
        // SDM: store the user mode registers, when in priviledged mode     
        // SDM: store the user mode registers, when in priviledged mode     
        if ( {instruction[22:20]} == 3'b100 )
        if ( {instruction[22],instruction[20]} == 2'b10 )
            o_user_mode_regs_store_nxt = 1'd1;
            o_user_mode_regs_store_nxt = 1'd1;
        end
        end
 
 
    if ( control_state == MTRANS_EXEC4 )
    if ( control_state == MTRANS_EXEC4 )
        begin
        begin
Line 1178... Line 1184...
            begin
            begin
            pc_wen_nxt = 1'd0;  // hold current PC value
            pc_wen_nxt = 1'd0;  // hold current PC value
            end
            end
 
 
        // LDM: load into user mode registers, when in priviledged mode     
        // LDM: load into user mode registers, when in priviledged mode     
        if ( {instruction[22:20],mtrans_r15} == 4'b1010 )
        if ( {instruction[22],instruction[20],mtrans_r15} == 3'b110 )
            user_mode_regs_load_nxt = 1'd1;
            user_mode_regs_load_nxt = 1'd1;
 
 
        // SDM: store the user mode registers, when in priviledged mode     
        // SDM: store the user mode registers, when in priviledged mode     
        if ( {instruction[22:20]} == 3'b100 )
        if ( {instruction[22],instruction[20]} == 2'b10 )
            o_user_mode_regs_store_nxt = 1'd1;
            o_user_mode_regs_store_nxt = 1'd1;
        end
        end
 
 
 
 
    // state is for when a data abort interrupt is triggered during an LDM
    // state is for when a data abort interrupt is triggered during an LDM
Line 1633... Line 1639...
// ========================================================
// ========================================================
// Decompiler for debugging core - not synthesizable
// Decompiler for debugging core - not synthesizable
// ========================================================
// ========================================================
//synopsys translate_off
//synopsys translate_off
 
 
`include "debug_functions.v"
`include "debug_functions.vh"
 
 
a23_decompile  u_decompile (
a23_decompile  u_decompile (
    .i_clk                      ( i_clk                            ),
    .i_clk                      ( i_clk                            ),
    .i_fetch_stall              ( i_fetch_stall                    ),
    .i_fetch_stall              ( i_fetch_stall                    ),
    .i_instruction              ( instruction                      ),
    .i_instruction              ( instruction                      ),

powered by: WebSVN 2.1.0

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