Download presentation
Presentation is loading. Please wait.
1
Computer System Architecture Shoaib.03339770257@outlook.com
2
In computer engineering, computer architecture is a set of rules and methods that describe the functionality, organization, and implementation of computer systems. Computer Architecture Definition: Computer architecture, like other architecture, is the art of determining the needs of the user of a structure and then designing to meet those needs as effectively as possible within economic and technological constraints.
4
Architecture
5
A decision to reverse an earlier decision An electronic circuit that can assume either of two stable states Flip-Flop In electronics, a flip-flop or latch is a circuit that has two stable states and can be used to store state information. A flip-flop is a bistable multivibrator. The circuit can be made to change state by signals applied to one or more control inputs and will have one or two outputs. It is the basic storage element in sequential logic. Flip-flops and latches are fundamental building blocks of digital electronics systems used in computers, communications, and many other types of systems.electronicscircuitbistable multivibratorsignalssequential logicdigital electronics Flip-flops and latches are used as data storage elements. A flip-flop stores a single bit (binary digit) of data; one of its two states represents a "one" and the other represents a "zero". Such data storage can be used for storage of state, and such a circuit is described as sequential logic. When used in a finite-state machine, the output and next state depend not only on its current input, but also on its current state (and hence, previous inputs). It can also be used for counting of pulses, and for synchronizing variably-timed input signals to some reference timing signal.bitstatesequential logicfinite-state machine Flip-flops can be either simple (transparent or opaque) or clocked (synchronous or edge-triggered). Although the term flip-flop has historically referred generically to both simple and clocked circuits, in modern usage it is common to reserve the term flip-flop exclusively for discussing clocked circuits; the simple ones are commonly called latches. [clockedsynchronous [
6
Flip flops are also known as bi-stable multi-vibrators. They are able to store one bit of data. Flip flops are able to be in two stable states namely one and zero. They can be in either states and in order to change their states they have to be driven by a trigger. Certain flip flops are edge triggered meaning they only respond to voltage changes from one level to another. They can be either positive edged triggering or negative edged triggering. Flip flops turn on in a random manner that is they can be in either of the states when they are turned on. In order to have a uniform state when they are powered on a CLEAR signal has to be sent to the flip flops. They can also be made to turn on in a particular state by applying PRESET. Explain briefly about Flip-flops.
7
Explain the requirement of page-table and the different ways in which the table can be organized. - For any computer generally the memory space is lesser as compared to the address space this implies that the main memory is lesser as compared to the secondary memory. - On the basis of the demands of the CPU data is transferred between the two memories. - Due to this a mapping technique is required which can be implemented using page-table. - The page table can be organized in two ways namely in the R/W memory and by using associative logic. - In case of R/W memory the speed of execution of programs is slow as it requires two main memory references to read data. It is also known as memory page table. - In case of associative logic it is considered to be more effective because it can be built with simply keeping mind to have equal no. of blocks in the memory as many as there are words.
8
Registers A processor register (CPU register) is one of a small set of data holding places that are part of the computer processor. A register may hold an instruction, a storage address, or any kind of data (such as a bit sequence or individual characters). Some instructions specify registers as part of the instruction. Register is a very fast computer memory, used to store data/instruction in-execution. A Register is a group of flip-flops with each flip-flop capable of storing one bit of information. An n-bit register has a group of n flip-flops and is capable of storing binary information of n-bits. A register consists of a group of flip-flops and gates. The flip-flops hold the binary information and gates control when and how new information is transferred into a register. Various types of registers are available commercially. The simplest register is one that consists of only flip-flops with no external gates. These days registers are also implemented as a register file. Register Load The transfer of new information into a register is referred to as loading the register. If all the bits of register are loaded simultaneously with a common clock pulse than the loading is said to be done in parallel. The basic purpose of a computer is to perform operations, and operations need operands. Operands are the data on which we want to perform a certain operation. Consider the addition operation; it involves adding two numbers to get their sum. We can have precisely one address on the address bus and consequently precisely one element on the data bus. At the very same instant the second operand cannot be brought inside the processor. As soon as the second is selected, the first operand is no longer there. For this reason there are temporary storage places inside the processor called registers.
9
are used to quickly accept, store, and transfer data and instructions that are being used immediately by the CPU, there are various types of Registers those are used for various purpose. Among of the some Mostly used Registers named as AC or Accumulator, Data Register or DR, the AR or Address Register, program counter (PC), Memory Data Register (MDR), Index register, Memory Buffer Register. These Registers are used for performing the various Operations. While we are working on the System then these Registers are used by the CPU for Performing the Operations. When We Gives Some Input to the System then the Input will be Stored into the Registers and When the System will gives us the Results after Processing then the Result will also be from the Registers. So that they are used by the CPU for Processing the Data which is given by the User. Registers Perform:- 1) Fetch: The Fetch Operation is used for taking the instructions those are given by the user and the Instructions those are stored into the Main Memory will be fetch by using Registers. 2) Decode: The Decode Operation is used for interpreting the Instructions means the Instructions are decoded means the CPU will find out which Operation is to be performed on the Instructions. 3) Execute: The Execute Operation is performed by the CPU. And Results those are produced by the CPU are then Stored into the Memory and after that they are displayed on the user Screen. REGISTER
10
Some types of special purpose registers are given below: Memory Address Register (MAR): It stores address of data or instructions to be fetched from memory. Memory Buffer Register (MBR): It stores instruction and data received from the memory and sent from the memory. Instruction Register (IR): Instructions are stored in instruction register. When one instruction is completed, next instruction is fetched in memory for processing. Program Counter (PC): It counts instructions. The instruction cycle is completed into two phases: (a) Fetch Cycle and (b) Execute Cycle. There are two parts in instruction- opcode and operand. In fetch cycle opcode of instruction is fetched into CPU. The opcode, at first, is reached to Data Register (DR), then to Instruction Register (IR). Decoder accesses the opcode and it decodes opcode and type of operation is declared to CPU and execution cycle is started. Types of Registers (a) Accumulator: It is most frequently used register used to store data taken from memory. Its number varies from microprocessor to microprocessor. (b)General Purpose registers: General purpose registers are used to store data and intermediate results during program execution. Its contents can be accessed through assembly programming. (c) Special purpose Registers: Users do not access these registers. These are used by computer system at the time of program execution.
11
Types of Registers are as Followings MAR stand for Memory Address Register This register holds the memory addresses of data and instructions. This register is used to access data and instructions from memory during the execution phase of an instruction. Suppose CPU wants to store some data in the memory or to read the data from the memory. It places the address of the-required memory location in the MAR.memory Program Counter Register The program counter (PC), commonly called the instruction pointer (IP) in Intel x86 microprocessors, and sometimes called the instruction address register, or just part of the instruction sequencer in some computers, is a processor register It is a 16 bit special function register in the 8085 microprocessor. It keeps track of the the next memory address of the instruction that is to be executed once the execution of the current instruction is completed. In other words, it holds the address of the memory location of the next instruction when the current instruction is executed by the microprocessor.microprocessor
12
Accumulator Register This Register is used for storing the Results those are produced by the System. When the CPU will generate Some Results after the Processing then all the Results will be Stored into the AC Register. Memory Data Register (MDR) MDR is the register of a computer's control unit that contains the data to be stored in the computer storage (e.g. RAM), or the data after a fetch from the computer storage. It acts like a buffer and holds anything that is copied from the memory ready for the processor to use it. MDR hold the information before it goes to the decoder. computercontrol unitRAMinformation MDR which contains the data to be written into or readout of the addressed location. For example, to retrieve the contents of cell 123, we would load the value 123 (in binary, of course) into the MAR and perform a fetch operation. When the operation is done, a copy of the contents of cell 123 would be in the MDR. To store the value 98 into cell 4, we load a 4 into the MAR and a 98 into the MDR and perform a store. When the operation is completed the contents of cell 4 will have been set to 98, by discarding whatever was there previously. The MDR is a two-way register. When data is fetched from memory and placed into the MDR, it is written to in one direction. When there is a write instruction, the data to be written is placed into the MDR from another CPU register, which then puts the data into memory. The Memory Data Register is half of a minimal interface between a micro program and computer storage, the other half is a memory address register.
13
A hardware element which holds a number that can be added to (or, in some cases, subtracted from) the address portion of a computer instruction to form an effective address. Also known as base register. An index register in a computer's CPU is a processor register used for modifying operand addresses during the run of a program. Index Register Memory Buffer Register MBR stand for Memory Buffer Register. This register holds the contents of data or instruction read from, or written in memory. It means that this register is used to store data/instruction coming from the memory or going to the memory. Data Register A register used in microcomputers to temporarily store data being transmitted to or from a peripheral device.
14
Register Transfer Language The symbolic notation used to describe the micro-operation transfers amongst registers is called Register transfer language. The term "register transfer" means 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. This programming language is a procedure for writing symbols to specify a given computational process. Following are some commonly used registers: 1.Accumulator: This is the most common register, used to store data taken out from the memory. 2.General Purpose Registers: This is used to store data intermediate results during program execution. It can be accessed via assembly programming. 3.Special Purpose Registers: Users do not access these registers. These registers are for Computer system, MAR: Memory Address Register are those registers that holds the address for memory unit. MBR: Memory Buffer Register stores instruction and data received from the memory and sent from the memory. PC: Program Counter points to the next instruction to be executed. IR: Instruction Register holds the instruction to be executed.
15
Register Transfer Information transferred from one register to another is designated in symbolic form by means of replacement operator. R2 ← R1 It denotes the transfer of the data from register R1 into R2. Normally we want the transfer to occur only in predetermined control condition. This can be shown by following if- then statement: if (P=1) then (R2 ← R1) Here P is a control signal generated in the control section. Control Function A control function is a Boolean variable that is equal to 1 or 0. The control function is shown as: P: R2 ← R1 The control condition is terminated with a colon. It shows that transfer operation can be executed only if P=1.
16
Micro-Operations The operations executed on data stored in registers are called micro-operations. A micro-operation is an elementary operation performed on the information stored in one or more registers. Example: Shift, count, clear and load. Types of Micro-Operations The micro-operations in digital computers are of 4 types: 1.Register transfer micro-operations transfer binary information from one register to another. 2.Arithmetic micro-operations perform arithmetic operations on numeric data stored in registers. 3.Logic micro-operations perform bit manipulation operation on non-numeric data stored in registers. 4.Shift micro-operations perform shift micro-operations performed on data.
17
Arithmetic Micro-Operations Some of the basic micro-operations are addition, subtraction, increment and decrement. a) Add Micro-Operation It is defined by the following statement: R3 → R1 + R2 The above statement instructs the data or contents of register R1 to be added to data or content of register R2 and the sum should be transferred to register R3. b) Subtract Micro-Operation Let us again take an example: R3 → R1 + R2' + 1 In subtract micro-operation, instead of using minus operator we take 1's compliment and add 1 to the register which gets subtracted, i.e R1 - R2 is equivalent to R3 → R1 + R2' + 1
18
c) Increment/Decrement Micro-Operation Increment and decrement micro-operations are generally performed by adding and subtracting 1 to and from the register respectively. R1 → R1 + 1 R1 → R1 – 1 Symbolic DesignationDescription R3 ← R1 + R2Contents of R1+R2 transferred to R3. R3 ← R1 - R2Contents of R1-R2 transferred to R3. R2 ← (R2)'Compliment the contents of R2. R2 ← (R2)' + 12's compliment the contents of R2. R3 ← R1 + (R2)' + 1 R1 + the 2's compliment of R2 (subtraction). R1 ← R1 + 1Increment the contents of R1 by 1. R1 ← R1 - 1Decrement the contents of R1 by 1.
19
Logic Micro-Operations These are binary micro-operations performed on the bits stored in the registers. These operations consider each bit separately and treat them as binary variables. Let us consider the X-OR micro-operation with the contents of two registers R1 and R2. P: R1 ← R1 X-OR R2 In the above statement we have also included a Control Function. Assume that each register has 3 bits. Let the content of R1 be 010 and R2 be 100. The X-OR micro-operation will be:
20
Shift Micro-Operations These are used for serial transfer of data. That means we can shift the contents of the register to the left or right. In the shift left operation the serial input transfers a bit to the right most position and in shift right operation the serial input transfers a bit to the left most position. There are three types of shifts as follows: a) Logical Shift It transfers 0 through the serial input. The symbol "shl" is used for logical shift left and "shr" is used for logical shift right. R1 ← she R1 The register symbol must be same on both sides of arrows. b) Circular Shift This circulates or rotates the bits of register around the two ends without any loss of data or contents. In this, the serial output of the shift register is connected to its serial input. "cil" and "cir" is used for circular shift left and right respectively.
21
c) Arithmetic Shift This shifts a signed binary number to left or right. An arithmetic shift left multiplies a signed binary number by 2 and shift left divides the number by 2. Arithmetic shift micro- operation leaves the sign bit unchanged because the signed number remains same when it is multiplied or divided by 2.
22
Types of Buses in Computer Architecture: Inside computers, there are many internal components. In order for these components to communicate with each other they make use of wires that are known as a ‘bus’. Bus Definition : A bus is a common pathway through which information flows from one computer component to another. This pathway is used for communication purpose and it is established between two or more computer components. We are going to check different computer bus architectures that are found in computers. Different Types of Computer Buses
23
Functions of Buses in Computers Summary of functions of buses in computers 1. Data sharing - All types of buses found in a computer transfer data between the computer peripherals connected to it. The buses transfer or send data in either serial or parallel method of data transfer. This allows for the exchange of 1, 2, 4 or even 8 bytes of data at a time. (A byte is a group of 8 bits). Buses are classified depending on how many bits they can move at the same time, which means that we have 8-bit, 16-bit, 32-bit or even 64-bit buses. 2. Addressing - A bus has address lines, which match those of the processor. This allows data to be sent to or from specific memory locations. 3. Power - A bus supplies power to various peripherals connected to it. 4. Timing - The bus provides a system clock signal to synchronize the peripherals attached to it with the rest of the system. The expansion bus facilitates easy connection of more or additional components and devices on a computer such as a TV card or sound card.
24
Bus Terminologies Computers have two major types of buses: 1. System bus:- This is the bus that connects the CPU to main memory on the motherboard. The system bus is also called the front-side bus, memory bus, local bus, or host bus. 2. A number of I/O Buses, (I/O is an acronym for input / output), connecting various peripheral devices to the CPU. These devices connect to the system bus via a ‘bridge’ implemented in the processors chipset. Other names for the I/O bus include “expansion bus", "external bus” or “host bus”.
25
Expansion Bus Types These are some of the common expansion bus types that have ever been used in computers: ISA - Industry Standard Architecture EISA - Extended Industry Standard Architecture MCA - Micro Channel Architecture VESA - Video Electronics Standards Association PCI - Peripheral Component Interconnect PCMCIA - Personal Computer Memory Card Industry Association (Also called PC bus) AGP - Accelerated Graphics Port SCSI - Small Computer Systems Interface.
26
Binary Adder Another common and very useful combinational logic circuit which can be constructed using just a few basic logic gates allowing it to add together two or more binary numbers is the Binary Adder.
27
Binary Adder and Subtractor
28
Binary incrementor
29
Arithmetic Circuit
30
Logic Micro-operation
31
List of Logic-Micro-operation
32
Hardware Implementation
33
Lo’ai Tawalbeh Lecture #4 Register Transfer and Microoperations 23/2/2006 Chapter 4: cpe 252: Computer Organization 33
34
contents Register Transfer Language Register Transfer Bus and Memory Transfers Arithmetic Microoperations Logic Microoperations Shift Microoperations Arithmetic Logic Shift Unit cpe 252: Computer Organization 34
35
4-1 Register Transfer Language (RTL) Digital System: An interconnection of hardware modules that do a certain task on the information. Registers + Operations performed on the data stored in them = Digital Module Modules are interconnected with common data and control paths to form a digital computer system cpe 252: Computer Organization 35
36
4-1 Register Transfer Language cont. Microoperations: operations executed on data stored in one or more registers. For any function of the computer, a sequence of microoperations is used to describe it The result of the operation may be: replace the previous binary information of a register or transferred to another register 101101110011010110111001 Shift Right Operation cpe 252: Computer Organization 36
37
4-1 Register Transfer Language cont. The internal hardware organization of a digital computer is defined by specifying: The set of registers it contains and their function The sequence of microoperations performed on the binary information stored in the registers The control that initiates the sequence of microoperations Registers + Microoperations Hardware + Control Functions = Digital Computer cpe 252: Computer Organization 37
38
4-1 Register Transfer Language cont. Register Transfer Language (RTL) : a symbolic notation to describe the microoperation transfers among registers Next steps: Define symbols for various types of microoperations, Describe the hardware that implements these microoperations cpe 252: Computer Organization 38
39
4-2 Register Transfer (our first microoperation) Computer registers are designated by capital letters (sometimes followed by numerals) to denote the function of the register R1: processor register MAR: Memory Address Register (holds an address for a memory unit) PC: Program Counter IR: Instruction Register SR: Status Register cpe 252: Computer Organization 39
40
4-2 Register Transfer cont. The individual flip-flops in an n-bit register are numbered in sequence from 0 to n-1 (from the right position toward the left position) R1 7 6 5 4 3 2 1 0 A block diagram of a register Register R1 Showing individual bits cpe 252: Computer Organization 40
41
4-2 Register Transfer cont. PC Numbering of bits Partitioned into two parts 150 PC(H)PC(L) 07 8 15 Lower byteUpper byte Other ways of drawing the block diagram of a register: cpe 252: Computer Organization 41
42
4-2 Register Transfer cont. Information transfer from one register to another is described by a replacement operator: R2 ← R1 This statement denotes a transfer of the content of register R1 into register R2 The transfer happens in one clock cycle The content of the R1 (source) does not change The content of the R2 (destination) will be lost and replaced by the new data transferred from R1 We are assuming that the circuits are available from the outputs of the source register to the inputs of the destination register, and that the destination register has a parallel load capability cpe 252: Computer Organization 42
43
4-2 Register Transfer cont. Conditional transfer occurs only under a control condition Representation of a (conditional) transfer P: R2 ← R1 A binary condition (P equals to 0 or 1) determines when the transfer occurs The content of R1 is transferred into R2 only if P is 1 cpe 252: Computer Organization 43
44
4-2 Register Transfer cont. n Clock R1 R2 Control Circuit Load tt+1 Clock Load Transfer occurs here Synchronized with the clock P Hardware implementation of a controlled transfer: P: R2 ← R1 Block diagram: Timing diagram cpe 252: Computer Organization 44
45
4-2 Register Transfer cont. Basic Symbols for Register Transfers SymbolDescriptionExamples Letters & numerals Denotes a registerMAR, R2 Parenthesis ( )Denotes a part of a register R2(0-7), R2(L) Arrow ←Denotes transfer of information R2 ← R1 Comma,Separates two microoperations R2 ← R1, R1 ← R2 cpe 252: Computer Organization 45
46
4-3 Bus and Memory Transfers Paths must be provided to transfer information from one register to another A Common Bus System is a scheme for transferring information between registers in a multiple-register configuration A bus: 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 cpe 252: Computer Organization 46
47
4-3 Bus and Memory Transfers 3 2 1 0 Register D D 3 D 2 D 1 D 0 3 2 1 0 Register C C 3 C 2 C 1 C 0 3 2 1 0 Register B B 3 B 2 B 1 B 0 3 2 1 0 Register A A 3 A 2 A 1 A 0 D 3 C 3 B 3 A 3 S0S0 S1S1 MUX3 3 2 1 0 D 2 C 2 B 2 A 2 S0S0 S1S1 MUX2 3 2 1 0 D 1 C 1 B 1 A 1 S0S0 S1S1 MUX1 3 2 1 0 D 0 C 0 B 0 A 0 S0S0 S1S1 MUX0 3 2 1 0 4-Line Common Bus Register ARegister BRegister CRegister D Bus lines cpe 252: Computer Organization 47
48
4-3 Bus and Memory Transfers The transfer of information from a bus into one of many destination registers is done: By connecting the bus lines to the inputs of all destination registers and then: activating the load control of the particular destination register selected We write: R2 ← C to symbolize that the content of register C is loaded into the register R2 using the common system bus It is equivalent to: BUS ← C, (select C) R2 ← BUS (Load R2) cpe 252: Computer Organization 48
49
4-3 Bus and Memory Transfers: Three-State Bus Buffers A bus system can be constructed with three-state buffer gates instead of multiplexers A three-state buffer is a digital circuit that exhibits three states: logic-0, logic-1, and high-impedance (Hi-Z) Normal input A Control input C Three-State Buffer Output B cpe 252: Computer Organization 49
50
4-3 Bus and Memory Transfers: Three-State Bus Buffers cont. A C=1 B A B A C=0 B A B Buffer Open Circuit cpe 252: Computer Organization 50
51
4-3 Bus and Memory Transfers: Three-State Bus Buffers cont. 2×4 Decoder Select Enable 0 1 2 3 S1S1 S0S0 E Bus line for bit 0 A0A0 B0B0 C0C0 D0D0 Bus line with three-state buffer (replaces MUX0 in the previous diagram) cpe 252: Computer Organization 51
52
4-3 Bus and Memory Transfers: Memory Transfer Memory read : Transfer from memory Memory write : Transfer to memory Data being read or wrote is called a memory word (called M)- (refer to section 2-7) It is necessary to specify the address of M when writing /reading memory This is done by enclosing the address in square brackets following the letter M Example: M[0016] : the memory contents at address 0x0016 cpe 252: Computer Organization 52
53
4-3 Bus and Memory Transfers: Memory Transfer cont. Assume that the address of a memory unit is stored in a register called the Address Register AR Lets represent a Data Register with DR, then: Read: DR ← M[AR] Write: M[AR] ← DR cpe 252: Computer Organization 53
54
4-3 Bus and Memory Transfers: Memory Transfer cont. AR x12 x0C x0E x10 x12 x14 x16 x18 19 34 45 66 0 13 22 R1←M[AR] R1 100 R1 66 RAM R1 100 cpe 252: Computer Organization 54
55
4-4 Arithmetic Microoperations The microoperations most often encountered in digital computers are classified into four categories: Register transfer microoperations Arithmetic microoperations (on numeric data stored in the registers) Logic microoperations (bit manipulations on non-numeric data) Shift microoperations cpe 252: Computer Organization 55
56
The basic arithmetic microoperations are: addition, subtraction, increment, decrement, and shift Addition Microoperation: R3 ← R1+R2 Subtraction Microoperation: R3 ← R1-R2 or : R3 ← R1+R2+1 4-4 Arithmetic Microoperations cont. 1’s complement cpe 252: Computer Organization 56
57
One’s Complement Microoperation: R2 ← R2 Two’s Complement Microoperation: R2 ← R2+1 Increment Microoperation: R2 ← R2+1 Decrement Microoperation: R2 ← R2-1 4-4 Arithmetic Microoperations cont. cpe 252: Computer Organization 57
58
Half Adder/Full Adder Half Adder 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 c n = xy + xc n-1 + yc n-1 = xy + (x y)c n-1 s = x’y’c n-1 +x’yc’ n-1 +xy’c’ n-1 +xyc n-1 = x y c n-1 = (x y) c n-1 x y c n-1 x y cncn s c = xy s = xy’ + x’y = x y xyxy cscs xyxy c n-1 ScnScn Full Adder 0 0 0 1 1 0 0 1 1 1 1 0 x y c s x y c n-1 c n s 0 0 1 0 0 1 1 1 0 1 0 1 1 0 1 0 cpe 252: Computer Organization 58
59
4-4 Arithmetic Microoperations Binary Adder FA C0C0 A0A0 B0B0 S0S0 A1A1 B1B1 S1S1 A2A2 B2B2 S2S2 A3A3 B3B3 S3S3 C1C1 C2C2 C3C3 C4C4 4-bit binary adder (connection of FAs) cpe 252: Computer Organization 59
60
4-4 Arithmetic Microoperations Binary Adder-Subtractor FA C0C0 A0A0 B0B0 S0S0 A1A1 B1B1 S1S1 A2A2 B2B2 S2S2 A3A3 B3B3 S3S3 C1C1 C2C2 C3C3 C4C4 4-bit adder-subtractor M cpe 252: Computer Organization 60
61
For unsigned numbers, this gives A – B if A≥B or the 2’s complement of (B – A) if A < B (example: 3 – 5 = -2= 1110) For signed numbers, the result is A – B provided that there is no overflow. (example : -3 – 5= -8) 1101 1011 + ـــــــــــــــــــــــــــ 1000 4-4 Arithmetic Microoperations Binary Adder-Subtractor C3C3 C4C4 V = 1, if overflow 0, if no overflow Overflow detector for signed numbers cpe 252: Computer Organization 61
62
4-4 Arithmetic Microoperations Binary Adder-Subtractor cont. What is the range of unsigned numbers that can be represented in 4 bits? What is the range of signed numbers that can be represented in 4 bits? Repeat for n-bit?! cpe 252: Computer Organization 62
63
4-4 Arithmetic Microoperations Binary Incrementer C S xy HA C S xy C S xy C S xy S0S0 S1S1 S2S2 S3S3 C4C4 1A0A0 A1A1 A2A2 A3A3 4-bit Binary Incrementer cpe 252: Computer Organization 63
64
4-4 Arithmetic Microoperations Binary Incrementer Binary Incrementer can also be implemented using a counter A binary decrementer can be implemented by adding 1111 to the desired register each time! cpe 252: Computer Organization 64
65
4-4 Arithmetic Microoperations Arithmetic Circuit This circuit performs seven distinct arithmetic operations and the basic component of it is the parallel adder The output of the binary adder is calculated from the following arithmetic sum: D = A + Y + C in cpe 252: Computer Organization 65
66
B0B0 4-4 Arithmetic Microoperations Arithmetic Circuit cont. 3 2 1 0 S 1 S 0 4×1 MUX FA C in D0D0 D1D1 D2D2 D3D3 C1C1 C2C2 C3C3 C out B0B0 10S1S1 S0S0 B1B1 3 2 1 0 S 1 S 0 4×1 MUX B1B1 10S1S1 S0S0 B2B2 3 2 1 0 S 1 S 0 4×1 MUX B2B2 10S1S1 S0S0 B3B3 3 2 1 0 S 1 S 0 4×1 MUX B3B3 10S1S1 S0S0 A0A0 A1A1 A2A2 A3A3 4-bit Arithmetic Circuit X0X0 Y0Y0 X1X1 Y1Y1 X2X2 Y2Y2 X3X3 Y3Y3 Figure A cpe 252: Computer Organization 66
67
4-5 Logic Microoperations The four basic microoperations OR Microoperation Symbol: , + Gate: Example: 100110 2 1010110 2 = 1110110 2 P+Q: R1 ← R2+R3, R4 ← R5 R6 OR ADD cpe 252: Computer Organization 67
68
4-5 Logic Microoperations The four basic microoperations cont. AND Microoperation Symbol: Gate: Example: 100110 2 1010110 2 = 0000110 2 cpe 252: Computer Organization 68
69
4-5 Logic Microoperations The four basic microoperations cont. Complement (NOT) Microoperation Symbol: Gate: Example: 1010110 2 = 0101001 2 cpe 252: Computer Organization 69
70
4-5 Logic Microoperations The four basic microoperations cont. XOR (Exclusive-OR) Microoperation Symbol: Gate: Example: 100110 2 1010110 2 = 1110000 2 cpe 252: Computer Organization 70
71
4-5 Logic Microoperations Other Logic Microoperations Selective-set Operation Used to force selected bits of a register into logic-1 by using the OR operation Example: 0100 2 1000 2 = 1100 2 In a processor register Loaded into a register from memory to perform the selective-set operation cpe 252: Computer Organization 71
72
4-5 Logic Microoperations Other Logic Microoperations cont. Selective-complement (toggling) Operation Used to force selected bits of a register to be complemented by using the XOR operation Example: 0001 2 1000 2 = 1001 2 In a processor register Loaded into a register from memory to perform the selective-complement operation cpe 252: Computer Organization 72
73
4-5 Logic Microoperations Other Logic Microoperations cont. Insert Operation Step1: mask the desired bits Step2: OR them with the desired value Example: suppose R1 = 0110 1010, and we desire to replace the leftmost 4 bits (0110) with 1001 then: Step1: 0110 1010 0000 1111 Step2: 0000 1010 1001 0000 R1 = 1001 1010 cpe 252: Computer Organization 73
74
4-5 Logic Microoperations Other Logic Microoperations cont. NAND Microoperation Symbols: and Gate: Example: 100110 2 1010110 2 = 1111001 2 cpe 252: Computer Organization 74
75
4-5 Logic Microoperations Other Logic Microoperations cont. NOR Microoperation Symbols: and Gate: Example: 100110 2 1010110 2 = 0001001 2 cpe 252: Computer Organization 75
76
4-5 Logic Microoperations Other Logic Microoperations cont. Set (Preset) Microoperation Force all bits into 1’s by ORing them with a value in which all its bits are being assigned to logic-1 Example: 100110 2 111111 2 = 111111 2 Clear (Reset) Microoperation Force all bits into 0’s by ANDing them with a value in which all its bits are being assigned to logic-0 Example: 100110 2 000000 2 = 000000 2 cpe 252: Computer Organization 76
77
4-5 Logic Microoperations Hardware Implementation The hardware implementation of logic microoperations requires that logic gates be inserted for each bit or pair of bits in the registers to perform the required logic function Most computers use only four (AND, OR, XOR, and NOT) from which all others can be derived. cpe 252: Computer Organization 77
78
4-5 Logic Microoperations Hardware Implementation cont. S1S1 S0S0 0 1 2 3 4×1 MUX EiEi AiAi BiBi S1S1 S0S0 Output Operatio n 00 E = A B XOR 01 E = A B OR 10 E = A B AND 11E = A Complem ent This is for one bit i Figure B cpe 252: Computer Organization 78
79
4-6 Shift Microoperations Used for serial transfer of data Also used in conjunction with arithmetic, logic, and other data-processing operations The contents of the register can be shifted to the left or to the right As being shifted, the first flip-flop receives its binary information from the serial input Three types of shift: Logical, Circular, and Arithmetic cpe 252: Computer Organization 79
80
4-6 Shift Microoperations cont. r0r0 r1r1 r3r3 r n-1 r0r0 r1r1 r2r2 r3r3 Shift Right Shift Left Serial InputSerial Output Serial Input Determines the “shift” type r2r2 ** Note that the bit r i is the bit at position (i) of the register cpe 252: Computer Organization 80
81
4-6 Shift Microoperations: Logical Shifts Transfers 0 through the serial input Logical Shift Right: R1 ← shr R1 Logical Shift Left: R2 ← shl R2 The same Logical Shift Left ? 0 r0r0 r1r1 r2r2 r3r3 r n-1 cpe 252: Computer Organization 81
82
4-6 Shift Microoperations: Circular Shifts (Rotate Operation) Circulates the bits of the register around the two ends without loss of information Circular Shift Right: R1 ← cir R1 Circular Shift Left: R2 ← cil R2 The same Circular Shift Left r0r0 r1r1 r2r2 r3r3 r n-1 cpe 252: Computer Organization 82
83
4-6 Shift Microoperations Arithmetic Shifts Shifts a signed binary number to the left or right An arithmetic shift-left multiplies a signed binary number by 2: ashl (00100): 01000 An arithmetic shift-right divides the number by 2 ashr (00100) : 00010 An overflow may occur in arithmetic shift-left, and occurs when the sign bit is changed (sign reversal) cpe 252: Computer Organization 83
84
4-6 Shift Microoperations Arithmetic Shifts cont. Arithmetic Shift Right Sign Bit Arithmetic Shift Left Sign Bit ? 0 ? r0r0 r1r1 r2r2 r3r3 r n-1 r0r0 r1r1 r2r2 r3r3 cpe 252: Computer Organization 84
85
4-6 Shift Microoperations Arithmetic Shifts cont. An overflow flip-flop V s can be used to detect an arithmetic shift-left overflow V s = R n-1 R n-2 R n-2 Vs=Vs= R n-1 1 overflow 0 no overflow cpe 252: Computer Organization 85
86
4-6 Shift Microoperations cont. Example: Assume R1=11001110, then: Arithmetic shift right once : R1 = 11100111 Arithmetic shift right twice : R1 = 11110011 Arithmetic shift left once : R1 = 10011100 Arithmetic shift left twice : R1 = 00111000 Logical shift right once : R1 = 01100111 Logical shift left once : R1 = 10011100 Circular shift right once : R1 = 01100111 Circular shift left once : R1 = 10011101 cpe 252: Computer Organization 86
87
4-6 Shift Microoperations Hardware Implementation cont. A possible choice for a shift unit would be a bidirectional shift register with parallel load (refer to Fig 2-9). Has drawbacks: Needs two pulses (the clock and the shift signal pulse) Not efficient in a processor unit where multiple number of registers share a common bus It is more efficient to implement the shift operation with a combinational circuit cpe 252: Computer Organization 87
88
4-6 Shift Microoperations Hardware Implementation cont. S1 0 S1 0 S1 0 S1 0 A3A3 A2A2 A1A1 A0A0 Serial Input I R Serial Input I L Select 0 for shift right 1 for shift left H3H3 H2H2 H1H1 H0H0 MUX 4-bit Combinational Circuit Shifter cpe 252: Computer Organization 88
89
4-7 Arithmetic Logic Shift Unit Instead of having individual registers performing the microoperations directly, computer systems employ a number of storage registers connected to a common operational unit called an Arithmetic Logic Unit (ALU) cpe 252: Computer Organization 89
90
4-7 Arithmetic Logic Shift Unit cont. 0 1 2 3 S3S3 S2S2 S1S1 S0S0 BiBi AiAi A i+1 A i-1 Select 4×1 MUX CiCi C i+1 One stage of arithmetic circuit (Fig.A) One stage of logic circuit (Fig.B) DiDi EiEi FiFi shr shl One stage of ALU cpe 252: Computer Organization 90
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.