text stringlengths 139 4.06k | source stringlengths 16 26 |
|---|---|
1.7 Real Stuff: Manufacturing and Benchmarking the AMD Opteron X4 44 1.8 Fallacies and Pitfalls 51 1.9 Concluding Remarks 54 1.10 Historical Perspective and Further Reading 55 1.11 Exercises 56 1.1 Introduction Welcome to this book! We’re delighted to have this opportunity to convey the excitement of the world of comp... | Hennesey_Page_1_Chunk1 |
4 Chapter 1 Computer Abstractions and Technology Computers have led to a third revolution for civilization, with the information revolution taking its place alongside the agricultural and the industrial revolu tions. The resulting multiplication of humankind’s intellectual strength and reach naturally has affected our... | Hennesey_Page_2_Chunk2 |
1.1 Introduction 5 Classes of Computing Applications and Their Characteristics Although a common set of hardware technologies (see Sections 1.3 and 1.7) is used in computers ranging from smart home appliances to cell phones to the largest supercomputers, these different applications have different design requirements... | Hennesey_Page_3_Chunk3 |
6 Chapter 1 Computer Abstractions and Technology microprocessors found in your car, the computers in a cell phone, the computers in a video game or television, and the networks of processors that control a mod ern airplane or cargo ship. Embedded computing systems are designed to run one application or one set of rel... | Hennesey_Page_4_Chunk4 |
1.1 Introduction 7 Embedded applications often have unique application requirements that combine a minimum performance with stringent limitations on cost or power. For example, consider a music player: the processor need only be as fast as necessary to handle its limited function, and beyond that, minimizing cost and ... | Hennesey_Page_5_Chunk5 |
8 Chapter 1 Computer Abstractions and Technology ■ ■How are programs written in a high-level language, such as C or Java, trans lated into the language of the hardware, and how does the hardware execute the resulting program? Comprehending these concepts forms the basis of understanding the aspects of both the hardwar... | Hennesey_Page_6_Chunk6 |
1.1 Introduction 9 To reinforce how the software and hardware systems used to run a program will affect performance, we use a special section, Understanding Program Performance, throughout the book to summarize important insights into program performance. The first one appears below. The performance of a program depen... | Hennesey_Page_7_Chunk7 |
10 Chapter 1 Computer Abstractions and Technology 1.2 Below Your Program A typical application, such as a word processor or a large database system, may consist of millions of lines of code and rely on sophisticated software libraries that implement complex functions in support of the application. As we will see, the h... | Hennesey_Page_8_Chunk8 |
Compilers perform another vital function: the translation of a program written in a high-level language, such as C, C++, Java, or Visual Basic into instructions that the hardware can execute. Given the sophistication of modern programming languages and the simplicity of the instructions executed by the hardware, the t... | Hennesey_Page_9_Chunk9 |
12 Chapter 1 Computer Abstractions and Technology to write one line for every instruction that the computer will follow, forcing the programmer to think like the computer. The recognition that a program could be written to translate a more powerful language into computer instructions was one of the great breakthroughs ... | Hennesey_Page_10_Chunk10 |
A compiler enables a programmer to write this high-level language expression: A + B The compiler would compile it into this assembly language statement: add A,B As shown above, the assembler would translate this statement into the binary instructions that tell the computer to add the two numbers A and B. High-level pro... | Hennesey_Page_11_Chunk11 |
14 Chapter 1 Computer Abstractions and Technology the five components of a computer that perform the tasks of inputting, outputting, processing, and storing data. The five classic components of a computer are input, output, memory, datapath, and control, with the last two sometimes combined and called the processor. F... | Hennesey_Page_12_Chunk12 |
Figure 1.5 shows a computer with keyboard, wireless mouse, and screen. This photograph reveals two of the key components of computers: input devices, such as the keyboard and mouse, and output devices, such as the screen. As the names suggest, input feeds the computer, and output is the result of computation sent to th... | Hennesey_Page_13_Chunk13 |
16 Chapter 1 Computer Abstractions and Technology Anatomy of a Mouse Although many users now take mice for granted, the idea of a pointing device such as a mouse was first shown by Doug Engelbart using a research prototype in 1967. The Alto, which was the inspiration for all workstations as well as for the Macintosh an... | Hennesey_Page_14_Chunk14 |
The computer hardware support for graphics consists mainly of a raster refresh buffer, or frame buffer, to store the bit map. The image to be represented onscreen is stored in the frame buffer, and the bit pattern per pixel is read out to the graphics display at the refresh rate. Figure 1.6 shows a frame buffer with ... | Hennesey_Page_15_Chunk15 |
18 Chapter 1 Computer Abstractions and Technology FIGURE 1.7 Inside the laptop computer of Figure 1.5. The shiny box with the white label on the lower left is a 100 GB SATA hard disk drive, and the shiny metal box on the lower right side is the DVD drive. The hole between them is where the laptop battery would be locat... | Hennesey_Page_16_Chunk16 |
stands for dynamic random access memory. Several DRAMs are used together to contain the instructions and data of a program. In contrast to sequential access memories, such as magnetic tapes, the RAM portion of the term DRAM means that memory accesses take basically the same amount of time no matter what portion of the ... | Hennesey_Page_17_Chunk17 |
20 Chapter 1 Computer Abstractions and Technology Descending into the depths of any component of the hardware reveals insights into the computer. Inside the processor is another type of memory—cache mem ory. Cache memory consists of a small, fast memory that acts as a buffer for the DRAM memory. (The nontechnical defi... | Hennesey_Page_18_Chunk18 |
name: the instruction set architecture, or simply architecture, of a computer. The instruction set architecture includes anything programmers need to know to make a binary machine language program work correctly, including instructions, I/O devices, and so on. Typically, the operating system will encapsulate the det... | Hennesey_Page_19_Chunk19 |
22 Chapter 1 Computer Abstractions and Technology former, and secondary memory for the latter. DRAMs have dominated main memory since 1975, but magnetic disks have dominated secondary memory since 1965. The primary nonvolatile storage used in all server computers and workstations is the magnetic hard disk. Flash memory... | Hennesey_Page_20_Chunk20 |
Diameters of hard disks vary by more than a factor of 3 today, from 1 inch to 3.5 inches, and have been shrunk over the years to fit into new products; workstation servers, personal computers, laptops, palmtops, and digital cameras have all inspired new disk form factors. Traditionally, the widest disks have the high... | Hennesey_Page_21_Chunk21 |
24 Chapter 1 Computer Abstractions and Technology Optical disk technology works differently than magnetic disk technology. In a CD, data is recorded in a spiral fashion, with individual bits being recorded by burning small pits—approximately 1 micron (10−6 meters) in diameter—into the disk surface. The disk is read by ... | Hennesey_Page_22_Chunk22 |
speed make Ethernet useful to connect computers on the same floor of a building; hence, it is an example of what is generically called a local area network. Local area networks are interconnected with switches that can also provide routing services and security. Wide area networks cross continents and are the backbone... | Hennesey_Page_23_Chunk23 |
26 Chapter 1 Computer Abstractions and Technology used over time, with an estimate of the relative performance per unit cost for each technology. Section 1.7 explores the technology that has fueled the computer industry since 1975 and will continue to do so for the foreseeable future. Since this technology shapes wha... | Hennesey_Page_24_Chunk24 |
purchasers and therefore to designers. The people selling computers know this as well. Often, salespeople would like you to see their computer in the best possible light, whether or not this light accurately reflects the needs of the purchaser’s application. Hence, understanding how best to measure performance and the ... | Hennesey_Page_25_Chunk25 |
28 Chapter 1 Computer Abstractions and Technology were interested in transporting 450 passengers from one point to another, however, the 747 would clearly be the fastest, as the last column of the figure shows. Similarly, we can define computer performance in several different ways. If you were running a program on tw... | Hennesey_Page_26_Chunk26 |
In discussing the performance of computers, we will be primarily concerned with response time for the first few chapters. To maximize performance, we want to minimize response time or execution time for some task. Thus, we can relate performance and execution time for a computer X: PerformanceX = 1 ______________ Exe... | Hennesey_Page_27_Chunk27 |
30 Chapter 1 Computer Abstractions and Technology Thus the performance ratio is 15 ___ 10 = 1.5 and A is therefore 1.5 times faster than B. In the above example, we could also say that computer B is 1.5 times slower than computer A, since PerformanceA PerformanceB = 1.5 means that PerformanceA 1.5 = P... | Hennesey_Page_28_Chunk28 |
do accurately, because it is often hard to assign responsibility for operating system activities to one user program rather than another and because of the functionality differences among operating systems. For consistency, we maintain a distinction between performance based on elapsed time and that based on CPU exe... | Hennesey_Page_29_Chunk29 |
32 Chapter 1 Computer Abstractions and Technology b. The networking software is improved, thereby reducing the network communication delay, but not increasing throughput. c. More memory is added to the computer. 2. Computer C’s performance is 4 times faster than the performance of com puter B, which runs a given appli... | Hennesey_Page_30_Chunk30 |
Let’s first find the number of clock cycles required for the program on A: CPU timeA = CPU clock cyclesA _________________ Clock rateA 10 seconds = CPU clock cyclesA 2 × 109 cycles second CPU clock cyclesA = 10 seconds × 2 × 109 cycles _______ second = 20 × 109 cycles CPU time for B can be found us... | Hennesey_Page_31_Chunk31 |
34 Chapter 1 Computer Abstractions and Technology instructions may take different amounts of time depending on what they do, CPI is an average of all the instructions executed in the program. CPI provides one way of comparing two different implementations of the same instruction set architecture, since the number of in... | Hennesey_Page_32_Chunk32 |
The Classic CPU Performance Equation We can now write this basic performance equation in terms of instruction count (the number of instructions executed by the program), CPI, and clock cycle time: CPU time = Instruction count × CPI × Clock cycle time or, since the clock rate is the inverse of clock cycle time: CPU tim... | Hennesey_Page_33_Chunk33 |
36 Chapter 1 Computer Abstractions and Technology Sequence 1 executes 2 + 1 + 2 = 5 instructions. Sequence 2 executes 4 + 1 + 1 = 6 instructions. Therefore, sequence 1 executes fewer instructions. We can use the equation for CPU clock cycles based on instruction count and CPI to find the total number of clock cycles fo... | Hennesey_Page_34_Chunk34 |
How can we determine the value of these factors in the performance equation? We can measure the CPU execution time by running the program, and the clock cycle time is usually published as part of the documentation for a computer. The instruction count and CPI can be more difficult to obtain. Of course, if we know the c... | Hennesey_Page_35_Chunk35 |
38 Chapter 1 Computer Abstractions and Technology The performance of a program depends on the algorithm, the language, the compiler, the architecture, and the actual hardware. The following table summarizes how these components affect the factors in the CPU performance equation. Understanding Program Performance Hardwa... | Hennesey_Page_36_Chunk36 |
1.5 The Power Wall Figure 1.15 shows the increase in clock rate and power of eight generations of Intel microprocessors over 25 years. Both clock rate and power increased rapidly for decades, and then flattened off recently. The reason they grew together is that they are correlated, and the reason for their recent slow... | Hennesey_Page_37_Chunk37 |
40 Chapter 1 Computer Abstractions and Technology Frequency switched is a function of the clock rate. The capacitive load per transistor is a function of both the number of transistors connected to an output (called the fanout) and the technology, which determines the capacitance of both wires and transistors. How cou... | Hennesey_Page_38_Chunk38 |
1.6 The Sea Change: The Switch from Uniprocessors to Multiprocessors The power limit has forced a dramatic change in the design of microprocessors. Figure 1.16 shows the improvement in response time of programs for desktop microprocessors over time. Since 2002, the rate has slowed from a factor of 1.5 per year to less... | Hennesey_Page_39_Chunk39 |
42 Chapter 1 Computer Abstractions and Technology Why has it been so hard for programmers to write explicitly parallel programs? The first reason is that parallel programming is by definition performance pro gramming, which increases the difficulty of programming. Not only does the program need to be correct, solve a... | Hennesey_Page_40_Chunk40 |
do at the same time, and that the overhead of scheduling and coordination doesn’t fritter away the potential performance benefits of parallelism. As an analogy, suppose the task was to write a newspaper story. Eight reporters working on the same story could potentially write a story eight times faster. To achieve this... | Hennesey_Page_41_Chunk41 |
44 Chapter 1 Computer Abstractions and Technology ■ ■Chapter 5, Section 5.8: Parallelism and Memory Hierarchies: Cache Coherence. One way to lower the cost of communication is to have all processors use the same address space, so that any processor can read or write any data. Given that all processors today use caches ... | Hennesey_Page_42_Chunk42 |
Let’s start at the beginning. The manufacture of a chip begins with silicon, a substance found in sand. Because silicon does not conduct electricity well, it is called a semiconductor. With a special chemical process, it is possible to add materials to silicon that allow tiny areas to transform into one of three devic... | Hennesey_Page_43_Chunk43 |
46 Chapter 1 Computer Abstractions and Technology each wafer, creating the transistors, conductors, and insulators discussed earlier. Today’s integrated circuits contain only one layer of transistors but may have from two to eight levels of metal conductor, separated by layers of insulators. A single microscopic flaw ... | Hennesey_Page_44_Chunk44 |
The first equation is straightforward to derive. The second is an approximation, since it does not subtract the area near the border of the round wafer that cannot accommodate the rectangular dies (see Figure 1.19). The final equation is based on empirical observations of yields at integrated circuit factories, with ... | Hennesey_Page_45_Chunk45 |
48 Chapter 1 Computer Abstractions and Technology SPEC CPU Benchmark A computer user who runs the same programs day in and day out would be the perfect candidate to evaluate a new computer. The set of programs run would form a workload. To evaluate two computer systems, a user would simply compare the execution time o... | Hennesey_Page_46_Chunk46 |
The formula for the geometric mean is n i = 1 n Execution time ratio i where Execution time ratioi is the execution time, normalized to the reference computer, for the ith program of a total of n in the workload, and i = 1 n ai means the product a1 × a2 × … × an SPEC Power Benchmark Today, SPEC o... | Hennesey_Page_47_Chunk47 |
50 Chapter 1 Computer Abstractions and Technology system. Performance is measured in throughput, and the units are business operations per second. Once again, to simplify the marketing of computers, SPEC boils these numbers down to a single number, called “overall ssj_ops per Watt.” The formula for this single summariz... | Hennesey_Page_48_Chunk48 |
1.8 Fallacies and Pitfalls The purpose of a section on fallacies and pitfalls, which will be found in every chapter, is to explain some commonly held misconceptions that you might encounter. We call such misbeliefs fallacies. When discussing a fallacy, we try to give a counterexample. We also discuss pitfalls, or easil... | Hennesey_Page_49_Chunk49 |
52 Chapter 1 Computer Abstractions and Technology The performance enhancement possible with a given improvement is limited by the amount that the improved feature is used. This concept also yields what we call the law of diminishing returns in everyday life. We can use Amdahl’s law to estimate performance improvements ... | Hennesey_Page_50_Chunk50 |
two of the three factors to compare performance. Although using two of the three factors may be valid in a limited context, the concept is also easily misused. Indeed, nearly all proposed alternatives to the use of time as the performance metric have led eventually to misleading claims, distorted results, or incorrect... | Hennesey_Page_51_Chunk51 |
54 Chapter 1 Computer Abstractions and Technology 1.9 Concluding Remarks Although it is difficult to predict exactly what level of cost/performance comput ers will have in the future, it’s a safe bet that they will be much better than they are today. To participate in these advances, computer designers and programmers... | Hennesey_Page_52_Chunk52 |
typically today via multiple processors, and exploiting locality of accesses to a memory hierarchy, typically via caches. Power has replaced die area as the most critical resource of microprocessor design. Conserving power while trying to increase performance has forced the hardware industry to switch to multicore micr... | Hennesey_Page_53_Chunk53 |
56 Chapter 1 Computer Abstractions and Technology The historical perspective for this chapter provides a background for some of the key ideas presented in this opening chapter. Its purpose is to give you the human story behind the technological advances and to place achievements in their historical context. By understa... | Hennesey_Page_54_Chunk54 |
1. virtual worlds 14. operating system 2. desktop computers 15. compiler 3. servers 16. bit 4. low-end servers 17. instruction 5. supercomputers 18. assembly language 6. terabyte 19. machine language 7. petabyte 20. C 8. data centers 21. assembler 9. embedded computers 22. high-level language 10. multicore processors 2... | Hennesey_Page_55_Chunk55 |
58 Chapter 1 Computer Abstractions and Technology 1.1.12 [2] <1.1> Personal computer delivering good performance to single users at low cost 1.1.13 [2] <1.2> Program that translates statements in high-level language to assembly language 1.1.14 [2] <1.2> Program that translates symbolic instructions to binary instruct... | Hennesey_Page_56_Chunk56 |
1.2.1 [10] <1.3> For a color display using 8 bits for each of the primary colors (red, green, blue) per pixel, what should be the minimum size in bytes of the frame buffer to store a frame? 1.2.2 [5] <1.3> How many frames could it store, assuming the memory contains no other information? 1.2.3 [5] <1.3> If a 256 Kbytes... | Hennesey_Page_57_Chunk57 |
60 Chapter 1 Computer Abstractions and Technology 1.3.3 [10] <1.4> We are trying to reduce the time by 30% but this leads to an increase of 20% in the CPI. What clock rate should we have to get this time reduction? For problems below, use the information in the following table. Processor Clock Rate No. Instructions Tim... | Hennesey_Page_58_Chunk58 |
The following table shows the number of instructions for a program. Arith Store Load Branch Total a. 650 100 600 50 1400 b. 750 250 500 500 2000 1.4.4 [5] <1.4> Assuming that arith instructions take 1 cycle, load and store 5 cycles, and branches 2 cycles, what is the execution time of the program in a 2 GHz processor? ... | Hennesey_Page_59_Chunk59 |
62 Chapter 1 Computer Abstractions and Technology No. Instructions Compute Load Store Branch Total a. Program1 600 600 200 50 1450 b. Program 2 900 500 100 200 1700 1.5.4 [5] <1.4> Assuming that computes take 1 cycle, loads and store instructions take 10 cycles, and branches take 3 cycles, find the execution time on a ... | Hennesey_Page_60_Chunk60 |
CPI Class A CPI Class B CPI Class C CPI Class D CPI Class E a. P1 1 2 3 4 5 P2 3 3 3 5 5 b. P1 1 2 3 4 5 P2 2 2 2 2 6 1.6.4 [5] <1.4> Assume that peak performance is defined as the fastest rate that a computer can execute any instruction sequence. What are the peak performances of P1 and P2 expressed in instructions pe... | Hennesey_Page_61_Chunk61 |
64 Chapter 1 Computer Abstractions and Technology Consider the following values for voltage in each generation. Processor Voltage 80286 (1982) 5 80386 (1985) 5 80486 (1989) 5 Pentium (1993) 5 Pentium Pro (1997) 3.3 Pentium 4 Willamette (2001) 1.75 Pentium 4 Prescott (2004) 1.25 Core 2 Ketsfield (2007) 1.1 1.7.4 [5] <1.... | Hennesey_Page_62_Chunk62 |
Capacitance Voltage Clock Rate Area a. 1 1/21/2 1.15 1/21/2 b. 1 1/21/4 1.2 1/21/4 1.8.4 [5] <1.5> Find the scaling factor for the dynamic power. 1.8.5 [5] <1.5> Find the scaling of the capacitance per unit area unit. 1.8.6 [5] <1.5> Assuming a Core 2 processor with a clock rate of 2.667 GHz, a power consumption of 95 ... | Hennesey_Page_63_Chunk63 |
66 Chapter 1 Computer Abstractions and Technology 1.9.4 [5] <1.5> Determine the static power at 0.8 V, assuming a static to dynamic power ratio of 0.6. 1.9.5 [5] <1.5> Determine the static and dynamic power dissipation assuming the rates obtained in problem 1.9.1. 1.9.6 [10] <1.5> Determine the geometric mean of the po... | Hennesey_Page_64_Chunk64 |
The table below shows the number of instructions per processor core on a multicore processor as well as the average CPI for executing the program on 1, 2, 4, or 8 cores. Using this data, you will be exploring the speedup of applications on multicore processors. Cores per Processor Instructions per Core Average CPI a... | Hennesey_Page_65_Chunk65 |
68 Chapter 1 Computer Abstractions and Technology Exercise 1.11 The following table shows manufacturing data for various processors. Wafer Diameter Dies per Wafer Defects per Unit Area Cost per Wafer a. 15 cm 84 0.020 defects/cm2 12 b. 20 cm 100 0.031 defects/cm2 15 1.11.1 [10] <1.7> Find the yield. 1.11.2 [5] <1.7> Fi... | Hennesey_Page_66_Chunk66 |
The following table shows data for further benchmarks. Name CPI Clock Rate SPECratio a. libquantum 1.61 4 GHz 19.8 b. astar 1.79 4 GHz 9.1 1.12.4 [5] <1.7> Find the increase in CPU time if the number of instructions of the benchmark is increased by 10% without affecting the CPI. 1.12.5 [5] <1.7> Find the increase in CP... | Hennesey_Page_67_Chunk67 |
70 Chapter 1 Computer Abstractions and Technology 1.13.4 [10] <1.8> If the execution time is reduced by an additional 10% with out affecting to the CPI and with a clock rate of 4 GHz, determine the number of instructions. 1.13.5 [10] <1.8> Determine the clock rate required to give a further 10% reduc tion in CPU time... | Hennesey_Page_68_Chunk68 |
Processor Instr. Count No. Instructions CPI L/S FP Branch L/S FP Branch Clock Rate a. P1 1.00E+06 50% 40% 10% 0.75 1.0 1.5 4 GHz P2 5.00E+06 40% 40% 20% 1.25 0.8 1.25 3 GHz b. P1 5.00E+06 30% 30% 40% 1.5 1.0 2.0 4 GHz P2 2.00E+06 40% 30% 30% 1.25 1.0 2.5 3 GHz 1.14.4 [10] <1.8> Find the MFLOPS figures for the programs.... | Hennesey_Page_69_Chunk69 |
72 Chapter 1 Computer Abstractions and Technology Assume that each processor has a 2 GHz clock rate. 1.15.4 [10] <1.8> How much must we improve the CPI of FP instructions if we want the program to run two times faster? 1.15.5 [10] <1.8> How much must we improve the CPI of L/S instructions if we want the program to run ... | Hennesey_Page_70_Chunk70 |
No. Processors Routine A (ms) Routine B (ms) Routine C (ms) Routine D (ms) Routine E (ms) Routing Time (ms) 2 40 78 9 70 4 11 4 29 60 4 36 2 13 8 15 45 3 19 3 17 16 7 35 1 11 2 22 32 4 23 1 6 1 23 64 2 12 0.5 3 1 26 1.16.4 [10] <1.8> For each doubling of the number of processors, determine the ratio of new to old compu... | Hennesey_Page_71_Chunk71 |
2 I speak Spanish to God, Italian to women, French to men, and German to my horse. Charles V, Holy Roman Emperor (1500–1558) Instructions: Language of the Computer 2.1 Introduction 76 2.2 Operations of the Computer Hardware 77 2.3 Operands of the Computer Hardware 80 2.4 Signed and Unsigned Numbers 87 2.5 Representing... | Hennesey_Page_72_Chunk72 |
2.8 Supporting Procedures in Computer Hardware 112 2.9 Communicating with People 122 2.10 MIPS Addressing for 32-Bit Immediates and Addresses 128 2.11 Parallelism and Instructions: Synchronization 137 2.12 Translating and Starting a Program 139 2.13 A C Sort Example to Put It All Together 149 2.14 Arrays versus Pointe... | Hennesey_Page_73_Chunk73 |
76 Chapter 2 Instructions: Language of the Computer 2.1 Introduction To command a computer’s hardware, you must speak its language. The words of a computer’s language are called instructions, and its vocabulary is called an instruction set. In this chapter, you will see the instruction set of a real computer, both in t... | Hennesey_Page_74_Chunk74 |
By learning how to represent instructions, you will also discover the secret of computing: the stored-program concept. Moreover, you will exercise your “foreign language” skills by writing programs in the language of the computer and running them on the simulator that comes with this book. You will also see the impac... | Hennesey_Page_75_Chunk75 |
78 Chapter 2 Instructions: Language of the Computer MIPS operands Name Example Comments 32 registers $s0–$s7, $t0–$t9, $zero, $a0–$a3, $v0–$v1, $gp, $fp, $sp, $ra, $at Fast locations for data. In MIPS, data must be in registers to perform arithmetic, register $zero always equals 0, and register $at is reserved by the a... | Hennesey_Page_76_Chunk76 |
The natural number of operands for an operation like addition is three: the two numbers being added together and a place to put the sum. Requiring every instruction to have exactly three operands, no more and no less, conforms to the philosophy of keeping the hardware simple: hardware for a variable number of operands ... | Hennesey_Page_77_Chunk77 |
80 Chapter 2 Instructions: Language of the Computer The compiler must break this statement into several assembly instructions, since only one operation is performed per MIPS instruction. The first MIPS instruction calculates the sum of g and h. We must place the result somewhere, so the compiler creates a temporary va... | Hennesey_Page_78_Chunk78 |
are also visible to the programmer when the computer is completed, so you can think of registers as the bricks of computer construction. The size of a register in the MIPS architecture is 32 bits; groups of 32 bits occur so frequently that they are given the name word in the MIPS architecture. One major difference betw... | Hennesey_Page_79_Chunk79 |
82 Chapter 2 Instructions: Language of the Computer The compiled program is very similar to the prior example, except we replace the variables with the register names mentioned above plus two temporary registers, $t0 and $t1, which correspond to the temporary variables above: add $t0,$s1,$s2 # register $t0 contains g +... | Hennesey_Page_80_Chunk80 |
The data transfer instruction that copies data from memory to a register is traditionally called load. The format of the load instruction is the name of the operation followed by the register to be loaded, then a constant and register used to access memory. The sum of the constant portion of the instruction and the co... | Hennesey_Page_81_Chunk81 |
84 Chapter 2 Instructions: Language of the Computer In addition to associating variables with registers, the compiler allocates data structures like arrays and structures to locations in memory. The compiler can then place the proper starting address into the data transfer instructions. Since 8-bit bytes are useful in ... | Hennesey_Page_82_Chunk82 |
The instruction complementary to load is traditionally called store; it copies data from a register to memory. The format of a store is similar to that of a load: the name of the operation, followed by the register to be stored, then offset to select the array element, and finally the base register. Once again, the MIP... | Hennesey_Page_83_Chunk83 |
86 Chapter 2 Instructions: Language of the Computer Many programs have more variables than computers have registers. Consequently, the compiler tries to keep the most frequently used variables in registers and places the rest in memory, using loads and stores to move variables between registers and memory. The process... | Hennesey_Page_84_Chunk84 |
Constant operands occur frequently, and by including constants inside arithmetic instructions, operations are much faster and use less energy than if constants were loaded from memory. The constant zero has another role, which is to simplify the instruction set by offering useful variations. For example, the move opera... | Hennesey_Page_85_Chunk85 |
88 Chapter 2 Instructions: Language of the Computer can be one of two values, which can be thought of as several alternatives: high or low, on or off, true or false, or 1 or 0. Generalizing the point, in any number base, the value of ith digit d is d × Basei where i starts at 0 and increases from right to left. This le... | Hennesey_Page_86_Chunk86 |
(x31 × 231) + (x30 × 230) + (x29 × 229) + . . . + (x1 × 21) + (x0 × 20) Keep in mind that the binary bit patterns above are simply representatives of numbers. Numbers really have an infinite number of digits, with almost all being 0 except for a few of the rightmost digits. We just don’t normally show leading 0s. Hardw... | Hennesey_Page_87_Chunk87 |
90 Chapter 2 Instructions: Language of the Computer The positive half of the numbers, from 0 to 2,147,483,647ten (231 - 1), use the same representation as before. The following bit pattern (1000 . . . 0000two) rep resents the most negative number -2,147,483,648ten (-231). It is followed by a declining set of negative ... | Hennesey_Page_88_Chunk88 |
Unlike the numbers discussed above, memory addresses naturally start at 0 and con- tinue to the largest address. Put another way, negative addresses make no sense. Thus, programs want to deal sometimes with numbers that can be positive or negative and sometimes with numbers that can be only positive. Some programming ... | Hennesey_Page_89_Chunk89 |
92 Chapter 2 Instructions: Language of the Computer Going the other direction, 1111 1111 1111 1111 1111 1111 1111 1110two is first inverted and then incremented: 0000 0000 0000 0000 0000 0000 0000 0001two + 1two = 0000 0000 0000 0000 0000 0000 0000 0010two = 2ten Our next shortcut tells us how to convert a binary numbe... | Hennesey_Page_90_Chunk90 |
Let’s negate the 16‑bit version of 2 using the earlier shortcut. Thus, 0000 0000 0000 0010two becomes 1111 1111 1111 1101two + 1two = 1111 1111 1111 1110two Creating a 32‑bit version of the negative number means copying the sign bit 16 times and placing it on the left: 1111 1111 1111 1111 1111 1111 1111 1110two = –2ten... | Hennesey_Page_91_Chunk91 |
94 Chapter 2 Instructions: Language of the Computer A third alternative representation to two’s complement and sign and magnitude is called one’s complement. The negative of a one’s complement is found by inverting each bit, from 0 to 1 and from 1 to 0, which helps explain its name since the complement of x is 2n – x –... | Hennesey_Page_92_Chunk92 |
Translating a MIPS Assembly Instruction into a Machine Instruction Let’s do the next step in the refinement of the MIPS language as an example. We’ll show the real MIPS language version of the instruction represented symbolically as add $t0,$s1,$s2 first as a combination of decimal numbers and then of binary numbers. T... | Hennesey_Page_93_Chunk93 |
96 Chapter 2 Instructions: Language of the Computer Hexadecimal Binary Hexadecimal Binary Hexadecimal Binary Hexadecimal Binary 0hex 0000two 4hex 0100two 8hex 1000two chex 1100two 1hex 0001two 5hex 0101two 9hex 1001two dhex 1101two 2hex 0010two 6hex 0110two ahex 1010two ehex 1110two 3hex 0011two 7hex 0111two bhex 1011t... | Hennesey_Page_94_Chunk94 |
2.5 Representing Instructions in the Computer 97 Here is the meaning of each name of the fields in MIPS instructions: ■ ■op: Basic operation of the instruction, traditionally called the opcode. ■ ■rs: The first register source operand. ■ ■rt: The second register source operand. ■ ■rd: The register destination operand. ... | Hennesey_Page_95_Chunk95 |
98 Chapter 2 Instructions: Language of the Computer Here, 19 (for $s3) is placed in the rs field, 8 (for $t0) is placed in the rt field, and 32 is placed in the address field. Note that the meaning of the rt field has changed for this instruction: in a load word instruction, the rt field specifies the destination regis... | Hennesey_Page_96_Chunk96 |
For convenience, let’s first represent the machine language instructions using decimal numbers. From Figure 2.5, we can determine the three machine lan guage instructions: ANSWER Note the similarity of the binary representations of the first and last instruc tions. The only difference is in the third bit from the lef... | Hennesey_Page_97_Chunk97 |
100 Chapter 2 Instructions: Language of the Computer Today’s computers are built on two key principles: 1. Instructions are represented as numbers. 2. Programs are stored in memory to be read or written, just like numbers. These principles lead to the stored-program concept; its invention let the computing genie out of... | Hennesey_Page_98_Chunk98 |
What MIPS instruction does this represent? Chose from one of the four options below. Check Yourself FIGURE 2.7 The stored-program concept. Stored programs allow a computer that performs accounting to become, in the blink of an eye, a computer that helps an author write a book. The switch hap pens simply by loading mem... | Hennesey_Page_99_Chunk99 |
102 Chapter 2 Instructions: Language of the Computer 2.6 Logical Operations Although the first computers operated on full words, it soon became clear that it was useful to operate on fields of bits within a word or even on individual bits. Examining characters within a word, each of which is stored as 8 bits, is one ex... | Hennesey_Page_100_Chunk100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.