150 likes | 258 Views
CSE115 / CSE503 Introduction to Computer Science I. Dr. Carl Alphonce 343 Davis Hall alphonce@buffalo.edu. cell phones off laptops away name signs out. Announcements. TA office hours posted they begin NEXT week. Roadmap. Computer organization (brief overview)
E N D
CSE115/ CSE503Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall alphonce@buffalo.edu
cell phones off laptops away name signs out
Announcements • TA office hours posted • they begin NEXT week
Roadmap • Computer organization (brief overview) • Fetch-Decode-Execute cycle • Low-level and high-level languages
Setting the flip-flopBecause the output of the bottom OR gate will now stay at 1, we can lower S to zero, and the circuit will stay in a stable state, with 1 as the remembered value! R (reset) = 0 1 0 remembered value 0 Resetting the flip-flopResetting the remembered value to zero is similar, except we raise, then lower, the value on R. 1 1 0 S (set) = 0
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 • Processor (CPU) • Memory (RAM) 11010010 R1 R2 11010010 . . . R16 11010010 11010010 PC IR 11010010 11010010 11010010 ALU
Encoding instructions • Example • 1101000001000010 a bit string • 1101 000001 000010 bit groupings • INSTR ARG1 ARG2 general pattern • ADD Reg1 Reg2 specific instruction
Instruction decoding • “ADD” • OP CODE • R2 • R1 • 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
Low-level languages • Machine language • 1101000001000010 • Assembly language • ADD R1 R2
Translation • LLL LLL is called assembly • there is a 1:1 translation from assembly to machine language • fairly simple process
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.
Translation • LLL LLL is called assembly • there is a 1:1 translation from assembly to machine language • fairly simple process • HLL LLL is called compilation • there is no 1:1 translation • translation is quite complex • optimizations can be applied to make low level code more efficient