1 / 9

Information Representation: Machine Instructions Demo

Department of Computer and Information Science, School of Science, IUPUI. Information Representation: Machine Instructions Demo. CSCI 230. Dale Roberts, Lecturer IUPUI droberts@cs.iupui.edu. xComputer Applet.

bedros
Download Presentation

Information Representation: Machine Instructions Demo

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Department of Computer and Information Science,School of Science, IUPUI Information Representation:Machine Instructions Demo CSCI 230 Dale Roberts, Lecturer IUPUI droberts@cs.iupui.edu

  2. xComputer Applet • xComputer applet – a java applet that simulates a simple model computer (which is also called xComputer). The model computer is discussed in Chapter 3 of The Most Complex Machine. The xComputer consists of a Central Processing Unit (CPU) and a main memory that holds 1024 sixteen-bit binary numbers. The CPU contains an Arithmetic-Logic Unit (ALU) for performing basic arithmetic and logical computations. It also contains eight registers, which hold binary numbers that are being used directly in the CPU's computations, a Control circuit, which is responsible for supervising the computations that the CPU performs, and a clock, which drives the whole operation of the computer by turning its single output wire on and off.

  3. xComputer Instructions • xComputer uses 16 bits per instruction. 6 bits are dedicated to the opcode, leaving 10 bits for the operand. • The type of information stored in the operand is dependent on the instruction being executed. A listing of xComputer opcodes can be found at http://www.cs.iupui.edu/~aharris/n301/xMachine.html. The xComputer applet can be run from http://www.cs.iupui.edu/~aharris/n301/alg/tmcm-java-labs/labs/xComputerLab1.html. • xComputer uses 16 bits per instruction. 6 bits are dedicated to the opcode, leaving 10 bits for the operand. • The type of information stored in the operand is dependent on the instruction being executed. A listing of xComputer opcodes can be found at http://www.cs.iupui.edu/~aharris/n301/xMachine.html. The xComputer applet can be run from http://www.cs.iupui.edu/~aharris/n301/alg/tmcm-java-labs/labs/xComputerLab1.html.

  4. Sample Opcodes (12) refers to the contents of address 12

  5. Semantic Gap • Machine languages: Native tongue of a particular kind of computer. Each instruction is a binary string. The code is used to indicate operations to be performed and the memory cells to be addressed. This form is the easiest form for computers to understand, but is the most difficult for a person to understand. • Assembly languages: Again, specific to one type of computer. Uses descriptive names for operations and data, e.g. “LOAD value”, “ADD delta”, “Store value”. Assemblers translate this to machine language. Intermediate level. Somewhat descriptive, but basically follow the machine instructions. • High-level languages: Write program instructions called statements that resemble a limited version of English. e.g. “value = value + delta”. Portable, meaning it can be used on different types of computers without modification. Compilers translate them to machine languages. Example are Fortran, Pascal, COBOL, C, C++, Basic, etc. • Semantic gap between statements in a high-level language and machine/assembly language. Each high level statement may represent many hundreds of machine instructions. Compilers must bridge this gap. • Complex machine instruction computer try to reduce this gap by implementing high-level language opcodes. This diminishes the semantic gap but makes the machine instructions more complex, and therefore makes the CPU circuitry more complex.

  6. Real-life Example: Pentium 4. • The instruction set information for the Pentium 4 process can be found at ftp://download.intel.com/design/Pentium4/manuals/25366520.pdf.

  7. Pentium 4 ADD • DescriptionAdds the first operand (destination operand) and the second operand (source operand) and 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 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. • OperationDEST ← DEST + SRC; So you can see that the instructions are a little more complicated in real life than in xComputer. But the same principles apply.

  8. Pentium 4 Add (cont)

  9. Acknowledgements • Several graphics and terms were obtained from Jonathan Michael Auld Central Queensland University. • xComputer and its machine instructions were developed by David Eck.

More Related