0% found this document useful (0 votes)
11 views173 pages

Computer Science - Unit 1 Mod 1

The document provides an overview of computer architecture, detailing various types of computers such as supercomputers, servers, microcomputers, and mobile devices, along with their purposes. It also covers essential components like input/output devices, memory types, storage devices, and the importance of logic gates and truth tables in digital circuits. Additionally, it discusses data representation and the significance of Boolean logic in digital systems.

Uploaded by

brandon.johnson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views173 pages

Computer Science - Unit 1 Mod 1

The document provides an overview of computer architecture, detailing various types of computers such as supercomputers, servers, microcomputers, and mobile devices, along with their purposes. It also covers essential components like input/output devices, memory types, storage devices, and the importance of logic gates and truth tables in digital circuits. Additionally, it discusses data representation and the significance of Boolean logic in digital systems.

Uploaded by

brandon.johnson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 173

Computer Architecture

Unit 1 Module 1
Types of Computers
Computers come in different types based on their processing power, size, and purpose.
The most powerful type of
computer, designed for extremely
Supercomput fast calculations and processing
vast amounts of data.
er
Used in scientific research,
weather forecasting, nuclear
simulations, and artificial
intelligence.

E.g. the IBM Summit used for


climate modeling and medical
research.
Server A computer designed to manage
network resources and provide
services to other client
computers/nodes.

Stores and processes data for


websites, applications, networks
and cloud computing.
Microcomput A personal computer (PC)
designed for general use
er (Desktop) by individuals or
businesses.

Used for office work,


entertainment, gaming,
and programming.
Mobile Portable computing devices
Devices designed for communication,
entertainment, and productivity.

Used for calls, internet browsing,


gaming, and mobile
applications. On the go
communications.
Hardware
Component
s
state the purpose of the main
components of a computer system;
Input and Output Devices
Input Devices

 A piece of hardware that PROVIDES


information TO the computer. It ONLY
sends data to the computer.
 List some examples:
Output A piece of hardware that only
RECIEVES information FROM the
Device computer, usually for display,
projection or physical production.

List some examples:


Output Quality
 Output Quality refers to the
degree to which a set of
characteristics is deemed an
acceptable standard of a
particular time.
 A 2 mega-pixel camera was the
BOMB back in 2009.
 PS I invented the bathroom
selfie!
A device capable of both
providing and receiving
Input and information from the
Output computer system.
Device List example
Port
Connectivity
A physical connection on a computer system used
for passing data between the computer system and
peripherals, networks, or other systems.
Input/Output (I/O) Ports eg USB (Universal Serial
Bus), HDMI (High-Definition Multimedia Interface),
and VGA (Video Graphics Array).
Networking Ports e.g Ethernet (RJ-45), Wi-Fi Adapter.

Storage & Expansion Ports e.g.. SD Card Slot

You should Click here https://www.electronicshub.org


/types-of-computer-ports/
Speed of device

This is the rate at


which a computer
transfers information Usually measured in
from the computer to Hertz.
the input or output
device.
Specialized devices were developed to
meet a special need of a group of
Specialized people.
Multifunction Printer – It’s a printer
devices that comes with scanning capabilities

Devices for the disabled

Interactive whiteboards
Memory
https://www.youtube.com/watch?v=H_M--weEzpA&t=120s
 ROM - is a type of computer storage containing
nonvolatile, permanent data that, normally, can only be
read and not written to. ROM contains the programming
that enables a computer to start up or regenerate each
time it is turned on.
 PROM - is ROM that can be modified once by a user. It
enables a user to tailor a microcode program using a
special machine called a PROM programmer.
 EPROM is programmable read-only memory PROM that
can be erased and re-used. Erasure is caused by shining
an intense ultraviolet light through a window designed

Types of
into the memory chip.
 EEPROM is a user-modifiable ROM that can be erased
and reprogrammed repeatedly through the application
Memory of higher than normal electrical voltage. Unlike EPROM
chips, EEPROMs do not need to be removed from the
computer to be modified.
 RAM - The term is based on the fact that any storage
location can be accessed directly by the processor.
 Cache Memory This temporary storage area, known as
a cache, is more readily available to the processor than
the computer's main memory source. It is also called
CPU memory because it is typically integrated directly
into the CPU chip or placed on a separate chip with a
bus interconnect with the CPU.
 Source:
https://whatis.techtarget.com/definition/memory (read
 Speed: RAM frequency works off of clock cycles.
Each read and write is done on a cycle. The
more cycles your RAM can perform per second
translates to how much data can be stored and
read – making for smoother user experiences.
 Size: How much memory or RAM should my
computer have? This depends on what you want
to do. Usually the software come with system
Features of requirements. But for today’s standards a min of
4GB and Excellent is 16GB or more.

Memory  Volatility: Volatile Memory is used to store


computer programs and data that CPU needs in
real time and is erased once computer is
switched off. RAM and Cache memory are
volatile memory. Where as Non-volatile memory
is static and remains in the computer even if
computer is switched off. ROM and HDD are non-
volatile memory.
 Source: https://www.wepc.com/tips/ram-speed/
Storage Devices
 This is a topic we covered
EXTENSIVLY in 4th form. Please
review those notes and pay KEEN
attention to
Capacity – How much Bytes of
data can it store. Anything less
than GB, TB nuh mek sense.
Storage Access speed – How fast can
devices data be transferred. Usually
measured in Bits per sec
Access method – Random
access, sequential access,
indexed sequential access
Portability – whether it can be
easily detached and become
portable.
Access Method

 The access speed of a storage device refers to how quickly data can be read from or
written to it. Measured in Hertz.
 The access method of a storage device refers to how the data is retrieved. It is the
technique that is used to store and retrieve data.
 There are three different methods which can be used to access (locate) data stored on
a backing storage device. They are direct access, serial access and sequential access.
Direct Access
 When direct access is used the
head that reads data from the
storage medium can move
directly to any point on the
storage medium. If a particular
record or file must be loaded or
saved, then the head can move
directly to the record/file's
position on the storage medium
and read the data. Magnetic disks
such as hard disks(HDD) and
floppy disks and optical disks such
as CD-ROMs use the direct access
method.
 The storage medium is divided
into fixed blocks or sectors. The
system can jump to a specific
block without reading everything
before it. Still, some mechanical
movement is required.
Random Access

 Any memory cell can be accessed directly and instantly, without mechanical
movement.
 Data is stored in a way that allows each memory unit to be reached independently.
Each memory unit has its own set of pins, and they are all connected to the CPU.
 Examples: RAM (Random Access Memory), SSDs (Solid-State Drives), Cache Memory.
Serial Access
 When a serial access medium
is being used, the head that
reads data from the storage
medium has limited freedom
of movement. The only serial
access medium is magnetic
tape.
 The tape head can not move
to a particular record/file on
the tape without reading
through all of the other
records that come before it.
 Data is stored and accessed
in the order it was written
without any categorization.
Sequential Access

 Sequential access is a slight modification of the serial access method. This method is
identical to serial access except that the records are stored on the storage medium in
a particular order, e.g. by customer number.
 Sorting the data into an order may speed up operations such as searching the tape.
The sequential access method is usually used by batch processing systems using
multiple tapes.
 Data is stored in a specific order and can be read sequentially eg alphabetically.
 One way to think about it is a book is written and ordered by chapters and pages.
 Indexed Sequential is a book that comes with a table of content that allows you to
go directly to a page/chapter. The TOC is the index. Or some books have an index at
the back. The system maintains an index table that maps key values to storage
locations.
Device
Power
Protectio
n
 The biggest risk to the computer system is
electricity (too much or the lack thereof).
 What do we use to protect against this risk?
 Surge protector - Surge protectors, also known
as surge suppressors, are a device used to
protect against electrical surges. Electrical
surges can have many causes, such as lightning
Device strikes or faulty wiring, and can severely
damage electrical devices connected to the
Power power grid. When a surge is detected, a surge
protector diverts the surge to the ground,
preventing it from reaching the connected
Protection devices.
 Voltage regulator - Voltage regulators are
devices used to provide a constant voltage to
any connected electrical devices. If the voltage
given to an electrical device is too high or too
low, it could cause damage. Voltage regulators
help prevent this, adjusting the provided voltage
up or down to keep it at the correct levels.
 UPS – Uninterrupted power supply.
PP Questions
Computer
Architectur
e
describe the basic building blocks of a
computer;
 Analogue data is a real-life signal that can
vary greatly in value. Examples include:
 sound waves
 pressure

Analogue  temperature
 Digital data is binary data which represents
data and analogue data. Computers work with digital
data.

Digital data  Analogue data must be converted to digital


before a computer can use it. A device known
as an analogue-to-digital convertor (ADC) is
used to generate digital data from analogue
signals.
 In the same way, a digital signal can be
converted back to an analogue signal using a
digital-to-analogue convertor (DAC).

https://www.bbc.co.uk/bitesize/guides/zfs
pfcw/revision/1
Analogue data and
Digital data

 There are two main types of signals


used in electronics: analog and digital
signals.
 Digital electronic circuits are the
foundation of modern computers.
 They process digital signals, which are
represented as binary values (0s and 1s).
 These circuits form the basic building
blocks of computer systems, such as
Digital processors, memory, and input/output
devices.
Circuits  Basic Digital Components:
 AND Gate
 NOT Gate
 OR Gate
 Types of Digital Circuits:
 Combinational Circuits
 Sequential Circuits
 Truth tables were developed in computer science
as a way of solving complexed logical calculations.
A truth table is a mathematical table used in
logic and digital electronics to represent the
relationship between the inputs and outputs of a
logical expression or digital circuit.
 To determine logic, we use Statements or
Propositions in the form of p, q and r. These

Truth Tables statements are either TRUE(1) or FALSE(0).


 A truth table consists of columns for:
1. Inputs: Possible binary values (0 or 1) for each input
variable.
2. Outputs: The resulting value of the logical
expression or circuit for each combination of inputs.
 For a logic gate with n inputs, there are 2^n
possible input combinations.
Why Are Truth Tables Important?
1. Digital Circuit Design: Helps in
understanding the behavior of logic
gates and circuits.
2. Boolean Algebra: Simplifies logical
Truth Tables expressions by analyzing input-output
relationships.
3. Error Checking: Identifies errors in
logical expressions or circuits by
comparing expected and actual
outputs.
Logic Gates
 A logic gate is a simple circuit that
determines whether an input
impulse can pass through to give an
output based on a given truth/logic
table.
 The building blocks of a digital
circuit are logic gates, which
execute numerous logical
operations that are required by any
digital circuit. They perform basic
logical functions on one or more
binary inputs to produce a single
binary output.
 The 3 primary gates are the
 NOT
 AND
 OR
 The NOT gate is a unary gate, meaning it has
only one input. It inverts the input; if the input is
true (1), the output is false (0), and vice versa. It
is also known as a logical negation.

NOT Gate
AND Gate
 A binary operation, meaning it only
takes in 2 values at a time, is also
known as a logical conjunction.

 Practical Use: A login system for your


email requires two conditions P: The
Username is correct. Q: The Password
is correct. The user only gains access
if both inputs are valid. This system
works like an AND gate.
OR Gate

 A binary operation, meaning it only


takes in 2 values at a time, is also
known as a logical disjunction.
 Practical Use: An alarm system with
two trigger points P and Q. The alarm
will sound if one or both triggers are
detonated. If none of the triggers go
off the alarm will not sound.
Combinational Circuits
https://www.youtube.com/watch?v=BnB2m1nXZ84
 Combinational Circuits – It is a combination
of the basic logic gates.
 NAND
 NOR
 XOR
 Build Your Own – we can build our own
combinational circuit based on a desired
Combination output.
 Special Combinational Circuits:
al Circuits  Encoder
 Decoder
 Multiplexor
 De-multiplexor
 Adder
 Write the Boolean expression and

NAND the truth table for the following.


 Not-And=NAND
NOR

 Write the Boolean expression and


the truth table for the following.
 Not-OR = NOR
XOR

 Exclusive OR requires
exactly one True and one
False value Table; result
in True.
 We have the Truth Table;
Lets build the circuit and
algebraic expression for this
gate.
Conditionality

 Logical Implication or IF – Then Operator examines two statements and


deduce if the second statement can be as a result of the first
statement.
 We have the Truth Table, Lets build the circuit and algebraic expression
for this gate.

Bi-Conditionality

 Logical equality or IF and only if produces a value of true if and only if


both operands are false or both operands are true.
 We have the Truth Table, Lets build the circuit and algebraic expression
for this gate.
Combining Logic Gates
Exercises
Write the Boolean expression and the truth table for each of the following.
Those were too
easy!
Boolean Logic

 Digital systems are constructed using logic gates. Gates are switches that produce an
output signal representing either on(1) or off (0) according to a particular logical
operation. Logic gates turn input into output according to Boolean logic.
Simplifying Boolean Logic
The Laws of Boolean Logic
From the Boolean Expression
Derive the Circuit and Truth table
Draw a circuit
from truth
table

https://www.youtube.com/wat
ch?v=ejjCMnmDx0k
Data
Representati
on
Explain how data is represented in a computer system
Bits; bytes; fixed (signed magnitude, ones and twos complement) and
floating point (sign, mantissa and exponent) numbers and character
representation; number systems/bases.
Data
Units
Number Systems
Binary, Octal, Decimal, Hexadecimal, BCD
Number
Systems
 Binary Coding schemes represent the
data such as alphabets, digits 0−9,
and symbols in a standard code.
 The binary coding schemes that are
Binary most commonly used are:
 Extended Binary Coded Decimal
Coding Interchange Code (EBCDIC) – 8bits

Schemes  American Standard Code for


Information Interchange (ASCII) –
7bits
 Unicode – 32bits
Character
Representati
on Chart
Binary Decimal
Binary Decimal
Octal Binary

 Convert each octal digit to the binary equivalent and put it together in order.
 728
 148
 4568
 2018
 1438
 6708
Octal Binary

 Separate binary in groups of 1 bits then convert each to the Octal equivalent. Add
leading 0s if necessary.
 1000011
 110000
 10000001
 111101
 100011
 11111
Hexadecimal Binary

 The Hexadecimal number systems has 16 symbols − 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and A,


B, C, D, E, F. Where A, B, C, D, E and F are single bit representations of decimal value
10, 11, 12, 13, 14 and 15 respectively.
Hexadecimal Binary
Recap

Bit: The smallest Byte: A group of 8


unit of data in a bits. A byte can
computer, represent 256
representing a different values
single binary value (from 0 to 255 in
(0 or 1). decimal).
Fixed-Point
Representation
Fixed Point Binary Representation allows for positive and negative integers.
 Previously, all the numbers we looked at
were unsigned and so only the magnitude is
represented.
 Integers are both positive and negative.
 Sign and magnitude is one way of
representing signed binary numbers, where
the most significant bit (MSB) is used as
the sign bit.
 The sign is represented as the first bit (from
Sign and left to right). 1 = -ve 0 = +ve

Magnitude  Therefore, there are max and min values


that can be represented.
 In a 4-bit sequence 1111 = - 7 and 0111 =
+7
 In an 8 bit sequence the highest integer is
+127 and the lowest integer is -127.
 NB. You will always be told the number of
bits used in your representation.
 Remove the sign bit, convert the
magnitude.
 (i) (01101101)2 =
What is the  (ii) (11101101)2 =
decimal  (iii) (00101011)2 =

equivalent?  (iv) (10101011)2 =


 (v) (00000000)2 =
 (vi) (10000000)2 =
 Write the 8-bit binary equivalent of:
 + 79

What is the  - 82
 -21
binary  Write the 4-bit binary equivalent of:

equivalent?  -5
 4
 -7
 Showing all working, find the
largest and smallest integers
that can be represented using
6 bits if signed magnitude is
used.
Past Paper
Questions  State the largest positive
integer and the largest
negative integer that can be
stored using eight bits if signed
magnitude is used.
Quick Math
Sign and Advantages: Disadvantag
Magnitude Simple to understand
because it mirrors the
es:
Addition and subtraction are
more complex because the
human understanding of a sign bit must be handled
sign and magnitude. Sign in separately. The sign must be
front and number follows. checked, and different rules
apply for addition vs
subtraction. This makes it
Conversion between positive computationally inefficient.
and negative is
straightforward—just flip the
MSB(most sig. bit). Two representations for zero:
0000 (positive zero) and
1000 (negative zero). This
wastes one of the possible
values in the binary system.
 Another way of representing
negative numbers is by using
the Two’s Complement method.
It eliminates the problems of sign
and magnitude.
 Two's complement is the most
Two’s widely used method for representing
signed integers in computers.
Complemen  It simplifies the arithmetic
operations and makes the
t representation of negative numbers
more efficient.
 To find the two's complement of a
binary number:
 Invert the bits.(ones complement)
 Add 1 to the least significant bit (LSB).
Two’s
Complemen
t
Binary
Addition
Advantages:
• Addition and subtraction work the same
way as with unsigned numbers, and the
sign is handled naturally.
Two’s • Single representation for zero: Zero is
always represented as 0000.
Compleme • It is easier for hardware to handle
calculations. Simpler and faster to
nt implement in digital circuits, which is
why modern computers and processors
use two's complement.

Disadvantages:
• Less intuitive as representing and
reading negative numbers requires
understanding the two's complement
process.
• Conversion can be confusing for
beginners.
Dealing with Real
Numbers
Fixed and Floating Point values.
Fixed Point Binary

 Fixed point in binary still has the


point as in decimal, but now we have
1’s and 0’s to deal with:
 Eg 01001101100 =
0100110.1100
 This is because the position of the
decimal point is fixed and always set
to the same position
Try this!

 Convert the binary number 0001011100 to denary. It is represented in unsigned


fixed-point form with 6 places before the binary point and 4 places after the binary
point.

 https://isaaccomputerscience.org/concepts/data_numbases_fixed_point?examBoard=al
l&stage=a_level
Decimal to Fixed Point Binary Conversion

 Convert 14.125 o an unsigned fixed


point binary number using 5 bits for
the whole part and 3 bits for the
fractional part.
 Whole number convert as usual
(dividing by 2)
 Decimals multiply by 2 until you get a
1. See 

 Hence, 14.125 in fixed point binary is


01110001

 NB. For recurring decimals we use


truncated rounding.
Floating point Numbers

 When dealing with very large or very small numbers, a more flexible technique,
known as floating point representation, can be employed. This allows the way that the
bits are allocated to vary so that both very large and very small numbers can be
represented.
 All large/small real numbers can be written in this common and consistent format.
 123456.7 = 0.1234567 x 106
 0.001234 = 0.1234 x 10-2
 1234.567 = 0.1234567 x 104
To convert to binary, we convert the mantissa and
the exponent.
Floating point Numbers

 Standard form but in Binary. It has 3 parts the sign, mantissa and the exponent.
 Sign Bit: Indicates whether the number is positive (0) or negative (1).
 Mantissa: Represents the significant digits of the number.
 Exponent: Indicates the scale of the number.
 Floating point numbers are stored in twos complement/sign and magnitude.
 The standard format for floating-point representation is defined by the IEEE 754
standard, which specifies different formats, including single precision (32 bits) and
double precision (64 bits).
Floating point Numbers

 The first bit is the sign bit.


 The next given number of bits is the exponent and the mantissa.
 The decimal point is found after the sign and the exponent tells how many spaces it is
moved to the right.
 Convert using the fixed-point format.
 https://www.youtube.com/watch?v=Zzx7HN4wo3A
Decimal Binary

 Convert to fixed point format


 Whole number convert as usual (dividing by
2)
 Decimals multiply by 2 until you get a 1 (
https://www.youtube.com/watch?v=kWLv0xn
Nd60
)
 Count the number of spaces that you float
the point to the front of the fixed-point format
= exponent.
 Place the sign bit at the front of the mantissa,
then the exponent(approx. 3bits)
example

 Convert this decimal number 13.3125 to binary.


 https://isaaccomputerscience.org/concepts/data_numbases_floating_point
 https://studylib.net/doc/6620747/floating-point-binary
-practice-questions
 https://youtu.be/DD7fiyLyIBI
 Overflow occurs when the result of a calculation
requires more bits (place values) than are in the
available range.
 For example, when using eight bits, the largest
number that can be recorded is 11111111
(denary 255). When adding together two eight-bit
numbers, a situation may occur when the result
requires more than eight bits to hold it. For
example, adding the binary numbers 11111110
Overflow (denary 254) and 00000010 (denary 2) would give
00000000.
 The result is actually 10000000 (denary 256),
which requires nine bits. However, as only eight
bits are available to hold the number, the result
would be 00000000 (denary 0).
 As you can see, overflow can have serious
consequences for the validity of calculations.
Binary Multiplication and Division

 Binary numbers are multiplied and divided through a process called shifting.
 Multiplication
 To multiply a number, a binary shift moves all the digits in the binary number
along to the left and fills the gaps after the shift with 0:
 to multiply by two, all digits shift one place to the left
 to multiply by four, all digits shift two places to the left
 to multiply by eight, all digits shift three places to the left
 Division
 To divide a number, a binary shift moves all the digits in the binary number along
to the right:
 to divide by two, all digits shift one place to the right
 to divide by four, all digits shift two places to the right
 to divide by eight, all digits shift three places to the right
Special Circuits
Combining basic logic gates for a desired output.
Storing bits – Sequential Logic
Circuits

 Storage devices are made up of circuits that store individual bits.


 One commonly used circuit that is used in all storage devices is a FLIP FLOP/Latch.
 Sequential Logic circuits remember their conditions and stay fixed in their current state
until the next clock signal changes one of the states, giving sequential logic circuits
“Memory”.
 The output state of a sequential logic circuit is based on one of the following states:
 the “present input”,
 the “past input” and/or the “past output”.
 Sequential Logic circuits remember these conditions and stay fixed in their current state
until the next clock signal changes one of the states, giving sequential logic circuits
“Memory”.
Flip Flops

 Flip-flops are sequential logic circuits that store binary data.


 A flip flop is a binary cell that holds one bit of data. They are used in memory
elements, registers, and counters. It is a single bit storage device.
 Flip-flops are known as a bistable device. A bistable device is a device in which the
output can remain in one of two states indefinitely.
 In sequential logic, the flip flop is the basic storage element.
 The two states of a flip flop represent “one” and “zero”. Flip-flops store a single bit of
data, which remains unchanged until a triggering event modifies it.
 https://www.youtube.com/watch?v=-aQH0ybMd3U
Flip Flops

• The term flip – flop is used as they can switch between


the states under the influence of a control signal
(clock or enable)
• Some of the most common flip – flops are SR Flip –
flop (Set – Reset), D Flip – flop (Data or Delay).
• https://www.youtube.com/watch?v=kt8d3CYWGH4
• https://www.youtube.com/watch?v=Hi7rK0hZnfc
Flip flops are used in:
• Registers: As the flip flops have two stable states, we use them in memory elements like
registers, for data storage. Generally, we use registers in electronic devices like computers.
• Counters: The groups of interconnected flip flops are uses as counters, to count the increment
or decrement of an event occurrence.
 The Set (S) input is used to store a binary 1 in
the flip-flop.
 The Reset (R) input is used to store a binary 0
Flip flops in the flip-flop.
 If both inputs are 0, the output remains in its
previous state (no change, hence remembers)
1 0 1 0
(Remembers
0 0 No No
change change
previous state)

0 1 0 1

0 1 0 1 Resets Q to 0

1 1
Basic SR Flip-Flop
Types of Flip
Flops

S-R Flip Flop

J-K Flip Flop

D Flip Flop
Used in basic memory
units for storing a single
Application bit.
s of SR
Employed in control
Flip-Flops circuits to remember
ON/OFF states.

Forms the foundation for


more complex JK, D,
and T flip-flops.
JK Flip Flop

 In J-K flip flop when both inputs are HIGH, the output toggles i.e. it changes from high
to low and low to high periodically when both the inputs are 1. For an SR flip flop,
however, when both the inputs are HIGH, we encounter an invalid state, which is not
present for a JK flip flop.
 In the SR Flip-Flop, when both inputs S and R are 1 then the output of the flip-flop is
indeterminate. That issue can be resolved using the JK Flip-Flop. Similar to the SR Flip-
Flop, the JK flip-flop has two inputs. And using the two inputs the flip-flop can be set,
reset, hold (memory) or toggled. Unlike the SR flip-flop, in the JK flip-flop, when both
inputs J and K are 1 then the output of the flip-flop toggles.
JK Flip flop
The System Clock

 The most fundamental characteristic of synchronous sequential circuits is a system


clock.
 This is an electronic circuit that produces a repetitive train of logic 1 and logic 0 at a
regular rate, called the clock frequency. for example – 2 GHz, 1GHz, 500MHz, and
125MHz.
 The clock input is very important to the concept of a sequential circuit. At each “tick”
of the clock the output of a sequential circuit is determined by its input and by its
state.
D Flip-Flop

 The D Flip-Flop (also called a Delay or Data Flip-Flop) is an improvement over the
SR Flip-Flop. It eliminates the undefined state problem by ensuring that only one
input is used. This flip-flop has a single data input (D) and a clock input (CLK).
 A D Flip-Flop can be constructed using a modified SR flip-flop with an inverter placed
between the S and R inputs. This guarantees that S and R are never high at the
same time, preventing the undefined state.
D Flip-flop

 When D = 0 on the rising edge


of the clock, the output Q is
reset to 0
 When D = 1 on the rising edge
of the clock, the output Q is set
to 1.
 Between clock pulses, the
output remains unchanged,
preserving the stored state.
Registers

 A register is a group of flip-flops connected together, controlled by a common clock


signal.
 Flip flops can be used to store a single bit of binary data (1or 0). However, to store
multiple bits of data, we need multiple flip flops.
 A register is a group of n flip-flops in a row. Each flip flop stores 1 bit, so the register
can store an n bit word.
 The register is a device that stores 1 memory word (8 bits, 16bits, 32 bits etc.)
 The computer memory is just a very large array of registers. Registers are essential in
digital systems for temporary storage and data transfer.
4-bit Parallel Register
Data Storage: Temporary storage of data in CPU

Data Transfer: Moving data from one part of a


Application circuit to another.

s of Counters: Used in counters and timers.


Registers
Arithmetic Operations: Participates in addition,
subtraction, and other operations.

Shift Register – a special purpose register that


can be used to move the bits in a word to the left
or to the right. Multiplication and division uses a
shift register.
Counters

 A counter is a special register(array of flipflops) that holds an m-bit word and


increases/decreases its content by x (usually 1).
 Counters can count up or down by 1, or any number, or they can count through any
given sequence.
 Counters are generally guided by the clock pulses to increment in value.
 Digital Clocks: Used to count time in seconds, minutes, and hours.
 Frequency Counters: Measure the frequency of signals.
 Event Counters: Count the number of occurrences of an event (e.g., people entering a room).
 Digital Timers: Used in digital circuits for timing applications.
 State Machines: Help manage states in sequential circuits.
 The adder is a circuit that performs two-bit
addition.
 Recall 1+1 = 0 carry 1 etc….
 They are essential in arithmetic logic units
(ALUs), which are part of computer
Adder processors.
 There are 2 types of adders – Half Adder and
Full Adder.
 https://www.youtube.com/watch?v=thkTzdnk
L5U
 https://www.youtube.com/watch?v=m0C3-JW
Wvcc
 The Half adder takes in 2 bits and outputs 2 bits (sum and
carry)
 Let’s draw the truth table and create the circuit for the half
adder using only primary logic gates.

Half Adder
Full Adder
 The Full adder takes in 1 extra bit than
the half adder, a carry bit from a
previous computation.
 A full adder adds three bits: two
input bits and a carry-in (Cin) from
the previous addition. It produces two
outputs: Sum (S) and Carry-out
(Cout).
 When multiple bits need to be added,
full adders can be connected in series
to form multi-bit adders.
 https://www.geeksforgeeks.org/implem
entation-of-full-adder-using-half-adders
/
Ripple Carry
Adder

 A chain of full adders where


the carry-out of one adder
becomes the carry-in for
the next.
 Simple but slow due to the
delay caused by the carry
ripple through each stage.
Applications of Adder

 Arithmetic Logic Units (ALUs): Perform arithmetic operations in CPUs.


 Digital Signal Processing (DSP): Used in filters, mixers, and other DSP applications.
 Counters and Timers: Used in digital clocks and other counting devices.
 Checksum Generators: Adders help generate and verify checksums in communication
protocols.
Multiplexors
 Multiplexer is a combinational circuit that has
maximum of 2n data inputs, ‘n’ selection lines and
single output line. One of these data inputs will be
connected to the output based on the values of
selection lines.
 The multiplexer, shortened to “MUX” or “MPX”, is
a combinational logic circuit designed to switch
one of several input lines through to a
single common output line by the application
of a control signal.
 AKA - The Data Selector.
 The number of output is always 1.
 The selection lines determine which input line flows
to the output line.
 The mux is a multiple input, single output device.
 https://www.youtube.com/watch?v=FKvnmxte98A
Applications of a Multiplexor

 Data Selection and Routing: Used in communication systems to route signals


efficiently.
 Arithmetic Logic Units (ALUs): Select between different arithmetic operations.
 Memory Address Selection: Helps select memory locations in microprocessors.
 Signal Processing: Used in data transmission and multiplexed audio/video signals.
De-multiplexor

 A single input multiple output


device.
Encoder

 An encoder is an electronic device used to convert an analogue signal to a digital


signal such as a BCD/Binary code.
 Encoders are very common electronic circuits used in all digital systems.
 If there are 4 lines of input it reduces the number of lines to 2 using binary
conversions.
 In binary encoders among all the input lines only a single input gets activated at a
time.
 for an encoder if the number of input lines is 2n then the output lines will be n.
 Thus less number of data lines are required by encoded data to get transmitted
from an end to another.
 https://www.youtube.com/watch?v=feBvhLFQEDk
 https://www.electronicshub.org/binary-encoder/
Uses of Encoders

 An encoder is a device which converts familiar numbers or characters or symbols into a coded
format.
 It accepts the alphabetic characters and decimal numbers as inputs and produces the outputs as
a coded representation of the inputs.
 Encoders are used to translate the decimal values (pressing a number key on the keyboard) to the
binary in order to perform the binary functions such as addition, subtraction, multiplication, etc.
 An encoder is a device used to change signals into a compressed format. This format is valuable
for transmission or storage, encrypting or adding redundancies to the input code.
 https://electronicsdesk.com/encoders.html
 Eg. A keyboard device where 1 of 64 lines is raised by pressing one key a corresponding 6-bit
character is produced on 6 wires coming out of the encoder. Usually two other bits are included
for parity and a control key.
Decoders

 A device that translates encoded data into its original format.


 It’s the opposite of encoding
 If n wires are connected in there will be 2n wires out, only one of which will be a logical
1 at any instant.
3:8 Decoder
4 Marks

1 Mark
Research Questions - HW

https://www.techopedia.com/definition/24124/
multiplexer-mux
Computer Organization
describe the main characteristics of a processor
Digital circuits are the building blocks of computer architecture.
Running the Object Code
Digital Component uses

 Registers and Counters are vital for CPU operations.


 Adders perform arithmetic operations in the Arithmetic Logic Unit (ALU).
 Decoders help manage memory addressing.
 Multiplexers combine multiple signals for efficient data transmission.
 Encoders and decoders are used in data compression and error correction.
The CPU

 The Central Processing Unit is the core/brain of the computer system. It is responsible
for integrating the peripheral devices and facilitate communication. Controls and
coordinates all activities of the computer.
 The CPU is responsible for the execution of the commands of the programs on the
computer system. Processes input instructions and data given to the computer
 The CPU facilitates all calculations and data processing that the computer needs to
perform.
Fetch-
Decode-
Execute-
Store
Cycle
Processor Components

 Control Unit – It acts under the


direction of the clock and sorts all
the paths needed to make sure data
gets from the right place TO the
right place. It instructs the ALU
which operation to perform.
 Arithmetic Logic Unit – Performs
the arithmetic and logical
operations.
 Registers - A register is a
temporary storage area built into
a CPU.
 Buses – wires that pass data
around the mother board.
Fetch-Decode-Execute-Store (FDES)
cycle

1. Fetch – The instruction is retrieved from memory. Fetch Data and instructions from
RAM.
2. Decode – The instruction is interpreted by the control unit. Decode and coordinate
the instructions and data received.
3. Execute – The instruction is carried out using arithmetic or logical operations.
Execute and perform instructions and data given to the computer.
4. Store – The result is written back to memory or a register.
 https://www.youtube.com/wat
ch?v=jFDMZpkUWCw
Fetch Stage

 The Program Counter (PC) holds the address of the next instruction to be executed.
 The address from the PC is sent to the Memory Address Register (MAR) via a
multiplexer. Memory Address Register are those that holds the address of the memory
location the CPU wants to access (read or write). The data from the MAR is sent across
the address bus with the instruction to read the data sent across the control bus.
 The Control Unit fetches the instruction stored at that address (the one in the MAR) and
places it (the actual instructions) in the Memory Data Register (MDR). The data from
that location in memory is sent down the data bus to the MDR. The MDR temporarily
holds the data being transferred to or from memory.
 The instruction is transferred from the MDR to the Instruction Register (IR) for
decoding. Instruction Register holds the instruction to be executed.
 The PC is incremented to point to the next instruction.
Types of Registers
 Accumulator: This is the most common register,
used to store data taken out from the memory.
Accumulates results.
 General Purpose Registers: This is used to store
data intermediate results during program execution.
It can be accessed via assembly programming.
 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 of the memory
location the CPU wants to access (read or write).
 MDR/MBR: Memory Data/Buffer Register
Temporarily holds the data being transferred to
or from memory.
 PC: Program Counter keeps track of the next
instruction to be executed.
 IR: Instruction Register stores the current
instruction being executed.
BUS
 A bus is an electrical path that
transports bits of instructions and
data between the different parts
of the CPU.
 Address Bus - Carries the
memory address of data or
instructions the CPU wants to
access. If the CPU wants to read
from memory location 1001, the
address 1001 is sent via the
address bus.
 Data Bus - Transfers actual data
between the CPU, memory, and
peripherals. The data stored at
1001 is sent via the data bus.
 Control Bus - Sends control
signals to coordinate operations
between the CPU and other
components. The CPU sends a
Read or Write signal to memory to
specify the type of operation.
Decode Stage

 The IR (Instruction Register) sends the fetched instruction to the Control Unit.
 The Control Unit (CU) decodes the instruction in the IR.
 The Decoder interprets the binary opcode and determines the required operation.
 Decoders – Identify the operation (e.g., ADD, SUB, LOAD, STORE, etc).
 The CPU then determines where to send data required for the operation eg to a
Register for storage or to the ALU for calculations.
Execute Stage

The ALU executes the decoded


instruction using input data from
registers or memory.
The required data is loaded into the
ALU from registers (e.g., A and B).
The ALU executes the instruction
(e.g., adds two numbers).
The result is temporarily stored in
the Accumulator Register or a
general-purpose register.
E.g. ADD A, B is the instruction, the
ALU adds the values stored in general
register A and B, storing the sum in A.
 How Computers
Calculate - the ALU:
Crash Course
Computer Science #5
 https://www.youtube.com/w
atch?v=1I5ZMmrOfnA
Store Stage

 The computed result is transferred from the ALU to a register or memory.


 A Multiplexer selects the destination (register or memory location).
 If storing to memory, the result is sent via the Memory Data Register (MDR) and
written to the appropriate location.
Machine Instructions

 When a high-level program is compiled into low level binary code, it is referred as
machine code that CPU can directly execute. A machine code can have many
instructions and these instructions in binary are referred as machine instructions.
 The instructions sent to the CPU is a
pattern of bits that the Control Unit
decodes.
 The Instruction Set is a basic set of
commands/operations that the CPU
understands/executes.
Instructions  The Instruction Set is the Range of
different types of Instructions that
the CPU knows how to execute.
 The instruction size is the number
of bits within the instruction that the
CPU can hold. Instructions come in
16bit sets, 32 bits sets, 64 bit sets
etc.….
Instruction Types

 Data Flow – copy/move data from one place to another (between memory, registers,
and I/O devices). Eg LDA, MOV
 Arithmetic – perform operations on numeric data ADD, SUB, MUL, DIV
 Logical – performs Boolean operations AND, OR, NOT
 Shift – moves bits one or more places to the left or to the right.
 Flow Control – permits instructions to be executed out of order. Eg GOTO, JMP
Instruction
Format

 The instruction format is a


combination of an op-code(operation
code), and operand (addresses in
memory).
 The instruction format is the way the
bits are organized.
 Instructions consists of an OPCODE and zero or
more OPERANDS.
 OPCODE (Operation Code) – the operation to be
performed (e.g., ADD, MOV, JMP).
 OPERANDS – Indicate the data or
Instruction memory/register locations involved in the
operation. register locations, memory locations
or literal data.
Format  ADDRESSING MODE – Part of the Opcode that
specifies how to locate the operands (e.g., direct,
indirect, immediate).
 Instruction Size – The total number of bits in an
instruction (fixed or variable length)
Instruction Format

Three address computer instruction


 ADD P Q R means add P to Q and
put results in R,
Two address computer instruction
 ADD P Q means add P to Q and put
results in Q
One address instruction
 JMP X means Jump to instruction at
location X.
Zero address instruction
 HLT Halts execution, do nothing.
https://www.learncomputerscienceonline.com/instruction-fo
rmat/
Addressing Modes

 Addressing modes are part of the opcode used to indicate WHERE the data is coming from,
it can be from the Registers, Main memory or a literal value.
 Immediate addressing – the operand provides the value to be used. Like a literal number.
 Eg Add #4 D0 means add the value 4 to register D0. The # means that 4 isnt a memory address,
but just the number 4.
 Absolute/direct addressing – the operand specifies the location of the data IN MEMORY.
 Eg CLR 1234 which means clear or set the contents of memory location 1234 to zero.
 Register addressing – the operand specifies the location of the data A REGISTER
 Eg LDA PC which means Load the Program Counter
 Indirect addressing - the operand provides a pointer to the location of the data.
 Eg MOV (A0), D1 means to read the address contained in A0, then go to that address, get the actual
data and move It to D1.
CPU Clock

 An internal timing device using a quartz crystal, gives the microprocessor a constant flow of
electrical pulses.
 Clock Speed – The rate at which the computer processes data. The clock speed measures
the number of cycles your CPU executes per second, measured in GHz (gigahertz).
 Determines how many instructions the CPU can process per second.
 For example, a 200 MHz CPU receives 200 million pulses per second from the clock.
 A 2 GHz CPU gets two billion pulses per second.
 In general, a higher clock speed means a faster CPU.
 CACHE memory is memory that stores
frequently accessed data for faster access.
 Cache memory acts as a buffer
between RAM and the CPU.
 The CPU checks CACHE first then RAM.
 It holds frequently requested data and

Performanc
instructions so that they are immediately
available to the CPU when needed.
 Cache memory is used to reduce the average
e - CACHE time to access data from the Main memory.
 Cache memory can either be a reserved
section of main memory or an independent
high speed storage device on the CPU.
 The purpose of cache memory is to allow the
CPU to operate at full speed without waiting for
main memory access that is very slow
(comparatively).
 Parallel Processing is the simultaneous
execution of multiple instructions or tasks to
improve performance.
 Multiple instructions are executed in each
clock cycle.

Performanc  Different tasks can be executed in parallel.


 GPUs use parallel processing to render
e - Parallel graphics faster. Especially helpful in
Gaming.

Processing  A single-core CPU can execute multiple


instructions from the same program
simultaneously if they don’t depend on each
other by rapidly switching between
processes. While it doesn’t run multiple
tasks at the exact same time, it creates the
illusion of parallel execution.
 A GPU is a specialized processor
designed for graphics rendering and
Performanc high-performance computations.
 High-performance rendering of 3D
e - Graphics environments e.g., Call of Duty

Processing  Rendering refers to how smooth


images are translated on the screen.
Unit It involves calculating lighting,
textures, colors, and shading to
create realistic or stylized visuals.
 A Multicore system is a CPU with two
or more independent processing
Performanc cores on a single chip.

e - Multi-  EG - Dual-Core (2 cores), Quad-


Core (4 cores), Octa-Core (8 cores),
core etc
 The Intel Core i9 is a 24-core CPU.
Systems  More cores improve performance for
multitasking.
 Overclocking is the process of
increasing a computer’s clock speed
beyond its factory-set limit to
Performanc improve performance.
 You can increase this speed manually
e- through BIOS settings or an
overclocking software, to allow the
Overclockin processor to perform more
calculations per second.
g  However, this also increases power
consumption and heat generation.
This can burn up the chips/board.
The End
https://edu.gcfglobal.org/en/computer-science/
https://www.oreilly.com/library/view/designing-embedded-hardw
are/0596007558/ch01.html

You might also like