MCS012 Solved Assignment 2024-25
MCS012 Solved Assignment 2024-25
in 1
Weightage : 25%
Last Dates for Submission : 31st October, 2024 (For July Session) 30th April, 2025 (For
January Session)
Note:
There are four questions in this assignment, which carries 80 marks. Rest 20 marks are for
viva voce. You may use illustrations and diagrams to enhance the explanations. Please go
through the guidelines regarding assignments given in the Programme Guide for the format
of the presentation. The answer to each part of the question should be confined to about
300 words. Make suitable assumptions, if any.
Question 1:
(a) Please refer to Figure 4 of Unit 1 of Block 1 on page 11 of the Instruction execution
example. Assuming a similar machine is to be used for the execution of the following three
consecutive instructions:
LOAD A ; Load the content of Memory location A into the Accumulator Register.
However, this machine is different from the example in Figure 4 in the following ways:
The AC, IR, MAR and MBR registers are of size 32 bits, whereas PC register is of size
20 bits. The initial content of the PC register is (11FFE)h.
(i) Draw a diagram showing the Initial State of the machine with the addresses and content
of memory locations in hexadecimal. Show only those address locations of the memory that
store the instruction and data. Also, show the content of all the stated registers. (2 Marks)
(ii) Draw three more diagrams, each showing the state of the machine after execution of
every instruction viz. LOAD, ADD and STOR. Show the changes in the values of Registers and
memory locations, if any, due to the execution of the instruction. Show all the addresses and
values in hexadecimal notations. (3 Marks)
Solution:
Memory:
Registers:
1. Instruction 1: LOAD A
2. Instruction 2: ADD B
3. Instruction 3: STOR C
iii) String “MCS-12 Price in $” into UTF 8. iv) Octal (12076543)O into Decimal.
Solution:
To convert 345789531₁₀ into binary, I repeatedly divide the number by 2 and record the
remainders:
10100100100111111011011000011₂
149454B₁₆
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 8
To convert the hexadecimal number ABC023DEF₁₆ into octal, I first convert it into binary,
then group the bits in sets of three (since octal is base 8).
A = 1010
B = 1011
C = 1100
0 = 0000
2 = 0010
3 = 0011
D = 1101
E = 1110
F = 1111
101010111100000000100011110111101111₂
Now, group the binary digits in sets of three starting from the right:
010 = 2
101 = 5
011 = 3
110 = 6
000 = 0
000 = 0
010 = 2
001 = 1
111 = 7
011 = 3
110 = 6
111 = 7
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 9
253600217367₈
Q1 (b) iii) Convert the string "MCS-12 Price in $" into UTF-8:
4D 43 53 2D 31 32 20 50 72 69 63 65 20 69 6E 20 24
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 10
To convert the octal number 12076543₈ into decimal, I use the expansion method, where
each digit is multiplied by 8 raised to the power of its position (starting from 0 on the
right).
= 2629539
2629539₁₀
Q1 (c) Simplify the following function using K-map: F(A, B, C, D) = Σ (0, 1, 2, 4, 8, 9, 10, 13)
Draw the circuit for the resultant function using NAND gates. (2 Marks)
Solution:
The function involves 4 variables: A, B, C, and D. This means we will need a 4-variable K-
map, which has 16 cells (2⁴ = 16 cells). I will label the cells based on the binary
combinations of the variables (AB for rows, CD for columns).
AB\CD 00 01 11 10
00 1 1 - 1
01 1 - 1 -
11 - - - -
10 1 1 - -
I can simplify the function by grouping adjacent 1's into the largest possible groups of 2ⁿ
cells. Here are the groups:
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 11
Group 1 (top-left corner 4 cells): This group covers minterms 0, 1, 8, and 9. The
simplified expression for this group is A'C'.
Group 2 (middle top 2 cells): This group covers minterms 2 and 10. The simplified
expression for this group is A'B'C.
Group 3 (bottom-left 2 cells): This group covers minterms 4 and 5. The simplified
expression for this group is B'D'.
Q1 (d) Consider the Adder-Subtractor circuit as shown in Figure 3.15 page 76 of Block 1.
What would be the values of various inputs and outputs; viz. Cin input to each full adder, A0,
B0, A1, B1, A2, B2, A3, B3, S0, S1, S2, S3, Carry out bit, and overflow condition; if this circuit
performs subtraction (A-B), when the value of A is 1010 and B is 1011. (1 Mark)
Solution:
Inputs:
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 12
Since the operation is subtraction, the circuit will compute A - B, which is 10102−101121010_2 -
1011_210102−10112.
Step-by-Step Analysis:
1. Two's Complement of B:
o First, we calculate the two's complement of B=1011B = 1011B=1011.
Invert the bits of B: 010001000100
Add 1 to the result: 0100+1=01010100 + 1 = 01010100+1=0101 (This is
the two's complement of BBB).
2. Subtraction Using Full Adders:
o We now add A=1010A = 1010A=1010 and the two's complement of B=0101B =
0101B=0101.
Final Results:
S0 = 1
S1 = 1
S2 = 0
S3 = 0
Carry Out = 1
Overflow Condition:
The overflow condition occurs when there is a carry into the most significant bit but no
carry out, or vice versa. In this case, both the carry into and carry out of the most significant
bit (bit 3) are 0, so overflow does not occur.
Q1 (e) Explain the functioning of a 2 × 4 decoder with the help of a logic diagram and an
example input. (2 Marks)
Solution:
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 13
A 2×4 decoder is a digital circuit that converts 2 input lines into 4 output lines, where each
output represents one of the possible combinations of the inputs. The inputs are typically
labeled A and B, and the outputs are Y0, Y1, Y2, and Y3. The truth table of a 2×4 decoder is
as follows:
Only one output is active at a time, depending on the combination of inputs. The logic
diagram typically includes two NOT gates and four AND gates. The outputs are formed by
AND gates based on combinations of inputs and their complements.
For example, for input A=1 and B=0, Y2 will be activated, meaning the corresponding AND
gate produces an output of 1, while all other outputs remain 0
Q1 (f) Assume that a source data value 1111 was received at a destination as 1011. Show
how Hamming's Error-Correcting code bits will be appended to source data to identify and
correct the error of one bit at the destination. You may assume that transmission error
occurs only in the source data and not the source parity bits. (2 Marks)
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 14
Solution:
Given that the original source data was 1111 and was received as 1011, the error occurred
in one of the bits.
Hamming Code works by adding redundancy bits (parity bits) at specific positions to the
source data. These parity bits help detect and correct errors. The number of parity bits
needed for error detection and correction is given by the formula:
2r ≥ m + r + 1
Where:
I insert the parity bits at positions that are powers of 2 (i.e., positions 1, 2, and 4 in the 7-bit
sequence):
P1 at position 1
P2 at position 2
P4 at position 4
D3 at position 3
D5 at position 5
D6 at position 6
D7 at position 7
Using the source data 1111, I place the bits in the data positions:
Position 1 2 3 4 5 6 7
Value P1 P2 1 P4 1 1 1
I now calculate the values for P1, P2, and P4 by ensuring each parity bit covers the
appropriate set of bits:
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 15
P1 covers positions 1, 3, 5, 7:
P1 = 1 ⊕ 1 ⊕ 1 = 1
P2 covers positions 2, 3, 6, 7:
P2 = 1 ⊕ 1 ⊕ 1 = 1
P4 covers positions 4, 5, 6, 7:
P4 = 1 ⊕ 1 ⊕ 1 = 1
The received data is 1011111. To detect the error, I calculate the parity bits at the
destination and compare them with the parity bits in the received data.
1. P1 covers positions 1, 3, 5, 7:
P1′ = 1 ⊕ 1 ⊕ 1 = 1
2. P2 covers positions 2, 3, 6, 7:
P2′ = 0 ⊕ 1 ⊕ 1 = 0
3. P4 covers positions 4, 5, 6, 7:
P4′ = 1 ⊕ 1 ⊕ 1 = 1
The error syndrome is formed by combining the results from the parity checks:
This points to position 2 (binary 010), indicating that the second bit is in error. I flip the
second bit of the received data 1011111, correcting it to 1111111, which matches the
original transmitted data.
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 16
Q1 (g) Explain the functioning of the RS flip flop with the help of a logic diagram and
characteristic table. Also, explain the excitation table of this flip-flop. (2 Marks)
Solution:
1. Functioning:
o In the SET state (S = 1, R = 0), the output Q is 1, and the flip-flop stores a "1."
o In the RESET state (S = 0, R = 1), the output Q is 0, and it stores a "0."
o When both S and R are 0, it leads to an invalid or undefined state in the RS
flip-flop using NOR gates, while using NAND gates, both outputs remain "1."
2. Characteristic Table: This table defines the next state of the output based on the
current inputs (S, R) and the current state (Q). For example:
o S=0, R=0: No change.
o S=0, R=1: Reset.
o S=1, R=0: Set.
o S=1, R=1: Invalid state (for NOR gates).
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 17
3. Excitation Table: This table provides the necessary inputs (S, R) to transition from
the current state to the next state, helping in the design of sequential circuits.
Q1 (h) Explain the functioning of the master-slave flip-flop with the help of a diagram. (2
Marks)
Solution:
Whenever the CLK pulse goes to high which means 1, then the slave can be separated; the
inputs like J & K may change the condition of the system.
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 18
The slave FF can be is detached until the CLK pulse goes to low which means to 0.
Whenever the CLK pulse goes back to low-state, then the data can be transmitted from the
master FF to the slave FF and finally, the o/p can be obtained.
At first, the master FF will be triggered at a positive level whereas the slave FF will be
triggered at a negative level. Due to this reason, the master FF responds first.
If J=0 & K=1, then the output of the master FF ‘Q’ goes to the input K of the slave FF & the
CLK forces the slave FF to RST (reset), therefore the slave FF copies the master FF.
If J=1 & K=0, then the of the master FF ‘Q’ goes to the input J of the slave FF & the CLK’s
negative transition sets the slave FF, and copies the master.
If J=1 & K=1, then it toggles over the CLK’s positive transition & therefore the slave toggles
over the CLK’s negative transition.
If both the J & K are 0, then the FF can be immobilized & Q remains unmovable.
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 19
Q1 (i) Represent (129. 5)10 and (-1.125)10 in IEEE 754 single-precision and double-
precision formats. (2 Marks)
Solution:
1. (129.5)10
Single-Precision:
o Convert to binary: 12910 = 11001012 and 0.510 = 0.12
o Combine: 1100101.12
o Normalize: 1.1001011 × 26
o Sign: 0 (positive)
o Exponent: 6 + 127 = 13310 = 100001012
o Mantissa: 1001011 (1.1001011 × 26 - 1) = 01001011000000000000000 2
o Binary Representation: 0 10000101 01001011000000000000000
o Hexadecimal Representation: 40 4B 00 00
Double-Precision:
o Convert to binary: 12910 = 11001012 and 0.510 = 0.12
o Combine: 1100101.12
o Normalize: 1.1001011 × 26
o Sign: 0 (positive)
o Exponent: 6 + 1023 = 102910 = 100000000112
o Mantissa: 1001011 (1.1001011 × 26 - 1) =
01001011000000000000000000000000 2
o Binary Representation: 0 10000000011
01001011000000000000000000000000 2
o Hexadecimal Representation: 40 08 4B 00 00 00 00 00
2. (-1.125)10:
Single-Precision:
o Convert to binary: -1.12510 = -1.0012
o Sign: 1 (negative)
o Exponent: 0 + 127 = 12710 = 011111112
o Mantissa: 001 (1.0012 - 1) = 00100000000000000000000 2
o Binary Representation: 1 01111111 00100000000000000000000
o Hexadecimal Representation: C0 40 00 00
Double-Precision:
o Convert to binary: -1.12510 = -1.0012
o Sign: 1 (negative)
o Exponent: 0 + 1023 = 102310 = 011111111112
o Mantissa: 001 (1.0012 - 1) = 001000000000000000000000000000002
o Binary Representation: 1 01111111111
0010000000000000000000000000000000 2
o Hexadecimal Representation: C0 00 00 00 00 00 00 40
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 20
Question 2:
Q2 (a) Refer to the Figure 2(b) on page 8 in Unit 1 of Block 2. Draw the Internal organisation
of a 16×2 RAM. Explain all the Input and Output of this organisation. Also, answer the
following:
(i) How many data input and data output lines does this RAM need? Explain your answer.
(ii)How many address lines are needed for this RAM? Give reasons in support of your
answer. (2 Marks)
Solution:
1. Decoder:
The RAM has 16 memory locations (24 = 16), which means I need a 4-to-16 decoder to select any
one of the 16 locations. The decoder will have 4 address lines (A0, A1, A2, A3) as inputs and 16
output lines to select the specific memory location in the RAM.
Since each word in the RAM is 2 bits wide, I will need 2 data input lines (I1 and I0) to provide data
for writing into the RAM.
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 21
Similarly, I need 2 data output lines (O1 and O0) to read the data from the RAM when it is in "read"
mode.
4. Control Signals:
R/W (Read/Write): This signal determines whether the operation is a read or write. If the
signal is 0, the RAM performs a write operation, and if it is 1, it performs a read operation.
Chip Select (CS): This enables the RAM chip. When CS = 0, the chip is active, meaning it can
perform either a read or a write operation depending on the R/W signal. If CS = 1, the chip
is disabled.
This RAM has 2 data input lines and 2 data output lines, as the data width is 2 bits. Each word stored
in the RAM has 2 bits, so I need two separate lines to input and output data.
I need 4 address lines for this RAM because I need to address 16 different memory locations. Since
24 = 16, four address lines (A0, A1, A2, A3) are required to uniquely select any of the 16 locations in
the RAM.
Q2 (b) A computer has 4 K Word RAM with each memory word of 8 bits. It has cache
memory, having 16 blocks, having a size of 16 bits (2 memory words). Show how the main
memory address (3AC)h will be mapped to the cache address, if
(iii)Two-way set associative cache mapping is used. You should show the size of the tag,
index, main memory block address and offset in your answer. (3 Marks)
Solution:
Cache Mapping
2 (c) What are the different kinds of interrupts? Explain the process of handling an interrupt
with the help of a diagram. . (3 Marks)
Solution:
1. Hardware Interrupts: These are triggered by external devices or internal events within
the computer system. Examples include:
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 23
I/O Interrupts: When an I/O device (like a keyboard, mouse, or printer) completes an
operation or encounters an error.
Timer Interrupts: Generated by a timer within the CPU, used for timekeeping and
scheduling.
Memory Interrupts: Occur when the CPU attempts to access a memory location that is not
valid, such as trying to read from a non-existent location.
Hardware Errors: Occur due to malfunctions in the computer system, like power failure or
memory parity errors.
2. Software Interrupts: These are caused by the execution of specific instructions within the
program. Examples include:
System Calls: Requests made by a program to the operating system for services, such as file
operations, memory allocation, or process management.
Trap Interrupts: Occur when the CPU encounters an error or exception, such as a divide-
by-zero error or an invalid instruction.
Explanation:
In essence, the interrupt handling process involves a transfer of control from the current
program to a dedicated interrupt handler, which processes the interrupt and restores the
system to a normal state.
Q2 (d) What is a DMA? What are the advantages of using DMA? Explain the functions of a
DMA interface with the help of a block diagram. (2 Marks)
Solution:
DMA stands for Direct Memory Access. It is a technique that allows devices to transfer data
directly to and from memory without the intervention of the CPU. This means the CPU does
not need to be involved in every data transfer, freeing it up to perform other tasks.
Increased Efficiency: DMA allows for faster data transfer rates, as it eliminates the
overhead of the CPU constantly handling data transfers. This can significantly
improve the performance of the system.
Reduced CPU Overhead: By offloading data transfer tasks to DMA, the CPU can focus
on other critical functions, leading to a more efficient and responsive system.
Improved System Throughput: DMA can handle multiple data transfers
simultaneously, leading to a higher overall throughput in the system.
Simplified Program Design: With DMA, programmers do not need to write complex
code to manage data transfers, simplifying their program design.
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 25
A DMA interface acts as a bridge between the device and the memory. It manages the data
transfer process, allowing the device to access memory directly. Here's a block diagram
illustrating its functions:
Explanation:
Device: This is the device that needs to transfer data to/from memory.
DMA Controller: This is the central component of the DMA interface. It handles the
data transfer process. It has:
o Address Register: Stores the memory address to which data needs to be
transferred.
o Control Logic: Controls the timing and flow of data transfers.
o Data Register: Stores the data to be transferred to/from memory.
o Status Register: Indicates the status of the DMA transfer (e.g., busy,
completed).
Memory: This is the memory location where data is stored or retrieved.
1. Device Request: The device sends a request to the DMA controller, indicating that it
needs to transfer data.
2. DMA Controller Activation: The DMA controller initiates the data transfer process.
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 26
3. Address and Data Transfer: The DMA controller uses the address register to access
the memory and transfer data to/from the device using the data register.
4. Completion: When the data transfer is complete, the DMA controller signals the
device and the CPU.
Q2 (e) Assume that a disk has 128 tracks, with each track having 64 sectors and each sector
is of size 1 M Bytes. The cluster size in this system can be assumed to be 2 sectors. A file
having the name assignmentmcs012.txt is of size 16 MB. Assume that it is a new disk, and the
first 16 clusters are occupied by the Operating System. Rest all the clusters are free. How can
this file be allotted space on this disk? Also, show the content of FAT after the space
allocation to this file. You may make suitable assumptions. (4 Marks)
Solution:
To allocate space for the file "assignmentmcs012.txt" on the disk, I will need to consider the
file size, the cluster size, and the available space on the disk.
2. Allocate space:
Since the first 16 clusters are occupied by the OS, the file needs to be placed starting
from cluster 17.
The file requires 8 clusters, so the file will occupy clusters 17 to 24.
The FAT is a table that stores information about the file allocation on the disk. Each
entry in the FAT corresponds to a cluster, and it contains the address of the next
cluster in the file's allocation chain.
Since the file is a new file, its FAT entries will be updated to reflect the allocation of
clusters to it.
Assumptions:
o The FAT has the same number of entries as the number of clusters on the
disk.
o The first 16 entries are occupied by the OS.
o The remaining entries are free.
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 27
Explanation:
o Clusters 17-24: These clusters are allocated to the file
"assignmentmcs012.txt". The FAT entries indicate the next cluster in the
file's allocation chain.
o Cluster 24: Since the file ends at cluster 24, the FAT entry for 24 is set to 0,
indicating the end of the file.
o Free Clusters: The remaining clusters (25-127) are free and can be allocated
to other files.
17 → 18 → 19 → 20 → 21 → 22 → 23 → 24 → 0
Q2 (f) Explain the following, giving their uses and advantages/disadvantages, if needed.
(Word limit for the answer of each part is 50 words ONLY) (6 Marks)
(ii) CD-ROM
(iv) Scanner
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 28
Solution:
(i) Access time of disks: The time it takes to locate and retrieve data from a disk. Uses:
Accessing data from a hard drive, reading files from a floppy disk. Advantages: Fast data
access, large storage capacity. Disadvantages: Slower than RAM access.
(ii) CD-ROM: A type of optical disc that stores data in a digital format. Uses: Storing and
distributing software, music, and data. Advantages: Cheap, durable, and capable of storing
large amounts of data. Disadvantages: Read-only, slow data access compared to hard drives.
(iii) Classification of Printers: Printers are categorized by technology, print quality, speed,
and type of paper they can use. Uses: Printing documents, photos, and labels. Advantages:
Variety of options for different needs. Disadvantages: Different printers have different
capabilities and costs.
(iv) Scanner: A device that converts printed documents into digital images. Uses: Digitizing
documents, photos, and artwork for storage or editing. Advantages: Saves paper, allows for
easy sharing of documents. Disadvantages: Can be slow for large documents, may not
always accurately capture images.
(v) Refresh rates of monitors: The frequency at which the monitor redraws the screen.
Uses: Ensuring smooth and flicker-free display of images. Advantages: Improved image
quality and viewing comfort. Disadvantages: Higher refresh rates can increase power
consumption.
(vi) Devices for data backup: Devices used to create copies of data for protection against
data loss. Uses: Protecting critical data from accidental deletion, corruption, or hardware
failure. Advantages: Ensures data recovery, protects against data loss. Disadvantages:
Requires time and resources to perform backups.
Question 3:
Q3 (a) A single-core uniprocessor system has 16 General purpose registers. The machine has
RAM of size 1 M memory words. The size of every general-purpose register and memory
word is 32 bits. The computer uses fixed-length instructions of size 32 bits each. An
instruction of the machine can have two operands. One of these operands is a direct memory
operand and the other is a register operand. An instruction of a machine consists of bits for
operation code, bits for memory operand and bits of register operand. The machine has
about 64 different operation codes. The machine also has special purpose registers, which
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 29
are other than general purpose registers. These special purpose registers are – Program
Counter (PC), Memory Address Register (MAR), Data Register (DR) and Flag registers (FR).
The first register among the general-purpose registers can be used as Accumulator Register.
The size of Integer operands on the machine may be assumed to be equal to the size of the
accumulator register. To execute instructions, the machine has another special purpose
register called Instruction Register (IR) of size 32 bits, as each instruction is of this size.
Perform the following tasks for the machine. (Make and state suitable assumptions, if any.)
(i) Design suitable instruction formats for the machine. Specify the size of different fields that
are needed in the instruction format. Also, indicate how many bits of the instructions are
unused for this machine. Explain your design of the instruction format. What would be the
size of each register? (3 Marks)
(ii) Illustrate two valid instructions of the machine by drawing a diagram that shows
instructions and related data in registers and memory. (2 Marks)
(iii) Assuming that an instruction is first fetched to the Instruction Register (IR), its memory
operand is brought to the DR register and the result of an operation is stored in the
Accumulator register, write and explain the sequence of micro-operations to fetch and
execute an addition instruction that adds the contents of a memory operand with the
contents of a register operand. The result is stored in the accumulator register. Make and
state suitable assumptions, if any. (5 Marks)
Solution:
Assumptions:
2. Memory Operand:
o 20 bits to address one of the 1 M memory words.
3. Register Operand:
o 4 bits to specify one of the 16 general-purpose registers.
4. Unused Bits:
o 32 - (6 + 20 + 4) = 2 unused bits.
Field Bits
Operation Code 6
Memory Operand 20
Register Operand 4
Unused 2
Operation Code: This field specifies the operation to be performed (e.g., ADD, SUB,
etc.). With 6 bits, 64 different instructions can be represented.
Memory Operand: This field contains the address of the memory location that holds
one of the operands.
Register Operand: This field specifies which of the 16 general-purpose registers is
being used for the second operand.
Unused Bits: There are 2 unused bits, as 32 bits are available but only 30 are needed
for the operation code, register, and memory operands.
This instruction adds the contents of memory location 100000h to the value in register R1
and stores the result in the accumulator (R0).
Memory Address: The memory operand points to the data located at 100000h.
Register: The register operand refers to R1.
This instruction subtracts the contents of memory location 0A0000h from the value in
register R2 and stores the result in the accumulator (R0).
Memory Address: The memory operand points to the data located at 0A0000h.
Register: The register operand refers to R2.
Assumption:
The instruction is ADD R1, [100000h]. The instruction adds the contents of memory
address 100000h to the contents of R1, and the result is stored in the accumulator register
R0.
MAR←PC
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 32
PC←PC+1
IR←Memory[MAR]
MAR←IR[Memory Operand]
DR←Memory[MAR]
Step Micro-operation
1. Fetch Instruction MAR ← PC, PC ← PC + 1, IR ← Memory[MAR]
2. Decode Instruction Control unit decodes the instruction in IR
3. Fetch Memory Operand MAR ← IR[Memory Operand], DR ← Memory[MAR]
4. Perform Addition R0 ← R1 + DR
5. Store Result (Result already stored in R0)
Q3 (b) Assume that you have a machine, as shown in section 3.2.2 of Block 3 having the set of
microoperations as given in Figure 10 on page 62 of Block 3. Consider that R1 and R2 both
are 8-bit registers and contain 01111110 and 11010101 respectively. What will be the
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 33
values of select inputs, carry-in input, and the result of the operation (including carry-out
bit) if the following micro-operations are performed on these registers? (For each micro-
operation you may assume the initial value of R1 and R2 as given above) (2 Marks)
(i) Increment R2
Solution:
Select
Micro- Initial Operation Carry-in Carry-
Inputs (S₃ Result
operation Values Description (Cᵢ) out
S₂ S₁ S₀)
R1 =
11010110
Increment 01111110 Increment the value
0001 0 (214 in 0
R2 R2 = in R2 by 1
decimal)
11010101
R1 =
Subtract R2 from R1 10101001
Subtract R2 01111110
using two's 0011 1 (−87 in 1
from R1 R2 =
complement decimal)
11010101
R1 =
Perform a bitwise 01010100
AND of R1 01111110
AND operation 0100 0 (84 in 0
with R2 R2 =
between R1 and R2 decimal)
11010101
R1 =
Shift all bits in R1 to 11111100
01111110 Not
Shift left R1 the left by one 1000 (252 in 0
R2 = applicable
position decimal)
11010101
Q3 (c) Consider that an instruction pipeline has four stages namely instruction fetch (INFE),
Instruction decode and Operand Fetch (IDOF), Instruction Execute (INEX) and store results
(STRE). Draw an instruction pipeline diagram showing the execution of five sequential
instructions using this pipeline. Explain, what problem may occur, if the 2nd instruction is a
conditional jump instruction? (3 Marks)
Solution:
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 34
Instruction Sequence:
Execution:
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 35
If the 2nd instruction (SUB R4, R5, R6) is a conditional jump instruction, the pipeline can
stall. This is because:
Q3 (d) Explain the structure and operation of the micro-programmed control unit with the
help of a diagram. (2 Marks)
Solution:
Key Components:
Operation:
Diagram (Simplified):
Q3 (e) Explain the use of large register file in RISC. Also, explain the optimisation of RISC
pipelining. (3 Marks)
Solution:
In a RISC processor, a large register file is crucial for efficient execution. This register file is
a collection of general-purpose registers that store data. The large size of this register file
allows the processor to hold more data, minimizing the need to load and store data from
memory. This helps to reduce the number of instructions needed to complete a task,
leading to faster execution.
Reduced Memory Access: Since most instructions operate on data stored in registers,
fewer memory accesses are required. This reduces the time taken to fetch
instructions and data, leading to a significant performance boost.
Increased Instruction Level Parallelism (ILP): With a large register file, more
instructions can be executed concurrently, as there's sufficient space to hold the
intermediate results. This leads to higher instruction-level parallelism, which
further accelerates the execution of programs.
Simplifies Instruction Set: A large register file simplifies the instruction set, as fewer
instructions are needed to perform operations. This makes the processor design
simpler and more efficient.
Question 4:
Q4 (a) Write a program using 8086 assembly Language (with proper comments) that
accepts two different digits as input from the keyboard. Each digit is converted to its binary
equivalent value. These converted digits are stored in registers BL and CL. The program then
stores the smaller of these two values in AL register. The program also checks if the present
AL value is larger than all the values contained in a byte array of size 6, which is stored in the
memory. If so, then a value 1 is moved to DL register, else a value 0 is moved to DL register.
You may assume the byte array has the values 02h, 03h, 05h, 01h, 02h, 03h. Make suitable
assumptions, if any. (7 Marks)
Solution:
.MODEL SMALL
.STACK 100H
.DATA
ARRAY DB 02H, 03H, 05H, 01H, 02H, 03H ; Byte array of size 6
.CODE
.STARTUP
INT 21H
INT 21H
INT 21H
INT 21H
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 39
CMP BL, CL
JBE LESS_OR_EQUAL
JMP CHECK_ARRAY
LESS_OR_EQUAL:
CHECK_ARRAY:
COMPARE_LOOP:
LOOP COMPARE_LOOP
NOT_LARGER:
DONE:
INT 21H
Screenshots of Output:
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 41
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 42
Q4 (b) Differentiate between the FAR and NEAR procedure calls in 8086 micro-processor.
Assuming that a stack is used for implementing procedure calls, explain how call and return
statements of 8086 microprocessor would use stack for NEAR and FAR procedure calls and
return from a call. Also, assuming that two parameters are to be passed to a procedure using
stack, explain how they will be passed to the procedure and accessed in the procedure. You
need not write the assembly code but draw necessary diagrams to illustrate the concept. (7
Marks)
Solution:
In the 8086 microprocessor, FAR and NEAR procedure calls refer to how the processor
handles the memory addresses during procedure calls and returns. I will explain the
differences between them, describe how the stack is used in both cases, and how
parameters are passed and accessed via the stack.
o This method uses more memory but allows the program to call procedures
outside the current code segment.
o When the NEAR procedure finishes, the RET instruction pops the IP from the
stack and continues execution from the saved address in the same segment.
In 8086 assembly language, parameters can be passed to procedures via the stack. To
explain how this works, I will illustrate how two parameters are pushed onto the stack,
accessed within the procedure, and the process of returning.
2. CALL Instruction:
o After pushing the parameters, the CALL instruction pushes the return
address (IP or CS depending on NEAR or FAR) onto the stack, as shown in the
previous diagrams.
3. Accessing Parameters in the Procedure:
o Inside the procedure, the BP (Base Pointer) register is typically used to
access the stack. After the procedure starts, BP is set to SP (Stack Pointer) to
point to the base of the stack frame. Parameters can then be accessed as
offsets from BP:
[BP + 4]: Points to Param1.
[BP + 6]: Points to Param2.
4. RET Instruction:
o After accessing and using the parameters, the RET instruction is executed to
pop the return address off the stack and continue execution from the point
where the procedure was called.
Q4 (c) Explain the following in the context of 8086 Microprocessor with the help of an
example or a diagram: (6 Marks)
Solution:
The 8086 microprocessor uses segment registers to address a large memory space. These
registers, which include CS (Code Segment), DS (Data Segment), SS (Stack Segment), and
ES (Extra Segment), allow the CPU to access different parts of memory. Imagine a book
with many pages. Each segment register acts like a bookmark, pointing to a specific page or
section of the book (memory).
For instance, the CS register points to the location of the program code. The DS register
points to the location of data. When the CPU wants to access a specific instruction or data, it
combines the segment register value with an offset address (a number within the segment)
to calculate the actual memory address. This allows the 8086 to address up to 1 MB of
memory.
Example:
MCS-012 Solved Assignment 2024-25 | learningscience.co.in 47
Let's say we have a program that stores a number in memory. The program code might be
located in memory starting at address 0x10000. The data is stored starting at address
0x20000. The code segment register (CS) would point to 0x10000, and the data segment
register (DS) would point to 0x20000.
The 8086 microprocessor has a set of flags that provide information about the result of an
arithmetic or logical operation. These flags are used by the CPU to make decisions and
control program flow.
XLAT (Translate): This instruction is used for translating a character code. It looks
up a value in a table and returns the corresponding value based on the current value
of the AL register. It's often used to convert character codes to their corresponding
ASCII values.
Example:
MUL (Multiply): This instruction multiplies two operands. The result is stored in the
AX register. For example, MUL BX will multiply the value in AL with the value in BX,
and the result will be stored in AX.
Example:
SAR (Shift Arithmetic Right): This instruction shifts the bits of a number to the right.
For example, SAR AX, 1 will shift the bits in AX one position to the right. This
instruction is often used for division and bit manipulation.
Example:
RCL (Rotate Carry Left): This instruction rotates the bits of a number left, including
the carry flag. The carry flag is included in the rotation.
Example: