Start from the following skeleton file: R11.circ
You will design a circuit that takes an 8-bit 2's complement number A as input, and produces A - 1. You need to do a stepwise design.
Option 1: to decrement 1 from any (2's complement or unsigned) binary integer, we use the grade school algorithm: work our way from the least significant bit (LSB) to the left towards the most significant bit (MSB). Work out three examples on paper.
Option 2: we can add the 2's complement of 1 (i.e., -1) to the number. Work out three examples on paper.
In both options, the logic for each bit needs two inputs (A and Xin) and two outputs (S and Xout). A is the value of the bit. S is the result of the decrement for that bit position. Xin and Xout have different meanings depending on the option you chose:
Option 1: Xin is the borrow-in bit. If it is 1, it means that the bit position to the right needs to borrow. Xout is the borrow-out bit. If it is 1, it means that this bit position needs to borrow from the left. This is exactly how we would subtract numbers by hand.
Option 2: Xin is the carry-in bit. If it is 1, it means that the bit position to the right generated a carry bit. Xout is the carry-out bit. If it is 1, it means that this bit position needs to carry a bit to the left.
Build the truth table for a bit position according to the option you chose and have your TA check it before you proceed:
Xin | A | S | Xout |