Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

GATCHANG MABANY UU93176R

Part I: TRUE OR FALSE(3pts)

1. Locality Principle is used in cache design. It means that: when a word is


referenced, it and some of its neighbors are brought from large slow memory to
the cache.

(TRUE)

2. The number of bits in the address determines the maximum number of


directly addressable cells in the memory and independent of the number of bits
per cell. (TRUE)

3. A variable is a symbol used to represent a logical quantity that can have a


value of 1 or 0.

(TRUE)

4. In an exclusive-OR, both inputs cannot be HIGH to provide a HIGH output.

(TRUE)

5. Static RAMs (SRAMs) use internal capacitors as basic storage elements.

(FALSE)

6. ROMs are used to store data that generally cannot be easily changed

(TRUE)

Part II: Explain the Following Questions(22pts)

1. List and explain the three basic techniques used for mapping blocks into cache
lines (2 mark)

ANSWER:

COA_Worksheet_1
Page 1
1. Direct Mapping

In direct mapping, each block of main memory maps to exactly one cache line.
The cache is divided into a number of lines, and each block from main memory is
assigned a specific line based on its address.

2. Associative Mapping

In associative mapping, a block from main memory can be placed in any cache
line. There are no fixed positions; the block can be stored anywhere in the cache.

3. Set-Associative Mapping

Set-associative mapping is a compromise between direct and associative


mapping. The cache is divided into several sets, each containing a fixed number
of lines (ways). A block maps to a specific set, but within that set, it can be
placed in any line.

2. First define CISC and RISC Compare and contrast RISC vs CISC (2 marks)

ANSWER:

CISC known as Complex Instruction Set Computer is an architecture design that


aims to complete tasks in as few lines of assembly code as possible. It achieves
this by having a large set of instructions that can execute complex tasks directly.

RISC also known as Reduced Instruction Set Computer, is an architecture


design that simplifies instructions, aiming to execute them within a single clock

COA_Worksheet_1
Page 2
cycle. It uses a small, highly optimized set of instructions that are of fixed length
and can execute simple tasks quickly and efficiently.

Similarities

1. Both aim to improve CPU performance: Whether through simplifying


instructions (RISC) or making each instruction more powerful (CISC), both
aim to enhance overall processing efficiency.

2. Both are used in modern computing: Modern processors often


incorporate elements of both RISC and CISC to balance performance and
complexity.

3. Instruction Execution: Both involve fetching, decoding, executing, and


storing instructions, though the implementation details differ significantly.

Differences

1. Instruction Set:

RISC uses simple, fixed-length instructions, while CISC uses complex,


variable-length instructions.

2. Execution Speed:

RISC aims for single-cycle execution per instruction, while CISC instructions
may take multiple cycles.

3. Hardware Complexity:

COA_Worksheet_1
Page 3
RISC architectures are simpler and easier to pipeline, while CISC
architectures are more complex but can handle more sophisticated tasks per
instruction.

4. Memory Access:

RISC uses separate load/store instructions for memory operations, while


CISC can include memory operations within complex instructions.

4. Draw the level of memory hierarchy diagram. Write the key parameters, as
we move down the hierarchy? (1 Marks)

Key Parameters as We Move Down the Hierarchy:

COA_Worksheet_1
Page 4
 Speed (Access Time): Generally, decreases as we move down the
hierarchy.

 Capacity: Generally, increases as we move down the hierarchy. Registers


have the smallest capacity, while tertiary storage has the largest.

 Cost per Unit of Storage: Generally, increases as we move down the


hierarchy. Registers are the most expensive per unit, while tertiary storage
is the least expensive.

 Volatility:

o Volatile: Loses data when power is off (RAM, CPU registers)

o Non-volatile: Retains data even when power is off (ROM, hard


drives, magnetic tapes)

 Accessibility:

o Directly accessible by the CPU: Registers, Cache, Main Memory

o Accessed through I/O operations: Secondary and Tertiary Storage

4. Use three inputs x, y, z and three outputs A, B, C. When the binary input is 0,
1, 2, or 3 the binary output is two greater than the input. When the binary input is
4, 5, 6 and 7, the binary output is one less than the input. (2 Marks)

A. Develop the truth table

B. Simplify the three outputs A, B, C using K-map simplification

COA_Worksheet_1
Page 5
5. Convert (205)10 to (1pt)

A,binary number B Hexadecimal number C, Octal number


ANSWER
A. Binary (base-2):
1. We can use repeated division by 2 and collect the remainders.
2. Divide 205 by 2:
o Quotient: 102 (write it down)
o Remainder: 1 (write it down)
3. Divide 102 by 2:
o Quotient: 51 (write it down)
o Remainder: 0 (write it down)
4. Continue dividing by 2 until the quotient becomes 0.
o 51 / 2 = 25 (quotient), 1 (remainder)
o 25 / 2 = 12 (quotient), 1 (remainder)
o 12 / 2 = 6 (quotient), 0 (remainder)
o 6 / 2 = 3 (quotient), 0 (remainder)
o 3 / 2 = 1 (quotient), 1 (remainder)
o 1 / 2 = 0 (quotient), 1 (remainder)
5. Reverse the order of the remainders (excluding the leading 0): 11001101.
B. Hexadecimal (base-16):
1. Divide 205 by 16 (the highest power of 16 less than 205).
o Quotient: 12 (write it down)
o Remainder: 13 (convert to hexadecimal digit: D)
2. Use the quotient (12) to repeat step 1:
o Quotient: 0 (write it down)
o Remainder: 12 (convert to hexadecimal digit: C)
3. Combine the digits in reverse order of remainders: CD.
C. Octal (base-8):
COA_Worksheet_1
Page 6
1. Divide 205 by 8 (the highest power of 8 less than 205).
o Quotient: 25 (write it down)
o Remainder: 5 (convert to octal digit: 5)
2. Use the quotient (25) to repeat step 1:
o Quotient: 3 (write it down)
o Remainder: 1 (convert to octal digit: 1)
3. Combine the digits in reverse order of remainders: 315.

6 Convert 96 to (1 pt)

A, binary number.. B Hexadecimal number C, Octal number


ANSWER:
A. Binary (base-2):
1. We can use repeated division by 2 and collect the remainders.
2. Divide 96 by 2:
o Quotient: 48 (write it down)
o Remainder: 0 (write it down)
3. Divide 48 by 2:
o Quotient: 24 (write it down)
o Remainder: 0 (write it down)
4. Continue dividing by 2 until the quotient becomes 0.
o 24 / 2 = 12 (quotient), 0 (remainder)
o 12 / 2 = 6 (quotient), 0 (remainder)
o 6 / 2 = 3 (quotient), 0 (remainder)
o 3 / 2 = 1 (quotient), 1 (remainder)
o 1 / 2 = 0 (quotient), 1 (remainder)
5. Reverse the order of the remainders (excluding the leading 0): 1100000.
B. Hexadecimal (base-16):

COA_Worksheet_1
Page 7
1. Divide 96 by 16 (the highest power of 16 less than 96).
o Quotient: 6 (write it down)
o Remainder: 0 (convert to hexadecimal digit: 0)
2. Since the quotient (6) is less than 16, we don't need further division.
3. Combine the digits: 60.
C. Octal (base-8):
1. Divide 96 by 8 (the highest power of 8 less than 96).
o Quotient: 12 (write it down)
o Remainder: 0 (convert to octal digit: 0)
2. Divide the quotient (12) by 8:
o Quotient: 1 (write it down)
o Remainder: 4 (convert to octal digit: 4)
3. Combine the digits in reverse order of remainders: 140

7.Prove it 100= -100(by using two complement)(2pts)

Steps to Convert a Positive Number to Two's Complement:

1. Write the number in binary form.

o For 100: 100 (base 10) = 1100100 (base 2)

2. Invert the bits (flip 0s to 1s and vice versa).

o Inverted bits: 0011011

3. Add 1 to the least significant bit (LSB).

o Add 1: 0011011 + 1 = 0011100

Two's Complement of 100:

COA_Worksheet_1
Page 8
Following the steps above, the two's complement of 100 (1100100 in binary) is
0011100.

Key Observation:

 In two's complement representation, the leftmost bit (most significant bit)


signifies the sign.

o 0: Positive number

o 1: Negative number

 The remaining bits represent the magnitude of the number.

Why 100 and -100 Share Similar Bit Patterns:

 In this case, both 100 and -100 have the same magnitude (100).

 The two's complement representation reflects this by having identical bits


for the magnitude (0011011).

 The only difference lies in the sign bit:

o 100 (positive): Leading 0 (MSB)

o -100 (negative): Leading 1 (

8. Convert (.0435)10 to octal. (1pts)

1. Multiply by 10^2 (to handle the fraction): 0.0435 * 10^2 = 4.35

2. Repeatedly divide 4.35 by 8, collecting remainders in reverse order


(ignoring quotients): 4

COA_Worksheet_1
Page 9
3. Since it's a fraction, multiply remainders by 8: 4 (from step 2) * 8 = 34.8 ->
collect integer part (3) and new fraction (0.8)

4. Continue multiplying fractions by 8 until a pattern repeats (like 0.4


appearing again): 3, 0.8 -> 8, 0.4

5. Reverse remainders and add leading zeros (adjusted for 10^2


multiplication): 436.48_8

Therefore, 0.0435_10 = 0.000043648_8

9.Simplify boolean expression .

A’BC + AB’C+ABC’+ABC+A’B’C’A’BC+ABC’+AB’C’+A’BC (1pts)

ANSWER:

1. Identify common factors:

o A'BC appears twice.

o AB'C appears twice.

o A'B'C' appears twice (one negated).

o ABC and A'BC appear together.

2. Combine terms based on common factors:

o A'BC (original + negated) = 0 (A' and BC cannot be true together).

o AB'C (original + original) = 2AB'C (no simplification).

o ABC + A'BC = (A + A')BC = 1 * BC = BC (A or A' is always true).

COA_Worksheet_1
Page 10
3. Final simplified expression: 2AB'C + BC = BC (AB'C term becomes
irrelevant because BC covers all possibilities).

Therefore, the simplified expression is BC

BC

10. What is the main difference between computer organization and


architecture? (2pts)

ANSWER:

 Computer Organization deals with the physical components and their


interactions within a computer system, focusing on the implementation
details and how they affect system performance and functionality.

 Computer Architecture deals with the high-level design principles and


conceptual structure of a computer system, focusing on the organization of
components and their relationships to achieve desired system attributes
such as performance, efficiency, and scalability.

11 .List down some key feature about each computer generations. (2pts)

ANSWER:

First Generation (1940s - 1950s)

 Vacuum Tubes: Relied on vacuum tube technology for processing and


memory.

 Large Size: Computers were huge and required a lot of space.

COA_Worksheet_1
Page 11
 High Power Consumption: Consumed a significant amount of power and
generated a lot of heat.

 Limited Programmability: Programmed using machine language and


assembly language.

 Batch Processing: Typically used for batch processing tasks.

Second Generation (1950s - 1960s)

 Transistors: Introduced transistor technology, replacing vacuum tubes,


leading to smaller, more reliable, and faster computers.

 Assembly Language: Programming languages evolved to assembly


language.

 Magnetic Core Memory: Magnetic core memory was used for primary
storage.

 Batch and Multiprogramming: Continued the use of batch processing,


with the introduction of multiprogramming techniques.

Third Generation (1960s - 1970s)

 Integrated Circuits: Integrated circuits (ICs) were developed, allowing for


further miniaturization and increased performance.

 High-Level Languages: High-level programming languages such as


FORTRAN, COBOL, and BASIC were developed, making programming
more accessible.

 Operating Systems: Operating systems became more sophisticated,


supporting multitasking and time-sharing.

COA_Worksheet_1
Page 12
 Minicomputers: The emergence of minicomputers made computing more
affordable and accessible to businesses and universities.

Fourth Generation (1970s - Present)

 Microprocessors: The invention of microprocessors led to the


development of personal computers (PCs) and small, powerful computing
devices.

 VLSI Technology: Very Large Scale Integration (VLSI) technology


enabled the integration of millions of transistors onto a single chip.

 Graphical User Interface (GUI): GUIs revolutionized user interaction with


computers, making them more intuitive and user-friendly.

 Networking and Internet: The proliferation of networking technologies


and the internet transformed communication and information sharing.

 Mobile Computing: The rise of smartphones and tablets brought


computing power to the palm of our hands, enabling mobile computing and
ubiquitous connectivity.

Fifth Generation (Present and Future)

 Artificial Intelligence: Focus on artificial intelligence (AI) and machine


learning (ML) technologies, including neural networks and deep learning
algorithms.

 Natural Language Processing: Advancements in natural language


processing (NLP) and human-computer interaction.

 Quantum Computing: Research and development in quantum computing


promise to revolutionize computing power and capabilities.

COA_Worksheet_1
Page 13
 Internet of Things (IoT): Integration of computing devices into everyday
objects, enabling smart and interconnected systems.

 Biotechnology and Bioinformatics: Application of computing in


biological research and healthcare, including genomics, proteomics, and
personalized medicine.

12. Derive the Boolean expression for the logic circuit shown below: (1pts)

13. Determine the values of A, B, C, and D that make the sum term
equal to zero. (1pts)

ANSWER:

A=1 B=0 C= 1 D=0

14. Compare zero-, one-, two-, and three-address machines by writing programs
using the follows equation (3 marks) X = (A + B * C)/(D - E * F). (2pts)

ANSWERS:

Zero-address

PUSH A

PUSH B

PUSH C

MUL // Multiply B by C

COA_Worksheet_1
Page 14
ADD // Add A to the result

PUSH D

PUSH E

PUSH F

MUL // Multiply E by F

SUB // Subtract the result from D

DIV // Divide the previous result by the current top of the stack (the result of
ADD)

One-address Machine

LOAD A // Load A into the accumulator

ADD B // Add B to the accumulator

MUL C // Multiply the accumulator by C

STORE TMP // Store the intermediate result in a temporary location

LOAD D // Load D into the accumulator

SUB E // Subtract E from the accumulator

MUL F // Multiply the accumulator by F

SUB TMP // Subtract the intermediate result from the accumulator

DIV // Divide the accumulator by the current value (the result of the previous
subtraction)

Two-address Machine

LOAD R1, A // Load A into register 1

ADD R1, B // Add B to register 1

COA_Worksheet_1
Page 15
MUL R1, C // Multiply register 1 by C

STORE R1, TMP // Store the intermediate result in a temporary location

LOAD R1, D // Load D into register 1

SUB R1, E // Subtract E from register 1

MUL R1, F // Multiply register 1 by F

SUB TMP, R1 // Subtract the intermediate result from register 1

DIV R1 // Divide register 1 by the current value (the result of the previous
subtraction)

Three-address Machine

ADD TMP, B, C // Add B multiplied by C, store in TMP

ADD R1, A, TMP // Add A to TMP, store in R1

MUL TMP, E, F // Multiply E by F, store in TMP

SUB R2, D, TMP // Subtract TMP from D, store in R2

DIV X, R1, R2 // Divide R1 by R2, store in X

15. Convert the following Expression from Infix to Postfix Notation by applying a
Stack operation (2 marks) f = (a - b)/(c + d * e) (1pts)

ANSWER:

COA_Worksheet_1
Page 16

You might also like