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

Subversion Repositories sbd_sqrt_fp

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

Details | Compare with Previous | View Log

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