CPS 125: Digital Computation and Programming - PowerPoint PPT Presentation

1 / 46
About This Presentation
Title:

CPS 125: Digital Computation and Programming

Description:

From refrigerators, coffee machines, cars, stereos, mp3s, cell phones, boats, toys, ... If you've got a late-model luxury sedan, two or three processors might be ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 47
Provided by: Squ59
Category:

less

Transcript and Presenter's Notes

Title: CPS 125: Digital Computation and Programming


1
CPS 125 Digital Computation and Programming
  • Week 1 Overview of Computers and Software

2
Why do engineers study programming?
  • Benefit
  • from the ability to write their own programs
  • Problems inevitably arise that are outside the
    range of problems solvable by the application
    software to which an individual
    engineer/scientist has immediate access.
  • Critical
  • Expanding societys technical knowledge
  • Applying the principles of science and
    mathematics to societys problems, overlooking
    the limitations of a software

3
Computer
  • exists almost every where in our living
    environment
  • From refrigerators, coffee machines, cars,
    stereos, mp3s, cell phones, boats, toys,
  • A modern car contains about 50 microprocessors
  • If you've got a late-model luxury sedan, two or
    three processors might be obvious in the GPS
    navigation system or the automatic distance
    control.
  • The current 7-Series BMW and S-class Mercedes
    boast about 100 processors apiece.

4
Computer in twenty-first century
5
Important hint
  • Learning programming is an essential to be a
    professional engineer for all fields.

6
Outline
  • What Is a Computer?
  • Computer Components
  • Computer Software
  • Software Development Method

7
What Is a Computer
  • Computer
  • An electronic machine that can receive, store,
  • transform, and output data of all kinds
  • numbers, text, images, graphics, and sound, to
    name a few.
  • Conceptual Layers of a Computer System
  • Application programs
  • Operating system
  • Computer hardware
  • External connections

8
What are Machine Structures?
Hardware
  • Coordination of many levels of abstraction

9
Computer Components
10
Computer System
  • CPU Main Memory core
  • Secondary Storage I/O Devices peripherals
  • Bus communication between components

11
Central Processing Unit
  • CPU the brain of a computer, transforms data
    from one to another, understands and executes
    computer programs written in machine language
  • The circuitry of a modern CPU consists of
    millions of miniature circuits manufactured in a
    sliver of silicon known as Integrated Circuit
    (IC) or chip
  • Microprocessor an entire CPU on a single chip
  • Arithmetic operations are performed using binary
    number system where data and control information
    (instructions) uses only two basic symbols 0,
    1 represented by electronics signals

12
Components of CPU
  • Arithmetic/Logic Unit (ALU)
  • performs arithmetic operations (addition,
    subtraction, etc.) and makes logical comparisons
    (and, or, equal to, etc.)
  • Control Unit (CU)
  • decodes machine instructions and sends control
    signals to the other components to carry out the
    instructions
  • Registers
  • high speed memory locations inside the CPU, used
    to store temporarily the current instructions and
    data values

13
Question
  • Which of the following statement is true?
  • A). CPU Main Memory core of a computer
  • B). The CPU consists of ALU,CU and Register
  • C). CU decodes machine instructions and sends
    control signals to the other components to carry
    out the instructions
  • D). Registers are high speed memory located
    inside the CPU
  • E). All of the above

14
Question 2
  • The arithmetic and Logic Unit
  • A). Decode instructions
  • B). Perform decision making
  • C). Performs arithmetic operations
  • D). All of the above
  • E). C and B above

15
Binary Numbers
  • All information in a typical computer is
    represented in binary
  • Bits a binary digit (0 or 1)
  • Bytes 8 bits of data, which is the amount of
    memory required to represent one character
  • Conversion from binary to decimal
  • b7 b6b5b4b3b2b1b0, where bi has place value 2i
  • Convert to decimal
  • b7 27b626 b525 b424 b323 b222 b121
    b020

16
Example of Binary-Decimal Conversion
  • 124 in binary
  • Answer 01111100
  • 251 ?
  • 10101011 in decimal
  • Answer 171
  • 01101111 ? In Binary

17
Negative binary numbers
  • 2s complement notation
  • In one's complement, positive numbers are
    represented as usual in regular binary. However,
    negative numbers are represented differently. To
    negate a number, replace all zeros with ones, and
    ones with zeros - flip the bits
  • Begin with the number in one's complement. Add 1
    if the number is negative.

18
True or false?
  • Arithmetic operations are performed by CPU
    using binary number system

19
Memory
  • The main memory is used to store the program and
    data which are currently manipulated by the CPU
  • The main memory is fast and of limited size
  • The most common memory type is random access
    memory (RAM)
  • The information stored in RAM will be lost when
    electrical power is removed
  • ROM

20
Memory Cells
  • Memory a collection of memory cells
  • Memory cell
  • Memory cell can be randomly accessed

21
Question
  • Answer Ture/False
  • Every byte in memory has a unique address to be
    accessed
  • RAM stand for Random Access Memory
  • can be read and written.
  • ROM stand for Read Only Memory
  • RAM is used to store application programs
  • ROM is used to install System routines
  • used for store the system BIOS and video BIOS

22
Secondary Storage
  • The secondary storage provides the long-term
    storage of large amounts of data and program
  • Before data and program in the secondary storage
    can be manipulated by the CPU, they must first be
    loaded into the main memory
  • The secondary storage is relatively slow and of
    very large size

23
Secondary Storage Devices
  • Magnetic Disks thin platter of metal or plastic
    on which data are represented by magnetized spots
    arranged in tracks
  • Hard disks (attached to disk drives) many GB
  • Floppy disks (removable) 1.44 MB
  • Zip disks (removable) 100 or 250 MB

24
Secondary Storage Devices
  • Optical Disks silvery plastic platter on which a
    laser records data as pits in a spiral track on
    one side of disk
  • CD 680 MB DVD 4.7 GB on one layer
  • Magnetic Tape a sequential-access device (for
    backup of data)
  • File named collection of data stored on disk
  • e.g. c\compons\ics\cpus\pent.txt (PC)

25
Data Storage Hierarchy
26
Storage Capacity
Units Abbrev. Equivalent to Comparison to Power of 10
Byte B 8 bits
Kilobyte KB 1024 (210) bytes gt 103
Megabyte MB 220 bytes gt 106
Gigabyte GB 230 bytes gt 109
Terabyte TB 240 bytes gt 1012
27
Input and Output Devices
  • Provide interfaces for humans to communicate with
    computers
  • Input devices
  • Keyboards type into text
  • Mouse, track balls, touch pads pointing devices
    for input of position/selection data
  • Scanner convert image to a grid of pixels
  • Output devices
  • Monitor, printer, speaker, etc.

28
Networks
  • Groups of individual computers and peripheral
    devices linked together to share information and
    resources.
  • Local Networks (LAN)
  • Wide Area Networks (WAN)
  • Internet
  • Links machine throughout the world

29
Connecting Computers LAN
computer
computer
computer
Local Area Network (LAN)
color printer
BW printer
30
Connecting Computers WAN
31
Computer Software
  • Two Types of Software
  • Operating System
  • Application Software
  • Computer Languages
  • Machine Language
  • Assembly Language
  • High-Level Language
  • From Source-Code to Executable Code

32
Operating System
  • Control and manage computer resources
  • Main functions
  • Communicating with computer users
  • Managing allocation of computer resource
  • Collecting input and conveying output
  • Accessing and writing to secondary storage
  • Authorization
  • Widely used operating systems
  • UNIX, Windows, Macintosh OS, and OS/2, etc.

33
Application Software
  • Application software is the software that has
    made using computers indispensable and popular
  • Common application software
  • Word processors
  • Spreadsheets
  • Database management systems
  • Drawing programs
  • Learning how to develop application software is
    our focus

34
Computer Languages
  • Machine Languages
  • A collection of binary instructions
  • Hard to understand by humans while the only
    understandable language by computers
  • Specific to a particular type of CPU
  • Assembly Languages
  • Operations are represented by mnemonics,
    variables are represented by names, so is more
    readable
  • Dependent on type of CPU

35
Example of machine language code
  • 000000 00001 00010 00110 00000 100000
  • 100011 00011 01000 00000 00001 000100
  • 000010 00000 00000 00000 10000 000001
  • adding the registers 1 and 2 and placing the
    result in register 6
  • Loading a value from the memory cell 68 cells
    after the one register 3 points to into register
    8
  • Jumping to the address 1025

36
Example of Assembly language code
  • page 60,132
  • TITLE A07LOOP (COM) Illustration of LOOP
  • .MODEL SMALL
  • .CODE
  • ORG 100H
  • A10MAIN PROC NEAR
  • MOV AX,1 Initialize AX and
  • MOV BX,1 BX to 1,
  • MOV CX,10 CX for 10 loops
  • INC AX Add 01 to AX
  • A20 ADD AX,BX Add BX to AX
  • MOV BX,AX
  • LOOP A20 Decrement CX,
  • loop if nonzero
  • MOV AX,4C00H End processing
  • INT 21H
  • A10MAIN ENDP
  • END A10MAIN

37
Computer Language
  • High-Level Language
  • Closer to the human way of expression
  • Using higher-level of abstraction concepts from
    the application area for which it is intended
  • Independent of a given hardware
  • The downside computers do not understand
    high-level languages

38
High-Level Language
39
Software Development Cycle
40
Software Development Method
  1. Specify the problem requirements
  2. Analyze the problem
  3. Design the algorithm to solve the problem
  4. Implement the algorithm in a high-level computer
    language
  5. Test and verify the completed program
  6. Maintain and update the program

41
An Example for Problem Analysis
  • Problem statement
  • Calculate and display the volume of a cylinder
    given its base radius and height in centimeters.
  • Summarization
  • Problem inputs
  • Radius of base of a cylinder (in centimeters)
  • Height of cylinder (in centimeters)
  • Problem outputs
  • Volume of cylinder (in cubic centimeters)
  • Relationship between input and output
  • The formula for the volume of a cylinder V p r2h

42
Design
  • Algorithm a list of instructions to solve a
    problem
  • Top-down design
  • List major steps, or sub-problems
  • Solve the sub-problems
  • Algorithm refinement
  • Basic algorithm for a programming problem
  • Get the data -gt Perform the computations -gt
    Display the results
  • Desk check

43
Implementation, Testing, and Maintenance
  • Implementation writing it as a program, which
    means converting each step into one or more
    statements in a programming language
  • Test testing the completed program to verify
    that it works as desired, with several runs and
    different sets of data
  • Maintenance modifying program to remove
    undetected errors and to keep it up-to-date
  • Caution Failure is part of the process

44
Summarize
  • What Is a Computer
  • Computer Components
  • Computer Software
  • Software Development Method

45
(No Transcript)
46
Week1
  • End
Write a Comment
User Comments (0)
About PowerShow.com