Tutorial:Computer Architecture (Computer Science)
| This tutorial was meant for School Year 2025-2026 Semester 2 and might be outdated. If you're currently taking this course, feel free to edit this tutorial. Remove this notice once it's been updated. |
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 .
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 , where is the number of digits, is the digit at position , and is the radix. We will be using this way of formatting numbers throughout the course.
More examples of this formatting:
- is binary
- is decimal
- is octal
- is hexadecimal
- is hexadecimal
- is ternary
- 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 , , etc.
Radix-n to decimal conversion
The formula below is a way to convert any number system into the decimal system; where is the radix, is the number of digits, and is the digit at position :
Examples: