Computer Systems An Introducton Computer Systems Introduction Computer

  • Slides: 28
Download presentation
Computer Systems An Introducton Computer Systems: Introduction

Computer Systems An Introducton Computer Systems: Introduction

Computer Systems n n Programmable machines Hardware + Software (program( Hardware 10/23/2021 Program Computer

Computer Systems n n Programmable machines Hardware + Software (program( Hardware 10/23/2021 Program Computer Systems: Introduction 2

What does a program do? n n n Take input data from users or

What does a program do? n n n Take input data from users or world Process data Output the result 10/23/2021 n n n Take input from keyboard and mouse Determine if the input is a click at button “save”, or a click at button “slide show”, or a press on keyboard “K”. Then, do it! Display the message “saved”, or show slide, or letter “K”. Computer Systems: Introduction 3

Representation of Data and Programs n n Bits: 0 or 1 Bytes: string/sequence of

Representation of Data and Programs n n Bits: 0 or 1 Bytes: string/sequence of bits e. g. 10010110 q n Words: sequence of bytes q n Normally, a byte is composed of 8 bits. A word can be composed of 4 or 8 bytes. There are standard formats of data stored in a computer. q ASCII code, Unicode 10/23/2021 Computer Systems: Introduction 4

Languages and Programs n n n A program is a sequence of instructions for

Languages and Programs n n n A program is a sequence of instructions for computer. A format of instructions = a language Computer languages q High-level languages n q Low-level languages n q Java, Python, C, ASP, HTML, … Assembly languages Machine languages 10/23/2021 Computer Systems: Introduction 5

Examples of Languages n High-level languages q n Assembly languages C q int main(void)

Examples of Languages n High-level languages q n Assembly languages C q int main(void) { int n, m, sum=0; for (n=0; n<7; n++) { scanf(“%d”, &m); sum+=m; } return 0; } ldx i ldaa ar, x staa max lp: ldaa i+1 cmpa #2 bgt ex ldaa ar, x cmpa max ble sp staa max=ar[i] sp: inx stx i jmp lp ex: Easier for human to understand 10/23/2021 6800 assembly ; max = ar[0] ; while i <= N ; if max<ar[i] ; then ; i=i+1 Easier for machines to understand (Also, for machine languages) Computer Systems: Introduction 6

Language Translation n A compiler is a program which translates a program in one

Language Translation n A compiler is a program which translates a program in one language into another language. Source program Source language 10/23/2021 Target program compiler Target language Computer Systems: Introduction 7

Compiler n n Usually, the source language is a high-level language, and the target

Compiler n n Usually, the source language is a high-level language, and the target language is a lowlevel language. Assembler is a compiler which translates from an assembly language to a machine language. 10/23/2021 Computer Systems: Introduction 8

Where are programs/data stored? n n In memory Components of computers Input Unit Processor

Where are programs/data stored? n n In memory Components of computers Input Unit Processor Output Unit Memory 10/23/2021 Computer Systems: Introduction 9

Memory n n Linear storage Addressable in words “Random access” Data/program can be read

Memory n n Linear storage Addressable in words “Random access” Data/program can be read from/ write to memory, one word at a time. q q To write data d to memory addressed a , data d and address a must be specified. To read data from memory addressed a , address a must be specified. 10/23/2021 Computer Systems: Introduction 10

Components of a computer: More detail processor registers memory ALU data program Control units

Components of a computer: More detail processor registers memory ALU data program Control units Instruction register address data Program counter 10/23/2021 Computer Systems: Introduction 11

Components of Processors n Arithmetic-logic unit (ALU) q n Registers q n Performs arithmetic

Components of Processors n Arithmetic-logic unit (ALU) q n Registers q n Performs arithmetic and logic functions: add, substract, multiply, divide, and, or, not, etc. Fast-access memory used by a processor to store intermediate results. Program counter (PC) q q q Keeps track where the current instruction is. Normally, incremented to point to the next instruction. Changed by instructions that alter the flow of control of a program (if-then-else, loop, and function call). 10/23/2021 Computer Systems: Introduction 12

Components of Processors n Instruction register (IR) q q n Store the current instruction

Components of Processors n Instruction register (IR) q q n Store the current instruction fetched from memory. Its content (the instruction) signals the control unit to initiate the execution of that instruction. Control unit q q q Most complex part of a processor. Send control signals to all parts in the processor to co-ordinate their activities. A large finite state machine. 10/23/2021 Computer Systems: Introduction 13

How a computer system works n n n Fetch-execute cycle Fetch: get an instruction

How a computer system works n n n Fetch-execute cycle Fetch: get an instruction (addressed by PC) from memory and store in IR, and update PC. Execute: work according to the instruction in IR q If the instruction causes PC changed, PC is updated again. 10/23/2021 Computer Systems: Introduction 14

Instruction Execution Cycle processor registers memory ALU data program Control units Instruction register address

Instruction Execution Cycle processor registers memory ALU data program Control units Instruction register address data Program counter increment 10/23/2021 Computer Systems: Introduction 15

Processor n Control unit n Data path q q 10/23/2021 Logic Multiplexor Registers Bus

Processor n Control unit n Data path q q 10/23/2021 Logic Multiplexor Registers Bus Computer Systems: Introduction 16

Data Path n Logic is a combinational function, out = f(in 1. . .

Data Path n Logic is a combinational function, out = f(in 1. . . inn) where f is a Boolean function {not, and, or}. q out = x 1 + x 2 · x 3 + x 1 · x 2 x 1 x 2 x 3 10/23/2021 f Computer Systems: Introduction out 17

Data Path n Registers are storage elements q q q out(t+1) = in(t) control

Data Path n Registers are storage elements q q q out(t+1) = in(t) control signal “load” width of a register defines the number of bits that can be stored in n register n out load 10/23/2021 Computer Systems: Introduction 18

Data Path n Muliplexors have n inputs (of width m) and select one input

Data Path n Muliplexors have n inputs (of width m) and select one input to be the output, called n: 1 multiplexor. q The control signal to determine the output is called the select signal. x 0 x 1 x 2 x 3 MUX out selector 10/23/2021 Computer Systems: Introduction 19

Data Path n Bus consists of wires and buffers. q q Wires carry data

Data Path n Bus consists of wires and buffers. q q Wires carry data (signal). Buffer controls the traffic of data from any element to a bus. A bus can be shared to reduce the number of wire within a circuit. A bus can broadcast data to many receivers limited by the fan-out electrical characteristic of the bus, the ability to drive other circuits. 10/23/2021 Computer Systems: Introduction 20

Levels of descriptions of computer systems Applications Operating systems Instruction set Functional units Finite

Levels of descriptions of computer systems Applications Operating systems Instruction set Functional units Finite state machine Logic gates Electronics 10/23/2021 Computer Systems: Introduction 21

Levels of descriptions of computer systems Applications Operating systems Instruction set Application level is

Levels of descriptions of computer systems Applications Operating systems Instruction set Application level is what a user typically sees a computer system, running his/her application programs. Functional units Finite state machine Logic gates Electronics 10/23/2021 An application is usually written in a computer language which used many system functions provided by the operating system. Computer Systems: Introduction 22

Levels of descriptions of computer systems Applications Operating systems Instruction set Functional units Finite

Levels of descriptions of computer systems Applications Operating systems Instruction set Functional units Finite state machine An operating system is abstraction layers that separate a user program from the underlying systemdependent hardware and peripherals. Logic gates Electronics 10/23/2021 Computer Systems: Introduction 23

Levels of descriptions of computer systems • computer architecture begins at Applications Operating systems

Levels of descriptions of computer systems • computer architecture begins at Applications Operating systems Instruction set Functional units Finite state machine Logic gates Electronics 10/23/2021 the instruction set. • An instruction set is what a programmer at the lowest level sees of a processor • one instruction set with different level of performance for many models, based on the implementation of a control unit via “microprogram”. • Present day processor designs converge, their instruction sets become more similar than different. Computer Systems: Introduction 24

Levels of descriptions of computer systems Units are divided by their functions, e. g.

Levels of descriptions of computer systems Units are divided by their functions, e. g. Applications ALU, control unit, etc. Operating systems Instruction set processor Finite state machine Electronics 10/23/2021 registers ALU data Control units Instruction register address memory Functional units Logic gates The interconnection between units are described. Program counter Computer Systems: Introduction 25

Levels of descriptions of computer systems Applications Operating systems Instruction set Functional units Finite

Levels of descriptions of computer systems Applications Operating systems Instruction set Functional units Finite state machine Logic gates Mathematical description of the behavior of a system. Important tool for verification of the correct behavior of the hardware. Electronics 10/23/2021 Computer Systems: Introduction 26

Levels of descriptions of computer systems Applications Operating systems Instruction set Logic gates (e.

Levels of descriptions of computer systems Applications Operating systems Instruction set Logic gates (e. g. and, or, not gates) are used to build functional units. Functional units Finite state machine Logic gates Electronics 10/23/2021 Computer Systems: Introduction 27

Levels of descriptions of computer systems Applications Operating systems Instruction set Electronic circuits are

Levels of descriptions of computer systems Applications Operating systems Instruction set Electronic circuits are used to build logic gates. Functional units Finite state machine Logic gates Electronics 10/23/2021 Computer Systems: Introduction 28