0% found this document useful (0 votes)
18 views31 pages

2024 25 SPR Intro Tomicroprocessors - Ver Jan20

The document provides an introduction to microprocessors, focusing on connecting digital circuits using buses and tri-stateable outputs. It explains the need for programmable digital circuits, the architecture of microprocessors, and the process of fetching and executing instructions. Additionally, it discusses managing data flow and the integration of external inputs and outputs in microprocessor design.

Uploaded by

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

2024 25 SPR Intro Tomicroprocessors - Ver Jan20

The document provides an introduction to microprocessors, focusing on connecting digital circuits using buses and tri-stateable outputs. It explains the need for programmable digital circuits, the architecture of microprocessors, and the process of fetching and executing instructions. Additionally, it discusses managing data flow and the integration of external inputs and outputs in microprocessor design.

Uploaded by

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

MS-101 Makerspace

Introduction to Microprocessors

Department of Electrical Engineering


Indian Institute of Technology, Bombay

Jan 31, 2025

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 1 / 31
Connecting multiple digital circuits

Connecting Digital Circuits Using a “Bus”


For Data communication between multiple units with digital outputs, it is
convenient if we can connect their input/output ports using common wires.
This is called a bus.
Unit-1 Unit-2
However, outputs of conventional digital
circuits cannot be shorted together.
BUS
Outputs of conventional digital circuits can only
be ‘0’ or ‘1’. If we short the outputs of multiple
circuits, some will try to make the output ‘High’
Unit-3 Unit-4
while the others may try to pull it ‘Low’.
This can lead to indeterminate outputs and heavy current being
drawn from the supply.
To connect outputs of multiple circuits to the same wire in the bus,
we need circuits with tri-stateable outputs or open-collector
outputs.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 2 / 31
Connecting multiple digital circuits Tri-stateable Logic

Tri-stateable Digital Circuits


The output of tri-stateable digital circuits can have three states. It
could be ‘0’ or ‘1’ like the conventional digital circuits, or it could be
in a high impedance state called ‘Z’.
In the high impedance state, the circuit is disconnected from the
output and does not interfere with other outputs connected to the
same wire.
The figure on the right shows the circuit VDD En
diagram and the symbol for a
tri-stateable buffer. En

The circuit has an extra input to enable it In In Out In Out

(– labelled as ‘En’ in the circuit).


When En = 1, the circuit acts as a buffer,
En
but when En = 0, the circuit is
disconnected from the output. Gnd

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 3 / 31
Connecting multiple digital circuits Tri-stateable Logic

Tri-stateable Buffer Circuit

Circuits which can disconnect their output drivers from the output
terminal are called tri-stateable circuits.
The connection to supply and ground is VDD
En
through the top pMOS and bottom nMOS
transistors. En
Both of these are OFF when En = 0 In In Out In Out
(and therefore En = 1).
Both are ON when En = 1 and En = 0, En
applying power to the circuit in the
Gnd
dashed box.
When En = 1, the middle two transistors in the dashed box form an
inverter, which inverts the output of the first inverter, thus providing a
buffer function.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 4 / 31
Connecting multiple digital circuits Tri-stateable Logic

Bus Control with Tri-stateable Output Circuits

One of the digital circuits on the bus acts as the “bus master”.
It decides which of the circuits on the bus will be listeners for the
data on the bus and which will be the talker.
While there can be multiple listeners on the bus, only one circuit
can be a talker. The bus master manages this by setting the
Enable line of the designated talker to TRUE and that of all others
to FALSE.
The bus itself contains many wires for carrying the data and a few
additional wires driven by the bus master for bus administration
functions such as designating roles as listeners or talkers.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 5 / 31
Connecting multiple digital circuits Open Collector Outputs

Open Collector Outputs


Another way for direct connection of outputs to common wires is to use
open-collector/open-drain output stages.
Output stage

Internal Out
The output stage of digital circuits
circuit of normally includes a switching device for
the device pulling the output up to the supply voltage,
as well as a device to pull it down to
ground.
Output stage
However, open collector/open drain
Internal Out circuits include only the pull down device.
circuit of
the device The collector/drain of the pull down device
is brought out as the output terminal.

Outputs of open-collector/open-drain circuits can be shorted together.


A common external resistor is used as a pull up for the shorted outputs.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 6 / 31
Connecting multiple digital circuits Open Collector Outputs

Open Collector Outputs for Bus connection

Common VDD
Pull up
Bus wire

Out1

Out2

Out3
Out0

Internal Internal Internal Internal


circuit of circuit of circuit of circuit of
Unit 0 Unit 1 Unit 2 Unit 3

There is a common pull up resistor for all output devices which are
effectively in parallel.
Units turn OFF their output device to write a ‘1’ to the output and
turn it ON to write a ‘0’ to the output.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 7 / 31
Connecting multiple digital circuits Open Collector Outputs

Open Collector Outputs for Bus connection . . . contd.


Common VDD
Pull up
Bus wire
Now it is possible for
different units to output
different logic values,
Out1

Out2

Out3
Out0

and still have their


outputs shorted.
Internal Internal Internal Internal
circuit of circuit of circuit of circuit of
Unit 0 Unit 1 Unit 2 Unit 3

The bus wire will be pulled up by the common pull up resistor


when all devices output a ‘1’ (turning their output device OFF).
The bus wire will be pulled down to ‘0’ if any device outputs a ‘0’
(turning its output device ON).
A ‘0’ is dominant over a ‘1’ in this system. A device writing a ‘1’ to
the output is effectively disconnecting from the bus.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 8 / 31
Microprocessors

Need for a Programmable Digital Circuit

Design of complex integrated circuits has a high fixed cost


component.
If sold in large quantities, the cost of an integrated circuit can be
made quite low.
It makes sense to design a programmable circuit which can be
configured to perform different functions for different products.
Now this circuit can be used for a variety of products and will thus
be required in large quantities.
The specific function performed by the circuit needs to be selected
by a digital input. This is called an instruction.
The circuit is given a series of instructions to perform a task. This
sequence of instructions is a program.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 9 / 31
Microprocessors

The Processor

The programmable digital circuit which can run a program is called


a processor.
A processor which is implemented on a single chip using VLSI
technology is called a microprocessor.
Modern microprocessors can be quite complex – a Pentium
processor used in PCs has upwards of 100 million transistors!
The basic logic in a processor just performs the following loop
endlessly:
Fetch next instruction
Decode it
Execute the instruction

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 10 / 31
Microprocessor Architecture A Programmable Digital Circuit

Notional Plan for a Programmable Digital Circuit


A notional plan for making a programmable circuit is shown below.
The common input going to Function code
the inputs of all functional
blocks is fine, but the Decoder
common output for these will
Input En 0 Output
cause problems if function Function 0
outputs use conventional En 1
Function 1
digital circuits! En 2
Function 2
We should use tri-stateable
En 3
outputs to share a common Function 3
output terminal.

However, each tri-stateable circuit needs an individual enable signal.


These enable signals can be provided by the decoder if these are
included in the function code.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 11 / 31
Evolution of a Processor

A Multipurpose Digital Circuit


Assume that we have multiple digital circuits, each performing a different
function. A circuit can be selected using its enable input.
Function code
Multiple
Data Multiple
Sources Decoder Destinations
En 0
Input Function 0 Output
Multiplexer En 1 De-multiplexer
Function 1
En 2
Function 2
En 3
Function 3

We need a multiplexer to route the data from multiple sources to the


input of this circuit and a de-multiplexer to route its outputs to a
selected device.
The multiplexer and de-multiplexer will also need ‘select’ inputs.
All this information has to be supplied through the function code to
configure this circuit to perform a selected function.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 12 / 31
Evolution of a Processor

Choosing a Specific Sub-circuit

Digital Circuits
Input Output A lot of control inputs will be required to
With Enable
choose and configure a specific circuit
and to route the data from input through
Instruction Decoder this circuit to the output.

We can encode this information in a compact form and use a


decoder to generate all the detailed control signals necessary for
data routing and for enabling circuits.
This encoded information is called an instruction.
The format of this information is decided by the circuit designer
and the decoder expands out the control signal according to this
format.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 13 / 31
Evolution of a Processor

Storing Instructions

The actual task performed by this flexible circuit may require a series
of operations to be carried out.

For example, we may wish to


Input Digital Circuits Output multiply a variable by a coefficient
With Enable
Address and then add the product to an
accumulating sum.
Program Instruction Decoder
Memory
This requires a group of
instructions to be executed in a
sequence.

This sequence of instructions is called a program.


We store the sequence of instructions in a memory called the program
memory.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 14 / 31
Evolution of a Processor

Fetching Instructions

Program Digital Circuits


Input Output To fetch each instruction,
Counter With Enable we need to provide its
Address address to the memory.
From where will this
Program Instruction Decoder address come?
Memory

We can include a counter to generate sequential addresses for


the program memory.
Every time an instruction is fetched from the memory, the counter
will increment the address to point to the next instruction.
The counter which provides addresses to the program memory is
called a program counter.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 15 / 31
Evolution of a Processor

Instructions From Auto-incremented Addresses

Incr Instr. Digital Circuits


Input Output
Pointer With Enable
Address
Program Instruction
Decoder
Memory

Fetch - Decode - Execute

The program counter is just a register to store a value and an


adder to increment the value stored in the register.
This register is also referred to as the instruction pointer.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 16 / 31
Evolution of a Processor

Instructions from Non-sequential Addresses: “Jump”

Mux
The instruction
pointer needs to Instr. Digital Circuits
Incr Input Output
be loaded with Pointer With Enable
some value when
Address
the whole
operation starts. Program Instruction Decoder
Memory

Instructions need not be executed in a strict sequence. After finishing a


block of instructions, we may wish to execute a different block of
instructions, stored at some other address.
The ability to load data into the instruction pointer gives us the ability to
alter the flow of instructions in the program during its run time.
When a new value is loaded in the instruction pointer, the next
instruction will be fetched from that new location.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 17 / 31
Evolution of a Processor

Executing a “Jump” Instruction


After finishing a Mux
block of instructions,
we may wish to Incr Instr. Digital Circuits
Pointer Input Output
“jump” to a different With Enable
block of instructions, Address
stored at some Program Instruction Decoder
other address. Memory

Moving to a different block of instructions may be accomplished by


loading a different value into the instruction pointer.
The value to be loaded into the instruction pointer can be provided
by the last instruction of the first block.
execution of this instruction will cause the multiplexer to choose
this new address, rather than the default incremented address as
the input to the instruction pointer.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 18 / 31
Evolution of a Processor

Managing Data

So far we have concentrated on the flow of instructions and control


path. What about the data path?
Data
Different instructions will, in
Memory Ext. Inputs general, operate on different data.
Operand
Address

Mux How do we propose to manage the


Input flow of data?
→ Data can also be stored in a
Demux

Execution
Unit memory. Successive data items
Ext. can then be fetched from/written to
Outputs
Instr this memory.
Decoder

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 19 / 31
Evolution of a Processor

Managing Data . . . contd.

For fetching and storing data, We shall need the address where
the data item is to be fetched from/written to.
The actual address of the data item is often stored in a register.
(This register is called a data pointer).
The instruction should identify the register which stores the
address.

The circuit we are designing should also be capable of fetching data


from external sources (other than the data memory) and also to output
data to destinations other than the data memory.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 20 / 31
Evolution of a Processor

Data I/O with External World


Data We can place a multiplexer in
Memory Ext. Inputs the input data path and a
de-multiplexer in the output
Operand
Address

Mux data path in order to choose


Input between data memory and
external IO.
Execution Demux
Unit Control for these
Ext.
Outputs multiplexers/de-multiplexers
Instr should also be included in the
Decoder
instruction.
The data and program memory need not be physically distinct.
Different architectures choose either a common memory and data
path for both instructions and data, or separate data and
instruction memories with independent paths.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 21 / 31
Evolution of a Processor

The Central Processing Unit


We have oversimplified the evolution of this circuit by assuming that
just a combinational circuit like a decoder is needed to execute
instructions.
Data
Memory
Ext. Inputs In fact each instruction may
Operand
Address
Mux
Mux need a sequence of actions
Input
to be executed properly.

deMux
Incr Instruction Execution
Pointer Unit
Therefore, we need a
Ext.
Address Outputs sequential circuit like a
Program Instr Central finite state machine to
Processing
Memory
Unit interpret and carry out an
Fetch - Decode - Execute instruction.

The circuit which generates the sequence of control inputs to the


execution unit is called the Central Processing Unit or CPU.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 22 / 31
Evolution of a Processor

The Central Processing Unit . . . contd.

The central processing unit generates control inputs for the


sequence of operations to be carried out.
At the top level, it repetitively carries out the three steps:
Fetch the next instruction
Decode the instruction
Execute it
Each of these operations may involve a series of transactions with
the memory or with internal execution units.
Instruction execution may involve data processing or controlling
the flow of instruction through writing to the instruction pointer.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 23 / 31
Evolution of a Processor

We Have Designed a Microprocessor! How to Use It?

The architecture which has evolved through this discussion


describes the skeleton of a microprocessor.
However, we need many devices external to the microprocessor to
make a useful system – For example, program and data
memories, display device drivers, keyboard readers etc.
So with microprocessors, we invariably need multiple ICs on a
circuit board to perform any useful function.
For example, the old 8085 processor needed a program memory
chip (say, type 2764, 8Kx8 EEPROM), data memory chip (type
6264, 8Kx8 RAM), 3 to 8 decoder (74LS138) to select I-O devices,
data transceiver etc. in order to make an operational circuit.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 24 / 31
Evolution of a Processor

Microcontroller Based Systems

As technology has progressed, it has become possible to put


many of the components required in the system along with the
microprocessor on the same IC.
Processors which have these components on the same IC are
called microcontrollers.
A system using microcontrollers can be quite compact and can be
made operational in practical systems with very few external
components.
Ready-made cards with microcontrollers and the essential
external components are available with varying capabilities.
“Raspberry Pi” is an example for such cards and uses the popular
ARM processor. This is a 32 bit or 64 bit system and is used in
somewhat high end applications.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 25 / 31
Evolution of a Processor

Microcontroller Based Systems . . . contd.

“Arduino” is a family of cards whose


design is open source. These are
therefore made by several manufacturers
and are quite economical.
There are many models of Arduino cards.
The most popular among these are UNO
R3 and nano, which are based on the 8 bit
AVR microcontroller ATMega 328P.
These cards are suitable for low-cost and
simple applications. The UNO R3 card
can be bought for under Rs. 500, while the
nano card is even cheaper.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 26 / 31
Evolution of a Processor

Microcontroller ATMega 328P

Arduino R3 and nano boards use the microcontroller


ATMega 328P.
This microcontroller contains:
an 8 bit microprocessor with 32 registers,
32KB of flash memory to store the program,
1 KB Electrically Erasable and Programmable memory,
2 KB SRAM to store data,
3 Counter/Timers,
10 bit A to D converter with 6 input channels,
Serial communication using RS232C, I2 C as as well as SPI
protocols.
The Arduino board adds a USB controller to the microcontroller
resources to provide USB connectivity.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 27 / 31
Evolution of a Processor

Application Development with Microcontroller Boards


Having selected a microcontroller board with the necessary resources,
we need to program it to perform the function we need. As discussed
earlier, this can be done using instructions recognized by the
microcontroller.
Instruction to the microcontroller are groups of ‘1’s and ‘0’s –
which do not make much sense to human beings. These
instructions are said to be in machine code.
Meaningful mnemonics are associated with each machine code
instruction which indicate the purpose for that instruction.
For example, we associate MOV R31, R0 with a pattern like:
0010 1101 1111 0000 for an instruction which copies the contents
of register number 0 to Register no. 31.
The collection of such mnemonics are then “assembled” into
machine code by a program (typically run on an external
computer).
This program is called an assembler.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 28 / 31
Evolution of a Processor

Application Development with Microcontroller Boards


. . . contd.
While assembly language programs make sense to human
beings, these are very detailed and it is laborious to write
programs in assembly language.
High level languages (such as C and C++) can express what
needs to be done much more compactly.
It is then possible to translate this high level language program to
assembly language and eventually to machine language using a
program called a compiler.
Once the translation is complete, the bit pattern corresponding to
the machine language must be downloaded to the microcontroller.
This requires a communication program to run on the external
computer and a receiver program to run on the microcontroller.
The receiver program is a small program which is pre-loaded into
the program memory of the microcontroller at the time of
manufacture. This is called boot code.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 29 / 31
Evolution of a Processor

Application Development with Microcontroller Boards


. . . contd.
The application development cycle involves
1 Writing the application program in a high level language (For
example, C or C++).
2 Compiling it on the PC – usually using an Integrated Development
Environment (IDE) supporting the board we shall be using.
(The Integrated Development Environment includes an editor for
writing the program, a compiler, a library with useful pre-written
functions and the software required to send the machine code to
the microcontroller board).
3 Downloading the compiled program to the board using IDE on the
PC and the boot loader on the microcomputer.
4 Running the downloaded program on the board after resetting the
processor.
5 Testing and debugging the application program.
(Department of Electrical Engineering, IIT Bombay)
MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 30 / 31
Evolution of a Processor

Still to Come . . .

In the next lecture, we’ll discuss the application development process


with a few examples.

(Department of Electrical Engineering, IIT Bombay)


MS-101 Makerspace Introduction to Microprocessors Jan 31, 2025 31 / 31

You might also like