K
kumar
Guest
Hi All,
I have a simple counter, the code is given below.
always @(posedge sysclk) //sysclk period @ 50 ns
if (reset)
counter <= 4'b0000;
else if (counter == 4'd13) //counter is of type reg
counter <= 4'b0000;
else if (!sig1 && sig1_q) //sig1 period @ 10us and sig1_q is the
delayed input of sig1
counter <= counter + 4'b0001;
else if (counter != 4'd0)
counter <= counter + 4'b0001;
I have run the simulation, the simulation result is as expected, the
counter will be in the zero state '0', when there is a change in the
sig1 going from high to low the counter will increment by '1'. and
then counts upto 13 and resets back to '0' till the sig1 changes from
high to low.
The problem now is that, i do a synthesis with synplify_pro, and the
resultant file is taken to a FPGA, when i see this counter in the LA
(logic analyser), the counter will be 'b1 and when there is a change
in the "sig1" signal, the counter increments in odd values, ie., from
1 -> 3 -> 5 -> 7 ......
Your inputs are very valuable.
Thanks,
Regards,
Kumar
I have a simple counter, the code is given below.
always @(posedge sysclk) //sysclk period @ 50 ns
if (reset)
counter <= 4'b0000;
else if (counter == 4'd13) //counter is of type reg
counter <= 4'b0000;
else if (!sig1 && sig1_q) //sig1 period @ 10us and sig1_q is the
delayed input of sig1
counter <= counter + 4'b0001;
else if (counter != 4'd0)
counter <= counter + 4'b0001;
I have run the simulation, the simulation result is as expected, the
counter will be in the zero state '0', when there is a change in the
sig1 going from high to low the counter will increment by '1'. and
then counts upto 13 and resets back to '0' till the sig1 changes from
high to low.
The problem now is that, i do a synthesis with synplify_pro, and the
resultant file is taken to a FPGA, when i see this counter in the LA
(logic analyser), the counter will be 'b1 and when there is a change
in the "sig1" signal, the counter increments in odd values, ie., from
1 -> 3 -> 5 -> 7 ......
Your inputs are very valuable.
Thanks,
Regards,
Kumar