Fall 2010, Siena College

Lecture 02: Binary Arithmetic; Signed Representations; Signed Arithmetic
Date: Thursday, September 9, 2010

Agenda

• Announcements
• First lecture assignment due now.
• Computer Science Seminar tomorrow: Dr. Lim and other members of the department talking about research opportunities. 3:30 PM, RB 328 (right here).
• Office hours posted but may change - see course web page.
• Need to finalize the lab schedule: can everyone make either our regularly-scheduled Friday lab (10:25-12:25) or one on a Friday afternoon (say, 2-4)?
• Accessing class examples: ~jteresco/shared/cs220 in our labs and on olsen.
• What is hardware? Ask Scooter Computer and Mr. Chips!
• Character representations
• Memory model and pointers
• Unsigned math
• multiplication
• Signed math
• signed representations
• multiplication

Lecture Assignment 02

Due at the start of class, Tuesday, September 14.

Please submit answers to these questions either as a hard copy (typeset or handwritten are OK) or by email to jteresco AT siena.edu by the start of class. We will discuss these questions at the start of class, so no late submissions are accepted.

1. Represent each of the following quantities using each of the following 8 bit representations, where possible: unsigned, signed magnitude, 1's complement, 2's complement. Values are given in base 10, and characters are ASCII. Express each as both an 8-bit binary number and a 2-digit hexadecimal number.
For example, to represent the value -17, the unsigned representation is not possible, the signed magnitude representation is 100100012 or 9116, the 1's complement representation is 111011102 or EE16 and the 2's complement representation is 111011112 or EF16.
• 0
• 11
• -42
• 42
• -127
• 127
• -128
• 128
• 255
• the character '6' (see man ascii)
2. Compute the following binary 2's complement problems in 4 bits. Which answers to you trust and why (your reasons should refer to values that can easily be checked by computer such as values of carry bits)?
``` 0001      0001      1001      1111
+0101     +0111     +1111     +0101
----      ----      ----      ----

```
3. The following problems are expressed in 8 bit, hexadecimal, 2's complement. Compute the result as 16 bit 2's complement expressed in hex. Which answers do you trust?
```  FF        FF        01        4c       7f       80
+ 11      + FF      + 7F      x 04     x 7f     x 80
----      ----      ----      ----     ----     ----

```