CSC230
CSC230
Input unit
o Input units are used by the computer to read the data. The most commonly used
input devices are keyboards, mouse, joysticks, trackballs, microphones, etc.
o However, the most well-known input device is a keyboard. Whenever a key is
pressed, the corresponding letter or digit is automatically translated into its
corresponding binary code and transmitted over a cable to either the memory or
the processor.
Central processing unit
o Central processing unit commonly known as CPU can be referred as an
electronic circuitry within a computer that carries out the instructions given by a
computer program by performing the basic arithmetic, logical, control and
input/output (I/O) operations specified by the instructions.
Memory unit
o The Memory unit can be referred to as the storage area in which programs are
kept which are running, and that contains data needed by the running programs.
o The Memory unit can be categorized in two ways namely, primary memory and
secondary memory.
o It enables a processor to access running execution applications and services that
are temporarily stored in a specific memory location.
o Primary storage is the fastest memory that operates at electronic speeds. Primary
memory contains a large number of semiconductor storage cells, capable of
storing a bit of information. The word length of a computer is between 16-64
bits.
o It is also known as the volatile form of memory, means when the computer is
shut down, anything contained in RAM is lost.
o Cache memory is also a kind of memory which is used to fetch the data very
soon. They are highly coupled with the processor.
o The most common examples of primary memory are RAM and ROM.
o Secondary memory is used when a large amount of data and programs have to
be stored for a long-term basis.
o It is also known as the Non-volatile memory form of memory, means the data is
stored permanently irrespective of shut down.
o The most common examples of secondary memory are magnetic disks, magnetic
tapes, and optical disks.
Arithmetic & logical unit
o Most of all the arithmetic and logical operations of a computer are executed in
the ALU (Arithmetic and Logical Unit) of the processor. It performs arithmetic
operations like addition, subtraction, multiplication, division and also the logical
operations like AND, OR, NOT operations.
Control unit
o The control unit is a component of a computer's central processing unit that
coordinates the operation of the processor. It tells the computer's memory,
arithmetic/logic unit and input and output devices how to respond to a program's
instructions.
o The control unit is also known as the nerve center of a computer system.
o Let's us consider an example of addition of two operands by the instruction given
as Add LOCA, RO. This instruction adds the memory location LOCA to the
operand in the register RO and places the sum in the register RO. This instruction
internally performs several steps.
Output Unit
o The primary function of the output unit is to send the processed results to the
user. Output devices display information in a way that the user can understand.
o Output devices are pieces of equipment that are used to generate information or
any other response processed by the computer. These devices display
information that has been held or generated within a computer.
o The most common example of an output device is a monitor.
General System Architecture
In Computer Architecture, the General System Architecture is divided into two major
classification units.
1. Store Program Control Concept
2. Flynn's Classification of Computers
Two basic types of computer architecture are:
1. von Neumann architecture
2. Harvard architecture
1. von Neumann architecture
The von Neumann architecture describes a general framework, or structure, that a
computer's hardware, programming, and data should follow. Although other structures
for computing have been devised and implemented, the vast majority of computers in
use today operate according to the von Neumann architecture.
von Neumann envisioned the structure of a computer system as being composed of the
following components:
1. ALU: The Arithmetic-Logic unit that performs the computer's computational and
logical functions.
2. RAM: Memory; more specifically, the computer's main, or fast, memory, also
known as Random Access Memory (RAM).
3. Control Unit: This is a component that directs other components of the computer
to perform certain actions, such as directing the fetching of data or instructions from
memory to be processed by the ALU; and
4. Man-machine interfaces; i.e. input and output devices, such as keyboard for input
and display monitor for output.
• Non-Volatile Memory: This is a permanent storage and does not lose any data
when power is switched off.
Auxillary memory access time is generally 1000 times that of the main memory, hence
it is at the bottom of the hierarchy.
The main memory occupies the central position because it is equipped to communicate
directly with the CPU and with auxiliary memory devices through Input/output
processor (I/O).
When the program not residing in main memory is needed by the CPU, they are
brought in from auxiliary memory. Programs not currently needed in main memory are
transferred into auxiliary memory to provide space in main memory for other programs
that are currently in use.
The cache memory is used to store program data which is currently being executed in
the CPU. Approximate access time ratio between cache memory and main memory is
about 1 to 7~10
Memory Access Methods
3. Direct Access: In this mode, information is stored in tracks, with each track
having a separate read/write head.
Main Memory
The memory unit that communicates directly within the CPU, Auxillary memory
and Cache memory, is called main memory. It is the central storage unit of the computer
system. It is a large and fast memory used to store data during computer operations.
Main memory is made up of RAM and ROM, with RAM integrated circuit chips holing
the major share.
In random-access memory (RAM) the memory cells can be accessed for information
transfer from any desired random location. That is, the process of locating a word in
memory is the same and requires an equal amount of time no matter where the cells
are located physically in memory. Communication between a memory and its
environment is achieved through data input and output lines, address selection lines,
and control lines that specify the direction of transfer. A block diagram of a RAM unit
is shown below:
The n data input lines provide the information to be stored in memory, and the n
data output lines supply the information coming out of particular word chosen among the
2k available inside the memory. The two control inputs specify the direction of transfer
desired.
Types:
o DRAM: Dynamic RAM, is made of capacitors and transistors, and must
As the name implies, a read-only memory (ROM) is a memory unit that performs
the read operation only; it does not have a write capability. This implies that the binary
information stored in a ROM is made permanent during the hardware production of the
unit and cannot be altered by writing different words into it.
3. A third type of ROM available is called Erasable PROM or EPROM. The EPROM
can be restructured to the initial value even though its fuses have been blown
previously. Certain PROMs can be erased with electrical signals instead of
ultraviolet light. These PROMs are called Electrically Erasable PROM or
EEPROM. Flash memory is a form of EEPROM in which a block of bytes can be
erased in a very short duration.
Virtual Memory
Virtual Memory is a storage mechanism which offers user an illusion of having a very big
main memory. It is done by treating a part of secondary memory as the main memory. In
Virtual memory, the user can store processes with a bigger size than the available main
memory. Therefore, instead of loading one long process in the main memory, the OS loads
the various parts of more than one process in the main memory. Virtual memory is mostly
implemented with demand paging and demand segmentation.
Why Need Virtual Memory?
Here, are reasons for using virtual memory:
Whenever your computer doesn't have space in the physical memory it writes what
it needs to remember to the hard disk in a swap file as virtual memory.
If a computer running Windows needs more memory/RAM, then installed in the
system, it uses a small portion of the hard drive for this purpose.
How Virtual Memory Works?
In the modern world, virtual memory has become quite common these days. It is used
whenever some pages require to be loaded in the main memory for the execution, and the
memory is not available for those many pages.
So, in that case, instead of preventing pages from entering in the main memory, the OS
searches for the RAM space that are minimum used in the recent times or that are not
referenced into the secondary memory to make the space for the new pages in the main
memory.
Benefits of Virtual Memory/ RAM?
Having a virtual memory can be of real advantage for the users, especially in critical
situations. Here are some of the best advantages that come with virtual memory.
Segmented Speed Rise
Virtual memory doesn't bother using the whole RAM to gain a certain level of speed.
Instead, it assists a particular segment of the whole program to gain an expected speed. It
uses the segment only when the segment of the program needs to execute a necessary
instruction or run another program.
Multi-programming Environment
If users need to make a multi-programming environment, they should use a virtual memory
system. Such memory provides the extra support that smoothens the multi-programming
environment. Furthermore, virtual memory helps users do large programs into
comparatively smaller programs. There is no specific multi-programming limit.
Memory Share
Programmers and designers often need systems that can share data or information between
memory. They will find a virtual memory system quite helpful. The process can
communicate data and instructions via and between memory.
Data Placement
Another big perk with virtual memory is users can place their data and codes anywhere in
the physical memory without a relocation. These data or codes can be read anytime from
the disc. Users will find the process larger than other physical memories. Users will get
more space for virtual addresses compared to physical memory.
Checks External Fragmentation
When unused memory is split into smaller segments and interleaved with assigned
memory, this is known as external fragmentation. It is considered an issue as an algorithm
for storage allocation, especially when these algorithms fail to effectively arrange memory
utilized by applications.
No Memory Holes
Memory holes may cause unusual fragmentation. However, virtual memory overcomes this
problem since it does not contact the physical memory management unit. Furthermore,
each program has its individual mapping, and users can utilize the mapping to place their
program data anywhere they want in the RAM.
Security
Each program has the ability to access any 32bit memory address. The issue arises when
two programs use the same address in address space to keep their results. In that case, the
output of one program may be altered by another, resulting in users not receiving the
desired outcome. It is the most serious issue that virtual memory can address.
Let's understand virtual memory management with the help of one example.
For example:
Let's assume that an OS requires 300 MB of memory to store all the running programs.
However, there's currently only 50 MB of available physical memory stored on the RAM.
The OS will then set up 250 MB of virtual memory and use a program called the
Virtual Memory Manager(VMM) to manage that 250 MB.
So, in this case, the VMM will create a file on the hard disk that is 250 MB in size
to store extra memory that is required.
The OS will now proceed to address memory as it considers 300 MB of real memory
stored in the RAM, even if only 50 MB space is available.
It is the job of the VMM to manage 300 MB memory even if just 50 MB of real
memory space is available.
Advantages of Virtual Memory
Here, are pros/benefits of using Virtual Memory:
Virtual memory helps to gain speed when only a particular segment of the program
is required for the execution of the program.
It is very helpful in implementing a multiprogramming environment.
It allows you to run more applications at once.
It helps you to fit many large programs into smaller programs.
Common data or code may be shared between memory.
Process may become even larger than all of the physical memory.
Data / code should be read from disk whenever required.
The code can be placed anywhere in physical memory without requiring relocation.
More processes should be maintained in the main memory, which increases the
effective use of CPU.
Each page is stored on a disk until it is required after that, it will be removed.
It allows more applications to be run at the same time.
There is no specific limit on the degree of multiprogramming.
Large programs should be written, as virtual address space available is more
compared to physical memory.
Disadvantages of Virtual Memory
Here, are drawbacks/cons of using virtual memory:
Applications may run slower if the system is using virtual memory.
Likely takes more time to switch between applications.
Offers lesser hard drive space for your use.
It reduces system stability.
It allows larger applications to run in systems that don't offer enough physical RAM
alone to run them.
It doesn't offer the same performance as RAM.
It negatively affects the overall performance of a system.
Occupy the storage space, which may be used otherwise for long term data storage.
INTERRUPTS
Data transfer between the CPU and the peripherals is initiated by the CPU. But the
CPU cannot start the transfer unless the peripheral is ready to communicate with
the CPU. When a device is ready to communicate with the CPU, it generates an interrupt
signal. A number of input-output devices are attached to the computer and each device is
able to generate an interrupt request.
The main job of the interrupt system is to identify the source of the interrupt. There is also
a possibility that several devices will request simultaneously for CPU communication.
Then, the interrupt system has to decide which device is to be serviced first.
Priority Interrupt
A priority interrupt is a system which decides the priority at which various devices,
which generates the interrupt signal at the same time, will be serviced by the CPU. The
system has authority to decide which conditions are allowed to interrupt the CPU, while
some other interrupt is being serviced. Generally, devices with high speed transfer such as
magnetic disks are given high priority and slow devices such as keyboards are given low
priority.
When two or more devices interrupt the computer simultaneously, the computer services
the device with the higher priority first.
Types of Interrupts:
When the signal for the processor is from an external device or hardware then these
interrupts is known as hardware interrupt. Let us consider an example: when we press
any key on our keyboard to do some action, then this pressing of the key will generate an
interrupt signal for the processor to perform certain action. Such an interrupt can be of two
types:
• Maskable Interrupt
The hardware interrupts which can be delayed when a much high priority interrupt
has occurred at the same time.
• Non Maskable Interrupt
The hardware interrupts which cannot be delayed and should be processed by the
processor immediately.
2. Software Interrupts
The interrupt that is caused by any internal system of the computer system is
known as a software interrupt. It can also be of two types:
• Normal Interrupt
The interrupts that are caused by software instructions are called normal software
interrupts.
• Exception
Unplanned interrupts which are produced during the execution of some program
are called exceptions, such as division by zero.
In daisy chaining system all the devices are connected in a serial form. The interrupt
line request is common to all devices. If any device has interrupt signal in low level state
then interrupt line goes to low level state and enables the interrupt input in the CPU. When
there is no interrupt the interrupt line stays in high level state. The CPU respond to the
interrupt by enabling the interrupt acknowledge line. This signal is received by the device
1 at its PI input. The acknowledge signal passes to next device through PO output only if
device 1 is not requesting an interrupt.
Key Takeaways
OR GATE:
The OR gate is an electronic circuit which gives a high output if one or more of its inputs
are high. The operation performed by an OR gate is represented by a plus (+) sign.
NOT GATE:
The NOT gate is an electronic circuit which produces an inverted version of the input at its
output. It is also known as an Inverter.
NAND GATE:
The NOT-AND (NAND) gate which is equal to an AND gate followed by a NOT gate.
The NAND gate gives a high output if any of the inputs are low. The NAND gate is
represented by a AND gate with a small circle on the output. The small circle represents
inversion.
NOR GATE:
The NOT-OR (NOR) gate which is equal to an OR gate followed by a NOT gate. The NOR
gate gives a low output if any of the inputs are high. The NOR gate is represented by an
OR gate with a small circle on the output. The small circle represents inversion.
EXCLUSIVE-NOR/Equivalence GATE:
The 'Exclusive-NOR' gate is a circuit that does the inverse operation to the XOR gate. It
will give a low output if one of its inputs is high but not both of them. The small circle
represents inversion.
Boolean algebra
Boolean algebra can be considered as an algebra that deals with binary variables and logic
operations. Boolean algebraic variables are designated by letters such as A, B, x, and y.
The basic operations performed are AND, OR, and complement.
The Boolean algebraic functions are mostly expressed with binary variables, logic
operation symbols, parentheses, and equal sign. For a given value of variables, the Boolean
function can be either 1 or 0. For instance, consider the Boolean function:
F = x + y'z
The logic diagram for the Boolean function F = x + y'z can be represented as:
Note: A truth table can represent the relationship between a function and its binary
variables. To represent a function in a truth table, we need a list of the 2^n combinations
of n binary variables.
The truth table for the Boolean function F = x + y'z can be represented as:
2. F2 = x + y'z
3. F3 = xy' + x'z
Truth tables for F1= xyz', F2= x+y'z, F3= xy'+x'z and F4= x'y'z+x'yz+xy'
x y z F1 F2 F3 F4
0 0 0 0 0 0 0
0 0 1 0 1 1 1
0 1 0 0 0 0 0
0 1 1 0 0 1 1
1 0 0 0 1 1 1
1 0 1 0 1 1 1
1 1 0 1 1 0 0
1 1 1 0 1 0 0
We will simplify this Boolean function on the basis of rules given by Boolean algebra.
AB + A (B+C) + B (B+C)
AB + AB + AC + BB + BC {Distributive law; A (B+C) = AB+AC, B (B+C) =
BB+BC}
AB + AB + AC + B + BC {Idempotent law; BB = B}
AB + AC + B + BC {Idempotent law; AB+AB = AB}
AB + AC +B {Absorption law; B+BC = B}
B + AC {Absorption law; AB+B = B}
Hence, the simplified Boolean function will be B + AC.
The logic diagram for Boolean function B + AC can be represented as:
REGISTERS
A register is a group of flip-flops with each flip-flop capable of storing information. In
addition to the flip-flops, a register may have combinational gates that perform certain
data processing tasks. So a register consists of a group of flip-flops and gates that effect
their transition. The flip-flops hold the binary information and the gates control when and
how new information is transferred into the register.
The fastest, smallest and most expensive type of memory consists of the registers internal
to the processor. Typically, a processor will contain a few dozen of such registers although
some machines contain hundreds of registers.
Micro-Operations
• The operations executed on data stored in registers are called micro-operations. A
micro-operation is an elementary performed on the information stored in one or
more registers. The result of the operation may replace the previous binary
information of a register or may be transferred to another register. A micro-
operation requires only one clock pulse for execution if the operation is done in
parallel.
Categories of Micro-operations
• The micro-operations most often encountered in digital computers are classified
into four categories:
• Register Transfer Micro-operations: transfer binary information from one register
to another.
• Arithmetic Micro-operations: perform arithmetic operation on numeric data
stored in register.
• Logic micro-operations: perform bit manipulation operations on non-numeric
data stored in registers.
• Shift micro-operations: perform shift operations on data stored in registers.
Computer registers are high-speed memory storing units. It is an element of the computer
processor. It can carry any type of information including a bit sequence or single data.
A register should be 32 bits in length for a 32-bit instruction computer. Registers can be
numbered relies upon the processor design and language rules.
The instructions in a computer are saved in memory locations and implemented one after
another at a time. The function of the control unit is to fetch the instruction from the
memory and implement it. The control does the similar for all the instructions in the
memory in sequential order.
A counter is needed to maintain a path of the next instruction to be implemented and
evaluate its address. The figure shows the registers with their memories. The memory
addresses are saved in multiple registers. These requirements certainly state the use for
registers in a computer.
The description for each of the registers determined in the figure is as follows −
The data register holds the operand read from the memory.
The accumulator is a general-purpose register need for processing.
The instruction register holds the read memory.
The temporary data used while processing is stored in the temporary register.
The address register holds the address of the instruction that is to be implemented
next from the memory.
The Program Counter (PC) controls the sequence of instructions to be read. In case
a branch instruction is detected, the sequential execution does not arise. A branch
execution calls for a transfer to an instruction that is not in sequence with the
instructions in the PC.
The input register (INPR) and output register (OUTPR) are the registers used for
the I/O operations. The INPR receives an 8-bit character from the input device. It
is similar to the OUTPR.
Concepts of data representation in digital computers
Data representation in digital circuits
Electronic components, such as microprocessor, are made up of millions of electronic
circuits. The availability of high voltage(on) in these circuits is interpreted as ‘1’ while a
low voltage (off) is interpreted as ‘0’. This concept can be compared to switching on and
off an electric circuit. When the switch is closed the high voltage in the circuit causes the
bulb to light (‘1’ state). on the other hand when the switch is open, the bulb goes off (‘0’
state). This forms a basis for describing data representation in digital computers using the
binary number system.
Data representation on magnetic media
The laser beam reflected from the land is interpreted, as 1. The laser entering the pot is not
reflected. This is interpreted as 0. The reflected pattern of light from the rotating disk falls
on a receiving photoelectric detector that transforms the patterns into digital form. The
presence of a magnetic field in one direction on magnetic media is interpreted as 1; while
the field in the opposite direction is interpreted as “0”.Magnetic technology is mostly used
on storage devices that are coated with special magnetic materials such as iron oxide. Data
is written on the media by arranging the magnetic dipoles of some iron oxide particles to
face in the same direction and some others in the opposite direction
Data representation on optical media
In optical devices, the presence of light is interpreted as ‘1’ while its absence is interpreted
as ‘0’.Optical devices use this technology to read or store data. Take example of a CD-
ROM, if the shiny surface is placed under a powerful microscope, the surface is observed
to have very tiny holes called pits. The areas that do not have pits are called land.
Reason for use of binary system in computers
It has proved difficult to develop devices that can understand natural language directly due
to the complexity of natural languages. However, it is easier to construct electric circuits
based on the binary or ON and OFF logic. All forms of data can be represented in binary
system format. Other reasons for the use of binary are that digital devices are more reliable,
small and use less energy as compared to analog devices.
Bits, bytes, nibble and word
The terms bits, bytes, nibble and word are used widely in reference to computer memory
and data size.
Bits: can be defined as either a binary, which can be 0, or 1.It is the basic unit of data or
information in digital computers.
Byte: a group of bits (8 bits) used to represent a character. A byte is considered as the basic
unit of measuring memory size in computer.
A nibble: is half a byte, which is usually a grouping of 4 bytes.
Word: two or more bits make a word. The term word length is used as the measure of the
number of bits in each word. For example, a word can have a length of 16 bits, 32 bits, 64
bits etc.
Types of data representation
Computers not only process numbers, letters and special symbols but also complex types
of data such as sound and pictures. However, these complex types of data take a lot of
memory and processor time when coded in binary form. This limitation necessitates the
need to develop better ways of handling long streams of binary digits. Higher number
systems are used in computing to reduce these streams of binary digits into manageable
form. This helps to improve the processing speed and optimize memory usage.
Number systems and their representation
A number system is a set of symbols used to represent values derived from a common base
or radix. As far as computers are concerned, number systems can be classified into two
major categories:
decimal number system
binary number system
octal number system
hexadecimal number system
Decimal number system
The term decimal is derived from a Latin prefix deci, which means ten. Decimal number
system has ten digits ranging from 0-9. Because this system has ten digits; it is also called
a base ten number system or denary number system.
A decimal number should always be written with a subscript 10 e.g. X10
But since this is the most widely used number system in the world, the subscript is usually
understood and ignored in written work. However ,when many number systems are
considered together, the subscript must always be put so as to differentiate the number
systems.
The magnitude of a number can be considered using these parameters.
Absolute value
Place value or positional value
Base value
The absolute value is the magnitude of a digit in a number. for example, the digit 5 in 7458
has an absolute value of 5 according to its value in the number line.
The place value of a digit in a number refers to the position of the digit in that number i.e.
whether; tens, hundreds, thousands etc.
The total value of a number is the sum of the place value of each digit making the number.
The base value of a number also k known as the radix, depends on the type of the number
systems that is being used. The value of any number depends on the radix. for example,
the number 10010 is not equivalent to 1002.
Binary number system
It uses two digits namely, 1 and 0 to represent numbers. unlike in decimal numbers where
the place value goes up in factors of ten, in binary system, the place values increase by the
factor of 2. binary numbers are written as X2. consider a binary number such as 10112.The
right most digit has a place value of 1×20 while the left most has a place value of 1×23.
Octal number system
Consists of eight digits ranging from 0-7.the place value of octal numbers goes up in factors
of eight from right to left.
Hexadecimal number system
This is a base 16 number system that consists of sixteen digits ranging from 0-9 and letters
A-F where A is equivalent to 10,B to 11 up to F which is equivalent to 15 in base ten
system. The place value of hexadecimal numbers goes up in factors of sixteen.
A hexadecimal number can be denoted using 16 as a subscript or capital letter H to the
right of the number .For example, 94B can be written as 94B16 or 94BH.
Symbolic representation using coding schemes
In computing, a single character such as a letter, a number or a symbol is represented by a
group of bits. The number of bits per character depends on the coding scheme used.
The most common coding schemes are:
Binary Coded Decimal (BCD),
Extended Binary Coded Decimal Interchange Code (EBCDIC) and
American Standard Code for Information Interchange (ASCII).
Binary Coded Decimal
Binary Coded Decimal is a 4-bit code used to represent numeric data only. For example, a
number like 9 can be represented using Binary Coded Decimal as 10012 .
Binary Coded Decimal is mostly used in simple electronic devices like calculators and
microwaves. This is because it makes it easier to process and display individual numbers
on their Liquid Crystal Display (LCD) screens.
A standard Binary Coded Decimal, an enhanced format of Binary Coded Decimal, is a 6-
bit representation scheme which can represent non-numeric characters. This allows 64
characters to be represented. For letter A can be represented as 1100012 using standard
Binary Coded Decimal
Extended Binary Coded Decimal Interchange code (EBCDIC)
Extended Binary Coded Decimal Interchange code (EBCDIC) is an 8-bit character-coding
scheme used primarily on IBM computers. A total of 256 (28) characters can be coded
using this scheme. For example, the symbolic representation of letter A using Extended
Binary Coded Decimal Interchange code is 110000012.
American standard code for information interchange (ASCII)
American standard code for information interchange (ASCII) is a 7-bit code, which means
that only 128 characters i.e. 27 can be represented. However, manufactures have added an
eight bit to this coding scheme, which can now provide for 256 characters.
This 8-bit coding scheme is referred to as an 8-bit American standard code for information
interchange. The symbolic representation of letter A using this scheme is 10000012..
Binary arithmetic operations
In mathematics, the four basic arithmetic operations applied on numbers are addition,
subtraction, multiplications and division.
In computers, the same operations are performed inside the central processing unit by the
arithmetic and logic unit (ALU). However, the arithmetic and logic unit cannot perform
binary subtractions directly. It performs binary subtractions using a process known for
multiplication and division, the arithmetic and logic unit uses a method
called shifting before adding the bits.
Octal Number System
The Octal Number System is another type of computer and digital numbering system which
uses the Base-8 system
The Octal Numbering System is very similar in principle to the previous hexadecimal
numbering system except that in Octal, a binary number is divided up into groups of only
3 bits, with each group or set of bits having a distinct value of between 000 (0) and 111
( 4+2+1 = 7 ).
Octal numbers therefore have a range of just “8” digits, (0, 1, 2, 3, 4, 5, 6, 7) making them
a Base-8 numbering system and therefore, q is equal to “8”.
Then the main characteristics of an Octal Numbering System is that there are only 8
distinct counting digits from 0 to 7 with each digit having a weight or value of just 8
starting from the least significant bit (LSB). In the earlier days of computing, octal numbers
and the octal numbering system was very popular for counting inputs and outputs because
as it works in counts of eight, inputs and outputs were in counts of eight, a byte at a time.
As the base of an Octal Numbers system is 8 (base-8), which also represents the number
of individual numbers used in the system, the subscript 8 is used to identify a number
expressed in octal. For example, an octal number is expressed as: 2378
Just like the hexadecimal system, the “octal number system” provides a convenient way of
converting large binary numbers into more compact and smaller groups. However, these
days the octal numbering system is used less frequently than the more popular hexadecimal
numbering system and has almost disappeared as a digital base number system.
Representation of an Octal Number
MSB Octal Number LSB
88 87 86 85 84 83 82 81 80
16M 2M 262k 32k 4k 512 64 8 1
As the octal number system uses only eight digits (0 through 7) there are no numbers or
letters used above 8, but the conversion from decimal to octal and binary to octal follows
the same pattern as we have seen previously for hexadecimal.
To count above 7 in octal we need to add another column and start over again in a similar
way to hexadecimal.
0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21….etc
Again do not get confused, 10 or 20 is NOT ten or twenty it is 1 + 0 and 2 + 0 in octal
exactly the same as for hexadecimal. The relationship between binary and octal numbers
is given below.
Hexadecimal
If you work with computer programming or computer engineering (or computer graphics,
about which more later), you will encounter base-sixteen, or hexadecimal, math.
As mentioned before, decimal math does not have one single solitary digit that represents
the value of "ten". Instead, we use two digits, a 1 and a 0: "10". But in hexadecimal math,
the columns stand for multiples of sixteen! That is, the first column stands for how many
units you have, the second column stands for how many sixteens, the third column stands
for how many two hundred fifty-sixes (sixteen-times-sixteens), and so forth.
In base ten, we had digits 0 through 9. In base eight, we had digits 0 through 7. In base 4,
we had digits 0 through 3. In any base system, you will have digits 0 through one-less-
than-your-base. This means that, in hexadecimal, we need to have "digits" 0 through 15.
To do this, we would need single solitary digits that stand for the values of "ten", "eleven",
"twelve", "thirteen", "fourteen", and "fifteen". But we don't. So, instead, we use letters.
That is, counting in hexadecimal, the sixteen "numerals" are:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
In other words, A is "ten" in "regular" numbers, B is "eleven", C is "twelve", D is
"thirteen", E is "fourteen", and "F" is fifteen. It is this use of letters for digits that makes
hexadecimal numbers look so odd at first. But the conversions work in the usual manner.
Convert 35710 to the corresponding hexadecimal number.
Here, I will divide repeatedly by 16, keeping track of the remainders as I go. (You might
want to use some scratch paper for this.)
Reading off the digits, starting from the top and wrapping around the right-hand side, I see
that:
35710 = 16516.
Convert 16516 to the corresponding decimal number.
List the digits, and count them off from the RIGHT, starting with zero:
digits: 1 6 5
numbering: 2 1 0
Remember that each digit in the hexadecimal number represents how many copies you
need of that power of sixteen, and convert the number to decimal:
1×162 + 6×161 + 5×160
= 1×256 + 6×16 + 5×1
= 256 + 96 + 5
= 357
Then 16516 = 35710.
Convert 6393310 to the corresponding hexadecimal number.
I will divide repeatedly by 16, keeping track of my remainders:
From the sequential division above, I can see that the hexadecimal number will have a
"fifteen" in the sixteen-cubeds column, a "nine" in the sixteen-squareds column, an
"eleven" in the sixteens column, and a "thirteen" in the ones column. But I cannot write the
hexadecimal number as "1591113", because this would be confusing and imprecise. So I
will use the letters for the "digits" that are otherwise too large, letting "F" stand in for
"fifteen", "B" stand in for "eleven", and "D" stand in for "thirteen".
Then 6393310 = F9BD16.
Convert F9BD to decimal notation.
I will list out the digits, and count them off from the RIGHT, starting at zero:
digits: F 9 B D
numbering: 3 2 1 0
Actually, it will probably be helpful to redo this, converting the alphabetic hexadecimal
"digits" to their corresponding "regular" decimal values:
digits: 15 9 11 13
numbering: 3 2 1 0
Now I'll do the multiplication and addition:
15×163 + 9×162 + 11×161 + 13×160
= 15×4096 + 9×256 + 11×16 + 13×1
= 61440 + 2304 + 176 + 13
= 63933
As expected, F9BD16 = 6393310.
and 25510 = FF16.
Hexadecimal Numbers group binary numbers into sets of four allowing for the conversion
of 16 different binary digits. The one main disadvantage of binary numbers is that the
binary string equivalent of a large decimal base-10 number can be quite long.
When working with large digital systems, such as computers, it is common to find binary
numbers consisting of 8, 16 and even 32 digits which makes it difficult to both read or
write without producing errors especially when working with lots of 16 or 32-bit binary
numbers.
One common way of overcoming this problem is to arrange the binary numbers into groups
or sets of four bits (4-bits). These groups of 4-bits uses another type of numbering system
also commonly used in computer and digital systems called Hexadecimal Numbers.
The “Hexadecimal” or simply “Hex” numbering system uses the Base of 16 system and
are a popular choice for representing long binary values because their format is quite
compact and much easier to understand compared to the long binary strings of 1’s and 0’s.
Being a Base-16 system, the hexadecimal numbering system therefore uses 16 (sixteen)
different digits with a combination of numbers from 0 through to 15. In other words, there
are 16 possible digit symbols.
However, there is a potential problem with using this method of digit notation caused by
the fact that the decimal numerals of 10, 11, 12, 13, 14 and 15 are normally written using
two adjacent symbols. For example, if we write 10 in hexadecimal, do we mean the
decimal number ten, or the binary number of two (1 + 0). To get around this tricky problem
hexadecimal numbers that identify the values of ten, eleven, . . . , fifteen are replaced with
capital letters of A, B, C, D, E and F respectively.
Then in the Hexadecimal Numbering System we use the numbers from 0 to 9 and the
capital letters A to F to represent its Binary or Decimal number equivalent, starting with
the least significant digit at the right hand side.
As we have just said, binary strings can be quite long and difficult to read, but we can make
life easier by splitting these large binary numbers up into even groups to make them much
easier to write down and understand. For example, the following group of binary
digits 1101 0101 1100 11112 are much easier to read and understand
than11010101110011112 when they are all bunched up together.
In the everyday use of the decimal numbering system we use groups of three digits or 000’s
from the right hand side to make a very large number such as a million or trillion, easier
for us to understand and the same is also true in digital systems.
Hexadecimal Numbers is a more complex system than using just binary or decimal and
is mainly used when dealing with computers and memory address locations. By dividing a
binary number up into groups of 4 bits, each group or set of 4 digits can now have a possible
value of between “0000” (0) and “1111” ( 8+4+2+1 = 15 ) giving a total of 16different
number combinations from 0 to 15. Don’t forget that “0” is also a valid digit.
We remember from our first tutorial about Binary Numbers that a 4-bit group of digits is
called a “nibble” and as 4-bits are also required to produce a hexadecimal number, a hex
digit can also be thought of as a nibble, or half-a-byte. Then two hexadecimal numbers are
required to produce one full byte ranging from 00 to FF.
Also, since 16 in the decimal system is the fourth power of 2 ( or 24 ), there is a direct
relationship between the numbers 2 and 16 so one hex digit has a value equal to four binary
digits so now q is equal to “16”.
Because of this relationship, four digits in a binary number can be represented with a single
hexadecimal digit. This makes conversion between binary and hexadecimal numbers very
easy, and hexadecimal can be used to write large binary numbers with much fewer digits.
The numbers 0 to 9 are still used as in the original decimal system, but the numbers
from 10 to 15 are now represented by capital letters of the alphabet from A to F inclusive
and the relationship between decimal, binary and hexadecimal is given below.
Hexadecimal Numbers
Decimal Number 4-bit Binary Number Hexadecimal
Number
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
16 0001 0000 10 (1+0)
17 0001 0001 11 (1+1)
Continuing upwards in groups of four
Using the original binary number from above 1101 0101 1100 11112 this can now be
converted into an equivalent hexadecimal number of D5CF which is much easier to read
and understand than a long row of 1’s and 0’s that we had before.
So by using hexadecimal notation, digital numbers can be written using fewer digits and
with a much less likelihood of an error occurring. Similarly, converting hexadecimal based
numbers back into binary is simply the reverse operation.
Then the main characteristics of a Hexadecimal Numbering System is that there are 16
distinct counting digits from 0 to F with each digit having a weight or value of 16 starting
from the least significant bit (LSB). In order to distinguish Hexadecimal numbers from
Denary numbers, a prefix of either a “#”, (Hash) or a “$” (Dollar sign) is used before the
actual Hexadecimal Number value, #D5CF or $D5CF.
As the base of a hexadecimal system is 16, which also represents the number of individual
symbols used in the system, the subscript 16 is used to identify a number expressed in
hexadecimal. For example, the previous hexadecimal number is expressed as: D5CF16
Counting using Hexadecimal Numbers
So we now know how to convert 4 binary digits into a hexadecimal number. But what if
we had more than 4 binary digits how would we count in hexadecimal beyond the final
letter F. The simple answer is to start over again with another set of 4 bits as follows.
0…to…9, A,B,C,D,E,F, 10…to…19, 1A, 1B, 1C, 1D, 1E, 1F, 20, 21….etc
Do not get confused, 10 or 20 is NOT ten or twenty it is 1 + 0 and 2 + 0 in hexadecimal. In
fact twenty does not even exist in hex. With two hexadecimal numbers we can count up
to FF which is equal to decimal 255. Likewise, to count higher than FF we would add a
third hexadecimal digit to the left so the first 3-bit hexadecimal number would
be 10016,(25610) and the last would be FFF16, (409510). The maximum 4-digit
hexadecimal number is FFFF16 which is equal to 65,535 in decimal and so on.
Representation of a Hexadecimal Number
MSB Hexadecimal Number LSB
168 167 166 165 164 163 162 161 160
4.3G 2.6G 16M 1M 65k 4k 256 16 1
This adding of additional hexadecimal digits to convert both decimal and binary numbers
into an Hexadecimal Number is very easy if there are 4, 8, 12 or 16 binary digits to
convert. But we can also add zero’s to the left of the most significant bit, the MSB if the
number of binary bits is not a multiple of four.
For example, 110010110110012 is a fourteen bit binary number that is to large for just
three hexadecimal digits only, yet too small for a four hexadecimal number. The answer is
to ADD additional zero’s to the left most bit until we have a complete set of four bit binary
number or multiples thereof.
Adding of Additional 0’s to a Binary Number
The main advantage of a Hexadecimal Number is that it is very compact and by using a
base of 16 means that the number of digits used to represent a given number is usually less
than in binary or decimal. Also, it is quick and easy to convert between hexadecimal
numbers and binary.
Hexadecimal Numbers Example No1
Convert the following Binary number 1110 10102 into its Hexadecimal number
equivalent.
Group the bits into four’s starting from the right hand side
= 1110 1010
= 14 10 (in decimal)
= E A (in Hex)