CS274: Computer Architecture - Computer Arithmetic: Addition and Subtraction Logic Gates

Activity Goals

The goals of this activity are:
  1. To design truth tables and a circuit for addition
  2. To design truth tables and circuit for overflow detection
  3. To generzlie overflow detection using only the carry bits

Supplemental Reading

Feel free to visit these resources for supplemental background reading material.

The Activity

Directions

Consider the activity models and answer the questions provided. First reflect on these questions on your own briefly, before discussing and comparing your thoughts with your group. Appoint one member of your group to discuss your findings with the class, and the rest of the group should help that member prepare their response. Answer each question individually from the activity, and compare with your group to prepare for our whole-class discussion. After class, think about the questions in the reflective prompt and respond to those individually in your notebook. Report out on areas of disagreement or items for which you and your group identified alternative approaches. Write down and report out questions you encountered along the way for group discussion.

Model 1: Logic Gates for Adding and Subtracting

A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

Questions

  1. Draw a truth table for addition for both sum and carry outputs.
  2. Draw a circuit representing the sum and carry when adding two one-bit values.

Model 2: Overflow Detection

Odometer rollover

Questions

  1. Given that overflow occurs when the sign bit of the sum differs from the sign bit of the two inputs.
  2. Generate examples of overflow when adding values of like signs together (both positive and negative). Generate examples of non-overview (for both positive and negative). Finally, generate an example adding a positive and negative value together. What do their carry bits have in common in the most significant bit?
  3. Generalize how you can detect overflow by using only the carry in and carry out bits in the most significant digit. Now, write this down in a truth table and draw a circuit for overflow detection.
  4. What is the effect of declaring a variable as an unsigned int as opposed to an int?

Submission

I encourage you to submit your answers to the questions (and ask your own questions!) using the Class Activity Questions discussion board. You may also respond to questions or comments made by others, or ask follow-up questions there. Answer any reflective prompt questions in the Reflective Journal section of your OneNote Classroom personal section. You can find the link to the class notebook on the syllabus.