Home › Practice › RTL Design › Widen a signed number

Widen a signed number

EasyRTLcombinationalarithmetic

Your 4-bit thermometer reads from -8 to +7. It has to be sent on an 8-bit bus, and the number it shows must not change on the way.

Concept first. In two's complement the top bit has a negative weight. In 4 bits the top bit is worth -8, and the others are worth +4, +2, +1. So 1111 is -8+4+2+1 = -1, and 0011 is +3. When you move to 8 bits, the new top bits must make the value come out the same. Try it: what must the four new bits be to keep 1111 equal to -1? And to keep 0011 equal to 3? Then ask what decided the answer each time.

What to build.

Solve in your browser →

No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.

More in this track

← Is it a decimal digit?Guard bits that find a flip →