Home › Practice › RTL Design › Borrowing in one column
Borrowing in one column
EasyRTLcombinationalarithmetic
You are subtracting two binary numbers on paper. In one column you must work out 0 minus 1, which you cannot do, so you borrow from the column on the left.
Concept first. In one binary column, a minus b gives two answers: a difference bit that stays in this column, and a borrow bit that tells the next column to the left that you took a 2 from it. There are only four cases. Two are easy: 0-0 is 0 with no borrow, and 1-0 is 1 with no borrow. Work out 1-1 yourself, then the tricky one, 0-1: you cannot take 1 from 0, so borrow a 2 from the left. What is left in this column? Fill in the little table, then look at each of the two answer columns on its own.
What to build.
half_sub(a, b)computesa - bfor one bit.- Outputs:
d(the difference bit) andbout(the borrow out). - No clock. The outputs follow the inputs.
No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.