no_mad
Full Member level 5
verilog code doubts
Hi all,
Here is the problem.
A)
Hi all,
Here is the problem.
A)
Code:
always @(posedge pulse or posedge rst)
begin
if(rst)
active_H <= 0;
else
active_H <= 1;
end
B)
always @(posedge clk or posedge rst)
begin
if(rst)
active_H <= 0;
else if(pulse)
active_H <= 1;
else
active_H <= active_H;
end
[\code]
# The size of pulse signal is 1 clock cycle of clk. (posedge to posedge)
Questions:
1) Which one is better? What is the impact to my design? (timing, synthesis)
2) Instead of using posedge clk to capture pulse signal, is it a good practice to use negedge clk? I have seen some people prefer to use negedge clk to capture pulse signal. The reason is pulse signal already stable. Thus, no timing violation. That's what these people told me.
In my opinion,
1) I think (B) is better than (A) because it would be much easier to synthesis and perform STA. I need to constraint only one clock, clk. Otherwise; I need to constraint pulse signal as a clock signal.
2) I would prefer to use posedge clk rather than negedge clk to capture the pulse signal. Any issue will deal later during synthesis. Tweak the design or tighter the timing constraint.
Please give your opinion and feedback to my 2 cents opinion.
Highly appreciate. Thanks
:?: