This preview shows page 1. Sign up to view the full content.
Unformatted text preview: n that will be carried out next. Lecture Unit 1 ECE15: Introduction to Computer Programming Using the C Language 8 Example of CPU Operation
Goal: Compute A + B = C, with A, B, and C being
stored in the RAM memory.
A ‣ Move the content of A into R1 ‣ Move the content of B into R2 ‣ Add R1 and R2, put result in R3 ‣ Move the result from R3 into C Registers
B R1 ALU R2 C R3 Note that the simple operation A + B = C takes four clock cycles. More complex operations take more cycles.
Lecture Unit 1 ECE15: Introduction to Computer Programming Using the C Language 9 Organization of RAM Memory
RAM ❖ Physically, RAM memory consists of one or more chips, containing millions of capacitors (or other electronic circuits) capable of storing data. ❖ Logically, the memory can be thought of as a long table divided into cells. Each cell has an address. Using the cell’s address, the computer can read its value or set its value. The cells are called bytes. ❖ How many bytes? A typical range for home PC is from 256MB to 2GB. The first Macintosh 128KB. My new workstation 16GB. Here is a useful table: KB = 210 bytes MB = 220 bytes GB = 230 bytes
Lecture Unit 1 ECE15: Introduction to Computer Programming Using the C Language 10 How Is Information Stored in RAM?
❖ The fundamental unit of information is a bit. The bit is binary, it can take only two values -- 0 and 1. ❖ Each byte is a sequence of 8 bits, for example 0000000, 01101110, etc. Since a byte is the smallest addressable unit in the computer memory, bits cannot be accessed individually but only in chunks of 8 bits forming a byte. ❖ W hat does a byte mean? Many different answers are possible: ‣ A number, for example 42, 100, 255, etc. ‣ A character, such as “a”, “b”, “c” or “C”, “P”, “U”, etc. ‣ Part of an instruction for the arithmetic logic unit in the CPU ‣ Anything you want, depending on how your program works
Lecture Unit 1 ECE15: Introduction to Computer Programming Using the C Language 11 The Binary Number System
❖ Just like in the decimal number system, we write: * 9 3 7 5 103 1...
View Full Document
This note was uploaded on 04/15/2010 for the course ECE ECE15 taught by Professor Vardy during the Fall '08 term at UCSD.
- Fall '08
- Computer Programming