Sobakava
Full Member level 6
FIXED Entry: VERILOG
I have problem with following code:
Module has a clock input. It generates some
outputs. For instance, I need a frame pulse
at the output (5 cycle duration) at every
56 cycles of clock. There is a F1 output.
It is High until 30th cycle, then it will
be half of clock.
F2 should be F1&Clock signal.
But there are some unwanted short pulses (X) appear on F2:
............................ a
|11111111|_________|11111111|_____clock
_|111111111111111111|_____________F1
__|11111111|_________|X|__________F2
//I hope this diagram looks fine after submit //
I think because of the delay clock to F1, F1 and clock
becomes High at (a). (then F2=F1 AND CLOCK becomes high)
I synthesised this to Altera FLEX EPF10K10 FPGA and I
see the (X) pulse (10ns width and ~1V amplitude) @40Mhz clock
by and oscilloscope. It appears also simulation.
How can I eliminate such unwanted signals in Verilog design?
Regards
module generator(clock,frame,cycle,F1,F2);
input clock;
output F1,F2;
reg F1;
output [12:0] cycle;
reg [12:0] cycle;
output frame;
reg frame;
assign F2=F1&clock;
always @(posedge clock)
begin
cycle=cycle+1;
if (cycle < 30)
F1=1;
else
F1=~F1;
if (cycle == 50)
frame=1;
if (cycle == 55)
frame=0;
if (cycle==56)
cycle=0;
end
endmodule
I have problem with following code:
Module has a clock input. It generates some
outputs. For instance, I need a frame pulse
at the output (5 cycle duration) at every
56 cycles of clock. There is a F1 output.
It is High until 30th cycle, then it will
be half of clock.
F2 should be F1&Clock signal.
But there are some unwanted short pulses (X) appear on F2:
............................ a
|11111111|_________|11111111|_____clock
_|111111111111111111|_____________F1
__|11111111|_________|X|__________F2
//I hope this diagram looks fine after submit //
I think because of the delay clock to F1, F1 and clock
becomes High at (a). (then F2=F1 AND CLOCK becomes high)
I synthesised this to Altera FLEX EPF10K10 FPGA and I
see the (X) pulse (10ns width and ~1V amplitude) @40Mhz clock
by and oscilloscope. It appears also simulation.
How can I eliminate such unwanted signals in Verilog design?
Regards
module generator(clock,frame,cycle,F1,F2);
input clock;
output F1,F2;
reg F1;
output [12:0] cycle;
reg [12:0] cycle;
output frame;
reg frame;
assign F2=F1&clock;
always @(posedge clock)
begin
cycle=cycle+1;
if (cycle < 30)
F1=1;
else
F1=~F1;
if (cycle == 50)
frame=1;
if (cycle == 55)
frame=0;
if (cycle==56)
cycle=0;
end
endmodule