ENGG1310 CE LT1 Vtam
ENGG1310 CE LT1 Vtam
ENGG1310 CE LT1 Vtam
(CE Part)
LT1: Introduction to Computer Engineering
- Computer Systems, Programming & Networking
ENGG1310 - VT 2
Extensive. Essential.
Extremely complicated.
ENGG1310 - VT 3
Wordcloud based on all course offered by HKU EEE
Created by www.jasondavies.com/wordcloud
ENGG1310 - VT 4
Wordcloud based on all course offered by HKU EEE
Created by www.jasondavies.com/wordcloud
ENGG1310 - VT 5
3 Modules, 1 Assignment
Digital
Logic
Computer
Systems & Assignment Modern CE
Networking Applications
( H/W + S/W )
ENGG1310 - VT
YouTube Video : https://www.youtube.com/watch?v=avZTQgLs064 7
Hardware
& Software
+ Hardware (H/W) is the physical and tangible parts of a
computer, e.g. keyboard, monitor, mouse and printer;
+ Software (S/W) refers to the programs (as a sequence
of instructions) and data;
+ A computer system requires both H/W and S/W to
operate.
ENGG1310 - VT 8
About Moore’s law (on Computer H/W)…
+ “The number of transistors incorporated in a chip will approximately
double every 24 months.”
—Gordon Moore, Intel Co-Founder (1965)
+ Core i7-980 has 1.17 billion transistors, at 3.33 GHz, 32nm technology
ENGG1310 - VT 9
taken from: http://www.intel.com/content/www/us/en/silicon-innovations/moores-law-embedded-technology.html
If Moore’s Law were to apply to assignment
+ Assume:
10 minutes to solve an assignment question with 10 circuit
components (level of this course)
Amount of time needed to analyze the circuit scales linearly
(much worse in real-life)
An Intel Core i7 CPU contains ~1 billion components
+ How long does it take to fully analyze the processor?
+ Ans:
ENGG1310 - VT 10
~ To Address Computer Systems..
+ Abstraction is the process of encapsulating (low-
level) details by well-defined interfaces.
Related concepts: layering, sub-system, hierarchy
ENGG1310 - VT 11
Decomposition of Computer/Complex
Systems (1)
Top-Level System Subsys B Subsys
Subsystem A B-1
Subsys
C
Subsys
B-2
ENGG1310 - VT 12
Abstraction of Computer/Complex Systems (2)
Top-Level System Subsys B Subsys
Subsystem A B-1
Subsys
C
Subsys
B-2
ENGG1310 - VT 13
Computer/Electronic Systems
Physical Physical
World Input Process Output World
ENGG1310 - VT 14
System Components - Input
• Sound
• Voltage (V)
• Temperature
Physical • Current (I)
• Light World Input
• Resistance (R)
• Pressure
• Capacitance, Inductance…
• …
ENGG1310 - VT 15
System Components - Output
• Sound
• Voltage (V)
• Temperature
• Current (I) Physical
Output World • Light
• Resistance (R)
• Pressure
• Capacitance, Inductance…
• …
ENGG1310 - VT 16
System Components - Processing
Process
ENGG1310 - VT 17
An Example Application of Computer
Systems
Process
Ball Rolls Turns on
Input Output
Past Sensor Laser
3 times?
ENGG1310 - VT 18
Abstraction At Work…
Process
Ball Rolls Turns on
Input Output
Past Sensor Laser
3 times?
DI DO
ENGG1310 - VT 19
Process
Ball Rolls Turns on
Input Output
Past Sensor Laser
3 times?
DI DO
“the laser is turned on only after 3 balls have passed through the
tunnel AND a toy car has reached the bottom of a ramp”
ENGG1310 - VT 20
“the laser is turned on only after 3 balls have passed
through the tunnel AND a toy car has reached the bottom
of a ramp”
Process
Ball Rolls Turns on
Input Output
Past Sensor Laser
3 times?
ENGG1310 - VT 21
Abstraction of A Computer System
ENGG1310 - VT 22
The Hardware Architecture…
ENGG1310 - VT 23
The Hardware Architecture…(2)
ENGG1310 - VT 24
The Hardware Architecture…(3)
INPUT OUTPUT
ENGG1310 - VT 25
Computer Organization
ENGG1310 - VT 26
Input Devices…
+ Accept data/information from the outside world (e.g. human,
physical environment or other computers) into the computer
system for processing;
ENGG1310 - VT 27
Output Devices…
+ Output processed information to the outside world (e.g.
human, physical environment or other computers);
ENGG1310 - VT 28
Central Processing Unit
(CPU)
+ Controls the operations of all parts of the computer
system
- Arithmetic operations;
- Decision making;
+ A physical CPU (such as one you buy from Intel or
AMD) may include functions of other parts of the
system
- Part of the memory system;
- Part of I/O.
ENGG1310 - VT 29
CPU – Arithmetic and Logic Unit
(ALU)
+ The ALU of a CPU performs the actual computation
+ Typical functions:
Arithmetic: + − × ÷
Bit operations: shift left/right, bitwise AND, OR
Comparison: < > ≤ ≥ = ≠
+ ALU can be controlled to perform any one of the above
functions according to instructions specified in a program.
ENGG1310 - VT
30
CPU – Control Unit
+ Determines what to do based on
- Instruction
- Result of previous computation
+ Internal control
- Determines the function of the ALU based on the given instruction
- Determines if and when should a memory read/write be performed
- Determines if the CPU should perform a reset of the datapath
+ Typical control-related instructions
Branching: determines the next instruction to fetch from the memory
Memory operations: load/store data from memory
ENGG1310 - VT
31
A Quick Summary: Reality Check
Memory
ALU (cache)
+
Control
Unit
Input/Output
(I/O)
ENGG1310 - VT
32
Memory
+ Stores instructions and data
+ Instructions:
- Control the operation of the CPU
- Obtained from a user’s software program through a process called
compilation.
+ Data e.g.
- User input
d = (a + b) × c
• Input data: values of a,b,c
- Temporary data • Temp data: (a+b)
- Computed output • Output data: d
ENGG1310 - VT
€ 33
Memory Storage Capability
+ Every memory device has a storage capacity, indicating
the number of bytes it can hold
+ Bytes: 1 Byte = 8 bits
+ Storage capacities are specified in the following units:
Unit Symbol No. of Bytes
kilobyte KB 210 = 1024
megabyte MB 220 (> 106 )
gigabyte GB 230 (> 109)
terabyte TB 240 (> 1012)
ENGG1310 - VT 34
Main Memory
+ Main memory is volatile – i.e. stored information is lost if
the electric power is removed;
+ Main memory are direct access devices - information can
be reached directly;
+ Main memory is consisted of:
- Random Access Memory (RAM) to store the user programs;
- Read-Only Memory (ROM) to store the operating systems (or system S/W
as stated on P. 22).
ENGG1310 - VT 35
Real Processor: Cache Memory
+ Modern processor systems have layers of cache memory
Level 1 (L1), Level 2 (L2), Level 3 (L3)
ENGG1310 - VT
36
The Stored Program Architecture
+ Also called the von Neumann
architecture
+ Named after John von Neumann
- Talented mathematician;
- Key person behind the development of EDVAC in
the 1940s;
+ A stored-program computer
- stores both program instruction and data in the
same memory storage;
- performs computation by executing instructions
stored in the memory
ENGG1310 - VT
37
Stored-Program Computers
Determines
Get the
Execute the the next
current
instruction instruction
instruction
to fetch
ENGG1310 - VT
38
Pros and Cons of Stored-Program
Computers…
+ Pros of the stored-program architecture:
- Control unit gets data and instructions in the same way from the
main memory unit;
- Similarly, data from memory and data from external devices are
accessed in the same way;
ENGG1310 - VT 40
3 Classes of Computers
+ Desktop
+ Server Dominate the Future
+ Embedded System
ENGG1310 - VT
41
Desktop Computers
+ Most people’s everyday encounter to computers;
+ Signifies by the rise of personal computer (PC) in the
early 1990s;
+ Typical examples:
- PC with a tower
- Laptop/Notebook computers
- Apple iMac, Mac Pro
+ Post-PC Era
- Tablet
- Smart Phones
ENGG1310 - VT
42
Embedded Systems
+ A computer system embedded
within a larger system
i.e. Computer systems as components
44
Ex: Smart TVs
+ Video processing
- Scaling
- Motion compensation
- Full HD, 4k
+ Audio processing
+ Internet access
- Video conference, YouTube…
- Motion Detection
- Voice Control
+ Example
- Samsung TVs run fully functional Linux
system internally
- 600 MHz ARM v7 processor
45
Servers
+ Includes many of the most powerful computers in
operations;
+ Most modern servers are implemented using highly
parallel multiprocessor systems
-Super-computers;
-Computer clusters;
+ Usually accessed only through networks;
+ Responsible for the most demanding computing
needs
- Web, video streaming
- Datacenter Google handles > 1 billion
- Scientific computations searches per day
- Financial computations
ENGG1310 - VT 46
• Roadrunner @ Los Alamos
National Laboratory
• 1st > petaflops
supercomputer
• 12,960 IBM PowerXCell 8i
CPUs + 6,480 AMD
Opteron dual-core
• USD$125M
• 444.94 Mflops/W
2022 State-of-the-art:
• 2008 World’s fastest ~ 1102 petaflops
• 2010 3rd fastest ~ 8.7 million cores
• 2012 #22
• 2013 Decommisioned Current #1: Frontier
HPE Cray EX235a, AMD
“Roadrunner has been replaced with Optimized 3rd Generation
something smaller, faster, more energy United States
efficient and cheaper.” –AP
ENGG1310 - VT
49
The Big Challenge
+ Generally speaking,
power consumption
increases with
Performance
Power/
performance;
Energy + Technical challenge:
find ways to improve
performance without
significant increase to
power.
TOP500 Green500
http://top500.org http://green500.org
ENGG1310 - VT
50
Latest Development in Computer
Systems…
+ Multi-Core CPU for parallel processing;
https://www.intel.com/content/www/us/en/products/docs/processors/what-is-a-gpu.html
ENGG1310 - VT 51
Multi-Core CPU
grade = 0;
tmp = 0.1 ´ lab;
grade = grade + tmp;
tmp = 0.2 ´ mt; Time
grade = grade + tmp;
tmp = 0.3 ´ hw;
grade = grade + tmp;
tmp = 0.4 ´ proj;
grade = grade + tmp;
*This is not how we are going to calculate your grades in this course !
ENGG1310 - VT
53
Calculation in Sequential Processors
0.1 0.1 0.2 0.2 0.4 0.4
tmp
× tmp
+ tmp
× tmp
+ tmp
+ tmp
× × × ×
+ +
+ Time
grade
SPACE
ENGG1310 - VT
55
2 Ways to Compute…
0.1 0.1 0.2 0.2 0.4 0.4
tmp
× tmp
+ tmp
× tmp
+ tmp
+ tmp
× Sequential Processor
+
×
+
×
+ Parallel Which way is faster?
× Processor
ENGG1310 - VT
56
GPU…
+ A multi-core CPU consists of a few [say 2 - 8] (processor) cores in
which each processor core is a processing unit which reads in
instructions to perform specific actions;
+ Each CPU is optimized for sequential serial processing while a
GPU has a massively parallel architecture consisting of
thousands of smaller, more efficient cores designed for handling
multiple tasks simultaneously.
ENGG1310 - VT
57
Performance Gain by GPU-Accelerated
Computing… Source URL at:
http://www.nvidia.com/object/what-is-gpu-computing.html
+ GPU-accelerated
computing offers attractive
performance gain by
offloading compute-
intensive portions (ar. 5%
on average) of the
application to the GPU,
while the remainder (~
95%) of the program code
still runs on the CPU.
ENGG1310 - VT
58
Edge Computing (EC)…
+ instead of processing and storing data in the data
centers far away from end users, EC keeps data
close to users to reduce the delay of waiting for any
server response in cloud computing;
+ Essentially, EC is a distributed computing
paradigm to bring computation and data storage
closer to the sources of data
Helping to reduce response times while saving network
bandwidth;
+ Potential applications: autonomous vehicles, home
automation, robotics, smart cities, Industry 4.0, etc.
ENGG1310 - VT 59
System S/W
+ Operating Systems (e.g. MS Windows 11, Linux, Mac OS)
- Controls all machine activities such as running of the processes;
- Provides the user interface to the computer;
- Manages resources such as the CPU and memory, etc.
+ Compilers/Interpreters
- Translate a computer program in a high-level programming
language such as C++ into low-level machine instructions (0 or 1);
- A compiler will translate the whole program in a batch mode
while an interpreter will translate the program line-by-line.
ENGG1310 - VT 60
Python Programming
+ Python is an interpreted high-level programming
language in which the Python interpreter will translate
each Python statement to machine instructions and
directly execute the machine instructions on a CPU.
ENGG1310 - VT 61
How a Python Program Works…
+ Basically, a CPU will continuously follow the fetch-
decode-execute cycle to go thru’ all instructions in a
Python program.
ENGG1310 - VT 62
How a Python Program Works…(2)
+ Essentially, all the CPU components go
thru’ the detailed steps of the fetch-
decode-execute cycle as follows.
Ø The control unit fetches (i.e. reads) the
instruction from the main memory;
Ø The control unit decodes (i.e. decides what it
means) and moves the required data from the
main memory to the ALU;
Ø The ALU executes the arithmetic, logical or other
predefined instruction.
ENGG1310 - VT 63
Computer Networking
+ A network contains two or more connected
computer systems/servers where data and
resources can be shared;
+ Each device has its own network address
(e.g. 192.168.0.100), which uniquely
identifies it among the others;
+ A local area network (LAN) covers a small
distance with a small number of computers,
e.g. home or campus WiFi;
+ A wide area network (WAN) such as the
Internet connects computers over long
distances. Therefore, users can be
geographically distributed (i.e. ubiquitous
computing) while accessing the information
on different computers.
ENGG1310 - VT Image Sources : https://www.heavy.ai/technical-glossary/local-area-network 64
https://www.softwaretesttips.com/wide-area-network/
Modern CE Applications…
+ With the availability of high-performance computing
technologies such as the GPU computing, artificial intelligence
(AI) or machine algorithms (ML) have wide applicability in many
sophisticated CE applications including computational finance or
tele-medicine;
+ Besides, cloud or edge computing platforms have nurtured many
interesting applications in embedded systems (ES) or Internet of
Things (IoT) for robotics, smart cities/homes/offices, and Industry
4.0, etc.
ENGG1310 - VT 66
Summary…(2)
+ Cache are high-performance memory with low access latency (or delay): L1 < L2 <
L3 < Main Memory;
+ The stored-program computer stores both program instruction and data in the
same memory storage. The pros is data/instructions from memory and also data
from external devices are accessed in the same way. On the contrary, the main
memory becomes the performance bottleneck;
+ There are 3 classes/types of modern computer systems including: desktop
computers, embedded systems, and servers with different design optimizations
and tradeoffs;
+ Computer networks connects different computer systems to share resources via
the local area networks (LANs) or the wide area network (WAN);
+ Modern CE applications may include various engineering applications with the
uses of AI/ML algorithms and/or ES/IoT technologies.
ENGG1310 - VT 67
Example Questions
+ When using the MS Word application to process of a word
document, why will all/most of the data be lost when the
electrical power is suddenly off ? What happens if you save
the document?
+ Key points: 1. Main Memory is volatile which means the data
stored there will be lost when the electricity is off;
2. When your MS Word application is running, the data
working there will be stored at the main memory.
3. If you save the document, the data will be transferred to a
secondary storage such as the hard disk;
4. A secondary storage like the hard disk is non-volatile.
ENGG1310 - VT 68
Example Questions
+ Which of the following is not a hardware component of a
computer?
+ (a) CPU
+ (b) RAM
+ (c) ROM
+ (d) Speaker
+ (e) Operating system
ENGG1310 - VT 69
Example Questions…
+ How many Megabytes (MB) will a coloured (RGB) image
with the resolution of 1080 pixels × 1920 pixels occupy?