Computer Organization: Virtual Memory

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 26

Computer organization

Computer organization helps optimize performance-based products. For example,


software engineers need to know the processing power of processors. They may
need to optimize software in order to gain the most performance for the lowest
price. This can require quite a detailed analysis of the computer's organization. For
example, in an SD card, the designers might need to arrange the card so that the
most data can be processed in the fastest possible way.
Computer organization also helps plan the selection of a processor for a particular
project. Multimedia projects may need very rapid data access, while virtual
machines may need fast interrupts. Sometimes certain tasks need additional
components as well. For example, a computer capable of running a virtual machine
needs virtual memory hardware so that the memory of different virtual computers
can be kept separated. Computer organization and features also affect power
consumption and processor cost.
Implementation
Once an instruction set and micro-architecture have been designed, a practical
machine must be developed. This design process is called the implementation.
Implementation is usually not considered architectural design, but rather
hardware design engineering. Implementation can be further broken down into
several steps:

 Logic implementation designs the circuits required at a logic-gate level.


 Circuit implementation does transistor-level designs of basic elements (e.g.,
gates, multiplexers, latches) as well as of some larger blocks (ALUs, caches
etc.) that may be implemented at the logic-gate level, or even at the physical
level if the design calls for it.
 Physical implementation draws physical circuits. The different circuit
components are placed in a chip floorplan or on a board and the wires
connecting them are created.
 Design validation tests the computer as a whole to see if it works in all
situations and all timings. Once the design validation process starts, the design
at the logic level are tested using logic emulators. However, this is usually too
slow to run a realistic test. So, after making corrections based on the first test,
prototypes are constructed using Field-Programmable Gate-Arrays (FPGAs).
Most hobby projects stop at this stage. The final step is to test prototype
integrated circuits, which may require several redesigns.
For CPUs, the entire implementation process is organized differently and is often
referred to as CPU design.

Design goals
The exact form of a computer system depends on the constraints and goals.
Computer architectures usually trade off standards, power versus performance,
cost, memory capacity, latency (latency is the amount of time that it takes for
information from one node to travel to the source) and throughput. Sometimes
other considerations, such as features, size, weight, reliability, and expandability
are also factors.
The most common scheme does an in-depth power analysis and figures out how to
keep power consumption low while maintaining adequate performance.
Performance
Modern computer performance is often described in instructions per cycle (IPC),
which measures the efficiency of the architecture at any clock frequency; a faster
IPC rate means the computer is faster. Older computers had IPC counts as low as
0.1 while modern processors easily reach near 1. Superscalar processors may reach
three to five IPC by executing several instructions per clock cycle.[citation needed]
Counting machine-language instructions would be misleading because they can do
varying amounts of work in different ISAs. The "instruction" in the standard
measurements is not a count of the ISA's machine-language instructions, but a unit
of measurement, usually based on the speed of the VAX computer architecture.
Many people used to measure a computer's speed by the clock rate (usually in
MHz or GHz). This refers to the cycles per second of the main clock of the CPU.
However, this metric is somewhat misleading, as a machine with a higher clock
rate may not necessarily have greater performance. As a result, manufacturers have
moved away from clock speed as a measure of performance.
Other factors influence speed, such as the mix of functional units, bus speeds,
available memory, and the type and order of instructions in the programs.
There are two main types of speed: latency and throughput. Latency is the time
between the start of a process and its completion. Throughput is the amount of
work done per unit time. Interrupt latency is the guaranteed maximum response
time of the system to an electronic event (like when the disk drive finishes moving
some data).
Performance is affected by a very wide range of design choices — for
example, pipelining a processor usually makes latency worse, but makes
throughput better. Computers that control machinery usually need low interrupt
latencies. These computers operate in a real-time environment and fail if an
operation is not completed in a specified amount of time. For example, computer-
controlled anti-lock brakes must begin braking within a predictable and limited
time period after the brake pedal is sensed or else failure of the brake will occur.
Benchmarking takes all these factors into account by measuring the time a
computer takes to run through a series of test programs. Although benchmarking
shows strengths, it shouldn't be how you choose a computer. Often the measured
machines split on different measures. For example, one system might handle
scientific applications quickly, while another might render video games more
smoothly. Furthermore, designers may target and add special features to their
products, through hardware or software, that permit a specific benchmark to
execute quickly but don't offer similar advantages to general tasks.
Power efficiency
Power efficiency is another important measurement in modern computers. A
higher power efficiency can often be traded for lower speed or higher cost. The
typical measurement when referring to power consumption in computer
architecture is MIPS/W (millions of instructions per second per watt).
Modern circuits have less power required per transistor as the number of transistors
per chip grows.[19] This is because each transistor that is put in a new chip requires
its own power supply and requires new pathways to be built to power it. However
the number of transistors per chip is starting to increase at a slower rate. Therefore,
power efficiency is starting to become as important, if not more important than
fitting more and more transistors into a single chip. Recent processor designs have
shown this emphasis as they put more focus on power efficiency rather than
cramming as many transistors into a single chip as possible. [20] In the world of
embedded computers, power efficiency has long been an important goal next to
throughput and latency.
Instruction Representation
Within the computer, each instruction is represented by a sequence of bits. The instruction is di
fields, corresponding to the constituent elements of the instruction. During   instruction executi
an instruction is read into an instruction register (IR) in the CPU. The CPU must be able to extr
instruction fields to perform the required operation. It is difficult for both the programmer and
reader of textbooks to deal with binary representations of machine instructions. Thus, it has bec
to use a symbolic representation of machine instructions. Opcodes are represented by abbrevia
that indicate the operation. Common examples include:
 

 ADD  Add

 SUB  Subtract

 MPY  Multiply

 DIV  Divide

 LOAD  Load data from memory

 STOR Store data to memory 

Operands are also represented symbolically. For example, the instruction

ADD R, Y

may mean add the value contained in data location Y to the contents of register R. In this examp

Y refers to the address of a location in memory, and R refers to a particular register.

Note that the operation is performed on the contents of a location, not on its address.

The machine instruction cycle


This is a basic concept in computer science

The machine instruction cycle describes the order that instructions are
processed in a computer.

Instructions are processed under the direction of the control unit in a step-by-step
manner.
There are four fundamental steps in the instruction cycle:
1. Fetch the instruction The next instruction is fetched from the memory address
that is currently stored in the Program Counter (PC), and stored in the Instruction
register (IR). At the end of the fetch operation, the PC points to the next instruction
that will be read at the next cycle.
2. Decode the instruction The control unit interprets the instruction. During this
cycle the instruction inside the IR (instruction register) gets decoded.
3. Execute The Control Unit of CPU passes the decoded information as a sequence
of control signals to the relevant function units of the CPU to perform the actions
required by the instruction such as reading values from registers, passing them to
the ALU to perform mathematical or logic functions on them, and writing the
result back to a register. If the ALU is involved, it sends a condition signal back to
the CU.
4. Store result The result generated by the operation is stored in the main memory,
or sent to an output device. Based on the condition of any feedback from the ALU,
Program Counter may be updated to a different address from which the next
instruction will be fetched.

Number system representation

A digital system can understand positional number system only where there are a few
symbols called digits and these symbols represent different values depending on the
position they occupy in the number.
A value of each digit in a number can be determined using
 The digit
 The position of the digit in the number
 The base of the number system (where base is defined as the total number of
digits available in the number system).

Decimal Number System


The number system that we use in our day-to-day life is the decimal number system.
Decimal number system has base 10 as it uses 10 digits from 0 to 9. In decimal
number system, the successive positions to the left of the decimal point represents
units, tens, hundreds, thousands and so on.
Each position represents a specific power of the base (10). For example, the decimal
number 1234 consists of the digit 4 in the units position, 3 in the tens position, 2 in the
hundreds position, and 1 in the thousands position, and its value can be written as
(1×1000) + (2×100) + (3×10) + (4×l)
(1×103) + (2×102) + (3×101) + (4×l00)
1000 + 200 + 30 + 1
1234
As a computer programmer or an IT professional, you should understand the following
number systems which are frequently used in computers.
S.N Number System & Description
.

1 Binary Number System

Base 2. Digits used: 0, 1

2 Octal Number System

Base 8. Digits used: 0 to 7

3 Hexa Decimal Number System

Base 16. Digits used: 0 to 9, Letters used: A- F

Binary Number System


Characteristics
 Uses two digits, 0 and 1.
 Also called base 2 number system
 Each position in a binary number represents a 0 power of the base (2). Example:
20
 Last position in a binary number represents an x power of the base (2).
Example: 2x where x represents the last position - 1.
Example

Example
Binary Number: 101012
Calculating Decimal Equivalent −

Step Binary Number Decimal Number

Step 1 101012 ((1 × 24) + (0 × 23) + (1 × 22) + (0 × 21) + (1 × 20))10

Step 2 101012 (16 + 0 + 4 + 0 + 1)10

Step 3 101012 2110


Note: 101012 is normally written as 10101.

Octal Number System


Characteristics
 Uses eight digits, 0,1,2,3,4,5,6,7.
 Also called base 8 number system
 Each position in an octal number represents a 0 power of the base (8). Example:
80
 Last position in an octal number represents an x power of the base (8). Example:
8x where x represents the last position - 1.
Example
Octal Number − 125708
Calculating Decimal Equivalent −

Step Octal Number Decimal Number

Step 1 125708 ((1 × 84) + (2 × 83) + (5 × 82) + (7 × 81) + (0 × 80))10

Step 2 125708 (4096 + 1024 + 320 + 56 + 0)10

Step 3 125708 549610

Note: 125708 is normally written as 12570.

Hexadecimal Number System


Characteristics
 Uses 10 digits and 6 letters, 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.
 Letters represents numbers starting from 10. A = 10, B = 11, C = 12, D = 13, E =
14, F = 15.
 Also called base 16 number system.
 Each position in a hexadecimal number represents a 0 power of the base (16).
Example 160.
 Last position in a hexadecimal number represents an x power of the base (16).
Example 16x where x represents the last position - 1.
Example −
Hexadecimal Number: 19FDE16
Calculating Decimal Equivalent −

Step Hexadecimal Number Decimal Number

Step 1 19FDE16 ((1 × 164) + (9 × 163) + (F × 162) + (D × 161) + (E × 160))10

Step 2 19FDE16 ((1 × 164) + (9 × 163) + (15 × 162) + (13 × 161) + (14 × 160))10

Step 3 19FDE16 (65536 + 36864 + 3840 + 208 + 14)10

Step 4 19FDE16 10646210

Note − 19FDE16 is normally written as 19FDE.

Number conversion

There are many methods or techniques which can be used to convert numbers from
one base to another. We'll demonstrate here the following −

 Decimal to Other Base System


 Other Base System to Decimal
 Other Base System to Non-Decimal
 Shortcut method − Binary to Octal
 Shortcut method − Octal to Binary
 Shortcut method − Binary to Hexadecimal
 Shortcut method − Hexadecimal to Binary

Decimal to Other Base System


Steps
 Step 1 − Divide the decimal number to be converted by the value of the new
base.
 Step 2 − Get the remainder from Step 1 as the rightmost digit (least significant
digit) of new base number.
 Step 3 − Divide the quotient of the previous divide by the new base.
 Step 4 − Record the remainder from Step 3 as the next digit (to the left) of the
new base number.
Repeat Steps 3 and 4, getting remainders from right to left, until the quotient becomes
zero in Step 3.
The last remainder thus obtained will be the Most Significant Digit (MSD) of the new
base number.
Example −
Decimal Number: 2910
Calculating Binary Equivalent −

Step Operation Result Remainder

Step 1 29 / 2 14 1

Step 2 14 / 2 7 0

Step 3 7/2 3 1

Step 4 3/2 1 1

Step 5 1/2 0 1

As mentioned in Steps 2 and 4, the remainders have to be arranged in the reverse


order so that the first remainder becomes the Least Significant Digit (LSD) and the last
remainder becomes the Most Significant Digit (MSD).
Decimal Number − 2910 = Binary Number − 111012.

Other Base System to Decimal System


Steps
 Step 1 − Determine the column (positional) value of each digit (this depends on
the position of the digit and the base of the number system).
 Step 2 − Multiply the obtained column values (in Step 1) by the digits in the
corresponding columns.
 Step 3 − Sum the products calculated in Step 2. The total is the equivalent value
in decimal.
Example
Binary Number − 111012
Calculating Decimal Equivalent −

Step Binary Number Decimal Number

Step 1 111012 ((1 × 24) + (1 × 23) + (1 × 22) + (0 × 21) + (1 × 20))10

Step 2 111012 (16 + 8 + 4 + 0 + 1)10

Step 3 111012 2910

Binary Number − 111012 = Decimal Number − 2910

Other Base System to Non-Decimal System


Steps
 Step 1 − Convert the original number to a decimal number (base 10).
 Step 2 − Convert the decimal number so obtained to the new base number.
Example
Octal Number − 258
Calculating Binary Equivalent −
Step 1 − Convert to Decimal
Step Octal Number Decimal Number

Step 1 258 ((2 × 81) + (5 × 80))10

Step 2 258 (16 + 5 )10

Step 3 258 2110

Octal Number − 258 = Decimal Number − 2110


Step 2 − Convert Decimal to Binary
Step Operation Result Remainder

Step 1 21 / 2 10 1

Step 2 10 / 2 5 0

Step 3 5/2 2 1

Step 4 2/2 1 0

Step 5 1/2 0 1

Decimal Number − 2110 = Binary Number − 101012


Octal Number − 258 = Binary Number − 101012

Shortcut method - Binary to Octal


Steps
 Step 1 − Divide the binary digits into groups of three (starting from the right).
 Step 2 − Convert each group of three binary digits to one octal digit.
Example
Binary Number − 101012
Calculating Octal Equivalent −

Step Binary Number Octal Number

Step 1 101012 010 101

Step 2 101012 28 58

Step 3 101012 258


Binary Number − 101012 = Octal Number − 258

Shortcut method - Octal to Binary


Steps
 Step 1 − Convert each octal digit to a 3 digit binary number (the octal digits may
be treated as decimal for this conversion).
 Step 2 − Combine all the resulting binary groups (of 3 digits each) into a single
binary number.
Example
Octal Number − 258
Calculating Binary Equivalent −

Step Octal Number Binary Number

Step 1 258 210 510

Step 2 258 0102 1012

Step 3 258 0101012

Octal Number − 258 = Binary Number − 101012

Shortcut method - Binary to Hexadecimal


Steps
 Step 1 − Divide the binary digits into groups of four (starting from the right).
 Step 2 − Convert each group of four binary digits to one hexadecimal symbol.
Example
Binary Number − 101012
Calculating hexadecimal Equivalent −

Step Binary Number Hexadecimal Number

Step 1 101012 0001 0101


Step 2 101012 110 510

Step 3 101012 1516

Binary Number − 101012 = Hexadecimal Number − 1516

Shortcut method - Hexadecimal to Binary


Steps
 Step 1 − Convert each hexadecimal digit to a 4 digit binary number (the
hexadecimal digits may be treated as decimal for this conversion).
 Step 2 − Combine all the resulting binary groups (of 4 digits each) into a single
binary number.
Example
Hexadecimal Number − 1516
Calculating Binary Equivalent −

Step Hexadecimal Number Binary Number

Step 1 1516 110 510

Step 2 1516 00012 01012

Step 3 1516 000101012

Hexadecimal Number − 1516 = Binary Number − 101012

Binary coding
In the coding, when numbers, letters or words are represented by a specific group of
symbols, it is said that the number, letter or word is being encoded. The group of
symbols is called as a code. The digital data is represented, stored and transmitted as
group of binary bits. This group is also called as binary code. The binary code is
represented by the number as well as alphanumeric letter.

Advantages of Binary Code


Following is the list of advantages that binary code offers.
 Binary codes are suitable for the computer applications.
 Binary codes are suitable for the digital communications.
 Binary codes make the analysis and designing of digital circuits if we use the
binary codes.
 Since only 0 & 1 are being used, implementation becomes easy.

Classification of binary codes


The codes are broadly categorized into following four categories.

 Weighted Codes
 Non-Weighted Codes
 Binary Coded Decimal Code
 Alphanumeric Codes
 Error Detecting Codes
 Error Correcting Codes

Weighted Codes
Weighted binary codes are those binary codes which obey the positional weight
principle. Each position of the number represents a specific weight. Several systems of
the codes are used to express the decimal digits 0 through 9. In these codes each
decimal digit is represented by a group of four bits.

Non-Weighted Codes
In this type of binary codes, the positional weights are not assigned. The examples of
non-weighted codes are Excess-3 code and Gray code.
Excess-3 code
The Excess-3 code is also called as XS-3 code. It is non-weighted code used to
express decimal numbers. The Excess-3 code words are derived from the 8421 BCD
code words adding (0011) 2 or (3)10 to each code word in 8421. The excess-3 codes
are obtained as follows −

Example

Gray Code
It is the non-weighted code and it is not arithmetic codes. That means there are no
specific weights assigned to the bit position. It has a very special feature that, only one
bit will change each time the decimal number is incremented as shown in fig. As only
one bit changes at a time, the gray code is called as a unit distance code. The gray
code is a cyclic code. Gray code cannot be used for arithmetic operation.

Application of Gray code


 Gray code is popularly used in the shaft position encoders.
 A shaft position encoder produces a code word which represents the angular
position of the shaft.

Binary Coded Decimal (BCD) code


In this code each decimal digit is represented by a 4-bit binary number. BCD is a way
to express each of the decimal digits with a binary code. In the BCD, with four bits we
can represent sixteen numbers (0000 to 1111). But in BCD code only first ten of these
are used (0000 to 1001). The remaining six code combinations i.e. 1010 to 1111 are
invalid in BCD.

Advantages of BCD Codes


 It is very similar to decimal system.
 We need to remember binary equivalent of decimal numbers 0 to 9 only.
Disadvantages of BCD Codes
 The addition and subtraction of BCD have different rules.
 The BCD arithmetic is little more complicated.
 BCD needs more number of bits than binary to represent the decimal number.
So BCD is less efficient than binary.

Alphanumeric codes
A binary digit or bit can represent only two symbols as it has only two states '0' or '1'.
But this is not enough for communication between two computers because there we
need many more symbols for communication. These symbols are required to represent
26 alphabets with capital and small letters, numbers from 0 to 9, punctuation marks
and other symbols.
The alphanumeric codes are the codes that represent numbers and alphabetic
characters. Mostly such codes also represent other characters such as symbol and
various instructions necessary for conveying information. An alphanumeric code should
at least represent 10 digits and 26 letters of alphabet i.e. total 36 items. The following
three alphanumeric codes are very commonly used for the data representation.

 American Standard Code for Information Interchange (ASCII).


 Extended Binary Coded Decimal Interchange Code (EBCDIC).
 Five bit Baudot Code.
ASCII code is a 7-bit code whereas EBCDIC is an 8-bit code. ASCII code is more
commonly used worldwide while EBCDIC is used primarily in large IBM computers

Logic gates are the basic building blocks of any digital system. It is an


electronic circuit having one or more than one input and only one output.
The relationship between the input and the output is based on a certain
logic. Based on this, logic gates are named as AND gate, OR gate, NOT
gate etc.

Digital Logic Gates Summary

There are three basic types of digital logic gates, the AND Gate, the OR
Gate and the NOT Gate
Digital Logic Gates can be made from discrete components such
as Resistors, Transistors and Diodes to form RTL (resistor-transistor logic)
or DTL (diode-transistor logic) circuits, but today’s modern digital 74xxx
series integrated circuits are manufactured using TTL (transistor-transistor
logic) based on NPN bipolar transistor technology or the much faster and
low power CMOS based MOSFET transistor logic used in the 74Cxxx,
74HCxxx, 74ACxxx and the 4000 series logic chips.

The eight most “standard” individual Digital Logic Gates are summarised


below along with their corresponding truth tables.

tandard Logic Gates

The Logic AND Gate

Symbol Truth Table

B A Q

0 0 0

2-input AND Digital Logic Gate 0 1 0

1 0 0

1 1 1
Boolean Expression Q = A.B Read as A AND B gives Q

The Logic OR Gate

Symbol Truth Table

B A Q

0 0 0

0 1 1

1 0 1

1 1 1

Boolean Expression Q = A + B Read as A OR B gives Q


Inverting Logic Gates

The Logic NAND Gate

Symbol Truth Table

B A Q

0 0 1

0 1 1

1 0 1

1 1 0

Boolean Expression Q = A . B Read as A AND B gives NOT Q

The Logic NOR Gate

Symbol Truth Table


B A Q

0 0 1

0 1 0

1 0 0

1 1 0

Boolean Expression Q = A + B Read as A OR B gives NOT Q

Exclusive Logic Gates

The Logic Exclusive-OR Gate (Ex-OR)

Symbol Truth Table

B A Q

0 0 0
0 1 1

1 0 1

1 1 0

Boolean Expression Q = A ⊕ B Read as A OR B but not BOTH gives Q (odd)

The Logic Exclusive-NOR Gate (Ex-NOR)

Symbol Truth Table

B A Q

0 0 1

0 1 0

1 0 0

1 1 1
Boolean Expression Q = A ⊕ B Read if A AND B the SAME gives Q (even)

Single Input Logic Gates

The Hex Buffer

Symbol Truth Table

A Q

0 0

1 1

Boolean Expression Q = A Read as A gives Q

The NOT gate (Inverter)

Symbol Truth Table


A Q

0 1

1 0

Read as inverse of
Boolean Expression Q = not A or A
A gives Q

The operation of the above Digital Logic Gates and their Boolean


expressions can be summarised into a single truth table as shown below. This
truth table shows the relationship between each output of the main digital logic
gates for each possible input combination.

Digital Logic Gate Truth Table Summary


The following logic gates truth table compares the logical functions of the 2-
input logic gates detailed above.

Inputs Truth Table Outputs For Each Gate

B A AND NAND OR NOR EX-OR EX-NOR

0 0 0 1 0 1 0 1

0 1 0 1 1 0 1 0
1 0 0 1 1 0 1 0

1 1 1 0 1 0 0 1

Truth Table Output for Single-input Gates

A NOT Buffer

0 1 0

1 0 1

Pull-up and Pull-down Resistors


One final point to remember, when connecting together digital logic gates to
produce logic circuits, any “unused” inputs to the gates must be connected
directly to either a logic level “1” or a logic level “0” by means of a suitable
“Pull-up” or “Pull-down” resistor ( for example 1kΩ resistor ) to produce a fixed
logic signal. This will prevent the unused input to the gate from “floating” about
and producing false switching of the gate and circuit.

https://www.tutorialspoint.com/computer_logical_organization/logic_gates.htm

You might also like