SlideShare a Scribd company logo
1
Computers and Microprocessors
Lecture 35
PHYS3360/AEP3630
2
Contents
• Input/output standards
• Microprocessor evolution
• Computer languages & operating systems
• Information encryption/decryption
3
• USB (universal serial bus)
– intelligent high-speed connection to devices
– up to 480 Mbit/s (USB 2.0 Hi-Speed)
– USB hub connects multiple devices
– enumeration: computer queries devices
– supports hot swapping, hot plugging
• Parallel
– short cable, Enhanced PP up to 2 Mbit/s
– common for printers, simpler devices
– bidirectional, parallel data transfer (IEEE 1284)
– Intel 8255 controller chip
Input/Output Ports
4
• Serial
– one bit at a time
– RS-232 (recommended standard 232) serial port
– used with long cables (not longer than ~15 m OK)
– low speeds (up to 115 kbit/s)
– still widely used to interface instruments
– additional standards available:
• E.g. RS-422/485 differential signals for better noise immunity,
can support speeds in access of 10 Mbit/s (becomes cable-
length dependent)
Input/Output Ports (2)
5
• IEEE-488 (GPIB)
– Has been around for 30 years, many
instruments are equipped with it
– Allows daisy-chaining up to 15 devices
– Updated versions have speeds up to 10Mbit/s
Input/Output Ports (3)
6
• Generally characterized by the “word” size
(registers and data bus)
– 8-bit, 16-bit, 32-bit, 64-bit
– addressable memory related to the word size
• Intel 8080 (1974)
– 8-bit, first truly usable m-processor (40 DIP)
– seven 8-bit registers (six of which can be
combined as three 16-bit registers)
– 6K transistors, 2MHz clock
– Other notable 8-bit processors include Zilog
Z80 (1976) (used in Osborne 1, first portable
m-computer) and Motorola 6800/6809 (1978)
– Small cost, compact packaging allowed home
computer revolution
Microprocessor Evolution
7
• Intel 8080 later variants
– 64K addressable RAM (16-bit bus address)
– 8-bit registers
– CP/M (control program for m-computers) OS
– 5,6,8,10 MHz
– 29K transistors
• Intel 8086/8088 (1978)
– 16-bit processor, IBM-PC used 8088
– 1 MB addressable RAM (20-bit addresses)
– 16-bit registers
– 16-bit data bus (8-bit for 8088)
– separate floating-point unit (8087)
– used in low-cost microcontrollers now
Early Intel Processors
8
• Western Design Center (WDC 65816)
– used in Apple II and Super Nintendo
– fully CMOS, low power consumption (300 mA
at 1MHz, operating voltage as low as 1.8V)
– Wait-for-Interrupt and Stop-the-Clock
instructions further reduce power consumption
– one of the most popular (made in huge numbers)
– Still sold today (original 1984), used as a
controller
– 24-bit address bus (16MB of memory space)
• Texas Instrument TM9900, National
Semiconductor IMP-16, etc.
Other 16-bit processors
9
• Intel 80286 (1982)
– Still largely a 16-bit processor
– 16 MB addressable RAM
– Protected memory
– several times faster than 8086
– introduced IDE bus architecture
– 80287 floating point unit
– Up to 20MHz
– 134K transistors
IBM-AT
10
• Motorola 680x0 series
– 32-bit registers
– 68010 (1982) adds virtual memory support
– Other successors 68020/68030/68040/68060
– Popular with UNIX operating systems in late
1980’s/early 1990’s
– Faded from computer desktop market, but had a strong
standing in embedded / controller equipment (still
used)
• “Microprocessor wars”
– leads to elimination of some / survival of the fittest. In
aftermath, the PC market to be largely dominated by IA-
32; however, much more diversity exists for the controllers
32-bit processors
11
• Intel386 (1985)
– 4 GB addressable RAM
– 32-bit registers
– paging (virtual memory)
– Up to 33MHz
• Intel486 (1989)
– instruction pipelining
– Integrated FPU
– 8K cache
• Pentium (1993)
– Superscalar (two parallel pipelines)
– Intel declines to license Pentium to others,
AMD and Cyrix start their own designs
IA-32
12
• Pentium Pro (1995)
– advanced optimization techniques in m-code
– More pipeline stages
– On-board L2 cache
• Pentium II (1997)
– MMX (multimedia) instruction set
– Up to 450MHz
• Pentium III (1999)
– SIMD (streaming extensions) instructions (SSE)
– Up to 1+GHz
• Pentium 4 (2000)
– NetBurst micro-architecture, tuned for multimedia
– 3.8+GHz
• Pentium D (Dual core)
• …
Intel Pentium Family
13
• 2003 data (from Wikipedia)
– $44 billion dealt in business on microprocessors
– Personal computers account for 50% of cost but
only 0.2% of all CPU’s sold
– 55% of all CPU’s sold are 8-bit controllers (many
billions sold overall)
– Less than 10% of all CPU’s are 32-bit or more
– Of all 32-bit processors sold, only 2% are used in
personal computers (laptops/desktops)
– “Taken as a whole, the average price for
microprocessor, microcontroller, or DSP is just
over $6”
– Read more at
http://www.embedded.com/shared/printableArticle.jhtml?articleID=9900861
Some interesting statistics
14
Programming
• Interpreted High Level
Language
• Compiled High Level
Language
• Assembly Language
• Machine Language
15
Programming (2)
• Machine Language
– binary instructions (op codes) actually read and
interpreted by the CPU
Ex: 1000 1011 0000 0101
‘move value from memory to AX register’ on
386
– different for each CPU type
• Assembly Language
– CPU instructions represented by mnemonics
Ex: MOV AX, M same as above
– each AL instruction converts to one ML instruction by
assembler program
– Efficient fast execution, inconvenient to program in
– Allows access to instructions not available with higher
16
Programming (3)
• High Level Language, e.g. C/C++
– easier to use
– it’s compiler’s job to translates (one) HLL instruction
into (many) ML instructions
– portable: can compile the same source (HLL
instructions) on different OS platforms
– slower and more restricted
• Interpreted Languages, e.g. JAVA, scripting
– on-the-fly translation of high level language
– slowest of the above, but often a good place to start
with a new project
17
m-processor: registers
CS
SS
DS
ES
EIP
EFLAGS
16-bit Segment Registers
EAX
EBX
ECX
EDX
32-bit General-Purpose Registers
FS
GS
EBP
ESP
ESI
EDI
Storage locations inside the CPU, optimized for speed.
Control registers
18
m-processor: registers (2)
• General Purpose Registers: used to contain arithmetic
and logical operands used by ALU
• Segment Registers: indicate segments of memory
currently in use.
– CS: (code segment) memory segment where
instructions/program are located
– DS: (data segment) …
– SS: (stack segment) …
– ES: (extra segment) …
• Pointer & Index Registers:
– BP: base pointer
– SP: stack pointer
– SI: source index
– DI: destination index
complete address =
segment +
pointer/index
19
• Control Registers:
– IP/IR: instruction pointer held in instruction register
(memory address of next instruction to be executed)
– FLAGS: status and control flags; used to indicate
processor status
m-processor: registers (3)
o i s z p c
11 10 9 8 7 6 5 4 3 2 1 0
c = 1: if operand produced carry
p = 1: if operand has parity of 1
z = 1: if result = 0
s = 1: if result < 0
i = 1: m-processor will respond to interrupts
o = 1: if result produced overflow
20
• Fetch the next instruction (address is held in instruction
pointer / register); instruction pointer is incremented to the
next value or branched, conditional statements may throw
it elsewhere
• Decode: what do 1’s and 0’s mean?
• Execute: the instruction
m-processor instruction cycle
21
• Data Transfer:
MOV d,s move (s)ource to (d)estination
• Arithmetic:
ADD d,s add s to d and store it in d
INC d increment contents of d by 1
• Logical and Shifts:
AND d,s bitwise AND of s with d, store in d
SHL d shift d left one bit
• Control Transfer:
JMP loc jump to memory location loc
JE loc jump to loc if result of last operation = 0
• I/O:
OUT d,s output to the I/O space (address d)
some basic assembler instructions
22
Location of the operand of an instruction may be obtained:
• Immediate: e.g. 200 (hex!)
Operand contained in 2nd
part of the instruction
• Register: e.g. BX
Operand is contained in one of the general registers
• Indirect: e.g. [200]
Operand’s address is contained in the 2nd
part of the instr.
• Register indirect: e.g. [BX]
Operand’s address is contained in one of the general
pointers or pointer/index registers
• Indexed: e.g. [BX+1]
Operand’s address is formed by adding displacement
contained in 2nd
part of the instr. to the contents of one of
the index registers
Addressing modes
23
Addr. ML AL Meaning
Assembler example
100 BB 00 02 MOV BX,200 BX  200h (load addr.)
103 8A 2F MOV CH,[BX] CH  value at loc 200h
105 8A 4F 01 MOV CL,[BX+1] CL  value at loc 201h
108 88 0F MOV [BX],CL loc 200h  CL
10A 88 6F 01 MOV [BX+1],CH loc 201h  CH
10D CD 20 INT 20 software interrupt (exit
Location Value before Value after
200 A1 B2
201 B2 A1
202 ? ?
The program swaps values in locations 200 and 201
opcode lo hi
24
I/O devices usually have their own registers which are
assigned or mapped to addresses in memory
I/O is achieved by m-processor reading from / writing to the
corresponding memory addresses
Ex: I/O user port used in the lab this week has 8 registers at
addresses 2A0H  2A7H. Used to control ADC, DAC and
digital I/O functions of the port.
Input/Outputs
25
• Provides a level of abstraction and security for higher
level applications; interrupts, memory handling, etc.
• I/O are privileged operations, usually only OS can do I/O
• A device driver is provided, which runs as part of the OS
• User’s program then communicates to the device through
the driver and OS
Operating System
26
• Most OS can run multiple programs at the same time.
• Multiple threads of execution within the same program.
• Scheduler utility assigns a given amount of CPU time to
each running program.
• Rapid switching of tasks gives illusion that all programs are
running at once
• The processor must support task switching
• Scheduling policy, priority, etc.
OS: multitasking
27
Used for handling peripheral I/O asynchronously (orders of
magnitude differences in time required for access,
enable/disable, read/write, etc.)
Device requiring services asserts Interrupt Request.
When INTR asserted:
• m-processor completes execution of current instruction
• IP/IR & other registers pushed onto stack
• IP/IR loaded with address of interrupt routine
• interrupt routine executed to identify and service the
device
• when completed, IP & registers popped from stack, and
program execution resumes
Interrupts
28
General purpose OS systems such as Linux, Windows, Mac
OS do not guarantee ‘real-time’ execution of instructions
i.e. they don’t necessarily have any operational deadlines
from event to system response
e.g. various interrupts, multitasking, etc. are usually
handled with the illusion of smooth running for a
casual user, but the behavior is not deterministic
Multitasking operating systems are available that provide
tools to ensure that certain deadlines from event to system
response are met.
Examples: VxWorks (Wind River) – used on Mars rovers
RTLinux, RTEMS (o.source)
Real Time Operating Systems
29
Signal encryption using a sequence of pseudo-random
numbers
• Uses linear feedback shift registers (LFSR) to generate a
sequence of pseudo-random numbers (deterministic
sequence that looks random)
• If LFSR has N bits, the max sequence will be 2N
– 1 long,
then repeats
• E.g. 8-bit LFSR can produce 255 long sequence, 32-bit
LFSR can produce 4,294,967,295 pseudo-random sequence
• XOR gates are used to tap certain outputs into the serial
input (see the table in the Supplement)
LTspice experiment 11.1
30
Pseudo-random number generator
• 8-bit pseudo-random generator
• Output random number is (Q7Q6Q5Q4Q3Q2Q1Q0)2
• At least one Qi bit must be non-zero initially for non-trivial (other
than always 0’s) pattern
• The initial state of Qi bits is known as seed, which uniquely defines
the sequence of pseudo-random numbers
31
Encrypting/decrypting
• To encrypt scramble the stream of data bits with pseudo-random
sequence:
ENi = Ai  PRi
• How to decrypt?
Ai = ENi  PRi
• Need the same unique sequence of pseudo-random numbers used
for encryption (seed becomes encryption/decryption password).
Information bit
encrypted bit P-random bit
32
• Implement pseudo-random number generator
• Decrypt an encrypted 8-bit data stream
• Perform digital-to-analog conversion and plot a parametric
curve (x(t), y(t)) to display the secret message
• E.g. explain how RSA encryption/decryption works
• RSA = Rivest, Shamir, Adleman
• Public key cryptography
LTspice experiment 11.1
Things to read/think about
33
Arduino – 30$ computer (Teensy – 19$)
QCO
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Frequency 16 MHz
Arduino Uno specs
www.arduino.cc
34
Arduino Mega Arduino UNO Arduino Mini/Nano Lilypad
Different Arduinos

More Related Content

Similar to computer_lecture2.pdf what is computer and microprocessor (20)

PPTX
COA lecture 04.pptx.....................
salmannawaz6566504
 
PPTX
Register & Memory
Education Front
 
PPTX
Computer Organization: Introduction to Microprocessor and Microcontroller
AmrutaMehata
 
PPT
Introduction
Shehrevar Davierwala
 
PPT
EEE226a.ppt
SaifulAhmad27
 
DOCX
8085 notes g scheme 2016
HarshitParkar6677
 
PDF
THE 8086 MICROPROCESSOR -architecture, basics
C.Helen Sulochana
 
PPTX
CMP 221.pptx computer science machine and assembly language
omotunwaserejoice
 
PPTX
COA Lecture 01(Introduction).pptx
syed rafi
 
PPTX
microprocessor unit1 2022.pptx
22X041SARAVANANS
 
DOCX
8085 notes g scheme 2016
HarshitParkar6677
 
DOCX
8085 notes g scheme 2016 (2)
HarshitParkar6677
 
PPTX
COA Lecture 01(Introduction to COAL).pptx
muhammadanasgc
 
PPT
Microprocessor fundamentals
JLoknathDora
 
PPTX
Chapter # 1 Intro to 80868088 uProcessor.pptx
WaqarUlHassan52
 
PPTX
Fundamentals of Microcontrollers CHAPTER 1.pptx
natyesu
 
PDF
introduction to Micro Processor and Microcontroller
Bharathi Venkatachalam
 
PPT
presentation_microcontroller_1457634560_181219.ppt
LalithKumar818864
 
PPTX
Microprocessor and assembly language.pptx
KelemAlebachew
 
DOCX
8085 notes g scheme
HarshitParkar6677
 
COA lecture 04.pptx.....................
salmannawaz6566504
 
Register & Memory
Education Front
 
Computer Organization: Introduction to Microprocessor and Microcontroller
AmrutaMehata
 
Introduction
Shehrevar Davierwala
 
EEE226a.ppt
SaifulAhmad27
 
8085 notes g scheme 2016
HarshitParkar6677
 
THE 8086 MICROPROCESSOR -architecture, basics
C.Helen Sulochana
 
CMP 221.pptx computer science machine and assembly language
omotunwaserejoice
 
COA Lecture 01(Introduction).pptx
syed rafi
 
microprocessor unit1 2022.pptx
22X041SARAVANANS
 
8085 notes g scheme 2016
HarshitParkar6677
 
8085 notes g scheme 2016 (2)
HarshitParkar6677
 
COA Lecture 01(Introduction to COAL).pptx
muhammadanasgc
 
Microprocessor fundamentals
JLoknathDora
 
Chapter # 1 Intro to 80868088 uProcessor.pptx
WaqarUlHassan52
 
Fundamentals of Microcontrollers CHAPTER 1.pptx
natyesu
 
introduction to Micro Processor and Microcontroller
Bharathi Venkatachalam
 
presentation_microcontroller_1457634560_181219.ppt
LalithKumar818864
 
Microprocessor and assembly language.pptx
KelemAlebachew
 
8085 notes g scheme
HarshitParkar6677
 

Recently uploaded (20)

PPTX
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
PPTX
SYMPATHOMIMETICS[ADRENERGIC AGONISTS] pptx
saip95568
 
PDF
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
PPTX
How to Setup Automatic Reordering Rule in Odoo 18 Inventory
Celine George
 
PDF
Cooperative wireless communications 1st Edition Yan Zhang
jsphyftmkb123
 
PPTX
week 1-2.pptx yueojerjdeiwmwjsweuwikwswiewjrwiwkw
rebznelz
 
PPTX
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
PPTX
PLANNING FOR EMERGENCY AND DISASTER MANAGEMENT ppt.pptx
PRADEEP ABOTHU
 
PPTX
Comparing Translational and Rotational Motion.pptx
AngeliqueTolentinoDe
 
PPTX
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
PDF
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
PDF
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
DOCX
Lesson 1 - Nature and Inquiry of Research
marvinnbustamante1
 
PDF
Supply Chain Security A Comprehensive Approach 1st Edition Arthur G. Arway
rxgnika452
 
PPTX
Natural Language processing using nltk.pptx
Ramakrishna Reddy Bijjam
 
PPTX
How to Manage Wins & Losses in Odoo 18 CRM
Celine George
 
PPTX
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
PPTX
How Physics Enhances Our Quality of Life.pptx
AngeliqueTolentinoDe
 
DOCX
MUSIC AND ARTS 5 DLL MATATAG LESSON EXEMPLAR QUARTER 1_Q1_W1.docx
DianaValiente5
 
PDF
Our Guide to the July 2025 USPS® Rate Change
Postal Advocate Inc.
 
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
SYMPATHOMIMETICS[ADRENERGIC AGONISTS] pptx
saip95568
 
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
How to Setup Automatic Reordering Rule in Odoo 18 Inventory
Celine George
 
Cooperative wireless communications 1st Edition Yan Zhang
jsphyftmkb123
 
week 1-2.pptx yueojerjdeiwmwjsweuwikwswiewjrwiwkw
rebznelz
 
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
PLANNING FOR EMERGENCY AND DISASTER MANAGEMENT ppt.pptx
PRADEEP ABOTHU
 
Comparing Translational and Rotational Motion.pptx
AngeliqueTolentinoDe
 
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
Lesson 1 - Nature and Inquiry of Research
marvinnbustamante1
 
Supply Chain Security A Comprehensive Approach 1st Edition Arthur G. Arway
rxgnika452
 
Natural Language processing using nltk.pptx
Ramakrishna Reddy Bijjam
 
How to Manage Wins & Losses in Odoo 18 CRM
Celine George
 
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
How Physics Enhances Our Quality of Life.pptx
AngeliqueTolentinoDe
 
MUSIC AND ARTS 5 DLL MATATAG LESSON EXEMPLAR QUARTER 1_Q1_W1.docx
DianaValiente5
 
Our Guide to the July 2025 USPS® Rate Change
Postal Advocate Inc.
 
Ad

computer_lecture2.pdf what is computer and microprocessor

  • 2. 2 Contents • Input/output standards • Microprocessor evolution • Computer languages & operating systems • Information encryption/decryption
  • 3. 3 • USB (universal serial bus) – intelligent high-speed connection to devices – up to 480 Mbit/s (USB 2.0 Hi-Speed) – USB hub connects multiple devices – enumeration: computer queries devices – supports hot swapping, hot plugging • Parallel – short cable, Enhanced PP up to 2 Mbit/s – common for printers, simpler devices – bidirectional, parallel data transfer (IEEE 1284) – Intel 8255 controller chip Input/Output Ports
  • 4. 4 • Serial – one bit at a time – RS-232 (recommended standard 232) serial port – used with long cables (not longer than ~15 m OK) – low speeds (up to 115 kbit/s) – still widely used to interface instruments – additional standards available: • E.g. RS-422/485 differential signals for better noise immunity, can support speeds in access of 10 Mbit/s (becomes cable- length dependent) Input/Output Ports (2)
  • 5. 5 • IEEE-488 (GPIB) – Has been around for 30 years, many instruments are equipped with it – Allows daisy-chaining up to 15 devices – Updated versions have speeds up to 10Mbit/s Input/Output Ports (3)
  • 6. 6 • Generally characterized by the “word” size (registers and data bus) – 8-bit, 16-bit, 32-bit, 64-bit – addressable memory related to the word size • Intel 8080 (1974) – 8-bit, first truly usable m-processor (40 DIP) – seven 8-bit registers (six of which can be combined as three 16-bit registers) – 6K transistors, 2MHz clock – Other notable 8-bit processors include Zilog Z80 (1976) (used in Osborne 1, first portable m-computer) and Motorola 6800/6809 (1978) – Small cost, compact packaging allowed home computer revolution Microprocessor Evolution
  • 7. 7 • Intel 8080 later variants – 64K addressable RAM (16-bit bus address) – 8-bit registers – CP/M (control program for m-computers) OS – 5,6,8,10 MHz – 29K transistors • Intel 8086/8088 (1978) – 16-bit processor, IBM-PC used 8088 – 1 MB addressable RAM (20-bit addresses) – 16-bit registers – 16-bit data bus (8-bit for 8088) – separate floating-point unit (8087) – used in low-cost microcontrollers now Early Intel Processors
  • 8. 8 • Western Design Center (WDC 65816) – used in Apple II and Super Nintendo – fully CMOS, low power consumption (300 mA at 1MHz, operating voltage as low as 1.8V) – Wait-for-Interrupt and Stop-the-Clock instructions further reduce power consumption – one of the most popular (made in huge numbers) – Still sold today (original 1984), used as a controller – 24-bit address bus (16MB of memory space) • Texas Instrument TM9900, National Semiconductor IMP-16, etc. Other 16-bit processors
  • 9. 9 • Intel 80286 (1982) – Still largely a 16-bit processor – 16 MB addressable RAM – Protected memory – several times faster than 8086 – introduced IDE bus architecture – 80287 floating point unit – Up to 20MHz – 134K transistors IBM-AT
  • 10. 10 • Motorola 680x0 series – 32-bit registers – 68010 (1982) adds virtual memory support – Other successors 68020/68030/68040/68060 – Popular with UNIX operating systems in late 1980’s/early 1990’s – Faded from computer desktop market, but had a strong standing in embedded / controller equipment (still used) • “Microprocessor wars” – leads to elimination of some / survival of the fittest. In aftermath, the PC market to be largely dominated by IA- 32; however, much more diversity exists for the controllers 32-bit processors
  • 11. 11 • Intel386 (1985) – 4 GB addressable RAM – 32-bit registers – paging (virtual memory) – Up to 33MHz • Intel486 (1989) – instruction pipelining – Integrated FPU – 8K cache • Pentium (1993) – Superscalar (two parallel pipelines) – Intel declines to license Pentium to others, AMD and Cyrix start their own designs IA-32
  • 12. 12 • Pentium Pro (1995) – advanced optimization techniques in m-code – More pipeline stages – On-board L2 cache • Pentium II (1997) – MMX (multimedia) instruction set – Up to 450MHz • Pentium III (1999) – SIMD (streaming extensions) instructions (SSE) – Up to 1+GHz • Pentium 4 (2000) – NetBurst micro-architecture, tuned for multimedia – 3.8+GHz • Pentium D (Dual core) • … Intel Pentium Family
  • 13. 13 • 2003 data (from Wikipedia) – $44 billion dealt in business on microprocessors – Personal computers account for 50% of cost but only 0.2% of all CPU’s sold – 55% of all CPU’s sold are 8-bit controllers (many billions sold overall) – Less than 10% of all CPU’s are 32-bit or more – Of all 32-bit processors sold, only 2% are used in personal computers (laptops/desktops) – “Taken as a whole, the average price for microprocessor, microcontroller, or DSP is just over $6” – Read more at http://www.embedded.com/shared/printableArticle.jhtml?articleID=9900861 Some interesting statistics
  • 14. 14 Programming • Interpreted High Level Language • Compiled High Level Language • Assembly Language • Machine Language
  • 15. 15 Programming (2) • Machine Language – binary instructions (op codes) actually read and interpreted by the CPU Ex: 1000 1011 0000 0101 ‘move value from memory to AX register’ on 386 – different for each CPU type • Assembly Language – CPU instructions represented by mnemonics Ex: MOV AX, M same as above – each AL instruction converts to one ML instruction by assembler program – Efficient fast execution, inconvenient to program in – Allows access to instructions not available with higher
  • 16. 16 Programming (3) • High Level Language, e.g. C/C++ – easier to use – it’s compiler’s job to translates (one) HLL instruction into (many) ML instructions – portable: can compile the same source (HLL instructions) on different OS platforms – slower and more restricted • Interpreted Languages, e.g. JAVA, scripting – on-the-fly translation of high level language – slowest of the above, but often a good place to start with a new project
  • 17. 17 m-processor: registers CS SS DS ES EIP EFLAGS 16-bit Segment Registers EAX EBX ECX EDX 32-bit General-Purpose Registers FS GS EBP ESP ESI EDI Storage locations inside the CPU, optimized for speed. Control registers
  • 18. 18 m-processor: registers (2) • General Purpose Registers: used to contain arithmetic and logical operands used by ALU • Segment Registers: indicate segments of memory currently in use. – CS: (code segment) memory segment where instructions/program are located – DS: (data segment) … – SS: (stack segment) … – ES: (extra segment) … • Pointer & Index Registers: – BP: base pointer – SP: stack pointer – SI: source index – DI: destination index complete address = segment + pointer/index
  • 19. 19 • Control Registers: – IP/IR: instruction pointer held in instruction register (memory address of next instruction to be executed) – FLAGS: status and control flags; used to indicate processor status m-processor: registers (3) o i s z p c 11 10 9 8 7 6 5 4 3 2 1 0 c = 1: if operand produced carry p = 1: if operand has parity of 1 z = 1: if result = 0 s = 1: if result < 0 i = 1: m-processor will respond to interrupts o = 1: if result produced overflow
  • 20. 20 • Fetch the next instruction (address is held in instruction pointer / register); instruction pointer is incremented to the next value or branched, conditional statements may throw it elsewhere • Decode: what do 1’s and 0’s mean? • Execute: the instruction m-processor instruction cycle
  • 21. 21 • Data Transfer: MOV d,s move (s)ource to (d)estination • Arithmetic: ADD d,s add s to d and store it in d INC d increment contents of d by 1 • Logical and Shifts: AND d,s bitwise AND of s with d, store in d SHL d shift d left one bit • Control Transfer: JMP loc jump to memory location loc JE loc jump to loc if result of last operation = 0 • I/O: OUT d,s output to the I/O space (address d) some basic assembler instructions
  • 22. 22 Location of the operand of an instruction may be obtained: • Immediate: e.g. 200 (hex!) Operand contained in 2nd part of the instruction • Register: e.g. BX Operand is contained in one of the general registers • Indirect: e.g. [200] Operand’s address is contained in the 2nd part of the instr. • Register indirect: e.g. [BX] Operand’s address is contained in one of the general pointers or pointer/index registers • Indexed: e.g. [BX+1] Operand’s address is formed by adding displacement contained in 2nd part of the instr. to the contents of one of the index registers Addressing modes
  • 23. 23 Addr. ML AL Meaning Assembler example 100 BB 00 02 MOV BX,200 BX  200h (load addr.) 103 8A 2F MOV CH,[BX] CH  value at loc 200h 105 8A 4F 01 MOV CL,[BX+1] CL  value at loc 201h 108 88 0F MOV [BX],CL loc 200h  CL 10A 88 6F 01 MOV [BX+1],CH loc 201h  CH 10D CD 20 INT 20 software interrupt (exit Location Value before Value after 200 A1 B2 201 B2 A1 202 ? ? The program swaps values in locations 200 and 201 opcode lo hi
  • 24. 24 I/O devices usually have their own registers which are assigned or mapped to addresses in memory I/O is achieved by m-processor reading from / writing to the corresponding memory addresses Ex: I/O user port used in the lab this week has 8 registers at addresses 2A0H  2A7H. Used to control ADC, DAC and digital I/O functions of the port. Input/Outputs
  • 25. 25 • Provides a level of abstraction and security for higher level applications; interrupts, memory handling, etc. • I/O are privileged operations, usually only OS can do I/O • A device driver is provided, which runs as part of the OS • User’s program then communicates to the device through the driver and OS Operating System
  • 26. 26 • Most OS can run multiple programs at the same time. • Multiple threads of execution within the same program. • Scheduler utility assigns a given amount of CPU time to each running program. • Rapid switching of tasks gives illusion that all programs are running at once • The processor must support task switching • Scheduling policy, priority, etc. OS: multitasking
  • 27. 27 Used for handling peripheral I/O asynchronously (orders of magnitude differences in time required for access, enable/disable, read/write, etc.) Device requiring services asserts Interrupt Request. When INTR asserted: • m-processor completes execution of current instruction • IP/IR & other registers pushed onto stack • IP/IR loaded with address of interrupt routine • interrupt routine executed to identify and service the device • when completed, IP & registers popped from stack, and program execution resumes Interrupts
  • 28. 28 General purpose OS systems such as Linux, Windows, Mac OS do not guarantee ‘real-time’ execution of instructions i.e. they don’t necessarily have any operational deadlines from event to system response e.g. various interrupts, multitasking, etc. are usually handled with the illusion of smooth running for a casual user, but the behavior is not deterministic Multitasking operating systems are available that provide tools to ensure that certain deadlines from event to system response are met. Examples: VxWorks (Wind River) – used on Mars rovers RTLinux, RTEMS (o.source) Real Time Operating Systems
  • 29. 29 Signal encryption using a sequence of pseudo-random numbers • Uses linear feedback shift registers (LFSR) to generate a sequence of pseudo-random numbers (deterministic sequence that looks random) • If LFSR has N bits, the max sequence will be 2N – 1 long, then repeats • E.g. 8-bit LFSR can produce 255 long sequence, 32-bit LFSR can produce 4,294,967,295 pseudo-random sequence • XOR gates are used to tap certain outputs into the serial input (see the table in the Supplement) LTspice experiment 11.1
  • 30. 30 Pseudo-random number generator • 8-bit pseudo-random generator • Output random number is (Q7Q6Q5Q4Q3Q2Q1Q0)2 • At least one Qi bit must be non-zero initially for non-trivial (other than always 0’s) pattern • The initial state of Qi bits is known as seed, which uniquely defines the sequence of pseudo-random numbers
  • 31. 31 Encrypting/decrypting • To encrypt scramble the stream of data bits with pseudo-random sequence: ENi = Ai  PRi • How to decrypt? Ai = ENi  PRi • Need the same unique sequence of pseudo-random numbers used for encryption (seed becomes encryption/decryption password). Information bit encrypted bit P-random bit
  • 32. 32 • Implement pseudo-random number generator • Decrypt an encrypted 8-bit data stream • Perform digital-to-analog conversion and plot a parametric curve (x(t), y(t)) to display the secret message • E.g. explain how RSA encryption/decryption works • RSA = Rivest, Shamir, Adleman • Public key cryptography LTspice experiment 11.1 Things to read/think about
  • 33. 33 Arduino – 30$ computer (Teensy – 19$) QCO Microcontroller ATmega328 Operating Voltage 5V Input Voltage (recommended) 7-12V Input Voltage (limits) 6-20V Digital I/O Pins 14 (of which 6 provide PWM output) Analog Input Pins 6 DC Current per I/O Pin 40 mA DC Current for 3.3V Pin 50 mA Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader SRAM 2 KB (ATmega328) EEPROM 1 KB (ATmega328) Clock Frequency 16 MHz Arduino Uno specs www.arduino.cc
  • 34. 34 Arduino Mega Arduino UNO Arduino Mini/Nano Lilypad Different Arduinos

Editor's Notes

  • #4: GPIB – general purpose interface bus
  • #5: GPIB – general purpose interface bus
  • #11: FPU – floating point unit
  • #12: SIMD – single instruction multiple data
  • #18: Stack – set of memory locations in RAM used for temporary storage of micro-processor registers, intermediate results, etc.