Hexidecimal, CPU, and the Toy Computer (Week 4) Flashcards
Definition : Byte
A byte is a sequence of 8 bits
It encodes 256 distinct values (0 to 255)
Each distinct value represents a unique sequence of 8 bits
Definition : Hexidecimal Numbers
Hexadecimal numbers use 16 symbols per digit: numerals 0-9 and letters A-F (base-16).
Why use hexadecimal?
Because binary numbers rapidly grow too large to be read effectively by humans, e.g. 2021(decimal) equals 111 1110 01012(binary)
To represent binary numbers in a compact format, hexadecimal numbers are particularly suitable
How many bits is one Hexidecimal digit?
1 hexadecimal digit represents exactly 4 binary digits (no more, no less)
Convert Hexidecimal to Decimal :
A
10
Convert Hexidecimal to Decimal :
B
11
Convert Hexidecimal to Decimal :
C
12
Convert Hexidecimal to Decimal :
D
13
Convert Hexidecimal to Decimal :
E
14
Convert Hexidecimal to Decimal :
F
15
Convert Hexidecimal Digits to Bits :
1
0001
Convert Hexidecimal Digits to Bits :
7
0111
Convert Hexidecimal Digits to Bits :
3B
00111011
Convert Hexidecimal to Decimal :
4B
75
Convert Hexidecimal to Decimal :
A7
167
Convert Hexidecimal to Decimal :
FF
255
Convert Hexidecimal to Decimal :
EC
236
How is color encoded?
In Hexidecimal eg.
ffffff
000000
00ff00
How many bits are 7 bytes?
56
What does a CPU do?
The CPU controls all other parts of a computer (by sending out signals on the bus)
Examples of what CPU controls: RAM, storage devices and peripherals (e.g. mouse, printer, etc.)
What can a CPU do?
CPUs can execute only up to a few dozen (sometimes up to a few hundred) of quite basic instructions
- Arithmetic: add, subtract, multiply, divide, etc. different types of numbers
- Move data around (fetch instructions and data from RAM, store results back in RAM, move date from and to Input/Output devices)
- Instructions to control the flow of execution, i.e. instructions that decide what to do next based on previous computation results
What is the CPU instruction cycle?
CPUs perform billions of operations per second (e.g. 3 billion per second if your CPU runs at 3 GHz clock speed)
An instruction cycle features the following (simplified and) ever repeating steps:
1. Clock cycle 1: Fetch next instruction from RAM
2. Clock cycle 2: Decode what to do
3. Clock cycle 3: Execute it
What is a Toy Computer?
The toy computer is a tool to simulate a highly simplified Computer/CPU in order to demonstrate how it works in principle.
It can run simple computer programs made of very basic instructions (similar to instructions of real CPUs).
The “Toy” uses one accumulator => storage area inside the CPU with capacity of one data item
Process of the Toy Computer?
Programs are stored in RAM
* Each line represents one memory location
* Each location stores an instruction or data item
The CPU executes one instruction after another starting at the top.