Professional Documents
Culture Documents
Controlled Processing Unit
Controlled Processing Unit
**1. Introduction**
- The CPU (Central Processing Unit) is the core component of a computer responsible for
data-processing operations.
- It consists of three major parts:
1. **Register Set:** Stores intermediate data used during instruction execution.
2. **Arithmetic Logic Unit (ALU):** Performs microoperations required for executing
instructions.
3. **Control Unit:** Supervises information transfer among registers and instructs the
ALU on operations to perform.
These notes provide an overview of the content covered in Chapter 8, focusing on the CPU,
its components, functions, architectures, and their relevance to both designers and
programmers.
Here are detailed notes based on the provided text from Section 8-2 about General Register
Organization:
2. **Register Communication**
- When a CPU includes a large number of registers, it's efficient to connect them through a
common bus system.
- Registers communicate with each other not only for direct data transfers but also while
performing various microoperations.
3. **Bus Organization**
- A typical bus organization for seven CPU registers is depicted in Figure 8-2.
- Each register's output is connected to two multiplexers (MUX) to form two buses,
referred to as A and B.
- The multiplexers are controlled by selection lines that choose between the register's
content or input data for the specific bus.
- The A and B buses serve as inputs to a common Arithmetic Logic Unit (ALU).
4. **ALU Operation**
- The operation selected in the ALU determines the arithmetic or logic microoperation to
be performed.
- The result of the microoperation is available as output data and also feeds into the inputs
of all the registers.
5. **Register Selection**
- To determine which register receives information from the output bus, a decoder is
employed.
- The decoder activates one of the register load inputs, establishing a transfer path
between the output bus's data and the selected destination register.
6. **Control Unit**
- The CPU's control unit manages the flow of information through the registers and ALU by
selecting various components in the system.
- For example, to perform an operation like `R1 ← R2 * R3`, the control unit must provide
binary selection variables to:
- MUX A selector (SELA): To place the content of R2 into bus A.
- MUX B selector (SELB): To place the content of R3 into bus B.
- ALU operation selector (OPR): To specify the arithmetic operation (multiplication in this
case).
- Decoder destination selector (SELD): To transfer the content of the output bus into R1.
These notes provide an in-depth understanding of the general register organization within a
CPU and how data is managed and processed within the CPU's architecture.
Certainly, here are detailed notes based on the provided text regarding control words and
examples of microoperations:
4. **Examples of Microoperations**
- Microoperations can be defined using control words.
- For example, to perform `R1 ← R2 - R3`, the control word is constructed as follows:
- SELA: R2, SELB: R3, SELD: R1, OPR: SUB
- Control Word: 010 011 001 00101
6. **Clearing a Register**
- A register can be cleared to 0 using an exclusive-OR operation because x XOR x equals 0.
These notes provide a detailed understanding of control words and how they are used to
specify microoperations in a CPU, along with examples of microoperations and efficient
control word generation techniques using control memory.
Certainly, here are detailed notes based on the provided text regarding stack organization in
CPUs:
1. **Introduction to Stack**
- A stack, in the context of computer CPUs, is a storage device that follows the Last-In,
First-Out (LIFO) principle.
- It stores information in such a way that the last item added is the first one to be
retrieved.
- This concept can be likened to a stack of trays where the last tray placed on top is the
first to be removed.
2. **Stack Pointer (SP)**
- A stack in digital computers is essentially a memory unit with an associated stack pointer
(SP).
- The stack pointer is a register that points to the top item in the stack.
- Unlike physical trays in a real-world stack, the registers in a CPU stack are always
available for reading or writing, and it's the content of the words that are inserted or
deleted.
3. **Stack Operations**
- The two primary operations on a stack are:
- **Push**: To insert an item on top of the stack.
- **Pop**: To remove the top item from the stack.
- These operations are simulated by incrementing or decrementing the stack pointer
register.
4. **Register Stack**
- A stack can be organized as a collection of memory words or registers.
- In a register stack, the stack pointer (SP) holds the address of the top item in the stack.
- For example, if item C is on top of the stack, SP contains the address 3.
- Popping an item involves reading the word at the current SP address and decrementing
SP.
- Pushing an item involves incrementing SP and writing a word to the new SP address.
6. **Memory Stack**
- A stack can also be implemented in a portion of computer memory.
- In this case, a CPU register (e.g., SP) points to the top of the stack within the memory
segment.
- Push and pop operations involve memory reads and writes using the stack pointer and a
data register (DR).
- Most computers lack hardware checks for stack overflow or underflow, so these limits
can be checked manually using registers.
1. **Introduction to RPN**
- Reverse Polish Notation (RPN) is a mathematical notation that places the operator after
the operands.
- It is also known as postfix notation and is particularly useful for evaluating arithmetic
expressions using stack-based processing.
3. **Advantages of RPN**
- RPN simplifies the evaluation of expressions because it doesn't require scanning back and
forth.
- It naturally lends itself to stack manipulation, making it efficient for computers to
compute complex expressions.
7. **Conversion to RPN**
- The conversion of an infix expression to RPN takes into account the order of operations
(operator precedence) to ensure correct evaluation.
- Parentheses are not needed in RPN because the order of operations is explicit in the
notation.
- For example, (3 * 4) + (5 * 6) in RPN would be converted to 34 * 56 * +.
4. **Address Field**
- The address field specifies either memory addresses or processor registers for data
manipulation.
- Register addresses are binary numbers defining one of the CPU's registers, typically with
k bits, allowing 2^k registers.
- For example, a CPU with 16 registers might use four bits for register addresses.
**Three-Address Instructions:**
- Three-address instruction formats allow each address field to specify either a processor
register or a memory operand.
- Example program in assembly language to evaluate `X * (A * B) * (C * D)`:
```
- The computer in this example has two processor registers, R1 and R2.
- Three-address formats result in concise programs for arithmetic expressions but may
require more bits for encoding instructions.
- Cyber 170 is an example of a computer that uses three-address instructions.
**Two-Address Instructions:**
- Two-address instructions are the most common in commercial computers.
- Each address field can specify either a processor register or a memory word.
- Example program for `X * (A * B) * (C * D)`:
```
- The `MOV` instruction transfers data between memory and processor registers.
- The first symbol in each instruction serves as both the source and destination.
**One-Address Instructions:**
- One-address instructions use an implied accumulator (AC) register for data manipulation.
- In this example, we neglect the need for a second register and assume the AC contains the
result.
- Example program for `X * (A * B) * (C * D)`:
- All operations are performed between the AC register and memory operands.
- A temporary memory location (T) is used to store intermediate results.
**Zero-Address Instructions:**
- Stack-organized computers do not use an address field for ADD and MUL instructions.
- PUSH and POP instructions need an address field to specify stack operands.
- Example program for `X * (A * B) * (C * D)` in a stack-organized computer:
- Expressions in stack computers are often evaluated using reverse Polish notation.
- Zero-address computers derive their name from the absence of an address field in
computational instructions.
**Implied Mode**:
- In implied mode, the operands are specified implicitly in the definition of the instruction.
- For example, the instruction "complement accumulator" is an implied-mode instruction
because the operand (the accumulator) is implied in the instruction's definition.
- Many register reference instructions using an accumulator are implied-mode instructions.
**Immediate Mode**:
- In immediate mode, the operand is specified directly within the instruction itself.
- The instruction includes an operand field containing the actual value to be used with the
operation defined in the instruction.
- Immediate-mode instructions are useful for initializing registers with constant values.
**Register Mode**:
- In register mode, the operands are stored in registers within the CPU.
- The specific register to be used is selected from a register field in the instruction.
- A k-bit field can specify any one of 2^k registers.
These addressing modes provide flexibility in how operands are accessed in instructions and
are essential for various computational and control tasks in computer systems.
NUMERICAL EXAMPLE: DONE