Organization of Computer Systems: § 2: ISA, Machine Language, and Number Systems. Reading Assignments and Exercises. This section is organized as follows. ISA and Machine Language 2. Instruction Representation 2. Decision Instructions and Procedure Support 2. Number Representations, Data Types and Addressing 2. Program Loops In Computer Organization PdfOrganization of Computer Systems: § 2: ISA. Decision instructions express control flow in computer program execution. Computer Organization and Design. In computer science, control flow (or alternatively, flow of control) is the order in which individual statements. Infinite loops are used to assure a program segment loops forever or until an exceptional condition arises.
MIPS Programs 2. 6. Pointers and Arrays. 7-1 Chapter 7- Memory Computer Architecture and Organization by M. Murdocca and V. Heuring. Computer Architecture and Organization by M. Murdocca and V. Heuring. and then loops 10 times from. Information contained herein was compiled from a. Web- based sources, is intended as a teaching aid. Particular thanks is given to Dr. Enrique Mafla. for his permission to use selected illustrations from his course notes. Web pages. Reading Assignments and Exercises. ISA and Machine Language Reading Assignments and Exercises. The instruction set architecture (ISA) is a protocol. The ISA describes the (1) memory model, (2). Instruction types include arithmetic. Instruction modes include kernel and user instructions. ISAs are specified in formal definition documents. V9 SPARC machine and Java Virtual Machine. Hierarchical View. As discussed previously, computing languages are. Figure 2. 1. Figure 2. Example of computing language translation. Maf. 01]The implementation of the ISA in hardware is couched. Figure 2. 2. In the fetch step, operands are retrieved from. The decode step puts the operands into a format that. ALU can manipulate. The execute cycle performs the. ALU. Control facilitates orderly. I/O to the ALU's external environment. Figure 2. 2. Basic ISA cycle, where fetch gets operands from. ALU can. accept, and execute performs an ALU operation on the decoded operands - . Maf. 01]2. 1. 2. Machine Language. Machne language instructions are of four types. Arithmetic, Logical, Data transfer, and Branches (also called flow. Arithmetic: add (addition). Logical: and, or. Data Transfer: lw (load word). Conditional: beq (branch on equal). Unconditional: j (jump). The MIPS instruction format uses the KISS principle. As we say more formally. Design Principle #1: Simplicity favors regularity. This means that the MIPS instruction format is. Each instruction begins with an. Figure 2. 3. MIPS instruction - simple addition example. Maf. 01]. These instructions are symbolic. MIPS actually understands. As an example of the symbolic notation used in. Figure 2. 3, consider the following equation, expressed in C. MIPS assembly. Symbolic names make assembly language code more. In the preceding example, note that we have temporary. In MIPS, we also have eight temporary. The s- registers can be thought of as containing. C variables. Thus, in MIPS, operands. This conforms to the. Design Principle #2: Smaller is faster. Thus, in proper MIPS code, the preceding example would become. MIPS Memory. Memory contains instructions and data specific to a. Instructions are fetched automatically by. Figure 2. 4 shows an example of memory. MIPS using the lw (load word) and. Figure 2. 4. Use of lw and sw instructions. Maf. 01]. Here, data is organized in linear memory as a. Each byte is comprised of eight contiguous. Data stored in memory is referenced using an. Addresses in MIPS range from 0 (which points to data in the. M[0]) up to 4,2. 94,9. M[2. 32]). Thus. all addresses are 3. MIPS memory. Only load/store instructions can access data in. Since each word has length 4 bytes, the addresses referenced. Because of differences. MIPS address formats have two types of encoding: big. Figure 2. 5. Here, a. Big endian stores the big part (0. Figure 2. 5. Example of big and little endian encoding. Maf. 01]. There are other interesting things you can do with. For example, suppose you. A[2] and put. the result in A[0]. We know that A[2] has. Figure 2. 6. Here, the register $s. Figure 2. 6. Example of memory offsets. Maf. 01]. The circled operands show how an address offset. MIPS instruction. Instruction Representation. Reading Assignments and Exercises. Computer instructions are based on three number systems. Salient features of these systems. Digits = {0,1} (Base 2). Composition Rule = (dn- 1. Example = (1. 01. Digits = {0,1,2,3,4,5,6,7,8,9} (Base 1. Composition Rule = (dn- 1. Example = (2. 04. Hexadecimal. Digits = {0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f} (Base 1. Composition Rule = (dn- 1. Example = (c. 02a)1. The basic operating concept of modern computers is. In the preceding section, we noted that the CPU. In hardware, this is typically. Machine Language Instruction Format. In machine language, all instructions have the same length. In MIPS, this design compromise produces instructions that are 3. The governing principle follows. Design Principle #3: Good design demands good compromises. MIPS instructions have three different formats. R format - Arithmetic instructions. I format - Branch, transfer, and immediate instructions. J format - Jump instructions. These formats are further explained in Figure 2. Note that jump instructions merely transfer control (execution) to the. As a result, J- format instructions are not. R- and I- format instructions. Figure 2. 7. MIPS instruction format. Maf. 01]. Example 1. Consider an example of an. R- format instruction add $t. C registers 1 and 2 ($s. Here, $t. 0 has the address 8. C- registers have the addresses 1. The "$" sign means contents- of. For example $1. 8 means. Also, note that the. Important Note. MIPS has several register. These conventions will be observed as we progress. MIPS programs. Table 2. MIPS Register Conventions, adapted. Maf. 01]Example 2. A slightly different example of an. R- format instruction involves subtraction - sub $t. C registers. 1 and 2 ($s. Here, $t. 1. has the address 9, and the C- registers have the addresses. Note that the. funct code for subtraction (3. Example 3. Consider an example of an. I- format instruction that involves loading a word - lw $t. Example 4. Another example of an. I- format instruction involves storing a word - sw $t. Example 3. Note that the opcode for store (4. We next assemble these concepts together to show how. Example 5. Given the high- level. A[3. 00] = h + A[3. Note that A[3. 00] is stored in memory. This is due to the 3. Section 2. 1. Since memory is structured. Special Cases. Thus far, we have overviewed the basic add, sub, load. However, MIPS has several special cases of these. We. consider these special cases, as follows. Addition of Constants. By analyzing. large bodies of source code (also called corpi, the plural of. MIPS were able to determine that. For example, A = A + 5; and C. D - 1; respectively are common types of increment or. In general, if an event occurs 5. Design Principle #4: Make the common case fast. As a result of this concept, MIPS puts typical. Example 6. Consider the following add. Here, the contents of C- register $s. The constant 4 is represented at the right- hand. The opcode for. addi is 8, which is different from the add. Example 1, above). As in our previous. Overflow. Compilers have limited. If a result of an addition or. We call this situation. Some high- level languages (e. Ada and certain Fortran. C) do not. MIPS. provides two types of arithmetic instructions. MIPS C compilers produce addu. ANSI standard C language specification. Logical Operations. In MIPS, a. logical constant is expressed as a vector of 3. This leads to the practice of bitwise. Boolean numbers, for example. In MIPS instructions and and or, the. R- format instruction is used (similar. Example 1, above). In contrast, MIPS. I- format instruction is used. An example of. the I- format logical instruction follows. Example 7. Consider the following andi. Boolean. andi $t. FFFThis instruction has several interesting. The first operand is stored in register t. FFF. This representation means fill the word with zeroes until. Since. F1. 6 = (1. When the logical and operation is applied bitwise to. Note that the. word 0x. FFF is called a mask because anding causes the. Shift Instructions. In order to move. MIPS has. a dedicated shift capability that is controlled by the following. Example 8. Assume that the R- format. The shift amount, represented as shamt, is. Since the instruction is R- format, note that the opcode. Shift instructions are used for a. Multiplication and Division. We will. discuss multiplication and division in MIPS in detail in Section 3. For now, consider the following information as useful in the context of the. MIPS instruction format. Multiplication and division of two N- bit numbers. N significant digits (i. N bits). As a result, MIPS uses two registers, called hi and. Example 9. Assume that mult $s. In order to get the high and low part of the product. Assembly vs. Machine Language. Assembly language is a convenient symbolic notation. In MIPS assembly language notation, the. This is generally. In contrast, machine language is the underlying. Each machine language instruction has the destination. Although assembly language can provide convenient. Important Note: When counting instructions to. IC) of a given program, count. If you count assembly language instructions. IC that is misleadingly small, since one. This concludes our overview of MIPS instruction. We next examine how the MIPS architecture supports. Decision Instructions and Procedure Support. Reading Assignments and Exercises. Decision instructions express. Important. types of decision instructions include. Conditional Branch such as if- then. Loops such as while, do- while. Inequalities that form the basis of logical predicates. Switch Statements that allow one to choose among multiple. Conditional Branches. Conditional branch instructions in MIPS have the. These instructions compare the contents of register. If equal (not. equal), then beq (bne) transfers control to. Otherwise, control is transferred. MIPS decision instructions have the machine language. Section 2. 2 of these notes. An example follows. Example 1. Suppose we have the following MIPS. The registers have addresses 1. Thus, we have. In MIPS, there is no need to calculate the addresses for. Example 2. Suppose we have the following high- level. L1. f = g + h. L1: f = f - i. The corresponding MIPS assembly code is as follows. Jump Instruction. The MIPS jump instruction functions like the. C, that is, control is transferred to a. The instruction format is. L1" in Example 2 of Section 2.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
September 2016
Categories |