Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPU Control Unit Main memory ALU INPUTINPUT OUTPUTOUTPUT ฯ OS Compiler OS   Compiler.

Similar presentations


Presentation on theme: "CPU Control Unit Main memory ALU INPUTINPUT OUTPUTOUTPUT ฯ OS Compiler OS   Compiler."— Presentation transcript:

1 CPU Control Unit Main memory ALU INPUTINPUT OUTPUTOUTPUT ฯ OS Compiler OS   Compiler

2 CPU Control Unit Main memory ALU INPUTINPUT OUTPUTOUTPUT OS Compiler Program  Binary Program  Data     OUTPUT  

3 Central Processing Unit (CPU) CPU performs the actual processing of information stored in memory. This information can be data or instructions for executing data. The CPU also store the results of those manipulations back in memory for later use. CPU consists of the following components 1. Control Unit (CU): CU coordinates all activities of the computer by determining which operations should be carried out. The CU then transmits coordination control signals to the ALU. 2. Arithmetic-Logic Unit(ALU): ALU consists of electronic circuitry to perform arithmetic operations (addition, subtraction, multiplication, and division) and to make comparisons (, =, !=, ==). The CU copies the program instructions from memory into ALU that performs the operation specified by these instructions on data that are also copied from memory into ALU, and the computational results are copied to memory. cont 

4 Central Processing Unit (CPU)…cont 3. Main Memory (RAM) : Random Access Memory stores information of all types: instructions, data, … etc. Computer’s memory are an ordered sequence of storage locations called memory cells. To be able to store or retrieve information kept in Main Memory, we must have some way to identify the individual memory cells. Each memory cell has a unique address associated with it. Whenever new information is placed in a memory cell, any existing contents is destroyed (the existing content always be overwritten by the new one.)

5 public static void Main(string[] args) { const double payrate = 200.50; int hrs; double wage; Console.Write("Please input hour work: "); hrs = int.Parse(Console.ReadLine()); wage = hrs * payrate; Console.WriteLine("If you work {0} hours, wage = {1:F2}",hrs, wage); } payrate 200.50 hrswage Please input hour work: 35 7017.50 If you work 35 hours, wage = 7017.50 35 Declaration Part Program Body Main Memory

6 Variable Declaration no initial value public static void Main(string[] args) { const int N = 5; double sum = 0; int k = 1; double num; Console.WriteLine("Please enter numbers :"); while (k <= N) { num = double.Parse(Console.ReadLine()); sum = sum + num; k = k+1; } Console.WriteLine("Summation = {0} ",sum); Console.ReadLine(); } Constant Declaration Variable Declaration with initial value Program Body


Download ppt "CPU Control Unit Main memory ALU INPUTINPUT OUTPUTOUTPUT ฯ OS Compiler OS   Compiler."

Similar presentations


Ads by Google