計算機導論 Introduction to Computer
Overview
In this course we mainly learned about :
- Two Architectures of Computer : von Neumann and Harvard
- Binary, Octal and Hexadecimal
- Representation of numbers: Sign-Magnitude, Ones' Complement and Two's complement
一、Two Architectures of Computer
There are two types of computer architectures. They regulate the composition of computers.
1. von Neumann Architecture
According to this architecture, a computer has three basic units:
- Central Processing Unit: contains Control Unit and Arithmetic Unit
- Main Memory Unit
- Input/Output Device
In this architecture, data and instructions share the memory.
2. Harvard Architecture
Unlike von Neumann architecture, data and instructions have their own memory.
二、Binary Octal Hexadecimal
Because of the characteristic of logic circuits, computer uses binary to represent all data.
But in order to help developers write and memorize data, we also use octal and hexadecimal to represent data.
Sometimes we need to convert them to each other.
三、原碼、反碼、補碼
For a number, the computer must encode it and then store it.
There are three encoding methods: Sign-Magnitude, Ones' Complement, Two’s Complement
1. Sign-Magnitude
Sign and Magnitude, as the name implies.
-
The first bit represent sign of the number: 0 for positive, 1 for negative.
-
The remaining bits represent the magnitude of the number in binary.
2. Complement
Since Binary number system has only 2 digits (0 and 1), the complement of one digit is the other.
1) One's Complement
- One’s Complement of a positive number is itself
- One’s Complement of a negative number is based on its sign-magnitude, with the sign bit unchanged, and the remaining bits inverted.
2) Two's Complement
It's similar to One's Complement.
The main difference is that when the number is negative, 1 is added to the last after getting the complement.
We use two's complement to simplify the calculation. So that we don't need to specifically deal with sign bit.