Jump to content

Tutorial:Computer Architecture (Computer Science)

From UoB Wiki

This is a tutorial for the Computer Architecture (Computer Science) course. It will cover all the lessons discussed in the course to help review for the coming quizzes, midterm, and final.

Introduction

Data Representation

Numbers can be represented in multiple ways, the most familiar of which would be the decimal system, base-10, or radix-10, such as 1, 17, 42, and 500. It's called radix-10 because radix means the number of unique digits used, and this system uses 10 different symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

Computers, on the other hand, use a different form of number representation called binary, or radix-2. There are only two digits in this system, 0 and 1. This is particularly useful in computers, as data can be represented as "off" and "on", or "low" and "high" using electricity in the hardware-level. An example of a binary number is (11001010)2.

There are an infinite amount of ways to represent numbers, but the ones that we will be mostly using throughout this course are: binary (radix-2), ternary (radix-3), octal (radix-8), decimal (base-10), and hexadecimal (radix-16).

Formatting

In general, any number can be represented as its digits and its radix as (dn1,dn2,,d1,d0)r, where n is the number of digits, dn1 is the digit at position n1, and r is the radix. We will be using this way of formatting numbers throughout the course.

More examples of this formatting:

  • (10111010)2 is binary
  • (2026)10 is decimal
  • (82)8 is octal
  • (13EF0894)16 is hexadecimal
  • (D0D0CACA)16 is hexadecimal
  • (21012)3 is ternary
  • (100101)10 is decimal

As you might have seen, we don't have enough symbols to represent all the digits for number systems that exceed radix-10. In that case we continue the numbering using letters in the alphabet. For example, in hexadecimal, the digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F; where A=(10)10, B=(11)10, etc.

Radix-n to decimal conversion

The formula below is a way to convert any number system into the decimal system; where r is the radix, n is the number of digits, and dn1 is the digit at position n1:

(dn1,,d1,d0)r=(dn1rn1)+(dn2rn2)++(d1r1)+(d0r0)

Examples:

  • (1010)2=(123)+(022)+(121)+(020)=8+0+2+0=(10)10
  • (753)8=(782)+(581)+(380)=448+40+3=(491)10
  • (1F3A)16=(1163)+(15162)+(3161)+(10160)=4096+3840+48+10=7994

Other conversions

Boolean Algebra