
What's my mistake? Combinatorial decision
I don't think you have a DeMorganization error; it's just a matter of when
you assign things. Let me rephrase your logic:
case 1) if (a); else b=0;
case 2) if (~a) b=0;
In case 1, b only gets assigned when a is true. In case 2, b only gets
assigned when a is false. Both are equivalent in a manner, because when b
is assigned, it is always assigned to a; it's just a matter of when it gets
assigned. There seems to be some code missing in your snippet, because you
don't show when the output gets a value of 1. That code should be in the
same process, because it's poor practice to assign a variable in two
processes unless it's nonsynthesizable test code.
-Kevin
Quote:
> I must be missing something simple but it looks to me like these two cases
> should be the same (can you say De Morgan?):
> if (hndshk_to_fpga | inc_ndx | rst_ndx) begin
> //do nothing
> end
> else begin
> hndshk_from_motor = 0;
> end
> if (~hndshk_to_fpga & ~inc_ndx & ~rst_ndx) begin
> hndshk_from_motor = 0;
> end
> else begin
> //do nothing
> end
> Signal hndshk_to_fpga is a 1-bit input. Signals inc_ndx and rst_ndx are
> 1-bit registers. Example 1 works, example 2 doesn't.
> Thanks,
> Tom