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

Subversion Repositories sbd_sqrt_fp

[/] [sbd_sqrt_fp/] [trunk/] [sbd_shifter_left3_right2.v] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sbdesign
/****************************************************************************
2
sbd_shifter_left3_right2
3
- shift register - shifts left - towards MSB - 3 bits or shifts right -
4
   towards LSB - 2 bits
5
 
6
Copyright (C) 2005 Samuel Brown
7
sam.brown@sbdesign.org
8
 
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Lesser General Public
11
License as published by the Free Software Foundation; either
12
version 2.1 of the License, or (at your option) any later version.
13
 
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
Lesser General Public License for more details.
18
 
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22
 
23
****************************************************************************/
24
 
25
module sbd_shifter_left3_right2 (SINLSB,SINMSB,PIN,LOAD,LR,RST,SHIFT,CLK,POUT);
26
 
27
parameter bitlength = 48;
28
 
29
input [2:0] SINLSB;
30
input [1:0] SINMSB;
31
input [bitlength-1:0] PIN;
32
input LOAD;
33
input LR;
34
input RST;
35
input SHIFT;
36
input CLK;
37
output wire [bitlength-1:0] POUT;
38
 
39
reg [bitlength-1:0] writeData, readData;
40
wire [1:0] sel = { LOAD, LR };
41
 
42
assign POUT = readData;
43
 
44
always @ ( posedge CLK)
45
begin:shiftreg
46
   if(RST) readData <= 0;
47
   else if(SHIFT | LOAD) readData <= writeData;
48
end
49
 
50
always @ (sel, readData, SINLSB, SINMSB, PIN)
51
begin:loadmux
52
   casez(sel)
53
      2'b00: writeData = { readData[bitlength-4:0], SINLSB };
54
      2'b01: writeData = { SINMSB, readData[bitlength-1:2] };
55
      2'b1z: writeData = PIN;
56
   endcase
57
end
58
 
59
endmodule

powered by: WebSVN 2.1.0

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