Date: Wed, 10 Apr 2019 21:09:30 -0500
From: "Yale N. Patt"
To: a.deshmukh@utexas.edu, mohammadbehnia@utexas.edu, chestercai@utexas.edu
Subject: Ooops!
After class, a student asked a question, which...
Message-ID: <20190411020929.GG1791@ece.utexas.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)

My students,

After class, a student asked a question which made me realize that I made a
mistake in what I told you today in explaining Boothe's algorithm.

Ergo, this message to clear it up. I can also talk about it on Monday if
this email is not clear.

The thing I messed up involved what to do if you see the two bits: 11.
I said we subtract the mutliplicand, and then borrow 1 from the next two
digits.

WRONG!

Guess I should not sleep while I am teaching! We do not borrow 1 from the
next two bits, we ADD 1 to the next two bits.

Why?

When we see 11, we agreed that it says the multiplier bits = 3. And we agreed
that 3 = four minus 1. Minus 1 means we subtract the multiplicand. And "four"
means we ADD 1 to the next two bits. That is we are adding 1 AFTER shifting
the multiplier by two bits. "1" after shifting two bits is "4"

Now let's look at the truth table that controls (a) the behavior of the shifter
before the ALU, (b) the ALU, and (c) the shifter after the ALU.

Three inputs to the truth table: bit1, bit0 and c, where c is 1 if we need
to add 1 from the previous two bits to what bit1 and bit0 produce.

The state of these three inputs determine the three control fields:

the shift before the ALU,
the ALU, and
the shift after the ALU.

Also, whether or not we need to add 1 to the next two bit quantity,
which I have labeled c'

Notice that the output of 010 is the same as the output of 001. "010" says
we need to not shift before alu, ADD in alu, and shift 2 after ALU.

"001" says the two bits are 00, but c=1 means we need to add 1 to 00, giving
us effectively for that input combination the same output as "010."

Recall from above that "110" says subtract the multiplicand but set c'=1,
so that we will add 1 to the next two bits.

Suppose we have three pairs of 11, that is: 11 11 11. The right most 11 is 3,
so we subtract 1 and set c'=1 so we know to add 1 to the next pair of bits.
Since the middle two bits are 11, adding 1 them makes 00 with setting c'=1. The
resulting 00 means do nothing, but set c' to 1 again. This in turn causes the
left two bit (which are also 11) to be 00 and sets c'=1 again. The net effect
of all this is 111111 subtracts the multiplican, and then adds 1 to the twobit
pair six digits to the left. That is correct since 111111 = 64 - 1.

Also note, as expected that in addition to 010 and 001 causing the same outputs,
100 and 011 cause the same outputs, 110 and 101 cause the same outputs.
You see why that is the case?

Anyhow, again, sorry I got it wrong in class and I am glad I was able to catch
it quickly after class and can send you this note.

Yale Patt