Initial commit for new branch

This commit is contained in:
Imants Pulkstenis
2020-04-04 00:16:44 +03:00
parent b132a68ca2
commit ab92a0c8a8
26 changed files with 373 additions and 1094 deletions
+41
View File
@@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////
// Author - Imants Pulkstenis
// Date - 04.04.2020
// Project name - Audio FFT on FPGA
// Module name - clock divider
//
// Detailed module description:
// This module devide FPGA input clock
// by DIVIDER. Result is 50% duty cicle
// pulses.
//
// Revision:
// A - initial design
// B -
// C -
//
///////////////////////////////////////////////////////////////////
module clock_divider #(
parameter WIDTH =2,
parameter DIVIDER =(2**WIDTH)
) (
input clk_in,
output clk_out);
reg state=1'b0, next_state=1'b1;
reg [WIDTH-1:0] counter = DIVIDER-1 ;
always@(posedge clk_in)begin
state <= next_state;
if ( counter == 0) begin
next_state <= ~next_state;
counter <= DIVIDER-1;
end
else if (counter >= 0 )
counter <= counter - 1;
end
assign clk_out = state;
endmodule