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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [rtl/] [lib/] [double_sync_high.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dinesha
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OMS 8051 cores common library Module                        ////
4
////                                                              ////
5
////  This file is part of the OMS 8051 cores project             ////
6
////  http://www.opencores.org/cores/oms8051mini/                 ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  OMS 8051 definitions.                                       ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////    nothing                                                   ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Dinesh Annayya, dinesha@opencores.org                 ////
16
////                                                              ////
17
////  Revision : Nov 26, 2016                                     //// 
18
////                                                              ////
19
//////////////////////////////////////////////////////////////////////
20
////                                                              ////
21
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
22
////                                                              ////
23
//// This source file may be used and distributed without         ////
24
//// restriction provided that this copyright statement is not    ////
25
//// removed from the file and that any derivative work contains  ////
26
//// the original copyright notice and the associated disclaimer. ////
27
////                                                              ////
28
//// This source file is free software; you can redistribute it   ////
29
//// and/or modify it under the terms of the GNU Lesser General   ////
30
//// Public License as published by the Free Software Foundation; ////
31
//// either version 2.1 of the License, or (at your option) any   ////
32
//// later version.                                               ////
33
////                                                              ////
34
//// This source is distributed in the hope that it will be       ////
35
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
36
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
37
//// PURPOSE.  See the GNU Lesser General Public License for more ////
38
//// details.                                                     ////
39
////                                                              ////
40
//// You should have received a copy of the GNU Lesser General    ////
41
//// Public License along with this source; if not, download it   ////
42
//// from http://www.opencores.org/lgpl.shtml                     ////
43
////                                                              ////
44
//////////////////////////////////////////////////////////////////////
45
//----------------------------------------------------------------------------
46
// Simple Double sync logic with Reset value = 0
47
// This double signal should be used for signal transiting from low to high
48
//----------------------------------------------------------------------------
49
 
50
module double_sync_high   (
51
              in_data    ,
52
              out_clk    ,
53
              out_rst_n  ,
54
              out_data
55
          );
56
 
57
parameter WIDTH = 1;
58
 
59
input [WIDTH-1:0]    in_data    ; // Input from Different clock domain
60
input                out_clk    ; // Output clock
61
input                out_rst_n  ; // Active low Reset
62
output[WIDTH-1:0]    out_data   ; // Output Data
63
 
64
 
65
reg [WIDTH-1:0]     in_data_s  ; // One   Cycle sync 
66
reg [WIDTH-1:0]     in_data_2s ; // two   Cycle sync 
67
reg [WIDTH-1:0]     in_data_3s ; // three Cycle sync 
68
 
69
assign out_data =  in_data_3s;
70
 
71
always @(negedge out_rst_n or posedge out_clk)
72
begin
73
   if(out_rst_n == 1'b0)
74
   begin
75
      in_data_s  <= {WIDTH{1'b0}};
76
      in_data_2s <= {WIDTH{1'b0}};
77
      in_data_3s <= {WIDTH{1'b0}};
78
   end
79
   else
80
   begin
81
      in_data_s  <= in_data;
82
      in_data_2s <= in_data_s;
83
      in_data_3s <= in_data_2s;
84
   end
85
end
86
 
87
 
88
endmodule

powered by: WebSVN 2.1.0

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