Machine Language Alex Ostrovsky 1 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming language (C++, Java) 3. Assembly Language (Machine dependent) 4. Machine Language (Machine dependent) 2 Introduction (Cont.) There is nothing “below” machine language – only hardware. Machine Language is the only language understood by computers (i.e. it’s native to processor) Impossible for humans to read. Consists of only 0’s and 1’s. • 0001001111110000 3 History 1943 – Colossus Computer. Based on the same working principles as modern computers. British mathematician Max Newman was one of the main founders of Colossus. 4 History: Colossus - Visual insight 5 Architecture Modern computers are using Von Neumann Architecture (also called stored-program concept) It was derived by Von Neumann (obviously), John Mauchly, and Presper Eckert. See picture on a next page for structural design of simple CPU based on Von Neumann Architecture 6 7 Requirements Every machine language must contain following commands: • Load instruction (CPU loads data directly from memory into ac register) consists of: • Operation code (opcode) • Address of main memory cell from which ac register will be loaded 0010000111100011 • Opcode address Store instruction stores computed information into a memory cell or CPU(ALU) register 8 Requirements Normally even the simplest instruction set includes: • Arithmetic operations – ADD, SUB (subtract), • • MUL (multiply), DIV (divide), INC (increment), DEC (decrement) Logic operations – AND, OR. XOR, NOT Additional operations like SHIFT, ROTATE 9 Assembly Language To program in assembly you need to understand concepts behind machine language and execution-fetch cycle of CPU. Assembly is a mnemonic form of machine language. As noted before, assembly is a machine specific language. Although Assembly and machine language might look similar, they are in fact two different types of languages. • • Assembly consists of both binary and simple words Machine code composed only of 0’s and 1’s 10 Assembly language (cont.) It is possible to code machine language directly, thus bypassing assembly instructions. This is done by replacing Assembly instructions by machine instruction numbers directly. • For example: • Instead of load instruction we might say 0004; thus load001000110001 is equal to 0004001000110001 • Add might equal to 2005 Execution speed remains the same because basic instructions (like ADD, SUB, LOAD, STORE, and etc.) are hardwired into CPU. 11 ALU Registers Simplest ALU design usually includes: • • • Program counter register Accumulator register Stack pointer register Memory and ALU exchange information in words. Word is a fixed chunk of data and depends on system design. Usually it is chosen so that one word fits into one memory slot. 12 Execution Process 13 Future of Machine Language With the introduction of 64-bit CPUs (Itanium, Itanium-2, AMD 64, new assembly language instructions have to be added, old ones have to be either redesigned or eliminated. This also puts stress on compiler designers as well as hardware implementation. Most recent introduction of Intel’s family of dual-core CPUs puts even higher demands on proper hardware and software implementation. Possibly current 16 and 32-bit instruction set will become obsolete in near future in order to avoid backward compatibility problems and minimize production costs. 14 References courses.cs.deu.edu.tr/cse122/Machine%20Language.ppt www.cs.rpi.edu/~hollingd/cpp/lectures/Background.ppt www.cis.ksu.edu/classes/450/jason/arch_overview.ppt www.cs.kent.edu/~kschaffe/teaching/f04/chap1.ppt williams.comp.ncat.edu/COMP375/MachineLanguage.pdf www.cc.gatech.edu/classes/AY2002/cs2130_spring/cs2130pres02_mo reintrohistorycintro.ppt www2.hawaii.edu/~walbritt/ ics312/basicConcepts/lecture.ppt www.cen.uiuc.edu/~cs101/spr04/lect10.ppt cs2.cs.brown.edu/lectures/lecture8.pdf www.andrew.cmu.edu/course/ 45-870/powerpoint/45870wk2-1.ppt http://www.codesandciphers.org.uk/lorenz/colossus.htm http://www.coledd.com/electronics/cpu/arch.png http://www.fact-index.com/m/ma/machine_language.html 15 Thank You Education is what remains after one has forgotten everything he learned in school. A. Einstein 16
© Copyright 2024 ExpyDoc