Professional Documents
Culture Documents
Lab Mannual CA
Lab Mannual CA
LOGIC DESIGN
LAB MANUAL
EMAN ZAI
SYEDA FARWA BATOOL
AREEJ INTISHAD
EXPERIMENTAL RESULTS
1. AND GATE :
TRUTH TABLE :
INPUT A INPUT B OUTPUT Q
0 0 0
0 1 0
1 0 0
1 1 1
2. OR GATE :
3. NAND GATE :
4. NOR GATE :
5. X-OR GATE :
6. NOT GATE :
INPUT A = 0 , OUTPUT Q = 1
TRUTH TABLE :
INPUT A INPUT Q
0 1
0 0
COMPUTER ARCHITECTURE &
LOGIC DESIGN
LAB NO. 02
EMAN ZAI
AREEJ INTISHAD
SYEDA FARWA BATOOL
EXPERIMENTAL RESULTS
1. Working of AND gate using NAND gate
• TRUTH TABLE :
INPUT A =0 , OUTPUT B = 1
TRUTH TABLE:
INPUT A OUTPUT B
0 1
0 0
COMPUTER ARCHITECTURE &s
LOGIC DESIGN
LAB NO. 03
SUBMITTED TO: SIR SHOAIB
EMAN ZAI
SYEDA FARWA BATOOL
AREEJ INTISHAD
EXPERIMENTAL RESULT
Fill in the following truth table in the presence of the
lab instructor.
4.1. Truth Table for XOR Gate: (Details above)
A B OUTPUT
0 0 0
1 0 1
0 1 1
1 1 0
Write Boolean function for XOR gate:
Draw NAND logic diagram for the XNOR gate:
Truth Table for XNOR Gate:
A B OUTPUT
0 0 1
0 1 0
1 0 0
1 1 1
Write Boolean function for XNOR gate:
COMPUTER ARCHITECTURE &
LOGIC DESIGN
LAB NO. 04
SUBMITTED TO: SIR SHOAIB
EMAN ZAI
SYEDA FARWA BATOOL
AREEJ INTISHAD
HALF ADDER:
FULL ADDER:
Lab-05
EMAN ZAI
AREEJ INTISHAD
SYEDA FARWA BATOOL
LAB 06
EMAN ZAI
AREEJ INTISHAD
The Intel i860, also known as the Intel 860 RISC processor, is a
historical processor.
It features a unique design combining scalar and vector
processing units.
Originally intended for graphics and scientific applications.
Transmeta Crusoe:
ANSWER:
Smartphones: Embedded processors manage various
functions, such as communication, sensors, and
multimedia.
MOBILE:
NAME : SAMSUNG A14
The Samsung Galaxy A14 5G has a 64-bit CPU architecture. 64-
bit CPUs are more efficient than 32-bit CPUs, which are more
efficient than 16-bit CPUs.
Here are some specifications for the Samsung Galaxy A14 5G:
Processor: Samsung Exynos 1330
CPU cores: Octa-core
CPU technology: 5 nm
CPU max speed: 2.4 GHz
GPU: Mali-G68 MC4
OS: Android v13
RAM: 4 GB
ROM: 64 GB
The Samsung Galaxy A14 5G has the following AnTuTu
Benchmark scores:
Overall: 409,771
CPU: 131,896
GPU: 84,030
Memory: 78,109
INSTRUCTOR:SIR SHOAIB
Hello World
Program 1:
org 100h
.data ; Declare variables
hello_message db 'Hello','World',0dh,0ah,'$'
.code ; Write code
main proc
mov ax,@data ; Copy the address of data
mov ds,ax ; Segment into DS register
mov dx,offset hello_message
mov ah,9 ; MS-Dos Function to display string
INT 21H
mov ax,4C00h ; Halt the program and return control to
OS
INT 21H
main endp
CONSOLE:
Program 2:
org 100h
CONSOLE:
Program 3:
org 100h
Program 4:
org 100h
CONSOLE:
LAB # 8
NAME:EMAN ZAI
AREEJ INTISHAD
SYEDA FARWA BATOOL
TASKS
Assemble and trace following programs using DEBUG. For each
program, write down the contents of only those registers and
flag bits which have been modified by the given program.
Program 1: [AX=0020, BX=00AA]
mov ah, bl
Program 2: [AX=06AF]
mov ah,3
LAB NO. 09
EMAN ZAI
SYEDA FARWA BATOOL
AREEJ INTISHAD
Exercise 9.1
Write a program that input a character from user is in lowercase,
the program will
convert it to uppercase and will display it on console after
conversion .(Hint: - The ASCII codes for lowercase letters (a-z)
are 97-122. In order to convert a lowercase letter to uppercase
letter, just subtract 32 from its ASCII code.)
CODE:
CONSOLE:
Exercise 9.2
Write a program that input a character from user. The program
will display it ten times on screen in newline.
CONSOLE:
CODE:
12/28/2023 COMPUTER
ARCHITECTURE
&LOGIC DESIGNS
LAB NO.10
9= 00001001
6 = 00000110
Now toggle bits of 6 : 11111001
Now add +1 : 11111010
Now add above numbers according to formula : A+(-B):
9+(-6) = 00000011
Here 0 indicates + sign so, 9 + (-6)= 0000011
• 146 – 9 =10001001
146 = 10010010
9=00001001
Now toggle all bits of 9 = 11110110
Add 1 to above : 11110111
146 -9 = 10010010 + (11110111) = 110001001
Now we will discard 1 as compiler execute only 7 bits
Here 1 indicates - sign so, 146 -9 = 10001001
Activity 3.2:
95C3 +1 -->01100000b
Activity 3.3:
Addition of two single digits numbers
CODE:
.data
Num1 db 0
Num2 db 0
msgNum1 db "Enter the 1st No: $"
msgNum2 db 10,13,"Enter the 2nd No: $"
msgAns db 10,13,"The answer is: $"
.code
;========================================
main proc
mov ax, @data
mov ds, ax
mov dx,offset msgNum1
mov ah, 09h
int 21h
mov ah, 1 ; accept 1 char from keyboard
int 21h
sub al,30h ; convert to number
mov Num1,al
;=======================================
mov ax, @data
mov ds, ax
mov dx,offset msgNum2
mov ah, 09h
int 21h
mov ah, 1 ;accept 1 char from keyboard
int 21h
sub al,30h ;convert to number
mov Num2,al
;++++++++++++++++++++++++++++++++++++++++++
;ADD Num1,Num2 is illegal
mov bh, Num1
add bh, Num2
add bh, 30h ;convert back to ASCII equiv
mov ax, @data
mov ds, ax
mov dx,offset msgAns ;some message
mov ah, 09h
int 21h
mov dl,bh
mov ah,2 ;print answer
int 21h
mov ah,00h ;pause..... resume when press any key
int 16h
main endp
end
CONSOLE:
Activity 3.4:
Addition of two multi-digits numbers
CODE:
include 'emu8086.inc';include library
.data
num1 dw 0
num2 dw 0
; get the multi-digit signed number from the keyboard, and store the
; result in cx register:
call scan_num ; Get first number
mov num1, cx ; store first number:
call scan_num ; Get second number
mov num2, cx ; store second number:
mov ax, num1 ; Can not add two memory variables
add ax, num2 ; add num2 in ax and store result in ax
call print_num ; print ax value.
DEFINE_PRINT_NUM ; used by print_num proc
DEFINE_PRINT_NUM_UNS ; used by print_num proc
DEFINE_SCAN_NUM ; used by scan_num proc
CONSOLE:
Exercise 3.1
Modify above program to format the output.
Enter first number: 25
Enter second number: 50
The sum of two number is : 75
Note: - GOTOXY col, row- macro to sets cursor position.
CODE:
.code
main:
mov ax, @data
mov ds, ax
Exercise 3.3:
Write a program using instruction shown in table and fill in the table with the offsets
of the instructions in the code segment.
CODE:
.data
number dw 100
sum dw 0
.code
main PROC
mov ax, number
add ax, 158
mov sum, ax
mov ax, 0
Eman zai
Areej intishad
Syeda farwa batool
EXERCISE 4.1
INSTRUCTION 1:
INSTRUCTION 3:
EXERCISE 4.2:
Calculate the range of signed and unsigned numbers that db, dw, dd, dq and dt
directives can specify. Mention the adopted method i.e how you will calculate the
range.
EXERCISE 4.3:
byte1 db 10110111b : 183
byte2 db 35q :29
byte3 db 0E8h :232
byte4 db 150 : 150
byte5 db -91 : 165
byte6 db „K‟ : 75
byte7 db „k‟ :107
byte8 db “Ali‟s book” : 065
byte9 db 5 DUP("< >") : 060
byte10 dw 1000000 : overflow error
Byte11 dw "Maria Sultan": 4D077- 90144
Exercise 4.4
Define 5 different 8-bit Numbers. Write a programme to do the
following : Use the DB directive to define the following list of numbers and
name it myarray.
• 36h, 37h, 39h, 40h
• Display the array in reverse order.
OPEN ENDED LAB
OPEN ENDED LAB
Exercise 5.1
Write a program to use the SCAN_NUM to input prompt for values for three
variables x, y and z and the PRINT_NUM to display an appropriate label and
value of the expression x – y + 2z – 1.
CODE:
include emu8086.inc ;include library
.data
x dw 0 ; Define variable for x
y dw 0 ; Define variable for y
z dw 0 ; Define variable for z
result dw 0 ; Variable to store the result
msgX db "Enter value for x: $"
msgY db 10, 13, "Enter value for y: $"
msgZ db 10, 13, "Enter value for z: $"
msgResult db 10, 13, "Result (x-y + 2z- 1): $"
.code
main:
mov ax, @data
mov ds, ax
; Input for x
mov dx, offset msgX
mov ah, 09h
int 21h
; Input for y
mov dx, offset msgY
mov ah, 09h
int 21h
; Input for z
mov dx, offset msgZ
mov ah, 09h
int 21h
.code
main:
mov ax, @data
mov ds, ax
EMAN ZAI
AREEJ INTISHAD
SYEDA FARWA BATOOL
Exercise 7.1
In the following instruction sequence. Show the changed value of AL where indicated,
in binary:
Exercise 7.2
In the following instruction sequence, show the changed value of AL where indicated,in
hexadecimal:
Exercise 7.3
In the following instruction sequence, show the values of the Carry, Zero, and Sign flags
where indicated:
mov al,00001111b
test al,00000010b ;
mov al,00000110b
cmp al,00000101b ;
mov al,00000101b
cmp al,00000111b ;
Exercise 7.4
Write a single instruction that clears the high 8 bits of AX and does not change the low 8 bits.
Exercise 7.5
Write a single instruction that sets the high 8 bits of AX and does not change the low 8
bits.