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

Subversion Repositories or1k

[/] [or1k/] [tags/] [first/] [mp3/] [rtl/] [verilog/] [dbg_interface/] [dbg_sync_clk1_clk2.v] - Blame information for rev 266

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

Line No. Rev Author Line
1 266 lampret
//////////////////////////////////////////////////////////////////////
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
// Revision 1.1.1.1  2001/10/06 10:19:09  igorm
45
// no message
46
//
47
// Revision 1.1.1.1  2001/09/13 13:49:19  mohor
48
// Initial official release.
49
//
50
//
51
//
52
//
53
// 
54
 
55
`include "dbg_timescale.v"
56
 
57
// FF in clock domain 1 is being set by a signal from the clock domain 2
58
module dbg_sync_clk1_clk2 (clk1, clk2, reset1, reset2, set2, sync_out);
59
 
60
parameter   Tp = 1;
61
 
62
input   clk1;
63
input   clk2;
64
input   reset1;
65
input   reset2;
66
input   set2;
67
 
68
output  sync_out;
69
 
70
reg     set2_q;
71
reg     set2_q2;
72
reg     set1_q;
73
reg     set1_q2;
74
reg     clear2_q;
75
reg     clear2_q2;
76
reg     sync_out;
77
 
78
wire    z;
79
 
80
assign z = set2 | set2_q & ~clear2_q2;
81
 
82
 
83
// Latching and synchronizing "set" to clk2
84
always @ (posedge clk2 or posedge reset2)
85
begin
86
  if(reset2)
87
    set2_q <=#Tp 1'b0;
88
  else
89
    set2_q <=#Tp z;
90
end
91
 
92
 
93
always @ (posedge clk2 or posedge reset2)
94
begin
95
  if(reset2)
96
    set2_q2 <=#Tp 1'b0;
97
  else
98
    set2_q2 <=#Tp set2_q;
99
end
100
 
101
 
102
// Synchronizing "set" to clk1
103
always @ (posedge clk1 or posedge reset1)
104
begin
105
  if(reset1)
106
    set1_q <=#Tp 1'b0;
107
  else
108
    set1_q <=#Tp set2_q2;
109
end
110
 
111
 
112
always @ (posedge clk1 or posedge reset1)
113
begin
114
  if(reset1)
115
    set1_q2 <=#Tp 1'b0;
116
  else
117
    set1_q2 <=#Tp set1_q;
118
end
119
 
120
 
121
// Synchronizing "clear" to clk2
122
always @ (posedge clk2 or posedge reset2)
123
begin
124
  if(reset2)
125
    clear2_q <=#Tp 1'b0;
126
  else
127
    clear2_q <=#Tp set1_q2;
128
end
129
 
130
 
131
always @ (posedge clk2 or posedge reset2)
132
begin
133
  if(reset2)
134
    clear2_q2 <=#Tp 1'b0;
135
  else
136
    clear2_q2 <=#Tp clear2_q;
137
end
138
 
139
 
140
always @ (posedge clk1 or posedge reset1)
141
begin
142
  if(reset1)
143
    sync_out <=#Tp 1'b0;
144
  else
145
    sync_out <=#Tp set1_q2;
146
end
147
 
148
endmodule

powered by: WebSVN 2.1.0

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