{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture02-jan23

lecture02-jan23 - 1 1 EE312 Lecture 2 Announcements •...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1/23/09 1 1 EE312 - Lecture 2 Announcements • Meet your TA at your recitation session today – Hand in surveys, discuss assignment 1 • TA lab hours schedule will be posted on the BB this weekend • Assignment 1 is out, due next Friday before midnight • Topics for today will answer the questions: – More on what is programming? – What is the relationship of high level languages to the von Neumann computer ? – What is the C programming language ? – What is C syntax ? 2 The von Neumann Computer Memory: holds the instructions and data Processing Unit: processes the information Input: external information into the memory Output: produces results for the user Control Unit: manages computer activity Register(s) device handler device handler 3 A Computer Program: • Contains a set of instructions that tell the computer exactly what to do: – Exists in the form of machine code (binary numbers) when it is run (i.e. executed) – Exists in the form of high-level programming language (e.g. C or Java) when its coded – Exists in the form of a natural language recipe, flowchart or algorithm when it is formulated • It often contains references to subprograms (used as component parts) – In C these are called “functions” as in y = f(x) • A program has instructions that operate on data, as in the following formula ( not in C ) A + B => C , the values of A,B,C are data items 4 Program Instructions Each brand of CPU has a unique instruction set which is deFned by a given coding scheme. A typical kind of instruction sequence might be one that adds 2 integer values and stores the result somewhere else. e.g. A + B => C (in a high level formula) Using a simple von Neumann computer instruction set we need 3 machine language instructions: The instruction format is: 0000 0000 1000 0010 0011 0000 1000 0100 0001 0000 1000 0110 Opcode Operand-address LOAD A (load the value of A into the register R in the CPU) ADD B (add the value of B to the value in R) STORE C (store the value in R into memory location C) This is called machine language This is called assembly language 5 LC-3 Assembly Language Example 01 ; 02 ; 03 ; 04 .ORIG x3050 05 LD R1, SIX 06 LD R2, NUM 07 AND R3, R3, #0 ; clear R3 08 ; 09 ; The loop that repeated adds number to R3 0A ; 0B LOOP ADD R3, R3, R2 0C ADD R1, R1, #-1 ; keep track of iterations in R1 0D BRp LOOP 0E ST R3, RES 0F HALT 10 ; 11 NUM .BLKW 1 12 RES .BLKW 1 13 SIX .FILL x0006 14 ; 15 .END /*C Program to multiply num by six*/ int num, res; res = num * 6; int main(void) { } Computes 6 * NUM => RES 6 High Level Programming Languages • These are artificial languages for specifying sequences of instructions to the computer (programs) • The evolution of computer programming languages spans from the mid 1950’s (Fortran, Cobol, Algol) up until the present, and have evolved as computers have evolved....
View Full Document

{[ snackBarMessage ]}

Page1 / 5

lecture02-jan23 - 1 1 EE312 Lecture 2 Announcements •...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online