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

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64/] [rtl/] [lib/] [ParallelToSerial.v] - Blame information for rev 47

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 46 robfinch
// ============================================================================
2
//      2006,2007,2011  Robert Finch
3
//      robfinch@<remove>sympatico.ca
4
//
5
//      ParallelToSerial.v
6
//              Parallel to serial data converter (shift register).
7
//
8
// This source file is free software: you can redistribute it and/or modify 
9
// it under the terms of the GNU Lesser General Public License as published 
10
// by the Free Software Foundation, either version 3 of the License, or     
11
// (at your option) any later version.                                      
12
//                                                                          
13
// This source file 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            
16
// GNU General Public License for more details.                             
17
//                                                                          
18
// You should have received a copy of the GNU General Public License        
19
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
20
//                                                                          
21
// ============================================================================
22
//
23
module ParallelToSerial(rst, clk, ce, ld, qin, d, qh);
24
parameter WID=8;
25
input rst;                      // reset
26
input clk;                      // clock
27
input ce;                       // clock enable
28
input ld;                       // load
29
input qin;                      // serial shifting input
30
input [WID:1] d;        // data to load
31
output qh;                      // serial output
32
 
33
reg [WID:1] q;
34
 
35
always @(posedge clk)
36
        if (rst)
37
                q <= 0;
38
        else if (ce) begin
39
                if (ld)
40
                        q <= d;
41
                else
42
                        q <= {q[WID-1:1],qin};
43
        end
44
 
45
assign qh = q[WID];
46
 
47
endmodule

powered by: WebSVN 2.1.0

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