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

Subversion Repositories xilinx_virtex_fp_library

[/] [xilinx_virtex_fp_library/] [trunk/] [DualPathFPAdderMappedConversions/] [shifter.v] - Diff between revs 11 and 19

Only display areas with differences | Details | Blame | View Log

Rev 11 Rev 19
 
 
 
 
`timescale 1ns / 1ps
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Company:     UPT
// Engineer: 
// Engineer:    Constantina-Elena Gavriliu
// 
// 
// Create Date:    18:00:33 10/15/2013 
// Create Date:    18:00:33 10/15/2013 
// Design Name: 
// Design Name: 
// Module Name:    shifter 
// Module Name:    shifter 
// Project Name: 
// Project Name: 
// Target Devices: 
// Target Devices: 
// Tool versions: 
// Tool versions: 
// Description: 
// Description: 
//
//
// Dependencies: 
// Dependencies:        d_ff.v
//
//
// Revision: 
// Revision: 
// Revision 0.01 - File Created
// Revision 0.01 - File Created
// Additional Comments: 
// Additional Comments: 
//
//
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
 
 
module shifter #(       parameter                INPUT_SIZE = 13,
module shifter #(       parameter                INPUT_SIZE = 13,
                                                parameter                SHIFT_SIZE = 4,
                                                parameter                SHIFT_SIZE = 4,
                                                parameter                OUTPUT_SIZE = 24, //>INPUT_SIZE
                                                parameter                OUTPUT_SIZE = 24, //>INPUT_SIZE
                                                parameter                DIRECTION = 1,
                                                parameter                DIRECTION = 1,
                                                parameter                PIPELINE = 1,
                                                parameter                PIPELINE = 1,
                                                parameter [7:0]          POSITION = 8'b00000000)
                                                parameter [7:0]          POSITION = 8'b00000000)
                                        (a, arith, shft, shifted_a);
                                        (a, arith, shft, shifted_a);
 
 
        input [INPUT_SIZE-1:0]   a;
        input [INPUT_SIZE-1:0]   a;
        input                    arith;
        input                    arith;
        input [SHIFT_SIZE-1:0]   shft;
        input [SHIFT_SIZE-1:0]   shft;
        output [OUTPUT_SIZE-1:0] shifted_a;
        output [OUTPUT_SIZE-1:0] shifted_a;
 
 
 
 
 
 
        wire [OUTPUT_SIZE-1:0]   a_temp_d[SHIFT_SIZE:0];
        wire [OUTPUT_SIZE-1:0]   a_temp_d[SHIFT_SIZE:0];
        wire [OUTPUT_SIZE-1:0]   a_temp_q[SHIFT_SIZE:0];
        wire [OUTPUT_SIZE-1:0]   a_temp_q[SHIFT_SIZE:0];
 
 
        assign a_temp_q[0][OUTPUT_SIZE-1 : OUTPUT_SIZE-INPUT_SIZE] = a;
        assign a_temp_q[0][OUTPUT_SIZE-1 : OUTPUT_SIZE-INPUT_SIZE] = a;
        assign a_temp_q[0][OUTPUT_SIZE-1-INPUT_SIZE : 0] = arith;
        assign a_temp_q[0][OUTPUT_SIZE-1-INPUT_SIZE : 0] = arith;
 
 
        generate
        generate
        begin : GENERATING
        begin : GENERATING
                genvar i;
                genvar i;
                for (i = 0; i <= SHIFT_SIZE - 1; i = i + 1)
                for (i = 0; i <= SHIFT_SIZE - 1; i = i + 1)
                begin : BARREL_SHIFTER_GENERATION
                begin : BARREL_SHIFTER_GENERATION
                        if (DIRECTION == 1)
                        if (DIRECTION == 1)
                        begin : LEFT
                        begin : LEFT
                                //begin : 1st_check
 
                                        genvar j;
                                        genvar j;
                                        for (j = 0; j <= OUTPUT_SIZE - 1; j = j + 1)
                                        for (j = 0; j <= OUTPUT_SIZE - 1; j = j + 1)
                                        begin : MUX_GEN_L
                                        begin : MUX_GEN_L
                                                if (j < 2 ** i)
                                                if (j < 2 ** i)
                                                begin : ZERO_INS_L
                                                begin : ZERO_INS_L
                                                        assign a_temp_d[i][j] = (shft[i] == 1'b0) ? a_temp_q[i][j] : arith;
                                                        assign a_temp_d[i][j] = (shft[i] == 1'b0) ? a_temp_q[i][j] : arith;
                                                end
                                                end
 
 
                                                if (j >= 2 ** i)
                                                if (j >= 2 ** i)
                                                begin : BIT_INS_L
                                                begin : BIT_INS_L
                                                        assign a_temp_d[i][j] = (shft[i] == 1'b0) ? a_temp_q[i][j] : a_temp_q[i][j-2**i];
                                                        assign a_temp_d[i][j] = (shft[i] == 1'b0) ? a_temp_q[i][j] : a_temp_q[i][j-2**i];
                                                end
                                                end
                                        end
                                        end
                                //end
 
                                  end
                                  end
 
 
                        if (DIRECTION == 0)
                        if (DIRECTION == 0)
                        begin : RIGHT
                        begin : RIGHT
                                //begin : 2nd_check
 
                                        genvar j;
                                        genvar j;
                                        for (j = 0; j <= OUTPUT_SIZE - 1; j = j + 1)
                                        for (j = 0; j <= OUTPUT_SIZE - 1; j = j + 1)
                                        begin : MUX_GEN_R
                                        begin : MUX_GEN_R
                                                if (OUTPUT_SIZE - 1 < 2 ** i + j)
                                                if (OUTPUT_SIZE - 1 < 2 ** i + j)
                                                begin : ZERO_INS_R
                                                begin : ZERO_INS_R
                                                        assign a_temp_d[i][j] = (shft[i] == 1'b0) ? a_temp_q[i][j] : arith;
                                                        assign a_temp_d[i][j] = (shft[i] == 1'b0) ? a_temp_q[i][j] : arith;
                                                end
                                                end
 
 
                                                if (OUTPUT_SIZE - 1 >= 2 ** i + j)
                                                if (OUTPUT_SIZE - 1 >= 2 ** i + j)
                                                begin : BIT_INS_R
                                                begin : BIT_INS_R
                                                        assign a_temp_d[i][j] = (shft[i] == 1'b0) ? a_temp_q[i][j] : a_temp_q[i][j+2**i];
                                                        assign a_temp_d[i][j] = (shft[i] == 1'b0) ? a_temp_q[i][j] : a_temp_q[i][j+2**i];
                                                end
                                                end
                                        end
                                        end
                                //end
 
                        end
                        end
 
 
                        if (PIPELINE != 0)
                        if (PIPELINE != 0)
                        begin : PIPELINE_INSERTION
                        begin : PIPELINE_INSERTION
                                if (POSITION[i] == 1'b1)
                                if (POSITION[i] == 1'b1)
                                begin : LATCH
                                begin : LATCH
                                        d_ff #(OUTPUT_SIZE) D_INS(.clk(clk), .rst(rst), .d(a_temp_d[i]), .q(a_temp_q[i + 1]));
                                        d_ff #(OUTPUT_SIZE) D_INS(.clk(clk), .rst(rst), .d(a_temp_d[i]), .q(a_temp_q[i + 1]));
                                end
                                end
 
 
                                if (POSITION[i] == 1'b0)
                                if (POSITION[i] == 1'b0)
                                begin : NO_LATCH
                                begin : NO_LATCH
                                        assign a_temp_q[i + 1] = a_temp_d[i];
                                        assign a_temp_q[i + 1] = a_temp_d[i];
                                end
                                end
                        end
                        end
 
 
                        if (PIPELINE == 0)
                        if (PIPELINE == 0)
                        begin : NO_PIPELINE
                        begin : NO_PIPELINE
                                assign a_temp_q[i + 1] = a_temp_d[i];
                                assign a_temp_q[i + 1] = a_temp_d[i];
                        end
                        end
                end
                end
        end
        end
        endgenerate
        endgenerate
 
 
        assign shifted_a = a_temp_q[SHIFT_SIZE];
        assign shifted_a = a_temp_q[SHIFT_SIZE];
 
 
endmodule
endmodule
 
 
 
 

powered by: WebSVN 2.1.0

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