280 likes | 287 Views
Learn about the components of computer systems, programming languages, language translation, memory storage, and processor functions.
E N D
Computer Systems An Introducton
Computer Systems • Programmable machines • Hardware + Software (program) Hardware Program Computer Systems: Introduction
Take input data from users or world Process data Output the result 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”. What does a program do? Computer Systems: Introduction
Representation of Data and Programs • Bits: 0 or 1 • Bytes: string/sequence of bits e.g. 10010110 • Normally, a byte is composed of 8 bits. • Words: sequence of bytes • A word can be composed of 4 or 8 bytes. • There are standard formats of data stored in a computer. • ASCII code, Unicode Computer Systems: Introduction
Languages and Programs • A program is a sequence of instructions for computer. • A format of instructions = a language • Computer languages • High-level languages • Java, Python, C, ASP, HTML, … • Low-level languages • Assembly languages • Machine languages Computer Systems: Introduction
High-level languages C int main(void) { int n, m, sum=0; for (n=0; n<7; n++) { scanf(“%d”, &m); sum+=m; } return 0; } Assembly languages 6800 assembly ldx i ldaa ar,x staa max ; max = ar[0] lp:ldaa i+1 cmpa #2 bgt ex ; while i <= N ldaa ar,x cmpa max ; if max<ar[i] ble sp staa max ; then max=ar[i] sp:inx ; i=i+1 stx i jmp lp ex: Examples of Languages Easier for human to understand Easier for machines to understand (Also, for machine languages) Computer Systems: Introduction
Language Translation • A compiler is a program which translates a program in one language into another language. Source program compiler Target program Source language Target language Computer Systems: Introduction
Compiler • Usually, the source language is a high-level language, and the target language is a low-level language. • Assembler is a compiler which translates from an assembly languageto a machine language. Computer Systems: Introduction
Where are programs/data stored? • In memory • Components of computers Input Unit Processor Output Unit Memory Computer Systems: Introduction
Memory • Linear storage • Addressable in words • “Random access” • Data/program can be read from/ write to memory, one word at a time. • 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. Computer Systems: Introduction
Components of a computer: More detail processor memory registers ALU data program Control units Instruction register data address Program counter Computer Systems: Introduction
Components of Processors • Arithmetic-logic unit (ALU) • Performs arithmetic and logic functions: add, substract, multiply, divide, and, or, not, etc. • Registers • Fast-access memory used by a processor to store intermediate results. • Program counter (PC) • 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). Computer Systems: Introduction
Components of Processors • Instruction register (IR) • Store the current instruction fetched from memory. • Its content (the instruction) signals the control unit to initiate the execution of that instruction. • Control unit • 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. Computer Systems: Introduction
How a computer system works • 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 • If the instruction causes PC changed, PC is updated again. Computer Systems: Introduction
Instruction Execution Cycle processor memory registers ALU data program Control units Instruction register data address Program counter increment Computer Systems: Introduction
Control unit Data path Logic Multiplexor Registers Bus Processor Computer Systems: Introduction
Data Path • Logic is a combinational function, out = f(in1 ... inn) where f is a Boolean function {not, and, or}. • out = x1 + x2· x3 + x1·x2 f x1 x2 x3 out Computer Systems: Introduction
Data Path • Registers are storage elements • out(t+1) = in(t) • control signal “load” • width of a register defines the number of bits that can be stored register n n in out load Computer Systems: Introduction
Data Path • Muliplexors have n inputs (of width m) and select one input to be the output, called n:1 multiplexor. • The control signal to determine the output is called the select signal. x0 x1 x2 x3 MUX out selector Computer Systems: Introduction
Data Path • Bus consists of wires and buffers. • 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. Computer Systems: Introduction
Levels of descriptions of computer systems Applications Operating systems Instruction set Functional units Finite state machine Logic gates Electronics Computer Systems: Introduction
Levels of descriptions of computer systems Applications Application level is what a user typically sees a computer system, running his/her application programs. An application is usually written in a computer language which used many system functions provided by the operating system. Operating systems Instruction set Functional units Finite state machine Logic gates Electronics Computer Systems: Introduction
Levels of descriptions of computer systems Applications An operating system is abstraction layers that separate a user program from the underlying system-dependent hardware and peripherals. Operating systems Instruction set Functional units Finite state machine Logic gates Electronics Computer Systems: Introduction
Levels of descriptions of computer systems • computer architecture begins at 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. Applications Operating systems Instruction set Functional units Finite state machine Logic gates Electronics Computer Systems: Introduction
ALU registers Control units Instruction register Program counter Levels of descriptions of computer systems Units are divided by their functions, e.g. ALU, control unit, etc. The interconnection between units are described. Applications Operating systems Instruction set processor Functional units data Finite state machine memory Logic gates address Electronics Computer Systems: Introduction
Levels of descriptions of computer systems Applications Mathematical description of the behavior of a system. Important tool for verification of the correct behavior of the hardware. Operating systems Instruction set Functional units Finite state machine Logic gates Electronics Computer Systems: Introduction
Levels of descriptions of computer systems Applications Logic gates (e.g. and, or, not gates) are used to build functional units. Operating systems Instruction set Functional units Finite state machine Logic gates Electronics Computer Systems: Introduction
Levels of descriptions of computer systems Applications Electronic circuits are used to build logic gates. Operating systems Instruction set Functional units Finite state machine Logic gates Electronics Computer Systems: Introduction