Altera_Forum
Honored Contributor
11 years agocompairing signals inside a clock sensitive process
Hi!
This code is a simplification of the actual code. clk is a 50Mhz clock signal, busy is an of chip signal coming from one of the pins. (GPIO on the DE2-115 developing board) busy_i is an internal signal and n is just a signal used to count clock periodes. process(clk) begin busy_i <= busy; n <= n + 1; if((busy_i = '1') and (busy = '0')) then state <= s_RD; elsif(n = 1500) then state <= s_RD; end if; end process; This code wil not always detect the falling edge on busy(the difference in busy_i and busy). That is also why i included the elsif statment, so that after a given count of clock periodes the state signal vil be forced the value of s_RD. So my question is: Is this some bad coding from me, or could it be somthing with the fact that busy is an of chip signal - maybe a combination of the two? Realy appreciate some thoughts! Maybe someone have hade a similar issue? Thanks! -electrosmith