Computer Architecture and Technical Documentation In the last lesson we learned how computers perform calculations and the principles of digital processing. Briefly, we learned the following: 1. The computer performs only 3 kinds of operations: arithmetic, logical, I/O, but it performs millions of these operations per second. 2. The computer uses the binary system do perform its operations – this is also known as “digital processing”. All data and processing is performed on only two values, 0’s and 1’s. 3. The circuitry inside the computer consists of millions of logic gates that work according to binary principles. Through combining logic gates, we can perform any of the 3 operations mentioned above. 4. By combining the 3 operations in various patterns we can get the computer to do any of the behaviors we associate with the computer – running programs, etc. In this lesson we continue our exploration of the computer and its technology. ACQUIRED KNOWLEDGE AND SKILLS In this lecture, you will learn the following: • The overall architecture of computers. • The structure and functioning of microprocessors. • Principles of Assembler programming. • Terminology and expressions associated with the above. • How to document microprocessors, including instruction sets. Principles of Computer Operations Copyright ©YEDA 2006 2 What’s a Computer? – Another View In the last lesson we looked at what a computer is from the standpoint of its basic operations. Now let’s look at it in terms of its overall architecture – its structure and parts. Here is a very simple block diagram of the overall structure of the computer: Documentation Note A block diagram consists of boxes (blocks) and arrows that illustrate the connection between parts of a system. The blocks may represent hardware parts, software modules, or just some function. The arrows connecting the parts may represent a flow of information, physical forces, etc. A block diagram can be quickly drawn to show the main idea and is often useful as a tool for interviewing – you can ask people to quickly sketch you a block diagram of some process that they are explaining to you. You can also include block diagrams in your documentation – this is particularly common in Overviews of complex systems where you want to show how something works. Examples include block diagrams of microprocessor functions, telecommunication systems, and computer processes. The easiest way of drawing a block diagram is to use Visio – you can quickly – when you first start the Visio drawing, choose block diagram as the template and then use the block diagram shapes. If you don’t have Visio, you can use Word’s drawing tools to easily draw block diagrams as well. Let’s look at some of the parts of our block diagram. Principles of Computer Operations Copyright ©YEDA 2006 3 CPU The most important part of the system, the part that essentially performs the 3 operations that we’ve already discussed, is the CPU – the Central Processing Unit. This unit contains the logic gate circuits that learned about earlier, and does all the arithmetic, logical and I/O operations. Today, using a technology developed in the 60’s, the computer’s CPU is contained on a single “chip” or what is called an “integrated circuit” (IC). This marvel of engineering can fit into the palm of your hand, while containing millions of integrated logic gates imprinted inside it. STORAGE While the CPU performs all of the computer operations, by itself, this is not very useful unless we can store the information somehow so that it can be reused again. For example, after working on a document, you probably want to store it permanently so that it can be worked on again tomorrow – you don’t want to start over again each time you want to edit the document. Computer storage allows data (information) to be stored in a format that can be immediately used again by the computer. That is, the data is stored in a way that it can be electronically interpreted by the computer’s circuits. The most common form of memory in personal computers is the Hard Disk. This is a separate unit that contains two platters coated with a material capable of storing data as magnetized particles, much like a tape recorder. The platters are kept in an airtight case and spin very fast (up to 10,000 Revolutions per Minute – RPM). A magnetic head scans the rotating disks for data. Hard Disks today can store hundreds of GB of data. Other types of storage involve tape backup and USB Flash drive (which is composed of a chip with NAND gates). Some types of mass storage rely on networks to distribute the data to various individual computers – the computers appear to users as a kind of virtual single storage area. There are two types of network storage: NAS (Network Attached Storage) and SAN (Storage Area Networks). A NAS system controls data as files, much like your operating system – that is, it stores and keeps track of files on the various computers, presenting them to the user as files stored in one virtual storage space. SAN systems simply make available the hard disk storage of various computers, but do not actually manage the data files themselves – it leaves that up to the individual computers that are accessing the storage. Principles of Computer Operations Copyright ©YEDA 2006 4 MAIN MEMORY Theoretically, the computer could work with just 2 blocks: the CPU and the Storage Unit. But a computer with only these components would have a very big disadvantage – it would be much too slow. That’s because, even though a hard disk spins at 10,000 RPM, it’s no match for the speed of the CPU itself – since the CPU chip is made up of pure electronic circuitry, information is processed close to the speed of light. A way had to be found to store data so that it could be accessed by the CPU nearly as quick as the processing itself. This solution is a temporary memory space called Main Memory. Unlike storage, Main Memory stores data electronically, on integrated circuits like the CPU itself. And unlike storage, the Main Memory’s data disappears when the computer is turned off. There are various types of Main Memory – the fastest and most reliable is called SRAM (Static RAM) and is composed of logic gates called Flip Flops that are made up of NOR gates – we saw this in one of the exercises of the last lecture. The clever arrangement of the NOR gates enables a high or low voltage current, representing a 1 or 0 to be “locked” in the gate so that the gate’s output remains steady, even when one of the inputs changes. SRAM is quick, but expensive – it is mostly used for holding information on the CPU itself in an area called the cache. A less expensive form of memory is called DRAM (Dynamic RAM) and is composed of minute capacitors that retain an electric charge over time-these need to be refreshed periodically to prevent loss of the charge. DRAM is not as fast as SRAM but more capacitors can be fitted onto a chip, and therefore the cost is lower. How Main Memory Works How does main memory speed up the workings of the computer? The main idea works something like this: Your programs and data are stored on the hard disk. When you access a program, part of the program’s instructions are transferred into the main memory where they are now available to the CPU. Thus the Main Memory functions as a kind of reservoir that allows information to be quickly accessed by the lightening fast CPU – instead of the CPU having to go to the much slower moving hard disk to find the information. CPU Main Memory Storage Data Data CachePrinciples of Computer Operations Copyright ©YEDA 2006 5 How is Data Stored in Main Memory? Although a Flip Flop can store one bit of memory (a 1 or a 0), the basic unit of memory is the byte – i.e., 8 bits. Each unit of memory (say, 8 flip flops, or 8 capacitors) forms a single “register” capable of holding a byte of data. Main Memory is composed of many of these registers – when we say the computer’s memory is 504 Megabytes, we mean, of course, that the computer can hold some 504 million bytes of data in Main Memory. That’s a lot of bytes – and the question is, how does the CPU go about accessing the data it needs at such a lightening speed? The answer is that each register in memory is assigned a unique number – its “address”. The CPU looks for a particular address and then accesses the data contained in it. For this reason, memory is referred to as RAM – Random Access Memory. It’s not really “random” as the CPU already possesses the address that it’s looking for – but the name is intended to imply that the CPU doesn’t have to do a thorough “search” for the memory, looking in each address, one by one, until it finds what it is looking for. There are 3 channels that connect the CPU to the memory – they are referred to as buses. They work something like this: CPU Data Bus Address Bus Control Bus 10110011 Address 596 Address 596 Say the CPU wants to bring some data over from Main Memory to its registers for processing. It places a Read signal (R) on the Control bus, and the number of the address where the data is located on the Address bus. The value contained in that address is then transferred to the CPU on the Data bus. When the CPU finishes a calculation and wants to store the results in memory, it issues a Write signal (W) on the control bus, and the number of the address Principles of Computer Operations Copyright ©YEDA 2006 6 where it is going to store the data on the data bus. The value is then transferred to the address in Main memory corresponding to the address on the address bus. This process is called a Read/Write cycle and it is very fast. The computer’s speed is often measured in these terms. One cycle is referred to as a “Hertz” – when we say a computer runs at 200 MHz we mean that it is capable of 200 million read/write cycles per second! To speed things up even more, a small amount of data from the memory flows into another reservoir on the CPU itself, called the cache. This enables the CPU to access information instantaneously, provided the required data is found in the cache – of course, the cache cannot hold the large amounts of data that the Main Memory can, so this method works by assuming that there will be a certain percentage of lucky hits where the CPU finds just what it is looking for. When the CPU doesn’t find the data in the cache, it is then accessed from Main Memory (which, of course, introduces a slight delay). OTHER BLOCKS IN THE DIAGRAM The other blocks in the diagram include Input units (keyboard, mouse), Output Units (printer, etc.), and Monitor. The computer controls these units through software (instructions) called “drivers”. The driver controls the flow of data to/from these units – each unit must have its own driver that controls the various hardware of that unit. Normally, when you install an Operating System such as Windows, the drivers are included on the installation disk and are automatically installed. Without the proper driver, an external unit, whether a mouse, printer, scanner, monitor, etc. will simply not work as it is unable to communicate with the computer itself. Exercise 1: Creating Block Diagrams Block diagrams may also be used to describe software systems. For example, a software program and its interaction with the user can be drawn as a block diagram with blocks that represent functions of the program, user tasks, and information flow. Create a block diagram for Cmap using Word or Visio. Make sure to clearly label the blocks and the connections between them.Principles of Computer Operations Copyright ©YEDA 2006 7 CPU architecture Let’s return to the CPU and take a closer look, since this is truly the heart of the computer where the real computing takes place. A block diagram of the CPU looks like this: Simplified CPU Block Diagram The CPU’s activity works something like this: 1. Data and Instructions are transferred from the Main Memory to the CPU ‘s memory interface through the 3 buses that we learned about previously. 2. Instructions are “fetched” by the CPU’s Control unit which consists of a decoder that reads the instruction and carries it out in the ALU (Arithmetic/Logic Unit). CONTROLLER ALU REGISTERS MEMORY INTERFACE Fetch Instructions R/W BUS E SPrinciples of Computer Operations Copyright ©YEDA 2006 8 3. The instruction is carried out on data that is brought to the CPU’s registers from Main Memory – the ALU then processes the data according to the instruction and returns the result to a register. 4. Eventually, the result is placed on the data bus and stored in an address in Main Memory. Of course, this storage is only temporary – for permanent storage, such as when you save a document, the data must be taken from Main Memory and stored on a Hard Disk or some other form of permanent storage. The registers on the CPU hold data and instructions until they are either processed by the CPU or stored in RAM. Here are some of the typical registers on an Intel CPU: General Purpose Registers AX, BX, CX, DX: these are divided into 3 segments of a byte each; for example, the AX register is really divided into the EAX, AH, and AL (AL stands for A low and holds the lower value bits in a long number; AH is A high and holds bits that represent higher level columns; EAX is “extended AX” and holds bits of even higher level columns. Pointer Registers DI, SI: these may contain values that “point” to addresses in RAM. This means that the value is really the number of a RAM address. The DI and SI registers are used to read/write information to and from RAM. IP Register Instruction Pointer: this contains the RAM address storing the next instruction to be executed. SP Stack Pointer: this contains the address in RAM where a special memory area called a “stack” is defined to store instructions or data. What Kinds of Instructions Does the CPU Execute? As we already know, the CPU carries out three kinds of instructions: arithmetic, logical, and I/O. Each of these instructions is given a code – called an Op Code (operation code) consisting of a string of 1’s and 0’s (usually 8 to make a byte). Arithmetic instructions, for example, include simple addition, subtraction, addition with a carry, subtraction with a borrow, etc. Although we might have a multiply instruction, it is not essential – the speed of computers make it possible to multiply by simply doing many additions per second. Each of these instructions has its own unique OP code. Principles of Computer Operations Copyright ©YEDA 2006 9 When the OP code is fed into the CPU from Main Memory, the CPU’s ALU executes the instruction of some data associated with it. The data on which the instruction is carried out are called the Operands. Of course, they are also in binary format – so a complete instruction, together with its operands looks like this: OP code First Operand Second Operand 10100111 10101010 11110011 For example, the above code might mean to add the two operands together. The computer is able to decode and punctuate the stream of bits so that it can perform the operation correctly (remember, such a bit stream is simply a series of fluctuations of high and low voltage through the computer’s logic gates). To carry out the instruction, the OP code activates a micro-program stored on the CPU that moves the data through the appropriate logic gates so that the operation is performed correctly. All of the OP codes together are called an instruction set. Each type of CPU chip has its own instruction set. Thus the Pentium from Intel has a different instruction set than, say, a Motorola chip for the MacIntosh. Assembler Programming A computer program is simply a sequence of instructions that the computer’s CPU executes, one by one. As we have seen, as far as the computer is concerned, these are just strings of 1’s and 0’s (high and low voltage streams). We sometimes refer to program directly written in this way as “machine code” or “machine language”. Another name is “binary code”. Programs that are ready to be run on the computer are saved in a binary file with an “exe” file ending. As soon as you start the program, the instructions are loaded into preestabblishe addresses in Main Memory and then the instructions are transferred to the CPU for execution, one at a time. However, programming directly in machine language is difficult for humans – obviously, trying to work with nothing but a sea of ones and zeros and remember what they stand for is good only for very simple, very short programs. To make things easier, an early improvement was the development of an abbreviated set of symbols that represented the various OP code instructions – these symbols make up what is called Assembler. Assembler code consists of 3 letter “menomonics” that stand for the various instructions. For example, ADD stands for the OP code for addition, MUL is the code for Multiplication, MOV is the code for moving a byte from one register to another or to and from Main Memory. Principles of Computer Operations Copyright ©YEDA 2006 10 The human programmer can write the Assembler program using any Word processing program such as Notepad or Word. The program is not executable, though, until it is “assembled” into machine code – this is done through using a special Assembler program that translates the code back into machine language. Of course, you might ask “how did they write the first assembler program that does this translation?” – the answer would have to be, it was programmed directly in machine language – instruction by instruction! To see what a typical machine code program looks like when translated into assembler, try using Windows’ debug program. Simply go to the start menu, click Run, type debug and click OK – the debug program is activated, but all you see is the following: Notice the little dash at the top of the black screen – this is a “prompt’ and indicates the command line where you can type a command. Type U and press Enter – this is the “Unassemble” command and displays machine code as a list of Assembler instructions. Of course, to see a real program you should type the name of the program after typing debug – but don’t worry about this here. After typing U and pressing Enter, you should see a screen like the following: Small dash indicates command line. Principles of Computer Operations Copyright ©YEDA 2006 11 This is a sequential list of instructions. The short, 3 letter codes in the middle stand for the actual instructions – for example ADD, MOV, CMP (compare), etc. To the right of these are the CPU registers containing the data on which the instructions are executed. For example, in the above screen, we have an add instruction like this: ADD AX, 453A. This tells the CPU to add the value 453A to the value contained in the AX register (whatever that is). By convention, an Assembler instruction always starts with the value furthest from the instruction code and works backwards to the code. Thus the full meaning is this: and store the result in the AX register. Thus, the original sum that was in AX is now overwritten with the new sum. To see the actual contents of the registers, type r and click OK – a display like the following appears at the bottom of the black screen: The symbols AX, BX, etc. are the names of the various registers on the CPU. The content of each register appears after the = sign. Although the actual content is just a string of 1’s and 0’s, the Assembler displays it in Hexadecimal notation, that is, base 16. This is because numbers are more easily represented this way, rather than using the actual binary format which often would produce too long and confusing a number. Because Base 16 is a multiple of 2, it’s used Principles of Computer Operations Copyright ©YEDA 2006 12 instead of Base 10, since it’s easier to convert binary to Hexadecimal (every 1 column of Hexadecimal stands for 4 columns in binary). Sometimes an H is placed after the number to indicate “Hexadecimal”. Alternatively, some notations use an “0x” symbol before the number. Why Do We Use Letters in Hexadecimal Notation? Since in Hexadecimal we have 15 digits, we need a few extra symbols after “9” – we used the characters A (10), B (11), C (12), D (13), E (14) , and F (15). Each column represents a multiple of 16 – thus the following number: 14D means 1 “256”, 4 “16s”, and 13 = 333 in base 10. So, in the screen capture above, the value in the DS register is 0AFC which stands for the number 10 “256s”, 15 “16s” and 12 = 2,812 in base 10. WHAT THE REGISTERS ARE USED FOR In general, the registers AX, BX, CX, and DX are used for calculations; the registers SI and DI are used for indicating the address in memory for a R/W operation; the address IP stands for “instruction pointer” – the value contained in this register indicates the address in RAM where the next instruction to be executed is located. After each instruction is carried out, the value in the IP register in incremented to indicate the address where the next instruction is located. UNDERSTANDING AN ASSEMBLER PROGRAM Reading an assembler program is not that difficult now that you understand the basics. For example, consider this program: MOV BX, 10 MOV AX, 11 ADD AX, BX 1. This program first moves the value “10” – in Hex (“16” in our base 10 number system), into the BX register. 2. The next line puts the value “11” ( i.e. 1 “16” and 1 “one” -i.e. “17” in our base 10 numbers system), into the AX register. 3. The last line adds the value in the BX register (16) to the value in the AX register (“17”) – the final result, “33” is left in the AX register. Another common expression is this: Principles of Computer Operations Copyright ©YEDA 2006 13 MOV [DI], 12 The brackets around the DI register mean that it is really pointing to an address in RAM. The address is the number that is currently in the DI register. So, what the expression means is that the CPU should move the value “12” to the address in RAM represented by the value in the DI register (whatever that is): Here is a list of commands that you may see in an Assembler program: MOV Copy the value of the right operand to the left INC Increment the operand by one DEC Decrement the operand by on ADD Add the value of the right operand to the value of the left SUB Subtract the value of the right operand from the value of the left NOP No operation CMP Compare the operands JMP Jump to another part of the program label Gives a name to another part of the program Conditional Jump Conditions: JE, JNE, JG, JL, JGE, JZ, JNZ jump to another part of the program if the compare statement above results in the specified condition – the conditions are JE (Jump if Equal to), JNE (Jump if not equal to), JG (jump if greater than), JL (jump if less than), JGE (jump if greater or equal), JZ (jump if equal to 0), JNZ (jump if not equal to zero). You may also see commands such as “push” and “pop” which refer to placing or removing values to/from specially designated contiguous addresses in RAM called “stacks”. Other commands such XOR or OR refer to operations in which the operands are combined using Boolean logic. For example, 1 AND 0 in a Boolean sense, is “0” (since True AND False = False for Boolean logic). 00000001 12 MOV the number “12” DI 00000001 00000000 00000010 00000011 RAM Principles of Computer Operations Copyright ©YEDA 2006 14 Exercise 2: Documenting an Assembler Program The following is an example of an Assembler program. Write what is called “internal documentation” for the program by describing what the program does, line by line. MOV AL, 8 MOV AH, 71H MOV DI, 100H CMP [DI], AL JE YES CMP [DI], AH JNE SOF YES: MOV AL,0 MOV [DI], AL SOF: NOP Hints: YES and SOF are labels. The “H” after a number stands for “Hexadecimal” so that you know how to read the number. NOP means “No operation” and serves as a kind of “filler” in the lines of the program. Microprocessor Documentation Documentation for a microprocessor may include a number of documents including the following: Document Description Programmer’s (or “Software Developers”) Manual Includes a command reference describing each instruction in the chip’s instruction set. Also includes an Overview section describing syntax, general chip architecture Architecture Describes the design of the microprocessor (for example, CPU design) including the registers, interfaces with other systems, and software. In the command reference, each of the commands of the Instruction set is described. Here is an example of a description of the ADD command from Intel’s developers manual for one of its microprocessor families: Description Adds the destination operand (first operand) and the source operand (second operand) and then stores the result in the destination operand. The destination operand can be a register or a memory location; the source operand can be an immediate, a register, or a memory location. (However, two memory operands cannot be used in one instruction.) When an immediate value is used as an operand, it is sign extended to the length of the destination operand format. The ADD instruction performs integer addition. It evaluates the result for both signed and unsigned integer operands and sets the OF and CF flags to indicate a Principles of Computer Operations Copyright ©YEDA 2006 15 carry (overflow) in the signed or unsigned result, respectively. The SF flag indicates the sign of the signed result. This instruction can be used with a LOCK prefix to allow the instruction to be executed atomically. In 64-bit mode, the instruction’s default operation size is 32 bits. Using a REX prefix in the form of REX.R permits access to additional registers (R8-R15). Using a REX a REX prefix in the form of REX.W promotes operation to 64 bits. See the summary chart at the beginning of this section for encoding data and limits. Operation DEST ← DEST + SRC; Notice that the description starts with a verb “Adds the …” – this is standard format and should be used whenever you document a command. Do not start out “this command…” – just use the plain verb. Looking closer at the description, you can see that it parallels our writing pattern in Lectures 5 and 6: Paragraph one: describes the exact mechanics of the command – what it does. Paragraph two: extends the explanation to describe the exact data that the command works on – in this case, integers. Paragraph three: describes restrictions or conditions under which the command works. Here is another example from the same manual, this time for the MOV instruction. Description Copies the second operand (source operand) to the first operand (destination operand). The source operand can be an immediate value, general-purpose register, segment register, or memory location; the destination register can be a general purpose register, segment register, or memory location. Both operands must be the same size, which can be a byte, a word, or a doubleword. The MOV instruction cannot be used to load the CS register. Attempting to do so results in an invalid opcode exception (#UD). To load the CS register, use the far JMP, CALL, or RET instruction. If the destination operand is a segment register (DS, ES, FS, GS, or SS), the source operand must be a valid segment selector. In protected mode, moving a segment selector into a segment register automatically causes the segment descriptor information associated with that segment selector to be loaded into the hidden (shadow) part of the segment register. While loading this information, the segment selector and segment descriptor information is validated (see the “Operation” algorithm below). The segment descriptor data is obtained from the GDT or LDT entry for the specified segment selector. A NULL segment selector (values 0000-0003) can be loaded into the DS, ES, FS, and GS registers without causing a protection exception. However, any subsequent attempt to reference a segment whose corresponding segment register is loaded with a NULL value causes a general protection exception (#GP) and no memory Basic operation Restriction Conditions Principles of Computer Operations Copyright ©YEDA 2006 16 reference occurs. Loading the SS register with a MOV instruction inhibits all interrupts until after the execution of the next instruction. This operation allows a stack pointer to be loaded into the ESP register with the next instruction (MOV ESP, stack-pointer value) before an interrupt occurs1. Be aware that the LSS instruction offers a more efficient method of loading the SS and ESP registers. When operating in 32-bit mode and moving data between a segment register and a general-purpose register, the 32-bit IA-32 processors do not require the use of the 16-bit operand-size prefix (a byte with the value 66H) with this instruction, but most assemblers will insert it if the standard form of the instruction is used (for example, MOV DS, AX). The processor will execute this instruction correctly, but it will usually require an extra clock. With most assemblers, using the instruction form MOV DS, EAX will avoid this unneeded 66H prefix. When the processor executes the instruction with a 32-bit general-purpose register, it assumes that the 16 least-significant bits of the general-purpose register are the destination or source operand. If the register is a destination operand, the resulting value in the two high-order bytes of the register is implementation dependent. For the Pentium 4, Intel Xeon, and P6 family processors, the two high-order bytes are filled with zeros; for earlier 32-bit IA-32 processors, the two high order bytes are undefined. In 64-bit mode, the instruction’s default operation size is 32 bits. Use of the REX.R prefix permits access to additional registers (R8-R15). Use of the REX.W prefix promotes operation to 64 bits. See the summary chart at the beginning of this section for encoding data and limits. Operation DEST ← SRC; Exercise 3: Understanding Microprocessor Documentation The following is a description for the AND instruction: Description Performs a bitwise AND operation on the destination (first) and source (second) operands and stores the result in the destination operand location. The source operand can be an immediate, a register, or a memory location; the destination operand can be a register or a memory location. (However, two memory operands cannot be used in one instruction.) Each bit of the result is set to 1 if both corresponding bits of the first and second operands are 1; otherwise, it is set to 0. This instruction can be used with a LOCK prefix to allow it to be executed atomically. In 64-bit mode, the instruction’s default operation size is 32 bits. Using a REX prefix in the form of REX.R permits access to additional registers (R8-R15). Using a REX prefix in the form of REX.W promotes operation to 64 bits. See the summary chart at the beginning of this section for encoding data and limits. Operation DEST ← DEST AND SRC Access the manual at this link: http://www.intel.com/design/processor/manuals/253666.pdf Extended operations Restriction Conditions Principles of Computer Operations Copyright ©YEDA 2006 17 1. Now, look up the Lock-Assert instruction in Chapter 3 and read its description. Explain paragraph 2 above (highlighted) in more detail. 2. Write a few lines of Assembler to show an example of the AND operation. 3. What would the result of the following operation be: 11001101 AND 01010110 How Microprocessors are Produced Although we cannot fully explore the technology associate with microprocessors here, one intriguing question that we need to answer is how a single microprocessor (“chip”) that can easily be held in the palm of your hand, is able to contain so many millions of logic gate circuits. In fact, early computers that were much less powerful than today’s PCs filled entire rooms with electronic components. The answer lies in the discovery of the “transistor” during the 1960s at Bell Labs. The story is something like this: Normally, in nature, substances are either conductors of electricity or not. For example, copper easily conducts electricity from an electrical source; wood or rubber, however, does not (which is why electrical wires are made of copper or some other metal, and not cotton thread). Quite by accident, it was discovered that certain substances have the ability to change from being a conductor, to a resistor (i.e. non-conductor). These were called “semi-conductors”. It was eventually discovered that these substances could be turned into a conductors simply by connecting them to an electrical current: When the semi-conductor was detached from the Electricity, it became a noncondducto and any Electrical current passing through it stopped (actually, the current was said to be at Low Voltage). This simple electrical component was called a transistor. Semi-Conductor Electricity Electric current Electric current Principles of Computer Operations Copyright ©YEDA 2006 18 Using transistors, circuits could be built that allowed high or low voltage to pass through them – thus enabling the construction of Logic Gates. The material that worked best for this (and the cheapest) was silicon (an element that makes up ordinary sand). The silicon could be treated so two opposite types of transistors could be produced: one that became a conductor when it was attached to high voltage electrical input, and one that became a conductor when it was attached to Low voltage electrical input. Logic Gates are made up of combinations of both of these types – the technology for this is called CMOS (Complementary Metal Oxide Semi-Conductor). The “Complementary” stands for the fact that 2 opposite types of transistors are used; the “Metal” is a conductor that attaches to the source of the electricity that turns the semiconductor “on” or “off’ and the “Oxide” is an insulator that is placed between the semiconductor and the metal – here is an example of a NOT gate: When the Electrical Input is High voltage, the P Silicon acts as a non conductor and the High Voltage source does not pass through; instead, the N Silicon DOES become a conductor and the Low Voltage electricity passes through it and makes the Electrical output Low voltage – which, of course, is just what we want from a NOT gate. When the Electrical Input is Low, the opposite effect occurs and the Electrical Output becomes High Voltage – thus corresponding to our NOT truth table. For other gates, such as AND and NAND we need more transistors, but the same principle applies – pairing of N and P transistors to get the correct results. Oxide Metal N Silicon Oxide Metal P Silicon High Voltage Electrical Input When this type of silicon is attached to High Voltage, it becomes a Conductor – otherwise, it is a Nonconduuctor When this type of silicon is attached to Low Voltage, it becomes a Conductor – otherwise it’s a Noncondducto Electrical Output Low Voltage Principles of Computer Operations Copyright ©YEDA 2006 19 Transistors made of P and N silicon are called MOSFETs (Metal Oxide Semiconductor Field Effect Transistors) and are the basic components of what is called TTL logic (transistor to transistor logic). Shrinking it down to size But what has this to do with the size of the chip? Chips, called Integrated Circuits, consist of millions of minute transistors manufactured through an ingenious process called photolithography. In this process, the silicon base is coated with special light sensitive chemicals in several layers and then etched away with light. Exercise 4: How Chips are Made Read the description of how chips are made at the Intel site: http://www.intel.com/pressroom/archive/backgrnd/making_a_chip.htm. And as to the answer of how so many small components can be etched onto the chip: the photolithographic image or stencil is projected onto the chip using various optical lenses that reduce the image – this allows images below 50 nm (nano-microns) to be etched. By using innovative light sources from ultra-violet light and even X-rays, even smaller components may be manufactured.