Transcript Slide 1

Basic Computer Organization
• Block diagram of a typical computer
I/O bus
Memory bus
Processor (CPU)
Direct Memory Access (DMA)
Input/Output
Memory
– Bus – a collection of "wires" for transferring information
– Memory – holds data and instructions
– Without DMA, all I/O must pass through the CPU
– This is a logical organization. The physical organization may have a different
appearance
E.g., the I/O bus and memory bus may be physically located in one main system bus
CS 270
Page 1.1
The CPU
Can be organized in various ways. Here is a simple CPU:
Memory bus
AC
ALU
PC
IR
Status
I/O bus
Control
Unit
• ALU – manipulates data
• Control unit
– Fetches and executes instructions
– Synchronizes the flow of data
CS 270
Page 1.2
The CPU
Memory bus
AC
PC
IR
Status
ALU
I/O bus
Control
Unit
• CPU registers – are like memory cells but are local to the CPU
– AC (accumulator) – holds the result of an arithmetic or logical operation
– PC (program counter) – holds the memory address of the next instruction to
be executed
– IR (instruction register) – holds the currently executing instruction
– Status register – maintains info. about the most recent ALU operation and
certain system events
CS 270
Page 1.3
Main Memory
• Contains
– instructions
– data
• Is composed of a number of memory cells or memory locations, each of the
same size
• Each memory cell has
– a unique address, and
– a value (or contents)
CS 270
Page 1.4
Main Memory
• Units of information
– Bit (binary digit) – a 0 or 1
– Byte – a group of 8 bits (usually)
Historically, the no. of bits to represent one character ('A', '=', etc.)
– Word – a larger grouping of bits, such as 16 or 32 or 64
• Addressability
– Some machines are word-addressable (the smallest addressable storage unit is
the word), but these days, most are byte-addressable
• Machines are commonly word-organized, but byte-addressable
• Little-endian vs. big-endian
CS 270
Page 1.5
Interaction of CPU and Memory
• The CPU can perform 2 operations on a memory cell:
– memory write (stores a new value into the memory cell)
– memory read (fetches the contents of the cell without altering it)
Main memory
Read
cell
0
cell
1
cell
2
Memory write
– CPU places address A on address bus
Write
Data bus
Memory read
– CPU places address A on address bus
– CPU activates Read control signal
– Memory sends contents of address A to
CPU on data bus
...
CPU
Control circuits
Address bus
Address
cell
n–2
cell
n–1
and value V on data bus
– CPU actives Write control signal
– Memory writes value V into cell whose
address is A, destroying previous
contents of A
CS 270
Page 1.6
A Computer System As a Series of
Layers or Levels
• Topmost level: Viewed as a command processor
E.g., invoke text editor, invoke C compiler, start Web browser
• Lower: Viewed as a text manipulator, a C machine, a Web machine
• Lower: Viewed as a CPU, memory, I/O devices
• Lower: Viewed as ALU, control unit, registers, etc. (The machine level)
• Lower: ALU viewed as AND gates/OR gates, registers viewed as flipflops, etc. (The digital logic level)
• In this course, we'll focus first on the machine level, then on the digital
logic level and see their relationships to higher levels.
CS 270
Page 1.7
Programming Language Hierarchy
(For Compiled Languages)
High-level language
C, C++, COBOL,
Pascal, Ada, …
Assembly language
Symbolic
machine language
Compiler
Assembler
Machine language
CS 270
Numeric
instructions
Page 1.8
Programming Language Hierarchy
•
High-level language
Machine language instructions
– Bit strings, with each instruction performing
a primitive operation
– Ex: 110001000101011 (Load contents of
mem. loc. 50 into AC)
Compiler
Assembly language
Assembler
Machine language
• Assembly language instructions
– Use mnemonic names for operations and symbolic names for memory
locations
– Ex: LAC 50 or LAC N
• High-level language instructions
– Typically translate into 5–10 machine language instructions
CS 270
Page 1.9
Interpreted Languages
• Interpreters vs. compilers
– Some languages are interpreted rather than compiled
High-level
language program
Interpreter
Instruction
Machine lang.
Executed
Instruction
Machine lang.
Executed
Instruction

Machine lang.
Executed
– Original BASIC language was interpreted
– Disadvantage?
Advantage?
CS 270
Page 1.10
Interpreted Languages
• Java
– The buzz: "Java programs run slowly because Java is an interpreted language"
– The truth: Java is a compiled language, not an interpreted language
However, Java uses a mixture of compilation and interpretation
Java program
Compiler
Interpreter
A generic
machine
language called
bytecode
__________
– Why do this?
CS 270
Instruction
Instruction
Instruction

Machine lang.
Machine lang.
Machine lang.
Executed
Executed
Executed
JVM
This interpreter is called the __________.
Each kind of machine (Mac, Intel, Sun, etc.) has
its own.
Page 1.11