Machine Architecture Prof Leslie Smith

Machine Architecture Prof Leslie Smith

Machine Architecture Prof Leslie Smith … or what’s in the box? Lectures 2 & 3 ITNP23 - Autumn 2014 Lectures 2&3, Slide 1 Basic Machine Architecture In these lectures we aim to: § understand the basic architecture of a simple computer. § understand the components: CPU, Main Memory, I/O Controllers. § understand concepts of stored program, machine cycle, memory mapped I/O. ITNP23 - Autumn 2014 Lectures 2&3, Slide 2 What is a computer ? … wikipedia § A computer is a programmable machine that receives input, stores and manipulates data or information, and provides output in a useful format. § While a computer can, in theory, be made out of almost anything, and mechanical examples of computers have existed through much of recorded human history, the first electronic computers were developed in the mid-20th century (1940–1945). § http://www.youtube.com/watch?v=0anIyVGeWOI&NR=1&feature=fvwp § http://www.youtube.com/watch?v=KL_wy-CxBP8&feature=related ITNP23 - Autumn 2014 Lectures 2&3, Slide 3 Background: computers and digital hardware § Digital computers consist of large number of gates • AND, OR, NOT, NAND § And other circuitry that (e.g.) generates digital signals • Clocks, lines carrying data § These all need switching circuitry § And switching circuitry can be built from may different technologies. 4 ITNP23 - Autumn 2014 Machine hardware: April 2016 Konrad Zuse’s 1st computer 1941 Zuse (1910-1995) Built the Z3 in 1941 (inspecting rebuilt Z3 at Deutsches Museum, 1991) 5 ITNP23 - Autumn 2014 Machine hardware: April 2016 IBM 7090 series: from 1959 § For “large scale scientific and technological applications” § $2.9 million (equivalent to $23 million now) § 50,000 Germanium transistors • 6x faster than IBM 709, much lower power consumption: world’s most powerful computer in 1960 IBM7090, from1965: credit Australian news and information bureau 6 ITNP23 - Autumn 2014 Machine hardware: April 2016 The era of the minicomputer § Data General NOVA minicomputer, early 1970’s 7 ITNP23 - Autumn 2014 Machine hardware: April 2016 Structure of a simple computer Screen CPU controller Control Bus Unit Main Memory ALU Registers Keyboard Disk controller controller ITNP23 - Autumn 2014 Lectures 2&3, Slide 8 Microcomputers, smartphones, … § The basic architecture of all of these is the same ITNP23 - Autumn 2014 Lectures 2&3, Slide 9 Basic architecture of a computer § Memory unit contains both programs and data § CPU runs the program by executing instructions using ALU. § Conceptually, this is a von Neumann computer § There are alternative designs, e.g. Harvard architecture: separate memory for data and instructions. ITNP23 - Autumn 2014 CSCU9A1: (c) LSS Execution of a program § A program is a sequence of instructions. § A machine-code program is a sequence of machine-code instructions. § To be executed, a machine-code program must be stored in main memory. § Execution takes place within the CPU. § Execution follows ‘Fetch-Decode-Execute’ cycle ITNP23 - Autumn 2014 Lectures 2&3, Slide 11 The CPU The Central Processing Unit (CPU) is where the work takes place. It has three components: • Control Unit organises the actions of the CPU, and sequences the actions of the other components to execute programs • Arithmetic/Logic Unit (ALU) acts as a calculator, under the direction of the control unit. All data alteration takes placec in the ALU. • Registers: individual high-speed storage locations, internal to the CPU, used to hold transient data. Some are dedicated for particular purposes, others are used as temporary stores during computations ITNP23 - Autumn 2014 Lectures 2&3, Slide 12 The CPU : control unit It is the task of the control unit to : 1. Fetch from memory the next instruction to be executed 2. Decode it, that is, determine what should be done 3. Execute it by issuing the appropriate command to the ALU, memory, and I/O Controllers These 3 steps are repeated over and over again until we reach the last instruction of a program (usually HALT, STOP, or QUIT). ITNP23 - Autumn 2014 Lectures 2&3, Slide 13 The Fetch-Execute Cycle ITNP23 - Autumn 2014 CSCU9A1: (c) LSS The CPU : ALU § The subsystem that performs such mathematical and logical operations as addition, subtraction, and comparison for equality. § In modern machines, the ALU, control unit and registers are fully integrated into a single component called the processor. For reasons of clarity and convenience, the functions of each are described separately. ITNP23 - Autumn 2014 Lectures 2&3, Slide 15 Main Memory : RAM Main Memory is also called random-access memory (RAM) § It traditionally has the following characteristics: • It is divided into fixed-sized units called cells. Each cell is associated with a unique identifier called an address. • Any location in the memory can be accessed very fast just by specifying the address of the location • The time it takes to fetch or store a cell is the same for all cells in memory • Programs (and data) are stored in main memory when they are running • RAM is linked to CPU in such a way that data can be moved from one to the other very quickly ITNP23 - Autumn 2014 Lectures 2&3, Slide 16 Main Memory : ROM § A small part of main memory is non-volatile, read-only memory (ROM) § Simply RAM where the ability to store information has been disabled § It is only possible to fetch information: it cannot be overwritten § In most computers, a section of RAM is set aside as ROM to store essential system instructions which the user cannot overwrite ITNP23 - Autumn 2014 Lectures 2&3, Slide 17 Buses § Buses: Each bus consists of several signal wires, so a large number of bits (perhaps 64 bits or more) can be sent simultaneously between the components, making communication between them very fast Screen CPU controller Control Bus Unit Main Memory ALU Registers Keyboard Disk controller controller ITNP23 - Autumn 2014 Lectures 2&3, Slide 18 I/O controllers Screen CPU controller Control Bus Unit Main Memory ALU Registers Keyboard Disk controller controller ITNP23 - Autumn 2014 Lectures 2&3, Slide 19 I/O controllers § Input and output operations are slow in comparison with computations done in the CPU § Communication with a peripheral is done via a special hardware controller. This can be nearly as complex as the CPU. § An I/O controller is like a special-purpose computer with a responsibility to handle the details of input/output, and to compensate for any speed differences between I/O devices and other parts of the computer. § It has a small amount of memory known as an I/O buffer and enough I/O control and logic processing capability to handle mechanical functions of the I/O device, such as the read/write head (on a disk), paper feed mechanism (on a printer), and screen display. § It is also able to transmit an interrupt signal (see later) when an I/O operation is complete. ITNP23 - Autumn 2014 Lectures 2&3, Slide 20 I/O example: display 1 line of text on a display 1. Transfer the 80 characters from their current location in memory to the I/O buffer storage within the I/O controller (takes place at high speed ~ 10s or 100s of millions of chars per second) 2. The processor then instructs the I/O controller to begin the output operation. 3. The control logic of the I/O controller Note that the processor handles the actual transfer of the 80 chars continues to execute to the screen (this takes place perhaps at a much slower rate ~100s /1000s of chars per instructions while this is second, depending on the display type) going on 4. When all 80 characters have been displayed, the I/O controller sends an interrupt signal to the processor 5. The appearance of this special signal indicates to the processor that the I/O operation is complete. ITNP23 - Autumn 2014 Lectures 2&3, Slide 21 Machine Instruction Set § Each type of processor (e.g., Core i7, PowerPC, ARM) has a repertoire of instructions that the CPU is built to recognise and execute § This is the instruction-set of the processor § A program that is expressed in this instruction-set is in machine code § In the first days of computers, programmers wrote in machine code (because there wasn’t’ anything else) § Now, we write programs in languages that other programs translate into machine code ITNP23 - Autumn 2014 Lectures 2&3, Slide 22 Machine Code § Machine code is binary code • not readable by people (without extreme difficulty or training) • very readable by machines § Binary • literally only 1s and 0s • like 11100111100000011110010111110000 § Internally held as a pattern of voltages representing 1’s and 0’s ITNP23 - Autumn 2014 Lectures 2&3, Slide 23 Machine Code Instructions Instructions in this language have a typical format: • operation code field (or op code) • address field (s) Operation code: A unique number assigned to each machine language operation recognised by the hardware Address field (s): Memory addresses of the values on which the operation will work Machine code (lines of numbers!) is very hard to read, so instead programmers use a set of mnemonics called assembly language to represent the numerical instructions. ITNP23 - Autumn 2014 Lectures 2&3, Slide 24 Assembly language instructions § Some examples from the Intel 8021 instruction set: • MOV A, 4 “Copy contents of memory location 4 to register A” • DEC A “Take away 1 from (decrement) the contents of register A” • MOV B, A “Copy contents of register A to register B” • ADD A, B “Add contents of register B to register A” • MOV 4, A “Copy contents of register A to memory location 4” Example Let’s try this out with the following values: A : initial value

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    37 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us