Documente Academic
Documente Profesional
Documente Cultură
K
MCA | SEMESTER 1
REGISTER NO: 190951144
January – 2019
MCS- 012
Computer Organisation and Assembly Language Programing
Assignment Code:
MCA (1)/012/Assignment/2018-19
MCS-012: Computer Organisation and Assembly Language
Question 1
A. 1. Fixed Point Numbers:
i. What is a fixed point number?
A number representation which is a real data type for a number
that has fixed number of digits before or after the radix point. A
fixed point data type is defined by the word length in bits, the
position of radix point and stating whether the umber is signed or
unsigned.
Representation in 8 bits
Decimal Number Sign bit Magnitude bits
+9 0 000 1001
There is carry in to the sign bit and carry out from the sign bit.
Therefore, No overflow and hence carry out will be discarded.
MCS-012: Computer Organisation and Assembly Language
Hence, There is an overflow at the carry into the sign bit is not
equal to the carry of the sign bit.
B. Conversion of Numbers
i. Decimal to binary
Decimal to HexaDecimal
Given = (ABCDEF)H
Octal = (1257157360)8
MCS-012: Computer Organisation and Assembly Language
Given F(A,B,C,D)=∑(2,3,4,5,10,11,12,13)
Truth Table
Decimal A B C D Output F
0 0 0 0 0 0
1 0 0 0 1 0
2 0 0 1 0 1
3 0 0 1 1 1
4 0 1 0 0 1
5 0 1 0 1 1
6 0 1 1 0 0
7 0 1 1 1 0
A8 1 0 0 0 0
9 1 0 0 1 0
10 1 0 1 0 1
11 1 0 1 1 1
12 1 0 0 0 1
13 1 1 0 1 1
14 1 1 1 0 0
15 1 1 1 1 0
K-Map
CD 00 01 11 10
AB
00 1 1
01 1 1
10 1 1
11 1 1
MCS-012: Computer Organisation and Assembly Language
→ (𝐴 + 𝐴)𝐵𝐶 + (𝐴 + 𝐴)𝐵𝐶
→ 𝐵𝐶 + 𝐵𝐶
Logic Diagram
𝐵𝐶 and 𝐵𝐶 are passed through AND gates and the output will be
𝐵𝐶 + 𝐵𝐶
(P.S. This arguments passed an output are mentioned separate as the tool I
use does not support adding these type of comments to the diagram)
D. Parity bit
1. Need for Parity bit:
Parity bit is used to keep a count of 1’s in the data and marks wether
the count is even or odd and is added to the data. It is used for error
detection and is majorly useful for detecting errors on data
transmission
MCS-012: Computer Organisation and Assembly Language
Example
Assume a 7bit data 011 0101 is transmitted.
For error checking we add an eighth bit which is the parity bit
If an even parity method is adapted then a parity bit 0 which is an
even parity bit is added. Whereas if an odd parity method is adapted
then an odd parity 1 is added.
Given equation
2i – 1 >= n + i
This equation is used to find number of error correction bits
B1 B2 B3 B4 P1 P2 (B2, P3 P4(B1,
(B1, B3,B4) (B3, B2, B3,
B2, B4, B4)
B3) B1)
1 0 0 1 1 1 0 0
Here P1-B1, P2-B2, P3-B3, P4-B4 pairs differ. Thus B3 hass error and
we could correct it by complementing it in order to obtain he correct
data 1101.
State Table
0 0 1 0 1 0 1
MCS-012: Computer Organisation and Assembly Language
-State diagram
K Map
Da
BX
A 𝐵𝑋 𝐵𝑋 𝐵𝑋 𝐵𝑋
𝐴 1
A 1 1 1
MCS-012: Computer Organisation and Assembly Language
Db
BX
A 𝐵𝑋 𝐵𝑋 𝐵𝑋 𝐵𝑋
𝐴 1 1
A 1 1
𝐷𝐴 = 𝐴𝐵 + 𝐴𝑋 + 𝐴𝐵𝑋
Thus 2 flip flop equations are
𝐷𝐴 = 𝐴𝐵 + 𝐴𝑋 + 𝐴𝐵𝑋
𝐷𝐵 = 𝐵𝑋 + 𝐵𝑋
MCS-012: Computer Organisation and Assembly Language
Logic Circuit
Where the outputs will be 𝐴 𝑎𝑛𝑑 𝐴 from first flip flop and 𝐵 𝑎𝑛𝑑 𝐵 from the
second flip flop respectively.
MCS-012: Computer Organisation and Assembly Language
Example
Similarly for -0 is
Sign Bit Exponent Significand
1 0000 0000 0000 0000 0000 0000
0000 0000
Question 2
A. RAM memory
i. Data input and output lines
Given 1M with 16 cells
Therefore, word size =16
Hence, given RAM needs 16 Data input lines and 16 Data output lines?
B. Ram Memory
i. Direct cache memory is needed
Given Ram 1MB =220 words
Word size of ram =16 bits
Cache memory size= 8 blocks
Cache memory block size=32 bits
=> 1 block of cache= 2 words of RAM
Given main memory address= 0001 1001 1110 1101 0001
Here, index= 3 and tag =17
C. DMA
D. Memory
Given
Total No. of tracks= 1000
Size of each sector= 512k
File size= 16M
Size of four free continuous clusters of 8sectors each
= 4*8*512k
=16384k
=16M
ii. RAID
RAID stands for Redundant array of independent disks.. A
basic scenario to use RAID is to replace the large capacity
disk multiple smaller capacity disks. It improves overall I/O
performance as data is distributed along disks to provide
stimulator.
Question 3
A.
i. Design instruction formats
Register type used for arithmetic interactions
OP RS RT RD Stamt Funct
6Bytes 5Bytes 5Bytes 5Bytes 5Bytes 5Bytes
Where,
OP - Operations code or operand
RS - The first register source operand
RT - Designation operand, stores result of operation
Shamt – used in case of self-operations
Funct – This field selects specific variable out of the operation in the
opcode field, and is sometimes referred as function code
Total 26 = 32 operations can be called on this machine as opcode
size is 6bit.
i. Demonstrate different addressing modes
Indirect and Direct Addressing modes can be used in the
machine
When addressing mode bit is ‘0’thenindirect addressing is
used
Example
LOAD I
500
500 50A
50A 0111
MCS-012: Computer Organisation and Assembly Language
Insertion
Address
↓
Address of
operand
↓
Operand
Main Memory
Instruction
Address
↓
Operand
MCS-012: Computer Organisation and Assembly Language
S3 S2 S1 S0 C F Macro Name
Operati
on
0 0 1 0 0 𝑓 R<-R2-R1 Subtra
=𝑥 ct with
+ (𝑦 borrow
+ 1)
0 1 1 0 - F= R<-R1+R2 Exclusi
x+y ve OR
of R1
and R2
MCS-012: Computer Organisation and Assembly Language
1 0 - - - F= R<- Shift
shl(x Shl(R1) Left
)
1 0 - - - F= R<- Shift
shl(x Shl(R2) Left
) twice
0 0 0 0 1 f- R<- R1+1 Increm
x+1 ent
A. Structure of CPU
A control unit has a set of input values on the basis of which it produces
on output control signals which in turn performs micro operations. These
input signals control the execution of a program
Use of large set of registers will lead to fewer memory access. Some most
operational resources are to lead variables of a function in C they are the
obvious choice for storing the registers. RISC register file produces a
support for such cell returns which the help of register windows. Register
files are broken into multiple small sets of registers and assigned to a
difficult function. A function call automatically changes each of these sets.
The use from fixed size window of registers to another, rather than saving
registers in memory or done in CISC. Windows for adjacent procedures
are often piped. This feature allows parameter passing without moving
the variables at all.
Given
No. of registers reserved for global variables = 32
No of registers reserved for interaction between bits =32
No of registers received from string 2i/p parameters =8
MCS-012: Computer Organisation and Assembly Language
This type of RISC machine can support 7 levels of calls all together.
MCS-012: Computer Organisation and Assembly Language
Question 4
A. Assembly program
Source Code
DATA SEGMENT
IN_1 DB 0
IN_10 DB 0
IN_100 DB 0
IN_1000 DB 0
CODE
MAIN PROC
; READ INPUT
MOV AX, @DATA ; SETS UP DATA
MOV DS, AX
LDA DX, MSG1
MOV AH, 091
INT 21H
; CHECK IF NUMBER
CMP INT_1, 304
MCS-012: Computer Organisation and Assembly Language
JB ERROR
CMP IN_1, 57
JA ERROR
CMP IN_100, 48
JB ERROR
CMP IN_100, 57
JA ERROR
CMP IN_1000, 48
JB ERROR
CMP IN_1000, 57
JA ERROR
MOV MSG5, DX
LDA DX, MSG5
MOV AH, 094
INT 21H
END;
OUTPUT
NOT NUMBER!
RESULT: 4D3
ERROR
INT 21H
JMP P_END
COMPUTE:
MOV DI
ADD DX, AX
MUL IN_10
ADD DX, AH
MUL IN_1000
ADD DX, AX
Source code
.DOSSEG
.MODEL SMALL
.STACK 11H
.DATA
.CODE
MAIN PROC
MOV AL, 31H
CALL DIVZERO
MOV AH, 9
INT 21H
MAIN ENDP
; ENDS MAIN PROC
DIVZERO PROC NEAR
CMP AL, 60H
JNE L1
MOV AH, 9
INT 21H
L1:
RET
DIVZERO ENDP
END MAIN
; END OF PROGRAM
MCS-012: Computer Organisation and Assembly Language
C. Explain following
Given
The address bus has total 20 bits address bus thus, the microprocessor can access upto
220 i.e. 1MB ram directly.
The address bus of 8086has 16 bit lines. Thus, the instruction offset is only 16 Bits.
1. Hardware Intrust:
The interrupts are general which a peripheral interrupt source program requests for some
service
2. Software interrupt
It makes a call to the operating system and usually it is the input –output route.
In 8086, software interrupts instruction processing is done using the interrupt vector table.
The IVT is located in the first 1k of memory and has a total of 256 entities each of 4 bytes. An
entity in the interrupt vector table is defined by the number given in the interrupt
instruction. The entry states the address of the operating system subroutine that is used to
process the interrupt. This address may be different for different machines.
Interrupt is processed as
Step 1:
The number field in IVT instruction is multiplied by 4 to find the entry in the interrupt vector
table.
Step 2:
The CPU locates the interrupt secondary routine whose address is stored at IVT entry
Of the interrupt.
MCS-012: Computer Organisation and Assembly Language
Step 3:
The Cupolas the CS register and the IP register with this new address in the IVT and
transfers the control to that address just like a for call.
Step 4:
IRET causes the program to resume execution at the next interaction in the calling program
In indexed interrupt addressing mode the contents of a register are added to a displacement
to generate an effective address