/* -*-Verilog-*-
*******************************************************************************
*
* File: divide_by_32768.v
* RCS: $Header: $
* Description:
* Author: Costas Calamvokis
* Language: Verilog
* Package: N/A
* Status: Experimental (Do Not Distribute)
*
* Copyright (c) 1998 Costas Calamvokis, all rights reserved.
*
*******************************************************************************
*/
module divide_by_32768 (
clk,
reset,
enable,
out);
input clk;
input reset;
input enable;
output out;
reg [14:0] count;
wire [14:0] new_count = count + 1;
assign out = (count == 15'b11111111111111);
always @(posedge clk)
begin
if (reset)
begin
count = 0;
end
else if (enable)
begin
count = new_count; // wrapping happens automatically
end
end
endmodule
/*
* Click on this link to go back to v2html home page:
* http:../../../v2html.html
*/