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

Subversion Repositories dbg_interface

[/] [dbg_interface/] [tags/] [sdram_test_working/] [rtl/] [verilog/] [dbg_sync_clk1_clk2.v] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mohor
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  dbg_sync_clk1_clk2.v                                        ////
4
////                                                              ////
5
////  This file is part of the SoC/OpenRISC Development Interface ////
6
////  http://www.opencores.org/cores/DebugInterface/              ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Igor Mohor (igorM@opencores.org)                      ////
10
////                                                              ////
11
////  All additional information is avaliable in the Readme.txt   ////
12
////  file.                                                       ////
13
////                                                              ////
14
//////////////////////////////////////////////////////////////////////
15
////                                                              ////
16
//// Copyright (C) 2001 Authors                                   ////
17
////                                                              ////
18
//// This source file may be used and distributed without         ////
19
//// restriction provided that this copyright statement is not    ////
20
//// removed from the file and that any derivative work contains  ////
21
//// the original copyright notice and the associated disclaimer. ////
22
////                                                              ////
23
//// This source file is free software; you can redistribute it   ////
24
//// and/or modify it under the terms of the GNU Lesser General   ////
25
//// Public License as published by the Free Software Foundation; ////
26
//// either version 2.1 of the License, or (at your option) any   ////
27
//// later version.                                               ////
28
////                                                              ////
29
//// This source is distributed in the hope that it will be       ////
30
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
31
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
32
//// PURPOSE.  See the GNU Lesser General Public License for more ////
33
//// details.                                                     ////
34
////                                                              ////
35
//// You should have received a copy of the GNU Lesser General    ////
36
//// Public License along with this source; if not, download it   ////
37
//// from http://www.opencores.org/lgpl.shtml                     ////
38
////                                                              ////
39
//////////////////////////////////////////////////////////////////////
40
//
41
// CVS Revision History
42
//
43
// $Log: not supported by cvs2svn $
44 20 mohor
// Revision 1.2  2001/10/19 11:40:01  mohor
45
// dbg_timescale.v changed to timescale.v This is done for the simulation of
46
// few different cores in a single project.
47
//
48 17 mohor
// Revision 1.1.1.1  2001/09/13 13:49:19  mohor
49
// Initial official release.
50 2 mohor
//
51
//
52
//
53 17 mohor
//
54 2 mohor
// 
55
 
56 20 mohor
// synopsys translate_off
57 17 mohor
`include "timescale.v"
58 20 mohor
// synopsys translate_on
59 2 mohor
 
60
// FF in clock domain 1 is being set by a signal from the clock domain 2
61
module dbg_sync_clk1_clk2 (clk1, clk2, reset1, reset2, set2, sync_out);
62
 
63
parameter   Tp = 1;
64
 
65
input   clk1;
66
input   clk2;
67
input   reset1;
68
input   reset2;
69
input   set2;
70
 
71
output  sync_out;
72
 
73
reg     set2_q;
74
reg     set2_q2;
75
reg     set1_q;
76
reg     set1_q2;
77
reg     clear2_q;
78
reg     clear2_q2;
79
reg     sync_out;
80
 
81
wire    z;
82
 
83
assign z = set2 | set2_q & ~clear2_q2;
84
 
85
 
86
// Latching and synchronizing "set" to clk2
87
always @ (posedge clk2 or posedge reset2)
88
begin
89
  if(reset2)
90
    set2_q <=#Tp 1'b0;
91
  else
92
    set2_q <=#Tp z;
93
end
94
 
95
 
96
always @ (posedge clk2 or posedge reset2)
97
begin
98
  if(reset2)
99
    set2_q2 <=#Tp 1'b0;
100
  else
101
    set2_q2 <=#Tp set2_q;
102
end
103
 
104
 
105
// Synchronizing "set" to clk1
106
always @ (posedge clk1 or posedge reset1)
107
begin
108
  if(reset1)
109
    set1_q <=#Tp 1'b0;
110
  else
111
    set1_q <=#Tp set2_q2;
112
end
113
 
114
 
115
always @ (posedge clk1 or posedge reset1)
116
begin
117
  if(reset1)
118
    set1_q2 <=#Tp 1'b0;
119
  else
120
    set1_q2 <=#Tp set1_q;
121
end
122
 
123
 
124
// Synchronizing "clear" to clk2
125
always @ (posedge clk2 or posedge reset2)
126
begin
127
  if(reset2)
128
    clear2_q <=#Tp 1'b0;
129
  else
130
    clear2_q <=#Tp set1_q2;
131
end
132
 
133
 
134
always @ (posedge clk2 or posedge reset2)
135
begin
136
  if(reset2)
137
    clear2_q2 <=#Tp 1'b0;
138
  else
139
    clear2_q2 <=#Tp clear2_q;
140
end
141
 
142
 
143
always @ (posedge clk1 or posedge reset1)
144
begin
145
  if(reset1)
146
    sync_out <=#Tp 1'b0;
147
  else
148
    sync_out <=#Tp set1_q2;
149
end
150
 
151
endmodule

powered by: WebSVN 2.1.0

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