CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 645-4739 alphonce@buffalo.edu
Announcements Cell phones off Name signs out
Today’s lessons Instructions are encoded as bit strings Machine languages Fetch-Decode-Execute cycle Assembly languages High-level languages Requirements for a programming language
Computer Organization Central Processing Unit (CPU) Registers General purpose (e.g. R1 – R16) Special purpose (e.g. Program Counter and Instruction Register) Arithmetic Logic Unit (ALU) Memory
Computer Organization Memory (RAM) Processor (CPU) 11010010 R1 R2 11010010 . . . R16 11010010 11010010 PC IR 11010010 11010010 ALU 11010010
Encoding instructions Example 1101000001000010 1101 000001 000010 INSTR ARG1 ARG2 ADD Reg1 Reg2
Instruction decoding “ADD” OP CODE R1 R2 1 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0 Circuitry to decode rest of instruction and carry it out (“execute” the instruction) This wire will carry a 1 only if the op code of the instruction is 1101.
Fetch-Decode-Execute cycle Fetch an instruction (& update PC) Decode instruction Execute instruction (load instruction into IR from location in PC) Fetch Update PC Decode Execute
Low-level languages Machine language Assembly language 1101000001000010 Assembly language ADD R1 R2
High level languages Java We can write “x + y” instead of “ADD R1 R2” (in addition to with several MOV instructions) Others: C#, Erlang, Python, ML, Prolog, Lisp, etc.