CS274: Computer Architecture - Number Systems

Activity Goals

The goals of this activity are:
  1. To convert between decimal, hexadecimal, and binary number representations
  2. To explain why computers represent values in binary rather than in another number system

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: Converting From Decimal to Binary

Divide the value by 2, and append the remainder to the beginning of your output string. Repeat using the new quotient until the quotient is 0.

Number Quotient / 2 Remainder
375 187 1
187 93 1
93 46 1
46 23 0
23 11 1
11 5 1
5 2 1
2 1 0
1 0 1

Questions

  1. Using the procedure above, convert 1024 to binary.
  2. Convert 617 to binary.
  3. Why might a computer prefer to store values in binary rather than in another number system?

Model 2: Converting From Binary to Decimal

Multiply the digit (1 or 0) by its place value (2 to the power of the digit position, right to left, beginning at the 1 place), and add up the result.
In the example in the table below: 00001011001 = 1 * 1 + 0 * 2 + 0 * 4 + 1 * 8 + 1 * 16 + 0 * 32 + 1 * 64 + 0 * 128 + 0 ... = 1 + 8 + 16 + 64 = 89

Place Value 1024 512 256 128 64 32 16 8 4 2 1
0 0 0 0 1 0 1 1 0 0 1

Questions

  1. Convert 0b1000100001 from binary to decimal.
  2. Convert 0b10001001 from binary to decimal.
  3. Convert 0b101110111 from binary to decimal.

Model 3: Converting From Binary to Hexadecimal

Take each group of 4 binary values from left to right. Look them up in the table to obtain the corresponding hexadecimal digit, and output that digit.

Positionalnotationtable

Questions

  1. What is the ASCII value of the letter C and the letter K? What are these values in binary, decimal, and hexadecimal?
  2. Suppose a binary value is fewer than 4 bits, like 0b110. How can you convert this to a 4-bit binary value so that it can be looked up in the table?
  3. Convert 0b1000100001 from binary to hexadecimal.
  4. Convert 0b10001001 from binary to hexadecimal.
  5. Convert 0b101110111 from binary to hexadecimal.
  6. Convert 375 from decimal to binary, and then to hexadecimal.

Model 4: Converting From Hexadecimal to Binary

Using the binary to hexadecimal table, look up the binary representation for each hexadecimal digit. In other words, convert each hexadecimal digit to decimal, and then to binary. This will result in a four digit binary number. Output those binary bits. Repeat for each hexadecimal digit from left to right.

Questions

  1. Convert 0xCAFE from hexadecimal to binary.
  2. Convert 0x3C from hexadecimal to binary, and from binary to decimal.
  3. Convert 0xFF from hexadecimal to binary, and from binary to decimal.

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.