Rational clock divider - Division by 4.5 example
Module : `timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Weekendvlsi.blogspot.com // Engineer: Weekendvlsi // Create Date: // Design Name: Rational clock divider - Division by 4.5 // Module Name: clk_div // Project Name: // Target Devices: // Tool Versions: // Description: // Dependencies: // Revision: // Revision 0.01 - File Created // Additional Comments: // ////////////////////////////////////////////////////////////////////////////////// module clk_div (clk,rst,clk_4_5); input clk; input rst; output clk_4_5; reg [8:0] count; reg SATcount1,SATcount5,SATcount6 ; /* Counter rst value : 9?b000000001 */ /* count is a ring counter */ always @( posedge clk or posedge rst) if (rst) count <='d1; else begin count <= count << 1; count[0] <= count[8]; end always @(negedge clk or posedge rst) ...