Forum Discussion

DBarn22's avatar
DBarn22
Icon for New Contributor rankNew Contributor
5 years ago
Solved

All code not being run every time

I have a verilog module designed to process an encoder signal, I have been having problems so have cut it down to a minimum that demonstrates the kind of problem. File is attached (and cited below)....
  • sstrell's avatar
    5 years ago

    It's hard to tell without zooming in, but it looks like enc and enc_prev are going low simultaneously, so they wouldn't trigger the if statement at all. You might be seeing glitches because enc is not registered. It looks like a truly asynchronous input, so there's no guarantees with that if statement. I'd register enc and then do the if check.

    If you do, you might also think about doing negedge enc in the sensitivity list.

    #iwork4intel