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

Subversion Repositories zap

[/] [zap/] [trunk/] [src/] [rtl/] [cpu/] [zap_predecode_compress.v] - Diff between revs 26 and 38

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

Rev 26 Rev 38
Line 36... Line 36...
        // Input from I-cache.
        // Input from I-cache.
        // Instruction and valid qualifier.
        // Instruction and valid qualifier.
        input wire [31:0]       i_instruction,
        input wire [31:0]       i_instruction,
        input wire              i_instruction_valid,
        input wire              i_instruction_valid,
 
 
 
        // Offset input.
 
        input wire [11:0]       i_offset,
 
 
        // Interrupts. Active high level sensitive signals.
        // Interrupts. Active high level sensitive signals.
        input wire              i_irq,
        input wire              i_irq,
        input wire              i_fiq,
        input wire              i_fiq,
 
 
        // Ensure compressed mode is active (T bit).
        // Ensure compressed mode is active (T bit).
Line 67... Line 70...
`include "zap_localparams.vh"
`include "zap_localparams.vh"
`include "zap_functions.vh"
`include "zap_functions.vh"
 
 
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
 
 
reg [11:0] offset_ff, offset_nxt;  // Remember offset.
reg [11:0] offset_w;  // Previous offset.
 
 
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
 
 
// Keep buferring offset since a long offset is constructed using consecutive
always @*
// valid compressed instructions.
        offset_w = i_offset;
always @ (posedge i_clk)
 
        if ( i_instruction_valid )
 
                offset_ff <= offset_nxt;
 
 
 
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
 
 
always @*
always @*
begin
begin
Line 88... Line 88...
        o_und                   = 0;
        o_und                   = 0;
        o_instruction           = i_instruction;
        o_instruction           = i_instruction;
        o_irq                   = i_irq;
        o_irq                   = i_irq;
        o_fiq                   = i_fiq;
        o_fiq                   = i_fiq;
        o_force32_align         = 0;
        o_force32_align         = 0;
        offset_nxt              = i_instruction[11:0];
 
 
 
 
 
        if ( i_cpsr_ff_t && i_instruction_valid ) // compressed mode enable
        if ( i_cpsr_ff_t && i_instruction_valid ) // compressed mode enable
        begin
        begin
                casez ( i_instruction[15:0] )
                casez ( i_instruction[15:0] )
 
                        T_BLX1                  : decode_blx1;
 
                        T_BLX2                  : decode_blx2;
                        T_ADD_SUB_LO            : decode_add_sub_lo;
                        T_ADD_SUB_LO            : decode_add_sub_lo;
                        T_SWI                   : decode_swi;
                        T_SWI                   : decode_swi;
                        T_BRANCH_COND           : decode_conditional_branch;
                        T_BRANCH_COND           : decode_conditional_branch;
                        T_BRANCH_NOCOND         : decode_unconditional_branch;
                        T_BRANCH_NOCOND         : decode_unconditional_branch;
                        T_BL                    : decode_bl;
                        T_BL                    : decode_bl;
Line 500... Line 500...
end
end
endtask
endtask
 
 
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
 
 
 
task decode_blx1;
 
begin
 
        o_instruction = 0; // Default value.
 
 
 
        // Generate a BLX1.
 
        o_instruction[31:25] =  7'b1111_101;    // BLX1 identifier.   
 
        o_instruction[24]    =  1'd0;           // H - bit.
 
        o_instruction[23:0]  =  ($signed(offset_w) << 12) | (i_instruction[10:0] << 1);  // Corrected.
 
        o_irq                = 1'd0;
 
        o_fiq                = 1'd0;
 
end
 
endtask
 
 
 
////////////////////////////////////////////////////////////////////////////////
 
 
 
task decode_blx2;
 
begin
 
        o_instruction = {4'b1110,4'b0001,4'b0010,4'b1111,4'b1111,4'b1111,4'b0011, i_instruction[6:3]};
 
        o_irq         = 1'd0;
 
        o_fiq         = 1'd0;
 
end
 
endtask
 
 
 
///////////////////////////////////////////////////////////////////////////////
 
 
task decode_bl;
task decode_bl;
begin
begin
        case ( i_instruction[11] )
        case ( i_instruction[11] )
                1'd0:
                1'd0:
                begin
                begin
                        // Store the offset and send out a dummy instruction.
                        // Send out a dummy instruction. Preserve lower
                        // offset_nxt      = i_instruction[11:0];
                        // 12-bits though to serve as offset. Set condition
                        o_instruction   = 32'd0;
                        // code to NV.
 
                        o_instruction        = i_instruction[11:0];
 
                        o_instruction[31:28] = 4'b1111;
                        o_irq           = 1'd0;
                        o_irq           = 1'd0;
                        o_fiq           = 1'd0;
                        o_fiq           = 1'd0;
                end
                end
                1'd1:
                1'd1:
                begin
                begin
                        // Generate a full jump.
                        // Generate a full jump.
                        o_instruction = {1'd1, 2'b0, AL, 3'b101, 1'b1, 24'd0};
                        o_instruction = {1'd1, 2'b0, AL, 3'b101, 1'b1, 24'd0};
                        o_instruction[23:0] = ($signed(offset_ff) << 12) | (i_instruction[11:0]);
                        o_instruction[23:0] = ($signed(offset_w) << 12) | (i_instruction[10:0] << 1);  // Corrected.
                        o_irq           = 1'd0;
                        o_irq           = 1'd0;
                        o_fiq           = 1'd0;
                        o_fiq           = 1'd0;
                end
                end
        endcase
        endcase
end
end

powered by: WebSVN 2.1.0

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