CS270 Recitation 11: Combinational Circuits

Goals

  1. To design a word-level combinational circuit.

Assignment

Start from the following skeleton file: R11.circ

Exercise: 8-bit Decrementer

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.

  1. First decide on and understand the algorithm that your circuit is to implement. There are at least two options for a decrementer:

    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.

  2. Decompose the algorithm into a set of functions for each bit and write their truth tables. This is the most challenging part.

    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:

    XinASXout
     
     
     
     
  3. Now implement and test it in Logisim: