Andy wrote:
>
> Is this misbehavior observable in HW, or in gate-level/full-timing
> simulation, and/or in RTL simulation? If either or both of the 1st
> two, I would suspect an improperly synchronized input (sdl or mode) or
> a timing problem (how fast is your clock?). Using the variable
> (depending on where you assign and read it) may eliminate a register
> that is created by the signal version, and that register may be
> correcting your synchronization (of sdl). If the 3rd is happening,
> you have a tool problem in your simulator, or your code is not exactly
> as posted. You could try nesting the 2nd if-then inside the first, and
> get rid of the 2nd comparison to "10", but this should not make any
> difference.
>
> Andy
Hi Andy,
This happens in gate-level/full-timing simulation.
After some experimentation I have now an new set
of interesting info, and specifically one that
tells a lot

Behaviour changed to normal some fits after when I changed
something totally unrelated to this that changed dramatically
the FPGA fit... and stayed behaving well from that moment on.
(ask me if I trust it now !!!
Clock is 200MHz but the SCK,SDA and SLD run at 5MHz or less
hence my comment of mode and etc being stable for ages.
However since mode was clocked into a register that might
be related with the issue.
Funny enough, as mode is a two bit signal I tried it
through all individual 4 combinations "00" "01" "10" and "11"
and it failed all so was not the value of mode that was wrong
but the logic generated that was invalid and returned always
false...
this got to be very wrong.
now I can't reproduce the problem anymore, unless I use that
specific old_version from two days ago
---
While I had the abnormal behavior moving the variable
assignment to the bottom (as suggested) made no difference.
and nesting the two IFs did not work as well.
---
This was quite entertaining...

As I was imagining a coding fault from me
the usual and most probable !
Thanks for your help, it was very helpful
after all, and I learned a lot.
Luis C.
p.s.(privately I can tell you what fpga family, vendor and tool chain
I was using if you are interested to know.)