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

Subversion Repositories versatile_library

[/] [versatile_library/] [trunk/] [rtl/] [verilog/] [versatile_library_altera.v] - Diff between revs 148 and 149

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

Rev 148 Rev 149
Line 5198... Line 5198...
input [31:0] din; // data in operand
input [31:0] din; // data in operand
input [4:0] s; // shift operand
input [4:0] s; // shift operand
input [1:0] opcode;
input [1:0] opcode;
output [31:0] dout;
output [31:0] dout;
parameter opcode_sll = 2'b00;
parameter opcode_sll = 2'b00;
//parameter opcode_srl = 2'b01;
parameter opcode_srl = 2'b01;
parameter opcode_sra = 2'b10;
parameter opcode_sra = 2'b10;
//parameter opcode_ror = 2'b11;
parameter opcode_ror = 2'b11;
 
parameter mult=0; // if set to 1 implemented based on multipliers which saves LUT
 
generate
 
if (mult==1) begin : impl_mult
wire sll, sra;
wire sll, sra;
assign sll = opcode == opcode_sll;
assign sll = opcode == opcode_sll;
assign sra = opcode == opcode_sra;
assign sra = opcode == opcode_sra;
wire [15:1] s1;
wire [15:1] s1;
wire [3:0] sign;
wire [3:0] sign;
Line 5261... Line 5264...
assign dout[7:0]   = (s[4:3]==2'b00) ? tmp[0] :
assign dout[7:0]   = (s[4:3]==2'b00) ? tmp[0] :
                     (sll) ?  {8{1'b0}}:
                     (sll) ?  {8{1'b0}}:
                     (s[4:3]==2'b01) ? tmp[1] :
                     (s[4:3]==2'b01) ? tmp[1] :
                     (s[4:3]==2'b10) ? tmp[2] :
                     (s[4:3]==2'b10) ? tmp[2] :
                     tmp[3];
                     tmp[3];
 
end else begin : impl_classic
 
reg [31:0] dout;
 
`ifdef SYSTEMVERILOG
 
always_comb
 
`else
 
always @ (din or s or opcode)
 
`endif
 
    case (opcode)
 
    opcode_sll: dout = din << s;
 
    opcode_srl: dout = din >> s;
 
    opcode_sra: dout = (din >> s) | ({32,din[31]}} << (6'd32-{1'b0,s}}));
 
    //opcode_ror: dout = not yet implemented
 
    default: dout = din << s;
 
    endcase
 
end
 
engenerate
endmodule
endmodule
// logic unit
// logic unit
// supporting the following logic functions
// supporting the following logic functions
//    a and b
//    a and b
//    a or  b
//    a or  b

powered by: WebSVN 2.1.0

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