lecture02-jan22 - 1/22/10 EE312 - Lecture 2 Announcements...

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

View Full Document Right Arrow Icon
1/22/10 1 1 EE312 - Lecture 2 Announcements Meet with the TA at your recitation session today – Go over surveys, discuss assignment 1, visit LRC TA office hour schedule will be posted on the BB this weekend – starts next week in ENS 307 Assignment 1 is out, due next Thursday 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” – Somewhat analogous to mathematical functions, e.g. y = f(x) = x 2 + 5x + 6 A program has instructions that operate on data, as in the following formula (this is 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 repeatedly adds NUM 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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/15/2010 for the course EE 16005 taught by Professor Krasner during the Spring '10 term at University of Texas.

Page1 / 5

lecture02-jan22 - 1/22/10 EE312 - Lecture 2 Announcements...

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

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