Cpen Reviewer

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

MACHINE CYCLE, INSTRUCTION CYCLE, AND CLOCK time – interval of time beginning when the

CYCLE clock goes to high state, lasting through the


return to a low state, then back again – basic
 Machine Cycle – consists of steps that a
unit that measures a CPU’s speed – aka clock
computer’s processor executes whenever it
tick
receives a machine language instruction –
most basic CPU operation – consists of three
standard steps: fetch, decode, and execute.

The steps of a machine cycle are:

1. Fetch – control unit requests instructions from  Measured in Hz, MHz, GHz
the main memory that is stored at a memory’s  Intel 4040
location as indicated by the program counter  Intel 8088
(aka instruction counter).  Intel 80186 &80188
2. Decode – received instructions are decoded in  Intel 80386
the instruction register – involves breaking the  Intel Core i3
operand field into its components based on
the instruction’s operation code(opcode).
3. Execute – involves the instruction’s opcode as SAP – 1 (Simple As Possible)
it specifies the CPU operation required.
 1st stage in evolution towards modern
4. Store – CPU stores any results or changes to
computers
memory that were made during the execution
 Used to introduced all crucial ideas behind
of the instruction.
computer operations without burying
5. Counter update – Once the machine cycle is
unnecessary details
complete, the program counter is updated to
point to the next instruction to be executed. Architecture of SAP – 1

 Instruction Cycle – time taken to execute one  A bus organized computer. All register outputs
instruction. to the W bus are three-state; this allows
orderly transfer of data. All other register
The program is implemented on the computer by outputs are two-state; these outputs
going through a cycle for each instruction. continuously drive the boxes they are
connected to.
1. Can fetch instruction from memory
2. Used to decode the instruction
3. Can read the effective address from memory if
the instruction has an indirect address
4. Can execute the instruction

*The cycle continues until a HALT condition is met.

 Clock Cycle – a device that generates a signal


that periodically cycles between a high state 1
and low state 0 – ensures operations is in
orderly manner – do so by enabling certain
operations to occur only at specific points in
FUNCTIONAL OPERATIONS OF
MICROPROCESSOR/MICROCONTROLLER

a) Data Movement – instructions move data


from one place, called the source operand, to
another place, called the destination operand.
Data movement instructions can be grouped
into loads, stores, moves, and immediate
loads.

 Load instructions move data from memory to


registers.

 Store instructions move data from registers to


memory.

 Move instructions move data from one register to


another.

 Immediate load instructions move constants,


including addresses, to registers.

*Data movement does what its name suggests and


there are multiple ways of doing so and of avoiding
doing so.

• Computer must be able to communicate with


outside world

• Data must be “accessible” to devices outside


computer

Two types:

– Peripheral – Data communications

Data movement to a peripheral


• Data must be passed between computer and I/O computers that can direct the operations during
devices connected to computer the execution of a program by the
processor/computer. The main function of the
• Typically to simple devices
control unit is to fetch and execute instructions
Data Movement to remote devices (data from the memory of a computer. It receives the
communications) input instruction/information from the user and
converts it into control signals, which are then
• Data communications is data movement over a given to the CPU for further execution. It is
longer range included as a part of Von Neumann architecture
• Typically to smart devices or other computers developed by John Neumann. It is responsible for
providing the timing signals, and control signals
b) Data Processing - is the conversion of data into and directs the execution of a program by the
usable and desired form. This conversion or CPU. It is included as an internal part of the CPU in
“processing” is carried out using a predefined modern computers.
sequence of operations either manually or
automatically. Most of the processing is done  Control it says that it is something needs
by using computers and other data processing to monitor operations and maintain
devices, and thus done automatically. control of data processing, data storage,
 The output or “processed” data can be and data management. Automated
obtained in various forms. Examples of these control of computers resources.
forms include image, graph, table, vector file,  Control key is a modifier key which, when
audio, charts or any other desired format. The pressed in conjunction with another key,
form obtained depends on the software or performs a certain action. Apple
method used. When done itself it is referred command key on Apple computer
to as automatic data processing. Data centers keyboards computer the Ctrl key is written
are the key component as it enables as “control " and is next to the option
processing, storage, access, sharing and control on key and command key.
analysis of data. Components of a Control Unit
 Data in any form and of any type requires
processing most of the time. It can be  The components of this unit are
categorized as personal information, financial instruction registers, control signals within
transactions, tax credits, banking details, the CPU, control signals to/from the bus,
computational, imagery and simply almost control bus, input flags, and clock signals.
anything you can think of.
 The components of the Hardwired control
Stages and process of Data Processing unit are instruction register (contains
opcode and address field), timing unit,
Processing of data is required by any activity
control state generator, control signal
which requires its collection. This data collected
generation matrix, and instruction
needs to be stored, sorted, processed, analyzed
decoder.
and presented. This complete process can be
divided into 6 simple primary stages which are:  The components of the Micro
programmed control unit are the next
1. Collection
address generator, a control address
2. Storage register, control memory, and control data
register. Functions The include the
3. Sorting following. functions of the control unit
4. Processing The include the following. functions of the
5. Analysis control unit

6. Presentation and Conclusions  It directs the flow of data sequence between


the processor and other devices.
c) Control - The control unit is the main
component of a central processing unit (CPU) in
 It can interpret the instructions and controls  Data storage is the collective methods and
the flow of data in the processor. technologies that capture and retain
digital information on electromagnetic,
 It generates the sequence of control signals
optical or silicon-based. Storage is storage
from the received instructions or
media a key component of digital devices,
commands from the instruction register. as consumers and businesses have come
to rely on it to preserve information
It has the responsibility to control the ranging from personal photos to business-
execution units such as ALU, data critical information.
buffers, and registers in the CPU of a  Storage is frequently used to describe the
computer. devices and data connected to the
computer through input/output (I/O)
 It has the ability to fetch, decode, handle the operations, including hard disks, flash
execution, and store results devices, tape systems and other media
 It cannot process and store the data types

 To transfer the data, it communicates with Other capacity measurements to know are:
the input and output devices and Larger measures include:
controls all the units of the computer.  kilobyte (KB) equal to 1,024 bytes
Design of Control Unit  megabyte (MB) equal to 1,024 KB
The design of this can be done using two which  gigabyte (GB) equal to 1,024 MB
include types of a control unit the
 terabyte (TB) equal to 1,024 GB
following.
 petabyte (PB) equal to 1,024 TB
 Hardwire based
 exabyte (EB) equal to 1,024 PB
 Microprogrammed based (single-level and
two-level)

 Hardwired Control Unit – In this type, the MICROPROCESSOR AND MICROCONTROLLER


control signals are generated by a special PROGRAMMING
hardware logic circuit without any change in Microprocessor
the structure of the circuit. In this, the
generated signal cannot be modified for  are programmed using assembly language,
execution in the processor. The basic data of which is a semi-English language
an opcode (operation code) of an instruction  understand machine code, but require a
is sent to the instruction decoder for higher-level programming language such as C
decoding. and assembly language to write the program.
 The instruction decoder is the set of decoders
Integrated Development Environment (IDE)
to decode different types of data in the
opcode. This results in output signals which  An essential tool for programming a
contain values of active signals that are given microprocessor.
as the input to the matrix generator to  Software, which is developed by the creators
generate control signals for the execution of a of the microprocessor, compiles the code into
program by the processor of the computer a language the machine can understand.
c) Data Storage – refers to the use of recording
media to retain data using computers or other 3 Types of Microprocessor Programming Language
devices. The most prevalent forms of data  Machine Language – consists of either binary
storage are, file storage block storage, and, or hexadecimal
with each being ideal for different purposes.  Assembly Language – done with use of
object storage mnemonics
 High-Level Language – use English-Language-  Yes, microcontrollers and microprocessors can
Type statements be programmed using the same programming
languages.
*A machine language program for one microprocessor
 Assembly language: Assembly language is a
will not run on the microprocessor of a different
low-level language that is closer to the
manufacturer
hardware of the microcontroller or
Machine Language microprocessor. It is often used for writing
efficient code that is tightly coupled to the
 Can be written using its instruction set in hardware.
binary machine language but its inconvenient  High-level languages: High-level languages
and impractical such as C, C++, and Python are more abstract
 Hexadecimal numbers is used rather than than assembly language. They are easier to
binary numbers write and read, but they may not be as
Assembly Language efficient as assembly language.
 The choice of programming language depends
Composed of four fields: on the specific application. For example, if you
 Labels – used to identify specific locations in are writing code that needs to be very
the code efficient, you may want to use assembly
 Mnemonics – short codes that represent language. If you are writing code that is easier
instructions to read and maintain, you may want to use a
 Operands – data that is operated on by an high-level language.
instruction
INTERFACING OF INPUT/OUTPUT DEVICES
 Comments – used to document the code
1. Interfacing of Input/Output Devices
*Assembly language program is translated into binary  Interface – is the path for
via a program called assembler. communication between two
components.
High-Level Language
Two Types of Interfacing:
 Used command words and Syntax, makes
them easier to understand  Memory Interfacing – involves
 A compiler/interpreter converts a high-level designing a circuit that will match the
language into a machine language program memory requirements with the
 Python – developed by Guido van Rossum - microprocessor signals – primary
most widely used programming languages function is it should be able to read
 Javascript – developed by Brendan Eich in ten from and write into a given register of
days a memory chip.
 C#- developed by Microsoft – faster and  I/O Interfacing – using latches and
secure version of C – initially called cool buffers.
 C++ - developed by Bjarne Stroustrup – most
Ways the Microprocessor communicate with the
popular programming in the world.
Outside World
*The void setup function is called once, when the
 Serial Communication Interface – gets a single
Arduino board is first turned on. It is used to initialize
byte of data from the microprocessor and
the board's hardware and to set up the main loop of
sends it bit by bit to other system serially and
the program. The void loop function is called
vice versa
repeatedly, until the Arduino board is turned off. It is
 Parallel Communication Interface - gets a
used to run the main code of the program, which is
byte of data from the microprocessor and
typically a loop that performs some action repeatedly.
sends it bit by bit to other system
Do microcontrollers and microprocessors have same simultaneous or parallel fashion and vice
programming language? versa
The Major Differences between central
computer and each peripheral:
1. Peripherals are electromechanical and
electromagnetic devices and CPU and
memory are electronic devices.
Therefore, a conversion of signal values
may be needed.
2. The data transfer rate of peripherals is
usually slower than the transfer rate of
CPU and consequently, a synchronization
mechanism may be needed.
 can be unidirectional or bidirectional,
3. Data codes and formats in the
single-ended or differential and could
peripherals differ from the word format in
follow one of the different I/O standards
the CPU and memory.
Some I/O standards are: 4. The operating modes of peripherals are
different from each other and must be
a. GTL (gunning transceiver logic). controlled so as not to disturb the
b. HSTL (high-speed transceiver logic). operation of other peripherals connected
to the CPU.
c. LVCMOS (low-voltage CMOS).

d. LVTTL (low-voltage transistor-transistor 3. Time-Based I/O Device


logic). Enterprise service bus
 Real-time interfaces are most frequently
e. PCI (peripheral component interconnect). implemented using an enterprise service
f. LDT (lightning data transport). bus (ESB) to orchestrate the interactions
between applications and systems.
g. LVDS (low-voltage differential signaling).  Real-time interfaces are used to support
master data management (moving data
into and out of the master data hubs real
2. Interface Devices time) as well as the movement of
 The Input / output organization of transactional data updates between
computer depends upon the size of applications.
computer and the peripherals connected  The enterprise service bus implements
to it. The I/O Subsystem of the computer, the movement of data between
provides an efficient mode of applications and the transformation of
communication between the central data from the specific source application
system and the outside environment format to the common canonical model
format and to the format of the target
The most common input output devices systems. The enterprise service bus
are: supports the interaction patterns of
a) Monitor “publish and subscribe” and “request and
b) Keyboard reply”.
c) Mouse  Supporting the enterprise service bus are
d) Printer local utilities to handle data movement,
e) Magnetic Tapes event monitoring, and transaction
 Peripherals connected to a computer processing middleware.
need special communication links for
interfacing them with the central Real-Time Interfaces
processing unit. The purpose of  Real-time interfaces are designed to
communication link is to resolve the transfer data on an as-needed basis.
differences that exist between the central When an application needs to either send
computer and each peripheral. or request data immediately, a real-time
interface is used. As previously
mentioned, the architecture used for  Handshaking is an I/O control approach to
these real time interfaces has changed a synchronize I/O devices with the
lot over the years and it will continue to microprocessor. As several I/O devices
evolve over time. accept or release data at a much lower
cost than the microprocessor, this
Two of the more popular interface technique is used to control the
architectures currently in use are SOA and microprocessor to operate with an I/O
ROA. device at the I/O devices data transfer
 With SOA, interfaces are designed in such rate.
a way that they support specific distinct  The drawback of the strobe approach is
services. For example, a service might be that the source unit that starts the
created to retrieve a customer’s account transfer has no method of knowing
information. whether the destination unit has received
 It is used for building software the data element that was located in the
applications that use services available in bus. A destination unit that initiates the
a network such as the web. transfer has no method of knowing
 SOA (Service oriented architecture). An whether the source unit has located the
entirely separate service would be created information on the bus.
to associate new products with that  The handshake approach solves this issue
account. SOA is based on the concept of by introducing a second control signal that
taking each type of interaction and supports a response to the unit that
exposing it as a unique service. These initiates the transfer. The basic feature of
services are then tied together through the two-wire handshaking approach of
the use of orchestration. Whereas a data transfer is as follows. One control line
service performs a distinct function, is in an equal direction as the data flow in
orchestration calls multiple services in the the bus from the source to the
correct manner to accomplish a specific destination.
business function.  It is used by the source unit to update the
 ROA(Resource Oriented Architecture) destination unit whether there are true
instead focuses on specific objects such as data in the bus. The other control line is in
accounts as a data object or state the other direction from the destination
transactions. The concept with ROA is to to the source. It is used by the destination
expose each resource in a reusable unit to update the source whether it can
manner and allow the consumer of that accept information. The sequence of
resource to consume it via a consistent control during the transfer is based on the
interface. unit that initiates the transfer.
 It is based on RESTful design philosophy.
The diagram shows the data transfer process
 REST (Representational state transfer)
when initiated by the source. The two
software that was created to guide design
handshaking lines are data valid, which is
and development of architecture of
created by the source unit, and data accepted,
WWW. There are some obvious
created by the destination unit. The timing
similarities between SOA and ROA, but
diagram displays the exchange of signals
there are many differences as well. Each
between the two units.
architecture has its benefits and
detriments and the discussion of these
typically turns into a religious debate
between interface architects. Generally,
the best approach is to choose the
architecture that best fits in any given
situation after carefully considering all
factors.

4. Handshaking
initiated and the destination-initiated transfer
is in their choice of the initial state.

The sequence of events showed in part (c)


shows the four possible states that the system
can be at any given time. The source unit
initiates the transfer by locating the
information on the bus and enabling its data
valid signal. The data accepted signal is
activated by the destination unit after it
obtains the data from the bus.

The destination-initiated transfer using


handshaking lines is shown in the figure. The
name of the signal created by the destination
unit has been modified to ready for data to
reflect its new definition. The source unit in
this case does not locate data on the bus until
after it takes the ready-for-data signal from
the destination unit.

The sequence of events in both cases would


be equal if it can consider the ready-for-data
signal as the complement of data accepted.
The only difference between the source-

You might also like