| 1 |
2 |
MichaelA |
////////////////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//
|
| 3 |
|
|
// Copyright 2006-2013 by Michael A. Morris, dba M. A. Morris & Associates
|
| 4 |
|
|
//
|
| 5 |
|
|
// All rights reserved. The source code contained herein is publicly released
|
| 6 |
|
|
// under the terms and conditions of the GNU Lesser Public License. No part of
|
| 7 |
|
|
// this source code may be reproduced or transmitted in any form or by any
|
| 8 |
|
|
// means, electronic or mechanical, including photocopying, recording, or any
|
| 9 |
|
|
// information storage and retrieval system in violation of the license under
|
| 10 |
|
|
// which the source code is released.
|
| 11 |
|
|
//
|
| 12 |
|
|
// The source code contained herein is free; it may be redistributed and/or
|
| 13 |
|
|
// modified in accordance with the terms of the GNU Lesser General Public
|
| 14 |
|
|
// License as published by the Free Software Foundation; either version 2.1 of
|
| 15 |
|
|
// the GNU Lesser General Public License, or any later version.
|
| 16 |
|
|
//
|
| 17 |
|
|
// The source code contained herein is freely released WITHOUT ANY WARRANTY;
|
| 18 |
|
|
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
| 19 |
|
|
// PARTICULAR PURPOSE. (Refer to the GNU Lesser General Public License for
|
| 20 |
|
|
// more details.)
|
| 21 |
|
|
//
|
| 22 |
|
|
// A copy of the GNU Lesser General Public License should have been received
|
| 23 |
|
|
// along with the source code contained herein; if not, a copy can be obtained
|
| 24 |
|
|
// by writing to:
|
| 25 |
|
|
//
|
| 26 |
|
|
// Free Software Foundation, Inc.
|
| 27 |
|
|
// 51 Franklin Street, Fifth Floor
|
| 28 |
|
|
// Boston, MA 02110-1301 USA
|
| 29 |
|
|
//
|
| 30 |
|
|
// Further, no use of this source code is permitted in any form or means
|
| 31 |
|
|
// without inclusion of this banner prominently in any derived works.
|
| 32 |
|
|
//
|
| 33 |
|
|
// Michael A. Morris
|
| 34 |
|
|
// Huntsville, AL
|
| 35 |
|
|
//
|
| 36 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
| 37 |
|
|
|
| 38 |
|
|
`timescale 1ns / 1ps
|
| 39 |
|
|
|
| 40 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
| 41 |
|
|
// Company: Alpha Beta Technologies, Inc.
|
| 42 |
|
|
// Engineer: Michael A. Morris
|
| 43 |
|
|
//
|
| 44 |
|
|
// Create Date: 11:45:29 12/31/2006
|
| 45 |
|
|
// Design Name: USB MBP HDL
|
| 46 |
|
|
// Module Name: re1ce
|
| 47 |
|
|
// Project Name: USBMBP_HDL
|
| 48 |
|
|
// Target Devices: XC2S15-5TQ144
|
| 49 |
|
|
// Tool versions: ISE Webpack 8.2i
|
| 50 |
|
|
// Description: Multi-stage synchronizer with rising edge detection
|
| 51 |
|
|
//
|
| 52 |
|
|
// Dependencies: None
|
| 53 |
|
|
//
|
| 54 |
|
|
// Revision History:
|
| 55 |
|
|
//
|
| 56 |
|
|
// 0.01 06L31 MAM File Created
|
| 57 |
|
|
//
|
| 58 |
|
|
// 1.00 13G06 MAM Added initial values for the sync FFs
|
| 59 |
|
|
//
|
| 60 |
|
|
// Additional Comments:
|
| 61 |
|
|
//
|
| 62 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
| 63 |
|
|
|
| 64 |
|
|
module re1ce(den, din, clk, rst, trg, pls);
|
| 65 |
|
|
|
| 66 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
| 67 |
|
|
//
|
| 68 |
|
|
// Module Port Declarations
|
| 69 |
|
|
//
|
| 70 |
|
|
|
| 71 |
|
|
input den;
|
| 72 |
|
|
input din;
|
| 73 |
|
|
input clk;
|
| 74 |
|
|
input rst;
|
| 75 |
|
|
output trg;
|
| 76 |
|
|
output pls;
|
| 77 |
|
|
|
| 78 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
| 79 |
|
|
//
|
| 80 |
|
|
// Module Level Declarations
|
| 81 |
|
|
//
|
| 82 |
|
|
|
| 83 |
|
|
reg QIn;
|
| 84 |
|
|
reg [2:0] QSync;
|
| 85 |
|
|
|
| 86 |
|
|
wire Rst_QIn;
|
| 87 |
|
|
|
| 88 |
|
|
///////////////////////////////////////////////////////////////////////////////
|
| 89 |
|
|
//
|
| 90 |
|
|
// Implementation
|
| 91 |
|
|
//
|
| 92 |
|
|
|
| 93 |
|
|
assign Rst_QIn = (rst | pls);
|
| 94 |
|
|
|
| 95 |
|
|
always @(posedge din or posedge Rst_QIn) begin
|
| 96 |
|
|
if(Rst_QIn)
|
| 97 |
|
|
#1 QIn <= 1'b0;
|
| 98 |
|
|
else if(den)
|
| 99 |
|
|
#1 QIn <= den;
|
| 100 |
|
|
end
|
| 101 |
|
|
assign trg = QIn;
|
| 102 |
|
|
|
| 103 |
|
|
always @(posedge clk or posedge rst) begin
|
| 104 |
|
|
if(rst)
|
| 105 |
|
|
#1 QSync <= 3'b0;
|
| 106 |
|
|
else
|
| 107 |
|
|
#1 QSync <= {QSync[0] & ~QSync[1], QSync[0], QIn};
|
| 108 |
|
|
end
|
| 109 |
|
|
assign pls = QSync[2];
|
| 110 |
|
|
|
| 111 |
|
|
endmodule
|