Silicon to Scripting 9

Equal to Zero

Should output 1 if and only if all bits in the input are 0.

We can rephrase the problem to

Output a 0 if any bits are 1

Which seems a bit confusing, but we can solve the opposite problem and invert the final output.

Output a 1 if any bits are 1

Well, that’s just a big OR gate

eq zero part 1

And all we need to do now is invert the output of the final OR.

eq zero part 2

Less than Zero

Based on the encoding scheme we picked, checking if a number is less than zero is a very easy thing to do. The highest (leftmost) bit is where the information for positive/negative is, so we can just connect that one to the output.

lt zero

part 10