Line 1... |
Line 1... |
`timescale 1ns / 1ps
|
/*
|
//////////////////////////////////////////////////////////////////////////////////
|
Author: Sebastien Riou (acapola)
|
// Company:
|
Creation date: 18:05:27 01/09/2011
|
// Engineer: Sebastien Riou
|
|
//
|
|
// Create Date: 18:05:27 01/09/2011
|
|
// Design Name:
|
|
// Module Name: clkDivider
|
|
// Project Name:
|
|
// Target Devices:
|
|
// Tool versions:
|
|
// Description:
|
|
//
|
|
// Dependencies:
|
|
//
|
|
// Revision:
|
|
// Revision 0.01 - File Created
|
|
// Additional Comments:
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
$LastChangedDate: 2011-01-29 13:16:17 +0100 (Sat, 29 Jan 2011) $
|
|
$LastChangedBy: acapola $
|
|
$LastChangedRevision: 11 $
|
|
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/sources/ClkDivider.v $
|
|
|
|
This file is under the BSD licence:
|
|
Copyright (c) 2011, Sebastien Riou
|
|
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
|
|
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
The names of contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
`default_nettype none
|
/*
|
/*
|
Basic clock divider
|
Basic clock divider
|
|
|
if divider=0
|
if divider=0
|
dividedClk=clk
|
dividedClk=clk
|
Line 31... |
Line 42... |
WARNING:
|
WARNING:
|
To change divider on the fly:
|
To change divider on the fly:
|
1. set it to 0 at least for one cycle
|
1. set it to 0 at least for one cycle
|
2. set it to the new value.
|
2. set it to the new value.
|
*/
|
*/
|
module ClkDivider(
|
module ClkDivider
|
input nReset,
|
#(//parameters to override
|
input clk, // input clock
|
parameter DIVIDER_WIDTH = 16
|
input [DIVIDER_WIDTH-1:0] divider, // divide factor
|
)
|
output dividedClk, // divided clock
|
(
|
output divideBy1,
|
input wire nReset,
|
output match,
|
input wire clk, // input clock
|
output risingMatch,
|
input wire [DIVIDER_WIDTH-1:0] divider, // divide factor
|
output fallingMatch
|
output wire dividedClk, // divided clock
|
|
output wire divideBy1,
|
|
output wire match,
|
|
output wire risingMatch,
|
|
output wire fallingMatch
|
);
|
);
|
//parameters to override
|
|
parameter DIVIDER_WIDTH = 16;
|
|
|
|
reg out;//internal divided clock
|
reg out;//internal divided clock
|
reg [DIVIDER_WIDTH-1:0] cnt;
|
reg [DIVIDER_WIDTH-1:0] cnt;
|
|
|
// if divider=0, dividedClk = clk.
|
// if divider=0, dividedClk = clk.
|
Line 71... |
Line 85... |
end
|
end
|
end
|
end
|
end
|
end
|
|
|
endmodule
|
endmodule
|
|
`default_nettype wire
|
|
|
No newline at end of file
|
No newline at end of file
|