Computer Organization Overview (by Trek Palmer) ============================== There are many different sorts of computers: -embedded systems -desktop systems -laptop systems -server systems -supercomputers -mainframes But they are all, at heart, rapid calculation machines. But all these systems are organized along similar lines. Digital computers are basically a set of connected functional components. ------------------------------------------------------ || || || || \/ \/ \/ \/ CPU Memory I/O Secondary Storage ==========+ +===========+ +==============+ +==============+ -ALU | |-Just bytes| |-keyboard | |-Disks | -Registers| +===========+ |-mouse | |-Tape | -FPU | |-display | |-Flash Media | -Control | |-NIC | |-CD | ==========+ |-serial ports | +==============+ +==============+ In most systems, these subsystems are connected with various busses. Sometimes, they all share a generic bus, but many modern systems have several special-purpose dedicated busses for certain devices (like video cards and memory). A Bit About Bits ----------------- Bits and bytes, halfs, words, and double words Computer Operation ------------------ All computers operate similarly. The processor is capable of many different types of operations and is controlled by a series of instructions. An instruction is basically an encoded bit string that, when interpreted by the processor, causes it to perform certain tasks on specified data. The Dirty Secret of Computer Organization: Processors are really dumb, but they make up for it with speed. A processor is basically an 'instruction muncher'. Instructions come in, one at a time, from memory. The processor munches them in turn. It twiddles memory in accordance with the instruction, and then moves on to munch the next instruction out of memory. The job of a compiler, then, is to convert the complicated operations of a program written in a high-level language to millions of simple instructions. A sample instruction (from the SPARC instruction set): add %r3, %r4, %r3 This tells the processor to add the value in register 3 to the value in register 4, and write the result into register 3. The equivalent ARM instruction: add R3, R4, R3 And a morally equivalent x86 instruction: addl eax, ebx Actually, these are the mnemonic forms for the instructions. All the processor sees is a series of bits. These mnemonics are an example of an assembly language, which is a human readable encoding for a processor's instruction stream. Because the instructions are not in a form the processor can interpret (namely a bit string), a special program-an assembler-is run on a stream of mnemonic instructions to convert them into the bits the processor can understand. For instance: add R3, R4, R3 => 0xe0843003 => 11100000100001000011000000000011 The Fetch-Execute Cycle ----------------------- The stodgy academic term for all this instruction munching is the fetch-execute cycle (or fetch-decode-execute, to be completely pedantic). A processor has a special register, the program counter (PC), that stores the address (in memory) of the next instruction. On Fetch, the processor gets the instruction in memory at the address stored in the PC. The processor then interprets the bit pattern (this is the decode step). Lastly, the processor's control logic performs the operation dictated by the instruction (this is the execute step). The program counter is incremented to point to the next instruction, and the cycle continues. At this point, it should be apparent that the PC represents the flow of control through a program. Normally the PC is just incremented to point at the next instruction, but to change the flow of control (with an if statement, for instance) the PC is overwritten with a different value. It's honestly that simple. It may be hard to believe that all the complicated if's, while's, and for loops get converted down to instructions that add or subtract values from the PC, but they do. A Brief History Lesson ---------------------- Computing devices have a surprisingly long history. Although electronic computers are recent inventions, people have found ways to mechanically compute things for centuries. An abacus is technically a computing device, capable of performing addition and subtraction (it can even be considered to have registers). Although they are thousands of years old, abacuses are still in use, particularly in the far east. By the time of the reformation, mechanical calculators were being constructed in Europe (by Schickard and Pascal). These devices represented numbers on stacks of gears or toothed wheels. Mechanical computation received its next innovation from the weaving industry. The complicated control issues involved in making the complicated patterns popular in the 18th century, required a sophisticated programming system. This led to the development of loops of punched cards used in the Jacquard loom. These cards were a sort of pattern language that controlled how the loom weaved. The Jacquard loom was a sort of special-purpose embedded mechanical computer. Mechanical computation reached new heights in the 19th century. Charles Babbage invented both a difference calculator and what can be considered the world's first programmable computer. The analytical engine was a mechanical system organized fairly similarly to a simple processor. It consisted of an ALU (which Babbage called the mill), values were read out of the store (which could be manually set or programmed in with punch cards) and written back into it. Babbage's ambitions far outstripped his funding and the machine tools of the early 19th century, and so the analytical engine never saw the light of day. The late nineteenth century saw the rise of electro-mechanical devices like the Hollerith tabulator. These systems combined punch cards and mechanical arithmetic machines and acted as a sort of automatic accountant. Many of these devices used relays as their fundamental computing technology. A relay is basically an electro-magnetic switch. An input signal controls the position of the relay (on or off, 0 or 1), and another signal flows through the relay to tell connected circuits what the state of the relay is. The next big phase in computer development occurred as a result of WWII. Both the Americans and the British employed electronic and electro-mechanical computers to crack the various Axis codes (generated by a sort of electro-mechanical computer). Many of the people involved in the code breaking programs went on to develop electrical computers in academia and industry. The implementation technology of choice for most of the 50s was the vacuum tube. Tubes are a sort of amplifier, and an amplifier is a device that allows a weak input signal to control a larger output signal. Given the right sort of signaling, a tube can be used like a switch. Many of the machines of this era were one-off designs with hokey names like UNIVAC and EDVAC. While all this was going on, researchers at Bell Labs invented the transistor. The transistor was basically a simple amplifier like a vacuum tube, but it was 1) solid state (tubes required a heated filament and vacuum gaps) 2) considerably smaller than a tube and 3) used much less power. This led to the current, modern phase in computer development, where transistor technology has allowed computer researchers to miniaturize and pack as many devices into a single processor as they can. Reading ========= Ch 1.