1 Class:: Transistor
1 Class:: Transistor
1 class :
Microprocessor and CPU Relation:
It is a multipurpose, programmable device that
accepts digital data(0,1binary data) as input,
processes it according to instructions stored in its
memory, and provides results as output.
Microprocessors operate on numbers(binary number)
and symbols(register :AX,BX,CX,DX) represented in the
binary numeral system.
Transistor:
In the analog world of continuously varying signals, a
transistor is a device used to amplify its electrical input.
In the digital world, a transistor is a binary switch and the
fundamental building block of computer circuitry. Like a
light switch on the wall, the transistor either prevents or
allows current to flow through.
A single modern CPU can have hundreds of millions or even
billions of transistors.
Transistor, semiconductor device for amplifying,
controlling, and generating electrical signals.
A transistor is a type of a semiconductor device that can
be used to both conduct and insulate electric current or
voltage.
A transistor basically acts as a switch and an amplifier.
In simple words, we can say that a transistor is a miniature
device that is used to control or regulate the flow of
electronic signals.
https://www.techwalla.com/articles/the-difference-between-
a-cpu-a-microprocessor
http://resource.renesas.com/lib/eng/e_learnig/h8_300hengli
sh/s01/04.html
The central processing unit (CPU) is a chip that functions as the
brains of the computer.
The CPU has a control unit, a logic and arithmetic unit and
registers, plus a small bit of memory called cache.
The CPU is a microprocessor. The microprocessor is an
integrated circuit that is made up of millions of transistors.
However, not all microprocessors are CPUs.
Microprocessor consists of ALU, array register and a control
unit.
CPU = ALU + CU
ALU Arithmetic Logic Unit (+,-,*,/) arithmetic
AND, OR, XOR Logic
CU Central Processing Unit
CPU 1 chip or more than one chip
Microprocessors 1 chip Single chip CPU
Every microprocessor is CPU but not every CPU are
microprocessor.
Microprocessor ALU(Microprocessor has one ALU)
8086 Microprocessor 16 bits
X bit microprocessor x bit data can process at a time [ x =
4,8,16]
ALU in Microprocessor can process x bit data at a time.
Register: AX, BX, CX, DX symbol
MOV AX,0003h
Symbol Number
AX = 0003H hex
1 hexadecimal = 4 bits 4 hex = 16 bits
AX is a 16 bits microprocessor.
Microprocessor and register are the same sizes in a specific
Microprocessor.
BUS = Communication Path Way.
Each microprocessor task may take a number of clock
cycles.
So a Microprocessor zxthat can do more clock cycles in
a particular time can achieve any task faster.
That’s why a 3.6 GHz microprocessor (which does
3.6x109 clock cycles per second) is faster than a 2.4 GHz
microprocessor.
nd
2 class
BUS = communication path way
There are three types of bus:
1.Address bus
3.Data bus
4.Control bus
Tarak borrow some money form Anirba. He(tarak) didn’t pay
back. So, Anirban goes tarak’s place which is address bus. He
take his money from Tarak, Which is data bus. Tarak take a
acknowledgement from Anirban, Which is Control bus.
A – Auxiliary flag
A = D7 D6 D5 D4 D3 D2 D1 D0
A = 11111000 and B = 00011000
A + B = 100010000
AF = 1 (Carry from D3 to D4)
A = 11111000 and B = 00000000
A + B = 11111000
AF = 0(There is no carry)
P – parity flag
PF = Parity flag;
PF = 1 ( even parity) = Even
Number of 1’s in lower byte = 4(even)
PF = 0 (Odd parity) = odd
Number of 1’s in Lower Byte = 5 (odd)
8086
AX = AH + AL
AX = 11110000 00001111 ---(1) even parity PF = 1
Ax = 11110000 10001111---(1)
Result = AX = 2
Remainder DX = 0
CX = COUNT
MOV CX,80; CX = 80
shanto: -- user define label
J…….
……….
LOOP shanto ; machine language for loop
BX = BASE REGISTER
XLATE(TRANSLATE) INSTRUCTION
We use base register for translate instruction and offset
address.
Physical Address = Segment Register * 10H + Offset address/
effective address
PA = CS * 10H + IP
Segment register = base address = Code Segment
IP = Offset Address/Effective address
IP = Instruction Pointer register
CS = 0004H Ip = 0000 H
PA = CS * 10H + IP
PA = 0004 * 10H + 0000
= 00040(20 bits address)
Th
4 class
MOV operational code/ opcode
AX, BX Operand
MOV AX, BX
AX Destination Operand
BX Source Operand
Before
AX = 0004H
BX = 0003H
MOV AX, BX
After
AX = 0003H
BX = 0003H
Before Execution:
CS = 0100
IP = 0000
PA = CS * 10H + IP
PA = 0100*10H + 0000
PA = 01000
MOV AX,BX .This instruction has address in 01000
Memory content = 8BC3H = 16 bit = 2 byte
IP value increase by memory content byte
After Execution
Immediate operand addressing mode
Before Execution:
IP = 0000
CS = 0100
PA = CS * 10 + IP
PA = 0100*10 + 0000
PA = 01000
MOV AL,03, address is 01000
Memory content = BO03 = 16 bit = 2 byte
After Execution
Direct memory operand addressing mode:
MOV CX,[1234] MOV CX,[Effective address]
Before Execution:
PA = CS*10H + IP
PA = 0100*10H + 0000
PA = 01000
After Execution:
PA = DS *10H + EA
PA = 0200 *10H + 1234
PA = 03234
CH CX
ED BE
ED = 03235
BE = 03234
6TH CLASS
Based indexed memory operand addressing mode:
MOV AH, [BX],[SI] + 1234H
MOV AH, [BX][AX] ,[SI] + 1234H
Before execution:
PA = CS* 10 H +IP
After execution
PA = DS * 10H + E.A
Ip will increment based on instruction size
After execution next instruction:
P.A = CS + 10H + IP
8086 Microprocessor has an instruction size of 1 byte to 6
bytes. Each byte of microprocessor instruction has different
information. first byte of 8086MP contains 3 information:
1.opcode(6bit)
2. D bit/ register direction bit (1 bit)
3.W bit / data size bit (1 bit 2 byte,)
Opcode: Operational code operand
Ex: MOV,ADD,Sub
D Bit
D = 1 when register operand is used as destination operand
D = 0 when register operand is used as source operand
W bit:
When W = 0, 8 bits data is use
When W = 1, 16 bits data is used
MOD: 2 bit is used to select different addressing mode
(register mode or memory mode)
Code Explanation
Last class:
R/M : (register/memory) :
R/M field is used with MOD field for detecting the second
operand of the instruction.
Fig: Encoding table
If 16 bits displacement and 16 bits immediate operand are
used both in the same instruction, byte 3,4,5 and 6 are
decoded.
Pipelining:
In first clock cycle(t1) I1 instruction is fetched and stored in
instruction queue. In second clock cycle (t2) I1 instruction is
decoded and executed.
Instruction fetch , decond and execution cycle
SP = stack pointer
ALU = arithmetic logic unit
CU = Control Unit
IR = Instruction Register
BR =Buffer register
CS 0 = chip is selected
1 = chip is not selected
FINAL SEMESTER
st
1 class : 09/10/21
Embedded system:
Firmware = hardware + software
2nd class: 17/10/2021
Microcontroler
microprocessor microcontroller
USART: Universal synchronous asynchronous
receiver transmitter
Serial com port: works with 1 bit data at a time
LAB Class:
\AH = all functions move here
Function 1h:
1h = takes single character as input
2h = displays single character as output (from dl
register)
Int 21h calls different functions and execution.
Mov AH,1h
Int 21H
Interrupt 21H call function 1h. Function 1H takes
input from keyboard
Mov AH,2H
Mov DL,’?’
Int 21H
Interrupt 21H call function 2H. Function 2H displays
value inside DL. After display DL, AL = ‘?’
Mov AH,4ch
Int 21H
Int 21h call function 4ch an 4ch function is used to
exit
Input: AH; AH takes inputs;
When we get input in AH, at the same time input
value goes to the AL
Output: AL; AL output the value
To go to new line, we have to execute 2 functions:
0DH = carriage return (start of current line)
Cursor will go in front of line.
0ah = line feed (new line)
Cursor will go next line.
Mov AH,2H
Mov DL,0DHcarriage return = 0DH
Int 21H
Interrupt 21h call function 2h and function 2h
displays value inside dl; AL = 0DH that means cursor
in front of the line
Mov AH,2h
Mov DL, 0DH
Int 21h
Interrupt 21h call function 2h and function 2h
displays value inside DL; AL = 0AH that means
cursor in the next line.
Mov DL, BL
Int 21H
Interrupt 21h call function 2h and function 21 h
displays value inside of DL.
Data-defining pseudo
DB = define byte
DW = define word
DD = define doubleword (two consecutive words)
DQ = define quadword (four consecutive words)
DT = define ten bytes (ten consecutive bytes)
Int 21h, function 9;
DX = offset address of string
The string must end with a ‘s’ character
LEA DX, MSG
Puts the offset address of the variable MSG into DX
LEA = Load Effective Address