1 of 89

DIGITAL LOGIC AND COMPUTER�ORGANIZATION (24AM202)

Dr. G. Polaiah

Assistant Professor

Department of ECE

2 of 89

2

Text Book: Morris Mano, “Computer Systems Architecture”, 3rd edition

3 of 89

Introduction to Computer Organization and Architecture�(Part-1)

3

4 of 89

  • Computer Organization and architecture:
  • Computer architecture defines how a computer’s components communicate through electronic signals to perform input, processing, and output operations.
  • It covers the design and organization of the CPU, memory, storage, and input/output devices.
  • Describes how these components interact through buses, control signals, and data pathways.
  • It directly influences the overall speed, functionality, and reliability of a computer system.

4

  • Computer Architecture:

5 of 89

5

6 of 89

6

7 of 89

7

  • Computer Organization:
  • Computer organization is the study of the functional behavior of a computer system and its components, specifically focusing on the hardware design and interconnection of parts like the CPU, memory, and input/output devices to execute programs.

  • It encompasses how these physical components are interconnected and organized to perform tasks, contrasting with computer architecture.

8 of 89

Key Aspects of Computer Organization

Physical Components:

It deals with the actual hardware, such as the Central Processing Unit (CPU), memory units, arithmetic and logic units (ALU), and input/output (I/O) devices.

Interconnections and Data Paths:

Computer organization examines the different ways these components are connected and how data moves between them.

Control Unit:

It includes the organization of the control unit, which directs the operations of the system

9 of 89

9

10 of 89

Example of Functional Units in a Computer

Input Unit: Accepts data and instructions from the user.

Memory Unit: Stores data and instructions needed for processing.

Arithmetic Logic Unit (ALU): Performs all the calculations and logical operations.

Output Unit: Displays the processed data to the user.

Control Unit (CU): Directs the operations of the system by sending control signals to other components

11 of 89

  • Register Transfer Language (RTL)
  • Register Transfer Language (RTL) is a symbolic notation used to describe the micro operation transfers among registers is called a register transfer language.

  • It represents data transfers between registers and the micro-operations (like arithmetic, logic, and shift) performed on that data.

  • The operations executed on data which is stored in registers are called “micro operations”.

11

Text Book: Morris Mano, “Computer Systems Architecture”, 3rd edition

(Page No. 93)

12 of 89

  • Examples of micro operations are shift, count, clear, and load.

  • A bidirectional shift register is capable of performing the shift right and shift left micro operations .

  • The term "register transfer" implies the availability of hardware logic circuits that can perform a stated micro operation and transfer the result of the operation to the same or another register.

  • The word "language" is borrowed from programmers, who apply this term to programming languages.

12

13 of 89

  • RTL is a convenient tool for describing the internal organization of digital computers in concise and precise manner. It can also be used to facilitate the design process of digital systems

13

14 of 89

Problem: A digital computer has a common bus system for 16 registers of 32 bits each. The bus is constructed with multiplexers.

  1. How many selection inputs are there in each multiplexer?
  2. What size of multiplexers are needed?
  3. How many multiplexers are there in the bus?

Answer:

(a) 4 selection lines to select one of 16 registers.

(b) 16 × 1 multiplexers.

(c) 32 multiplexers, one for each bit of the registers.

14

15 of 89

Key Components and Operations

  • Registers: These are the fundamental storage elements in digital systems that RTL describes.
  • Micro-operations: These are the low-level operations performed on the data stored in registers, such as

Arithmetic operations (addition, subtraction)

Logical operations (AND, OR, NOT)

Shift operations

Counting and clearing

  • Register Transfer: The process of moving information from one register to another, often using a replacement operator (e.g., R2 ← R1).

15

16 of 89

Example

  • A statement like R2 ← R1 in RTL signifies that the contents of register R1 are transferred to register R2. If this transfer needs to happen only under a specific condition, a control function can be added, such as Control Signal: R2 ← R1.

16

17 of 89

  • Register Transfer
  • Computer registers are designated by capital letters (sometimes followed by numerical) to denote the function of the register.

For example:

Memory Address Register (MAR)

Program Counter (PC)

Instruction Register (IR)

Processor Register (R1)

17

Text Book: Morris Mano, “Computer Systems Architecture”, 3rd edition

(Page No. 95)

18 of 89

  • The individual flip-flops in an n-bit register are numbered in sequence from 0 through n-1, starting from 0 in the rightmost position and increasing the numbers toward the left.

18

19 of 89

19

20 of 89

  • Control function

  • A control function is a Boolean variable that is equal to 1 or 0. The control function is included in the statement as follows:

20

21 of 89

21

22 of 89

22

23 of 89

  • Bus and Memory Transfers
  • A typical digital computer has many registers, and paths must be provided to transfer information from one register to another.
  • A more efficient scheme for transferring information between registers in a multiple-register configuration is a common bus system.
  • A bus structure consists of a set of common lines, one for each bit of a register, through which binary information is transferred one at a time.
  • Control signals determine which register is selected by the bus during each particular register transfer.

23

24 of 89

24

25 of 89

25

26 of 89

Three-State Bus Buffers

  • A bus system can be constructed with three-state gates instead of multiplexers.

  • A three-state gate is a digital circuit that exhibits three states.

  • Two of the states are signals equivalent to logic 1 and 0 as in a conventional gate. The third state is a high-impedance state.

  • The high-impedance state behaves like an open circuit, which means that the output is disconnected and does not have a logic significance.

  • Three-state gates may perform any conventional logic, such as AND or NAND.

26

27 of 89

27

28 of 89

28

29 of 89

29

30 of 89

Memory Transfer

  • A memory transfer is a data transfer initiated by the CPU to read information from or write new information into a specific memory location.

  • This process involves coordinating the address, data, and control buses.

30

31 of 89

Key registers

  • Memory Address Register (MAR): Holds the address of the memory location being accessed.

  • Memory Data Register (MDR): Also known as the Memory Buffer Register (MBR), it temporarily stores the data being transferred to or from memory.

31

32 of 89

Memory transfer operations

Read operation:

  • Transfers data from a memory location to a data register.

  • The CPU places the address of the desired memory word in the MAR.

  • It sends a "read" control signal on the control bus.

  • The data from that memory address is placed onto the data bus and transferred into the MDR.

Symbolic representation: MDR ← M[MAR].

32

33 of 89

Write operation:

  • Transfers data from a register to a memory location.

  • The CPU places the memory address into the MAR and the data to be written into the MDR.

  • It sends a "write" control signal on the control bus.

  • The data from the MDR is transferred over the data bus to the specified memory location.

Symbolic representation: M[MAR] ← MDR.

33

34 of 89

How bus and memory transfer work together

The CPU uses the bus to perform memory operations by following a sequence of steps:

  • Instruction execution: The CPU decodes an instruction that requires memory access (e.g., LOAD or STORE).
  • Address placement: The CPU places the memory address onto the address bus via the MAR.
  • Control signal: The CPU asserts the appropriate signal (e.g., READ or WRITE) on the control bus.
  • Data transfer: The data is transferred along the data bus between the memory (via the MDR) and a CPU register.
  • Synchronization: The control bus provides timing signals to ensure that all components act in sync to prevent data corruption.

34

35 of 89

35

36 of 89

36

37 of 89

Micro operations�(Part-2)

37

38 of 89

  • Arithmetic micro operations

(a) 4-bit binary adder

  • “The digital circuit that generates the arithmetic sum of two binary numbers of any length is called a binary adder.”

  • To implement the add micro operation with hardware, we need the registers that hold the data and the digital component that performs the arithmetic addition.

  • The digital circuit that forms the arithmetic sum of two bits and a previous carry is called a full-adder.

  • The binary adder is constructed with full-adder circuits connected in cascade, with the output carry from one full-adder connected to the input carry of the next full-adder.

38

39 of 89

39

40 of 89

40

  • The augend bits of A and the addend bits of B are designated by subscript numbers from right to left, with subscript 0 denoting the low-order bit.

41 of 89

  • The augend bits of A and the addend bits of B are designated by subscript numbers from right to left, with subscript 0 denoting the low-order bit.

  • An n-bit binary adder requires n full-adders.

  • The output carry from each full-adder is connected to the input carry of the next-high-order full-adder.

  • Then data bits for the A inputs come from one register (such as R1), and the n data bits for the B inputs come from another register (such as R2).

  • The sum can be transferred to a third register or to one of the source registers (R 1 or R2),replacing its previous content.

41

42 of 89

(b) Binary lncrementer

  • The increment micro operation adds one to a number in a register.

  • For example, if a 4-bit register has a binary value 0110, it will go to 0111 after it is incremented.

  • One of the inputs to the least significant half-adder (HA) is connected to logic-1 and the other input is connected to the least significant bit of the number to be incremented.

  • The output carry from one half-adder is connected to one of the inputs of the next-higher order half-adder.

42

43 of 89

  • The circuit receives the four bits from A0 through A3 adds one to it, and generates the incremented output in S0 through S3.
  • The output carry C4 will be 1 only after incrementing binary 1111.

43

44 of 89

  • Logic micro operations
  • Logic micro operations specify binary operations for strings of bits stored in registers.

  • A bit string is a finite, ordered sequence of 0s and 1s.

Examples: 10110, 000, 1, and 101010 are all bit strings.

  • These operations consider each bit of the register separately and treat them as binary variables.

44

45 of 89

  • For example, the exclusive-OR micro operation with the contents of two registers R 1 and R2 is symbolized by the statement.

  • It specifies a logic micro operation to be executed on the individual bits of the registers provided that the control variable P = 1.

45

46 of 89

46

47 of 89

  • Shift Micro operations
  • Shift micro operations are used for serial transfer of data.

  • They are also used in conjunction with arithmetic, logic, and other data-processing operations.

  • The contents of a register can be shifted to the left or the right. At the same time that the bits are shifted, the first flip-flop receives its binary information from the serial input.

47

48 of 89

  • During a shift-left operation the serial input transfers a bit into the rightmost position.

  • During a shift-right operation the serial input transfers a bit into the leftmost position.

  • The information transferred through the serial input determines the type of shift.

  • There are three types of shifts: logical, circular, and arithmetic.

48

49 of 89

49

  1. Logical shift

50 of 89

  • The circular shift (also known as a rotate operation) circulates the bits of the register around the two ends without loss of information.
  • This is accomplished by connecting the serial output of the shift register to its serial input.

50

2. Circular shift

51 of 89

  • An arithmetic shift is a micro operation that shifts a signed binary number to the left or right.

  • most significant bit (MSB) acts as a sign bit (0 for positive, 1 for negative).

  • A right arithmetic shift of a binary number by 1. The empty position in the most significant bit is filled with a copy of the original MSB..

  • A left arithmetic shift of a binary number by 1. The empty position in the least significant bit is filled with a zero.

51

3. Arithmetic shift

52 of 89

52

(i) arithmetic shift right

(ii) arithmetic shift left

53 of 89

53

Difference between arithmetic shift and logical shift

54 of 89

  • Arithmetic Logic Shift Unit
  • “Instead of having individual registers performing the micro operations directly, computer systems consists of a number of storage registers connected to a common operational unit called an arithmetic logic unit (ALU).”

  • To perform a micro operation, the contents of specified registers are placed in the inputs of the common ALU.

  • The ALU performs an operation and the result of the operation is then transferred to a destination register.

54

55 of 89

  • The ALU is a combinational circuit so that the entire register transfer operation from the source registers into the destination register through the ALU can be performed during one clock pulse period.

55

One Stage of Arithmetic Logic Shift Unit

56 of 89

  • With inputs S1 and S0, a specific micro operation is chosen.

  • At the output, a 4 x 1 multiplexer selects between an arithmetic output and a logic output. Inputs S3 and S2 select the data in the multiplexer.

  • The multiplexer's other two data inputs receive inputs Ai-1 for the shift-right operation(shr) and Ai + 1 for the shift-left operation (shl).

56

57 of 89

57

58 of 89

Basic Computer Organization and Design�(Part-3)

58

59 of 89

# Syllabus topics

  • Instruction Codes
  • Computer Registers
  • Computer Instructions
  • Instruction Cycle
  • Memory Reference Instructions
  • Register Reference Instructions
  • Input-Output and Interrupt

59

60 of 89

  • Instruction Codes
  •  

60

61 of 89

Example:

Consider a computer with 64 distinct operations, one of them being an ADD operation. The operation code consists of six bits, with a bit configuration 110010 assigned to the ADD operation. When this operation code is decoded in the control unit, the computer issues control signals to read an operand from memory and add the operand to a processor register.

  • Operand means data on which an operation is to be done.

61

62 of 89

62

63 of 89

  • Computer Registers
  • Computer instructions are normally stored in consecutive memory locations and are executed sequentially one at a time.
  • The control reads an instruction from a specific address in memory and executes it.
  • It then continues by reading the next instruction in sequence and executes it, and so on.
  • This type of instruction sequencing needs a counter to calculate the address of the next instruction after execution of the current instruction is completed.
  • It is also necessary to provide a register in the control unit for storing the instruction code after it is read from memory.

63

64 of 89

64

65 of 89

  • The memory unit has a capacity of 4096 words and each word contains 16 bits.
  • Twelve bits of an instruction word are needed to specify the address of an operand. This leaves three bits for the operation part of the instruction and one bit to specify a direct or indirect address.
  • The data register (DR) holds the operand read from memory. The accumulator (AC) register is a general-purpose processing register. The instruction read from memory is placed in the instruction register (IR). The temporary register (TR) is used for holding temporary data during the processing.

65

66 of 89

66

67 of 89

  • Computer Instructions
  • The basic computer has three instruction code formats, as shown in below Figure. Each format has 16 bits.

67

68 of 89

68

69 of 89

  •  

69

70 of 89

  1. Register - reference instruction
  2. The register-reference instructions are recognized by the operation code 111 with a 0 in the leftmost bit (bit 15) of the instruction.
  3. A register-reference instruction specifies an operation on or a test of the accumulator (AC) register.
  4. An operand from memory is not needed; therefore, the other 12 bits are used to specify the operation or test to be executed.

70

71 of 89

c) Input - output instruction

  • Similarly, an input-output instruction does not need a reference to memory and is recognized by the operation code 111 with a 1 in the leftmost bit of the instruction.
  • The remaining 12 bits are used to specify the type of input-output operation or test performed.

71

72 of 89

72

73 of 89

  • Instruction Cycle
  • A program residing in the memory unit of the computer consists of a sequence of instructions.

  • The program is executed in the computer by going through a cycle for each instruction.

  • Each instruction cycle in turn is subdivided into a sequence of sub cycles or phases.

73

74 of 89

In the basic computer each instruction cycle consists of the following phases:

1. Fetch an instruction from memory.

2. Decode the instruction.

3. Read the effective address from memory if the instruction has an

indirect address.

4. Execute the instruction.

Upon the completion of step 4, the control goes back to step 1 to fetch, decode, and execute the next instruction. This process continues indefinitely unless a HALT instruction is encountered.

74

75 of 89

  • Memory-Reference Instructions
  •  

75

76 of 89

76

77 of 89

  1. AND to AC
  2. This is an instruction that performs the AND logic operation on pairs of bits in AC and the memory word specified by the effective address. The result of the operation is transferred to AC. The micro operations that execute this instruction are:

77

78 of 89

  •  

78

79 of 89

3) LDA: Load to AC

  • This instruction transfers the memory word specified by the effective address to AC. The micro operations needed to execute this instruction are

79

80 of 89

4) STA: Store AC

  • This instruction stores the content of AC into the memory word specified by the effective address. Since the output of AC is applied to the bus and the data input of memory is connected to the bus, we can execute this instruction with one micro operation:

80

81 of 89

  • Register-Reference Instructions
  •  

81

82 of 89

82

83 of 89

  • Input-Output and Interrupt
  • A computer can serve no useful purpose unless it communicates with the external environment.
  • Instructions and data stored in memory must come from some input device.
  • Computational results must be transmitted to the user through some output device.
  • Commercial computers include many types of input and output devices.

83

84 of 89

  • Input-Output Configuration
  • The terminal sends and receives serial information. Each quantity of information has eight bits of an alphanumeric code.
  • The serial information from the keyboard is shifted into the input register INPR.
  • The serial information for the printer is stored in the output register OUTR.
  • These two registers communicate with a communication interface serially and with the AC in parallel.
  • The transmitter interface receives serial information from the keyboard and transmits it to INPR.
  • The receiver interface receives information from OUTR and sends it to the printer serially.

84

85 of 89

85

86 of 89

  •  

86

87 of 89

87

88 of 89

  • However, when a flag is set, the computer is momentarily interrupted from proceeding with the current program.
  • The computer deviates momentarily from what it is doing and completes the task of the input or output transfer.
  • It then returns to the current program to continue what it was doing before the interrupt.

**********

88

89 of 89

  • Program Interrupt
  • The external device inform the computer when it is ready for the transfer.
  • In the meantime the computer can be busy with other tasks.

(This type of transfer uses the interrupt facility.)

  • While the computer is running a program, it does not check the flags.

Note: A flag is a single binary digit (0 or 1) used to signal for a specific status or condition in a computer's processor.

89