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