Computer Structure &
Language:
Introduction & Basics
Hossein Asadi (asadi@sharif.edu)
Department of Computer Engineering
Sharif University of Technology
Fall 2024
Copyright Notice
• Some Parts (text & figures) of this Lecture
adopted from following:
– Computer Organization & Design, The
Hardware/Software Interface, 4th Edition, by D.
Patterson and J. Hennessey, MK pub., 2012.
– “Intro to Computer Architecture” handouts, Dept of
ECE, CMU, by James Hoe, 2009.
– “Computer Organization I” handouts, Dept of Computer
Science, FSU, by X. Liu, Fall 2007.
– “Computer Organization & Design” handouts, by Prof.
Kumar, UIUC, Fall 2007.
– “Machine Structures” handouts, by Prof. D. Garcia,
UCB, Spring 2010.
Slide 2
Today’s Topics
• Course Introduction
• Class Policy
• Course Syllabus & Objective
• Introduction to Computer Organization
• Computer History
• Moore’s Law
Slide 3
Course Introduction
• Instructor: Hossein Asadi
• Classes
– Sat & Mon: 13:30~15:00
• Attend class on time
• Office Hours
– Can be reached by email & skype or stop by my office
(Room # 610)
– Email: asadi@sharif.edu
• Sat. through Wed.: 9AM ~ 6PM
• TAs Classes
– TBD
Slide 4
Course Introduction (cont.)
• Course Webpage on CW
– Check this webpage on regular basis
• At least on Sun, Tue, Thur
• Q&A only using CW forums
– Everything will be posted on CW
• Announcements, handouts, assignments, grades,
quiz and exam notices, simulators, …
– Handouts
• Will be posted a day before class
– Print it & bring it to class
• But I may update it a day after class
– Check out submission date of handouts
Slide 5
Teaching Assistants
• TA Administration, Grades, CW, HW Schedules,
Comments on TAs
– Ali Sedaghatgoo (Chief TA)
• Computer Org. & History, ISA, Memory & I/O
– TBD (Head TA)
Slide 6
Teaching Assistants (cont.)
• MIPS Assembly Programming, 8086
Programming, Inline Assembly, Device Driver
– TBD (Head TA)
Slide 7
Teaching Assistants (cont.)
• Addressing Mode, Compiler, Assembler, Linker,
Number Representation, Arithmetic & FP, &
Interrupt
– TBD (Head TA)
Slide 8
Few Notes on Assignments
• Post All your Questions on CW Forums
– Check forum history before posting any question
• Be Respectful to your Classmates and TAs
• Harsh Cheating Penalty
Slide 9
Textbook
• Computer Organization & Design, The
Hardware/Software Interface, 4th Edition, by D.
Patterson and J. Hennessey, MK publishing,
2012.
– You can keep textbook for “Computer Architecture”
course, too!
Slide 10
Syllabus
• Computer History
• Computer Organization
– Hardware & software components
– CPU, ALU, registers, buses, I/Os, and memory
subsystem
– Von Neumann model
– Stored program concept
– Introduction to Memory Organization
Slide 11
Syllabus (cont.)
• Computer Language
– Instruction Set Architecture (ISA)
– MIPS instruction set
– Addressing modes in assembly lang.
– MIPS assembly language &
programming
• Subroutines, directives, macros, assembler
& linker
– Introduction to Intel IA-32 ISA
• 8086 Programming
• Inline assembly
Slide 12
Syllabus (cont.)
• Compiler, Assembler, Linker, & Loader
• Computer Arith./Logical Operations
– Number representation (integer &
floating-point)
– Addition, subtraction, multiplication,
division
– Logical operations
• Interrupts & I/O Transactions
Slide 13
Class Policy
• Ask Questions Anytime
– Don’t hesitate to ask even stupid questions!!!
• Cell Phones off or on Silent
• Absence
– Three sessions allowed
• Food No, Drink yes!
• Feel Free to Pass Me Your Feedbacks
– Anything related to this course
Slide 14
Class Policy (cont.)
• Assignments
– Three late assignments will be accepted!
• Only two days late!
• Fourth late assignment (two-day late)
–HW will be graded out of 50%
• Fifth and next late assignments will not be
accepted!
– Discussions encouraged!
– But do your own handwriting!
– Zero score for copied assignments!
• Second time zero score for 30% share!
Slide 15
Objective
• Understand organization of existing
computer systems
• Understand number representations in
computer
• Improve SW performance by writing your
own assembly code
– Introduction to assembly code optimization
– Basic optimizations performed by compilers
Slide 16
Objective (cont.)
• Understand MIPS instruction set
– Be able to encode and decode MIPS
instructions
• Be able to read and write functions using
MIPS assembly language
• Understand different types of instruction set
architectures
– MIPS, Intel IA-32
• Understand how assembler & linker works
• Understand instruction execution flow
Slide 17
Computer Systems:
From Embedded to Enterprise Systems
Slide 18
Objective (cont.)
• By end of semester, you should be able to
answer these questions:
– What is difference in representations of
integers, fixed-point & floating-point numbers?
– What is difference between MIPS and Intel
IA32 instruction sets?
– How recursive procedure calls like “factorial” or
“Towers of Hanoi” are implemented in MIPS
assembly language?
Slide 19
Objective (cont.)
• By end of semester, you should be able to
answer these questions:
– What is best application of different addressing
modes?
– What is difference between load/store
architecture and CISC architectures?
– Why opcode of MIPS ISA is not 4- or 8-bit?
– How a simple assembly instruction is encoded
in machine code (e.g., “add $s0, $s1, $s2”)?
Slide 20
Objective (cont.)
• By end of semester, you should be able to
answer these questions:
– How much stack will be used when calling
fact(20)?
– Difference between Dynamically Linked Libs
(DLL) and Statically Linked Libs?
– Difference between IO-mapped-IO and
memory-mapped-IO?
– How 1010 and (1010 +1) represented in FP?
– Simple optimizations used in compilers?
Slide 21
Grading
• Midterm Exam: 25%
– Aban 19th
• Final Exam: 35% (as posted in EDU)
• Quiz (1&2): 15%
– First quiz: Mehr 28th
– Second quiz: Azar 24th
– Up to three additional unscheduled quizzes
• Assignments & Project: 30%
– Bonus points for outstanding projects
• Exams: Topics of this Class and TA Classes
Slide 22
Today’s Topics
• Introduction to Computer Organization
• Computer History
Slide 23
Copyright Notice
• Parts of lectures adopted from:
– Computer Organization & Design, The
Hardware/Software Interface, 4th Edition, by D.
Patterson and J. Hennessey, MK pub., 2012.
– “Intro to Computer Architecture” handouts, Dept of
ECE, CMU, by James Hoe, 2009.
– “Computer Organization I” handouts, Dept of Computer
Science, FSU, by X. Liu, Fall 2007.
– “Computer Organization & Design” handouts, by Prof.
Kumar, UIUC, Fall 2007.
– “Machine Structures” handouts, by Prof. D. Garcia,
UCB, Spring 2010.
Slide 24
Introduction
• What Is a Computer?
– An electronic device capable of storing and
processing information in accordance with a
predetermined set of instructions
• Oxford English Dictionary
– A machine that manipulates data according to a set of
instructions
– A general purpose device that can be programmed to
carry out a set of arithmetic or logical operations
• Wiki
Slide 25
Introduction (cont.)
• Where are Computers?
– PCs
– Cars
– Toys
– Home appliances
• Microwaves, refrigerators, TVs
– In your pocket ☺
• Cell phones, IPoDs, MP3 players
– Or maybe in your shoes!!!
Slide 26
Introduction (cont.)
• Where are Computers?
Slide 27
Computer System
• A computer system consists of hardware and
software that are combined to provide a tool to
solve problems (with best performance)
– Hardware may include:
• CPU, memory, disks, printers, screen, keyboard, mouse
• Other peripherals
– Software may include:
• System software
– A general environment to create specific applications
• Application software
– A tool to solve a specific problem
Slide 28
Computer System (cont.)
• Most complicated machines ever built on
the earth
– For example (BT: Billion Transistors)
• Intel 22-core Xeon Broadwell-E5: 7.2 BT
• Nvidia GPU GV100 Volta: 21 BT
• AMD Epyc Rome: 32 BT
• Xilinx Everest/Versal FPGA: 50 BT
• Samsung 128 Gb SDRAM (DDR4): 137 BT
• Samsung 8Tb 4-bit V-NAND Flash: 2048 BT
Slide 29
Computer System (cont.)
• Most complicated machines ever built on
the earth
• A Boeing airplane has only 4 million parts
• How can we comprehend these computer
systems?
– Using hierarchical abstraction levels
Slide 30
Computer System (cont.)
• Hierarchical Abstractions
– Applications
– Systems software
– Assembly/machine language
– Architectural issues
• i.e., caches, virtual memory, pipelining
– Boolean logic, 1s and 0s
• Sequential logic, finite state machines
• Combinational logic, arithmetic circuits
– Transistors used to build logic gates (CMOS)
– Semiconductors/silicon used to build
transistors
– Properties of atoms, electrons, and quantum
dynamics
Slide 31
Instruction Set Architecture
• Our Focus in this Course:
– SW/HW Interface
– Known as Instruction Set Architecture (ISA)
• ISA
– A very important abstraction
– Interface between hardware and low-level
software
• Modern Instruction Set Architectures
– IA-32, PowerPC, MIPS, SPARC, ARM, …
Slide 32
Computer Organization
• Computer Components
– Input, output, memory, control unit, & datapath
Computer
Control Input
Memory
Datapath Output
Slide 33
Types of Computer Systems
• Desktops
• Servers
• Embedded Systems
Slide 34
Types of Computer Systems (cont.)
• Desktops
– General purpose computers
– Variety of software
– Designed for use by individuals
• PCs, Notebooks
Slide 35
Types of Computer Systems (cont.)
• Servers
– High-end computing systems
• Consists of several CPUs
– Used by multiple users
– Networked based
– High capacity, performance, reliability
– Range from small servers to building sized
Slide 36
Types of Computer Systems (cont.)
• Servers
– Supercomputers highest performance servers
• Hundreds of CPUs, TBs of memory, PBs of
storage
Slide 37
Types of Computer Systems (cont.)
• Embedded Systems
– A computer system designed to perform one or
a few dedicated functions
• Often with real-time, power, high reliability,
low-cost, size/weight constraints
– Hidden as components of systems
Slide 38
Types of Computer Systems (cont.)
• Embedded Systems
– Widest range of applications!
• Telecommunications systems: routers, …
• Consumer electronics: cell phones, PDAs,
MP3 players, digital cameras, printers, fax
machines, …
• Transportation systems: cars (ABS, airbag
controller, …), aircrafts, …
• Medical equipment
Slide 39
Types of Computer Systems (cont.)
• Embedded Systems
– Q1: Embedded systems are special-purpose
designed; why?
• To further reduce cost and power
– Q2: Is performance a major metric?
• As long as we satisfy real-time constraint
• Further performance increase not desired
Slide 40
Computer Organization (cont.)
• Components of a Desktop System
– Processor
– Memory system
– Power supply
– Cooling system
– Motherboard
– I/Os
• Disk drive , network card (on-chip), video
card (on-chip), keyboard, mouse, printer,
mouse, camera, …
Slide 41
Computer Organization: Inside the Box
Slide 42
Computer Organization (cont.)
• Components of an Embedded Computer
– Processor
– Memory system
– Power supply
– Cooling system
– Sensors
– Converters
• Analog-to-Digital Converter (ADC)
• Digital-to-Analog Converter (DAC)
– Actuators
Slide 43
Computer Organization (cont.)
• A Typical Computer Org.
Slide 44
Inside the Processor (CPU)
• Datapath
– Performs operations on data
• Control
– Sequences datapath and memory accesses
• Cache memory
– Small fast SRAM memory for immediate
access to data
Slide 45
Inside the Processor (CPU)
• AMD Barcelona: 4 processor cores
Slide 46
Computer Organization (cont.)
• A Typical Embedded Computer
Slide 47
Market: Application
Slide 48
Market: Application (cont.)
Slide 49
Market: CPU Brand
Slide 50
Computer History: General Overview
• Non-Electronic Computing Machines
– Abacus
– Punch machine
– Difference engine
– Analytical engine
• Electro-Mechanical Computers
• Electronic Computers
Slide 51
Computer History
• Generation -1: The early days ( ? - 1642)
• Generation 0: Mechanical (1642 - 1945)
• Generation 1: Vacuum tubes (1945 - 1955)
• Generation 2: Discrete transistors (1955 - 1965)
• Generation 3: Integrated circuits (1965 - 1975)
• Generation 4: VLSI (IC) (1975 - 2005)
• Generation 5: ULSI (IC) (2005 - present)
1. http://www.answers.com/topic/history-of-computing-hardware
2. http://www.answers.com/topic/history-of-computing-hardware-1960s-present
3. http://web.njit.edu/~ziavras/Ziavras-
history.pdf#search=%22computer%20history%2Bpentium%2Beniac%2Bquantum%2
Bfiletype%3Apdf%22
4. http://inventors.about.com/library/blcoindex.htm
© Computer Structure and Language by Dr. Miremadi Slide 52
Generation -1: The early days ( ? - 1642)
• The abaci was emerged about 5,000 years ago in Asia
and is still in use today, may be considered the first
computer.
• Only much later, counting became an abstract process
and groups of objects were represented by a symbolic
name. This allowed for computing on … papyrus.
© Computer Structure and Language by Dr. Miremadi Slide 53
Generation -1: The early days ( ? - 1642)
• In the 12th century
Muhammad ibn Musa
Al'Khowarizmi developed
the concept of a written
process to be followed to
achieve some goal, and
published this in a book:
algorithm.
– a precise rule (or set of rules)
specifying how to solve some
problem
© Computer Structure and Language by Dr. Miremadi Slide 54
Generation 0: Mechanical (1642-1945)
• In 1642, Blaise Pascal
(1623-1662), the 18-
year-old son of a French
tax collector, invented
what he called a
numerical wheel
calculator to help his
father with his duties.
• Pascal's device was an
adding machine with
automatic carries from
one position to the next.
• Pascal's device used a
base of ten.
© Computer Structure and Language by Dr. Miremadi Slide 55
Generation 0: Mechanical (1642-1945)
• Charles Babbage recognized
in 1822 that most navigation
tables contained lots of errors
leading to the loss of ships.
• He applied to the British
Government for assistance,
and received the first
government grant for
computer research.
• Babbage put the concepts of
mechanical control and
mechanical calculation
together into a machine.
© Computer Structure and Language by Dr. Miremadi Slide 56
Generation 0: Mechanical (1642-1945)
• In1832, Babbage
designed the
Difference Engine for
computing the entries
in navigation tables:
– application specific
– hard-coded machine.
• A portion of the
Difference Engine
holds in the
Powerhouse Museum
in Sydney, Australia
© Computer Structure and Language by Dr. Miremadi Slide 57
Generation 0: Mechanical (1642-1945)
• In 1835, Babbage’s second
design, this time:
– programmable device.
• This engine was never
completed in his lifetime.
• But his son, Henry Provost
Babbage built the machine from
his father's drawings, and
computed multiples of Л to
prove the adequacy of the
design.
• Perhaps, this represents the first
successful test of a portion of an
Analytical Engine, this "modern"
computer.© Computer Structure and Language by Dr. Miremadi Slide 58
Generation 0: Mechanical (1642-1945)
• Babbage's assistant , Ada
Augusta King, daughter of
English poet Lord Byron,
became the first programmer
by writing a program for the
Analytical Engine, Babbage’s
second and this time
programmable device.
© Computer Structure and Language by Dr. Miremadi Slide 59
Generation 0: Mechanical (1642-1945)
• In 1935, Konrad Zuse, in Berlin, Germany,
developed his Z-1 computer in his parent's living
room, a relay computer. (An Electromechanical computer).
• Instruction cycle time: 6 seconds (0.17 Hz)
© Computer Structure and Language by Dr. Miremadi Slide 60
Generation 0: Mechanical (1642-1945)
• With the Second World War, governments sought
to develop computers to exploit their potential
strategic importance.
• By 1941, Konrad Zuse had developed a computer,
the Z3, to design:
– Airplanes and missiles
© Computer Structure and Language by Dr. Miremadi Slide 61
Generation 0: Mechanical (1642-1945)
• In late 1930, the first large scale calculator was the Harvard
Mark I, conceived by Howard Aiken (a graduate student in
theoretical physics at Harvard University):
– General purpose,
– An electrically driven
mechanical calculator
– known as the Automatic
Sequence Controlled
Calculator (ASCC) by IBM
• The ASCC was driven
by a punched paper tape
containing the
instructions.
© Computer Structure and Language by Dr. Miremadi Slide 62
Generation 1: Vacuum tubes (1945-1955)
Generation 1: Vacuum tubes
© Computer Structure and Language by Dr. Miremadi Slide 63
Generation 1: Vacuum tubes (1945-1955)
• Use of vacuum tubes
– ENIAC
• Electronic
• Numerical
• Integrator
• And
• Computer
• Work on ENIAC was started
in 1943 by:
– John Mauchly (left)
– J. Presper Eckert
© Computer Structure and Language by Dr. Miremadi Slide 64
Generation 1: Vacuum tubes (1945-1955)
• A vacuum tube also called an electron tubes is a
sealed glass or metal-ceramic enclosure used in
electronic circuitry to control the flow of electrons
between the metal electrodes sealed inside the
tubes. The air inside the tubes is removed by a
vacuum.
• The vacuum tube was an extremely important
step in the advancement of computers. It's
purpose was to act like an amplifier and a
switch.
© Computer Structure and Language by Dr. Miremadi Slide 65
Generation 1: Vacuum tubes (1945-1955)
• Vacuum tubes could:
– Take very weak signals and make the signal
stronger (amplify it).
– Stop and start the flow of electricity instantly
(switch).
– These two properties made the ENIAC
computer possible.
© Computer Structure and Language by Dr. Miremadi Slide 66
Generation 1: Vacuum tubes (1945-1955)
• The ENIAC electronic computer
used vacuum tubes instead of
the mechanical switches of the
Mark I.
• 18000 vacuum tubes
• 1500 relays
• 70000 resistors
• 30 ton
• 5 million soldered joints
• 140-160 kW el. power
• 150 m2 Numeral system: Decimal
• Programmed via 6000 multi-
choice switches and tons of
wires © Computer Structure and Language by Dr. Miremadi Slide 67
Generation 1: Vacuum tubes (1945-1955)
• Programming Available:
– Patch-cord programming
• The programmers actually wired in steps telling the
computer what to do with data.
– Punched and Paper tape programming
• Programming Problems:
– Nothing was stored in memory
• Program Storage
became very important
© Computer Structure and Language by Dr. Miremadi Slide 68
Generation 1: Vacuum tubes (1945-1955)
• John von Neumann designed a computer
architecture consisting of
– a program/data memory
– an ALU with accumulator and
– a controller,
• Was the first to use binary arithmetic instead of
decimal arithmetic
© Computer Structure and Language by Dr. Miremadi Slide 69
Generation 1: Vacuum tubes (1945-1955)
• Today’s computers still have this von Neumann
architecture
• He lay the foundation for the “von Neumann
bottleneck”, i.e. the bottleneck between the
memory and the rest of the computer
– All newer designs have been focusing on removing
this bottleneck
© Computer Structure and Language by Dr. Miremadi Slide 70
Generation 1: Vacuum tubes (1945-1955)
• In 1946, John von Neumann (1903-1957)
invented the stored program machine:
– The program was not anymore stored in switches
and wires or on punched paper, but in program
memory:
• The EDVAC, was designed, however,
not implemented.
– Electronic Discrete Variable Automatic Computer
© Computer Structure and Language by Dr. Miremadi Slide 71
Generation 1: Vacuum tubes (1945-1955)
• In 1948, the first
stored program
machine was
operational at the
University of
Manchester:
– Manchester Mark I
• The first general-
purpose digital
computer
• Instruction execution:
– 1.2 milliseconds
© Computer Structure and Language by Dr. Miremadi Slide 72
Generation1: Vacuum tubes (1945-1955)
• John von Neumann in 1952 with his new machine
© Computer Structure and Language by Dr. Miremadi Slide 73
Generation 1: Vacuum tubes (1945-1955)
• The problem with vacuum tubes:
– Were unreliable
– Made computers expensive to run and maintain
– Were hot
– Required air conditioning room
– Large space needed http://www.noisefx.com/product_details/electro_harmonix_va
http://www.computermuseum.li/Testpage/IntroToVacuumTubes.htm
© Computer Structure and Language by Dr. Miremadi Slide 74
Generation 2: Discrete transistors (1955-1965)
Generation 2:
Discrete Transistors
© Computer Structure and Language by Dr. Miremadi Slide 75
Generation 2: Discrete transistors (1955-1965)
• Scientists at Bell
Laboratory:
– William Shockley,
– John Bardeen, and
– Walter Brattain
invented in 1947 the
transistor.
© Computer Structure and Language by Dr. Miremadi Slide 76
Generation 2: Discrete transistors (1955-1965)
• A transistor has three leads, called the
base, the collector, and the emitter.
• The voltage of the base (in relation to the
ground) determines whether and how
much current flows from the collector to
the emitter.
• In sum, a transistor controls the flow
between the collector and the emitter
based upon the voltage of the base.
© Computer Structure and Language by Dr. Miremadi Slide 77
Generation 2: Discrete transistors (1955-1965)
IBM:
• 1953 - the IBM 701
– IBM’s first stored program computer
– Scientific calculations
• 1955 - the IBM 702
– Business applications
• 1955 - the IBM 704
– Mainframe computer
– Distributed data input and output
© Computer Structure and Language by Dr. Miremadi Slide 78
CDC 6000/7000
Slide 79