Verilog Coding
I am getting the following error
[Synth 8-403] loop limit (65536) exceeded
Could somebody please help, the design code is as below:
module latchregister_4bit(
input clk, reset,
input in,
output reg pulse,
output [3:0]out);
parameter DUTY = 50; // in percentage
parameter clk_pd = 10;
parameter clk_on = (DUTY * clk_pd) / 100;
parameter clk_off = (100 - DUTY) * clk_pd / 100;
reg start_clk;
// Initialize variables to zero
initial
begin
start_clk <= 0;
pulse <= 0;
end
always@(posedge clk or negedge clk) begin
if(clk)
start_clk = 1;
else
start_clk = 0;
end
// Achieve duty cycle by a skewed clock on/off
// run as long as the clocks are turned on.
always@(posedge start_clk) begin
if (start_clk) begin
pulse = 1;
while (start_clk) begin
#(clk_on) pulse = 0;
#(clk_off) pulse = 1;
end
pulse = 0;
end
end
reg [3:0]q;
always@(pulse)
begin
if(reset)
q<=4'b0000;
else if(pulse)
q<={in,q[3:1]};
end
assign out = q;
endmodule