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

Subversion Repositories raptor64

[/] [raptor64/] [trunk/] [rtl/] [verilog/] [lib/] [rolx4.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 robfinch
//=============================================================================
2
//      (C) 2006-2011  Robert Finch
3
//      All rights reserved.
4
//      robfinch@opencores.org
5
//
6
//      rolx4.v
7
//              Rotate or shift left by multiples of four bits.
8
//
9
//
10
//
11
// This source file is free software: you can redistribute it and/or modify 
12
// it under the terms of the GNU Lesser General Public License as published 
13
// by the Free Software Foundation, either version 3 of the License, or     
14
// (at your option) any later version.                                      
15
//                                                                          
16
// This source file is distributed in the hope that it will be useful,      
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
19
// GNU General Public License for more details.                             
20
//                                                                          
21
// You should have received a copy of the GNU General Public License        
22
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
23
//                                                                          
24
//
25
//      Rotate or arithmetic shift left by 0, 4, 8 or 12 bits.
26
//      Parameterized with a default width of 32 bits.
27
//
28
//      Resource Usage Samples:
29
//      Ref. SpartanII
30
//      64 LUTs
31
//      
32
//      Webpack 7.1i xc3s1000-4ft256
33
//      64 LUTs / 32 slices / 11 ns             (32 bits)
34
//=============================================================================
35
//
36
// rol 0,4,8 or 12 bits
37
module rolx4
38
#(parameter WID = 32)
39
(
40
input op,
41
input [WID:1] a,
42
input [1:0] b,
43
output reg [WID:1] o
44
);
45
wire [12:1] opx = {12{op}};
46
always @(a, b, opx)
47
begin
48
        case (b)
49
        2'd0:   o <= a;
50
        2'd1:   o <= {a[WID- 4%WID:1],a[WID:WID- 3%WID]&opx[ 4:1]};
51
        2'd2:   o <= {a[WID- 8%WID:1],a[WID:WID- 7%WID]&opx[ 8:1]};
52
        2'd3:   o <= {a[WID-12%WID:1],a[WID:WID-11%WID]&opx[12:1]};
53
        endcase
54
end
55
 
56
endmodule

powered by: WebSVN 2.1.0

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