Chapter-1
Basic Structure of Computers
CPU Organization
• Study of design and architecture of a small accumulator based CPU,
• A typical CPU with general register organization,
• Pipelining,
• Functional units,
• Floating-Point numbers, Addressing modes,
• Accessing I/O devices,
• Linker, Compiler, Debugger
Fundamentals:
• Function of CPU: To execute sequence of instructions
• Program execution
Cache Memory:
• Extremely fast and small memory
• Placed between CPU and main memory
• Used for temporarily storing data
Small accumulator
based CPU:
Architecture extensions:
• Multipurpose register set for storing data and addresses(register file)
• Additional data, instructions and address types
• Register to indicate computation status (Status Register)
• Program control stack
-Stack Pointer keeps track of stacks entry point
-A part of external mem is used as push down stack mem
A typical CPU with
general register
organization:
Pipelining:
• Parallelism may be present in DPU, overlapping carried out by DPU or
PCU
• "A pipeline processor consists of a sequence of processing circuits,
called segments or stages, through which a stream of operands can
be passed.
• "Partial processing of the operands takes place in each segment.
• "... a fully processed result is obtained only after an operand set has
passed through the entire pipeline."
Pipelining:
• A Pipeline is a series of stages, where some work is done at each
stage. The work is not finished until it has passed through all stages.
• Types of Pipelines
• Instructional pipeline
where different stages of an instruction fetch and execution are
handled in a pipeline.
• Arithmetic pipeline
where different stages of an arithmetic operation are handled
along the stages of a pipeline.
Basic Information Types
Fixed- Point Numbers
• Allows limited range of values and have relatively simple hardware
requirements
• Binary Numbers:
-derived from ordinary representation of number
-left side represent number while right side represent fraction
called positional notation(each digit has same weight)
• Decimal Numbers- use of BCD
• Hexadecimal Numbers
Floating- Point Numbers
• Allows much larger range of values but require either costly processing
hardware or lengthy software implementations
• Floating point codes used in computers are binary(or binary coded) version
• 3 numbers associated with floating point number-
M (Mantissa),
E (Exponent),
B (Base)
Instruction Set
• Instruction Format
• Combination of opcode and operand
op X1, X2,X3,…….,Xn ADD A, B
• RISC Format
Addressing Modes
• To point the current value V(X) of some operand X used by an instruction
1. Immediate Addressing modes MOV R0, #300-opernd is mentioned
directly
2. Direct Addressing modes
MOV R0, X
3. Indirect Addressing modes MOV R0, (P) //p contains address of x
4. Relative Addressing modes MOV R0, 30
used without modifications, requires complete operand address
Accessing I/O Devices
• The interconnection network consists of circuits
needed to transfer information between the
processor, the memory unit, and a number of I/O
devices.
• Load and Store instructions use addressing modes to
generate effective addresses that identify the desired
locations.
• Each I/O device must appear to the processor as consisting of some
addressable locations, just like the memory.
• The I/O devices and the memory share the same address space, this
arrangement is called memory-mapped I/O.
• Load R2, DATAIN
• Store R2, DATAOUT
Linker
• All instructions and data for a particular program are specified in a single
source file from which the assembler generates an object program
• Each program may contain references to external names, which are address
labels defined in other source files.
• A utility program called the linker is used to combine the contents of separate
object files into one object program.
• The linker needs the relative positions of address labels defined in the source
files.
• The linker uses the information in each object file and the known sizes of
machine language programs to build a memory map of the final combined
object file.
Compiler
• A utility program called a compiler performs the first task.
• A source file in a high-level language is prepared by the programmer and stored
on the disk.
• The compiler generates assembly-language instructions and directives, and
writes them into an output file.
• It is often convenient to partition a high-level source program into multiple files,
grouping subroutines together based on related tasks.
• For each source file, the compiler generates an assembly-language file, then
invokes the assembler to generate an object file.
• Benefit of programming in a high-level language is that the compiler automates
many of the tedious tasks that a programmer has to do when programming in
assembly language
Compiler Optimizations
• Improved performance can be achieved if the compiler uses techniques
such as reordering the instructions produced from a straightforward
approach.
• A compiler with such capabilities is called an optimizing compiler.
• Because much of the execution time of a program is spent in loops,
compilers may apply optimizations that are particularly effective for loops.
Debugger
• An object program is generated successfully when there are no syntax errors
or unknown names in the source files for the program.
• When an object program is executed, it may produce incorrect results due to
programming errors, or bugs, that are often difficult to isolate.
• To help the programmer identify such errors, a utility program called the
debugger can be used.
• It enables the programmer to stop execution of the object program at some
points of interest and to examine the contents of various processor registers
and memory locations.
• the programmer can compare computed values with the expected results at
any point of
• execution to determine where a programming error may exist.
Debugger
• Trace Mode:
• When a processor is operating in the trace mode, an interrupt occurs
after the execution of every instruction.
• When the user enters a command to resume execution of the object
program, a return from- interrupt instruction is executed.
• The next instruction in the program being debugged is executed, then the
debugger is activated again with another interrupt.
• The trace-mode interrupt is automatically disabled when the debugger
routine is entered, and re-enabled upon return to the object program.
Debugger
• Breakpoints:
• Breakpoints provide a similar interrupt-based debugging facility, except
that the object program being debugged is interrupted only at specific
points indicated by the programmer.
• The programmer may set a breakpoint to determine whether a particular
subroutine in the object program is ever reached.
• The advantage of using a breakpoint is that execution proceeds at full
speed until the breakpoint is encountered.
• A special instruction called Trap or Software-interrupt is usually used to
implement breakpoints.

Chapter-1 CPU ORGANIZATION and architectur

  • 1.
  • 2.
    CPU Organization • Studyof design and architecture of a small accumulator based CPU, • A typical CPU with general register organization, • Pipelining, • Functional units, • Floating-Point numbers, Addressing modes, • Accessing I/O devices, • Linker, Compiler, Debugger
  • 3.
    Fundamentals: • Function ofCPU: To execute sequence of instructions • Program execution
  • 5.
    Cache Memory: • Extremelyfast and small memory • Placed between CPU and main memory • Used for temporarily storing data
  • 6.
  • 7.
    Architecture extensions: • Multipurposeregister set for storing data and addresses(register file) • Additional data, instructions and address types • Register to indicate computation status (Status Register) • Program control stack -Stack Pointer keeps track of stacks entry point -A part of external mem is used as push down stack mem
  • 8.
    A typical CPUwith general register organization:
  • 9.
    Pipelining: • Parallelism maybe present in DPU, overlapping carried out by DPU or PCU • "A pipeline processor consists of a sequence of processing circuits, called segments or stages, through which a stream of operands can be passed. • "Partial processing of the operands takes place in each segment. • "... a fully processed result is obtained only after an operand set has passed through the entire pipeline."
  • 10.
    Pipelining: • A Pipelineis a series of stages, where some work is done at each stage. The work is not finished until it has passed through all stages. • Types of Pipelines • Instructional pipeline where different stages of an instruction fetch and execution are handled in a pipeline. • Arithmetic pipeline where different stages of an arithmetic operation are handled along the stages of a pipeline.
  • 11.
  • 12.
    Fixed- Point Numbers •Allows limited range of values and have relatively simple hardware requirements • Binary Numbers: -derived from ordinary representation of number -left side represent number while right side represent fraction called positional notation(each digit has same weight) • Decimal Numbers- use of BCD • Hexadecimal Numbers
  • 13.
    Floating- Point Numbers •Allows much larger range of values but require either costly processing hardware or lengthy software implementations • Floating point codes used in computers are binary(or binary coded) version • 3 numbers associated with floating point number- M (Mantissa), E (Exponent), B (Base)
  • 14.
    Instruction Set • InstructionFormat • Combination of opcode and operand op X1, X2,X3,…….,Xn ADD A, B • RISC Format
  • 15.
    Addressing Modes • Topoint the current value V(X) of some operand X used by an instruction 1. Immediate Addressing modes MOV R0, #300-opernd is mentioned directly 2. Direct Addressing modes MOV R0, X 3. Indirect Addressing modes MOV R0, (P) //p contains address of x 4. Relative Addressing modes MOV R0, 30 used without modifications, requires complete operand address
  • 16.
    Accessing I/O Devices •The interconnection network consists of circuits needed to transfer information between the processor, the memory unit, and a number of I/O devices. • Load and Store instructions use addressing modes to generate effective addresses that identify the desired locations. • Each I/O device must appear to the processor as consisting of some addressable locations, just like the memory. • The I/O devices and the memory share the same address space, this arrangement is called memory-mapped I/O. • Load R2, DATAIN • Store R2, DATAOUT
  • 17.
    Linker • All instructionsand data for a particular program are specified in a single source file from which the assembler generates an object program • Each program may contain references to external names, which are address labels defined in other source files. • A utility program called the linker is used to combine the contents of separate object files into one object program. • The linker needs the relative positions of address labels defined in the source files. • The linker uses the information in each object file and the known sizes of machine language programs to build a memory map of the final combined object file.
  • 18.
    Compiler • A utilityprogram called a compiler performs the first task. • A source file in a high-level language is prepared by the programmer and stored on the disk. • The compiler generates assembly-language instructions and directives, and writes them into an output file. • It is often convenient to partition a high-level source program into multiple files, grouping subroutines together based on related tasks. • For each source file, the compiler generates an assembly-language file, then invokes the assembler to generate an object file. • Benefit of programming in a high-level language is that the compiler automates many of the tedious tasks that a programmer has to do when programming in assembly language
  • 19.
    Compiler Optimizations • Improvedperformance can be achieved if the compiler uses techniques such as reordering the instructions produced from a straightforward approach. • A compiler with such capabilities is called an optimizing compiler. • Because much of the execution time of a program is spent in loops, compilers may apply optimizations that are particularly effective for loops.
  • 20.
    Debugger • An objectprogram is generated successfully when there are no syntax errors or unknown names in the source files for the program. • When an object program is executed, it may produce incorrect results due to programming errors, or bugs, that are often difficult to isolate. • To help the programmer identify such errors, a utility program called the debugger can be used. • It enables the programmer to stop execution of the object program at some points of interest and to examine the contents of various processor registers and memory locations. • the programmer can compare computed values with the expected results at any point of • execution to determine where a programming error may exist.
  • 21.
    Debugger • Trace Mode: •When a processor is operating in the trace mode, an interrupt occurs after the execution of every instruction. • When the user enters a command to resume execution of the object program, a return from- interrupt instruction is executed. • The next instruction in the program being debugged is executed, then the debugger is activated again with another interrupt. • The trace-mode interrupt is automatically disabled when the debugger routine is entered, and re-enabled upon return to the object program.
  • 22.
    Debugger • Breakpoints: • Breakpointsprovide a similar interrupt-based debugging facility, except that the object program being debugged is interrupted only at specific points indicated by the programmer. • The programmer may set a breakpoint to determine whether a particular subroutine in the object program is ever reached. • The advantage of using a breakpoint is that execution proceeds at full speed until the breakpoint is encountered. • A special instruction called Trap or Software-interrupt is usually used to implement breakpoints.