Microsoft PowerPoint – L1 ELEC1601 2021
ELEC1601
Introduction to Computer Systems
Outline:
• Introduction to course
• Course admin
• Computers at a high‐level (course overview)
• Lab intro
• Encoding numbers
Introduction to Computer
Systems
Why are you here?
Why are you here?
• You have no choice…
• It is a core unit
Why are you here?
• You want to understand how computers work
• Not how to use MS Word/send email…
Why are you here?
• You want to understand how computers work
• Not how to use MS Word/send email…
• What is inside a computer
• How could you design your own computer
• Make the best better
• How does a computer ‘talk’ to other devices
• Hardware vs software
• How do you use a computer efficiently
What is involved in understanding computers
• You may already have your favourite programming language
• You are talking to them
• But circuit only understands 0’s and 1’s
• We will learn how to bridge the gap
Why do people like this course?
Why do people like this course?
• You want to understand how computers work
Why do people like this course?
• You want to understand how computers work
• Fun
• Practical
Fun/Practical
• Learn how to control a real‐chip…ish
• We use an Arduino
• You should build skills and methodologies to talk to any computer
Fun/Practical (e.g. lab1)
Let’s talk about computer
systems
What is a computer system
• https://padlet.com/davidboland/7sgxpv8xz8onrkh4
What is a computer system
• Something you communicate through keyboard/mouse/touchscreen
• Supporter of apps
• Something that does mass arithmetic instructions
• Something that integrates inputs and computation
• A collection of digital logic that can execute machine instructions
What is a computer system
• Something you communicate through keyboard/mouse/touchscreen
• Supporter of apps
• Something that does mass arithmetic instructions
• Something that integrates inputs and computation
• A collection of digital logic that can execute machine instructions
• An electronic brain??
Typical structure of a computer system
What is a program
• Written in a programming language
• Meaning defined by language
Program to execution
• Sequence of steps
Assembly language
• Human readable machine language
• Map directly to binary digits
Can you program in assembly language?
• Yes…
• You can write extremely efficient code
• But…You need to understand the processor in detail
• You may not be smarter than a compiler…
Program execution
• Yes…
• You can write extremely efficient code
• But…You need to understand the processor in detail
• You may not be smarter than a compiler…
Abstraction
Are all computers the same?
Course Details
Course scenario
• Lectures
• Under the hood ‐ Understand circuit/architecture
• Lab
• Designing a system ‐ Program it bottom up
Learning Objectives
• Content should always be linked to these objectives
• We are here to help you achieve
Additional Learning Objectives
• We want to help you to learn how to learn
• What are your learning strategies?
• How did you study for your HSC/VCE/IBAC/A‐levels
• https://padlet.com/davidboland/ol0rwdpyzw53ewu0
Strategies for sophisticated learners
• You are going to run a marathon
Strategies for sophisticated learners
• Example learning strategy
• Lectures
• Attend
• Tutorials
• Attend
• Do exercises as instructed by tutor
• Labs
• Attend
• Complete as much as possible during lab session
• Write lab report afterwards
• Exam
• Study during STUVAC
• Make sure you complete all past lecture quizzes
• Extra last minute study before relevant exam
• Go to any ‘exam consultation sessions’ organised by lecturer
Strategies for sophisticated learners
• We want you to experience new options that can potentially help you
to learn better.
Dual‐process theories of reasoning
• Brain processes in two ways
• System 1:
• Intuitive/instantaneous
• Walk down street
• What is 2+2?
• Effortless
• System 2:
• Invoked when system 1 fails to solve problem
• Tries to create a rational answer
• You are not learning when you are using system 1
A better learning strategy
• Lectures
• Prepare for lectures
• Not at the last moment
• Distributed practice better
• Attend
• Participate diligently/actively
• Be willing to make mistakes
• Tutorials
• Prepare for lectures
• Attend
• Do exercises as instructed by tutor
• Participate diligently/actively
• Be willing to make mistakes
• Be willing to get ahead/go beyond/ask tutor more questions
A better learning strategy
• Labs
• Prepare for lab in advance
• Attend
• Complete as much as possible during lab session
• Build your team
• Use the demonstrators
• Write lab report afterwards
• SPEAK UP EARLY ABOUT ANY ISSUES
A better learning strategy
• Exam
• Study throughout semester
• Have a study plan for exam period starting during STUVAC
• Make sure you complete all past lecture quizzes
• DO NOT DEPEND ON THIS
• Extra last minute study before relevant exam
• Go to any ‘exam consultation sessions’ organised by lecturer
• Only if they can help you
• Use your friends
• Use the discussion forum
Learning strategies
Learning strategies
• We want you to prepare before a lecture.
• Really? Why?
Learning strategies
• We want you to prepare before a lecture.
• Really? Why?
• So you can work in lecture
• Active participation
• Talk to partners.
• Lectures only contain a subset of the information in Canvas.
Learning strategies
• Tutorials should follow lectures
• You are introduced to ideas, but build on it in tutorials.
• Harder questions
• More help
Learning strategies
• Labs arguably separate
• More practical
• But it should all come together at the end
Bureaucratic stuff
Your life for this course
• https://canvas.sydney.edu.au/
• (https://canvas.sydney.edu.au/courses/35882)
How do I pass?
https://canvas.sydney.edu.au/courses/25935/pages/course‐organisation?module_item_id=901923
How do I pass?
• Lab Completion
• Marked as a group.
• We will test anyone at random. You have the responsibility to teach your
peers
• Lab reports (weeks 3‐6)
• Submit before start of next lab
• Each group member will take a turn
How do I pass?
• Midterm
• Give you an idea how things work/how you are tracking
• Project
• Changing focus to quality
• Exam
• Hurdle task. Can’t ride on your peers
How this course is structured/What you need
to do each week
• Know what week you are in
• Do not get behind
• Do not do the wrong tasks
• https://canvas.sydney.edu.au/courses/25935/pages/week‐
2?module_item_id=901930
Plagiarism
• Taken very seriously at university
Edstem
• https://edstem.org/courses/4704/discussion/278920
• Ask questions
• Answer other questions
• Does not matter if your answers are incorrect
• Discussion will improve them
Labs
• Groups of 5. CC/RE same
• If you want to create a team in advance OK
• When you join a lab, change your name to be group1_<
• Simulation based
• Zoom breakout rooms
• Discord chat encouraged
• Screen sharing encouraged
• Remote control encouraged
• Codeshare encouraged
• Mini‐demo
Encoding Information
Why do computers need to encode
information?
Why do computers need to encode
information?
• Because they can only deal with 0’s and 1’s
What do we mean by encoding information
for computers?
What do we mean by encoding information
for computers?
• Numbers
• (binary)
What do we mean by encoding information
for computers?
• Numbers
• (binary)
• Colours
• Red/green/blue
• Machine Code
What do we mean by encoding information
for computers?
• Anything that you possibly want to do with a computer
What do we mean by encoding information
for computers?
• Literally everything…
Start with numbers…
• Why?
• Computers very good at arithmetic
• Computers do a lot of arithmetic
Start with natural numbers
• What are they?
How do we count numbers in base 10?
How do we count numbers in binary?
• Same way, but max of 2
What do numbers in base 10 mean
• Consider the number 1429
• How do we break it down?
What does a binary number mean
• Consider the number 111010 mean
• How do we break it down?
How do we convert numbers between bases
• Convert 382710 to binary?
Why Octal/Hexadecimal
• How do you think this monitor is encoded?
Why Octal/Hexadecimal
• Make binary more human readable
• Conversion (from binary) is easy
First exercise from worksheet
Useful properties of base 10
• Is 1345 a multiple of 10? Is it a multiple of 100?
• Is 13450 a multiple of 10? Is it a multiple of 100?
• Is 10400 a multiple of 10? Is it a multiple of 100?
• Is this hard?
Useful properties of base 10
• How do you multiply 1274 by 10?
• How do you multiply 1830 by 100?
• Is this hard?
Useful properties of base 10
• How do you divide 10400 by 10?
• How do you divide 10400 by 100?
• Is this hard?
Useful properties of base 10
• Is 1345 a multiple of 7? Is it a multiple of 77?
• Is 13450 a multiple of 70? Is it a multiple of 777?
• Is 10400 a multiple of 70? Is it a multiple of 777?
• How do you multiply 1274 by 7?
• How do you multiply 1830 by 77?
• How do you divide 10400 by 77?
• How do you divide 10400 by 777?
• Is this hard?
Useful properties of base 2
• Is 101100 a multiple of 2? Is it a multiple of 4?
• How do you multiply 1010010 by 2?
• How do you multiply 1011110 by 4?
• How do you divide 10101010 by 2?
• How do you divide 10111100 by 4?
• Is this hard?
Useful properties of base 8, base 16
• Worksheet exercise 2
Couple of bonus questions
• What is 10016 ‐1 ?
How many different numbers can you
represent?
• 10 digits?
• 10 octal values?
• 10 hex values?
• 10 bits?
Encoding integers
• What is the difference between the set of integers and set of natural
numbers?
Encoding integers
• What is the difference between the set of integers and set of natural
numbers?
• Sign‐magnitude: the easiest way to represent negative numbers
• Add a sign bit
Encoding integers
• What is the difference between the set of integers and set of natural
numbers?
• Sign‐magnitude: the easiest way to represent negative numbers
• Add a sign bit
• Is this a good representation?
How do we add sign‐magnitude numbers
How do we add positive numbers
• How do we add 1503+1729?
How do we add positive binary numbers
• How do we add 1001+1011?
How do we add sign‐magnitude numbers
• Suppose we have two binary numbers in sign‐magnitude
representation:
• A+B (A+ve, B+ve)
• A+B (A+ve, B‐ve)
• A+B (A‐ve, B‐ve)
One’s complement
• Invert all bits
• Simpler addition
Two’s complement
• Easy to compute
• Invert all bits and add 1
• Has a direct understanding
• Simpler addition still
Worksheet Q2
Why Floating‐point?
Encoding Real Numbers
• Do we need floating‐point to encode real numbers?
Why Floating‐point?
• Can we represent natural numbers with fixed point?
• Can we represent integer numbers with fixed point?
Why Floating‐point?
• You have 8 bits. How do you represent numbers between 0 and 63?
Why Floating‐point?
• You have 8 bits. How do you represent numbers between 0 and 63?
• You have 8 bits. How do you numbers between 0 and 126?
Why Floating‐point?
• You have 8 bits. How do you represent numbers between 0 and 63?
• You have 8 bits. How do you numbers between 0 and 126?
• Is 8‐bits sufficient to represent numbers between 0 and 63?
How many different values can you
represent?
• 10 digits?
• 10 octal values?
• 10 hex values?
• 10 bits?
Why Floating‐point?
• You want to represent a wide range with a fixed number of bits?
Why Floating‐point?
• You want to represent a wide range with a fixed number of bits?
• Reason for floating‐point: You want to represent a variable range with
a fixed number of bits
Fixed vs Float
Overflow
5 bit fixed point, 2 bits integer, 3 bits fractional
Roundoff
Number system must not overflow (error unbounded)
Accumulation of round‐off errors must lie below tolerable region
5 bit floating point, 2 bits exponent, 3 bits mantissa
m
e bbbx ….02 21 }1,0{, ib
Fixed vs floating point
• Fixed point:
• Number system must not overflow (error unbounded)
• Accumulation of round‐off errors must lie below tolerable region
• Floating‐point similarities:
• Number system must not overflow
• Accumulation of round‐off errors must lie below tolerable region
• Differences:
• Bigger dynamic range
• Underflow
• Size of roundoff errors vary relative to the representable value
• Floating point is not associative
Is floating‐point good?
Notes vs IEEE 754 Standard Floating Point
• Single precision:
• Double precision
Notes vs IEEE 754 Standard Floating Point
• Single precision:
• Half precision
Notes vs IEEE 754 Standard Floating Point
• IEEE standard
• Implicit leading 1
• Special codes:
• NaN (0/0, sqrt(‐10))
• Infinity (100/0, ‐100/0)
• Exponent subtract a bias (127 for single gives range ‐126 to +127)
Important to remember
• Floating point needs its representation defined
Floating‐point practice
• Worksheet Q3
Floating‐point
range/precision/underflow/overflow
• How do you increase range?
• How do you increase precision?
• What is overflow?
• What is underflow?
• Worksheet Q4
Floating‐point games
Floating point is not associative
Which answer is correct?
71
1
e
i
i
Floating point is not associative
How do you add numbers in FP
• Compute 3+0.625
• 3 is 22×0.110
• 0.625 is 20×0.101
• Align exponents
• 3 is 22×0.110
• 0.625 is 22×0.00101
• Perform addition
• 22×0.11101
• Re‐normalise to 5 bits
• 22×0.111 = 3.5
• Roundoff error of 0.125
• Compute 3.5+0.875.
• 3.5is 22×0.111
• 0.875 is 20×0.111
• Align exponents
• 3.5 is 22×0.111
• 0.875 is 22×0.00111
• Perform addition
• 22×1.00011
• Re‐normalise to 5 bits
• 23×0.100 = 4
• Roundoff error of 0.375
m
e bbbx ….02 21
Evaluate 3+0.625+0.875, with 3 bit mantissa
How do you add numbers in FP
• Compute 0.625+0.875
• 0.625 is 20×0.101
• 0.875 is 20×0.111
• Align exponents
• 0.625 is 20×0.101
• 0.875 is 20×0.111
• Perform addition
• 20×1.100
• Re‐normalise to 5 bits
• 21×0.110 = 1.5
• No roundoff error
• Compute 1.5+3
• Result is 21×0.110
• 3 is 22×0.110
• Align exponents
• 3 is 22×0.110
• 0.875 is 22×0.0110
• Perform addition
• 22×1.001
• Re‐normalise to 5 bits
• 23×0.101 = 5
• Roundoff error of 0.5
m
e bbbx ….02 21
Evaluate 0.625+0.875+3, with 3 bit mantissa
Not just round‐off errors can go wrong
12
252
1
25
i
Floating point games
12
252
1
25
i