Instructions for Lab#5
Student ID: 23133022 Group: 23133A
Full in name: Lê Ngô Thanh Hoa
Theory (Memory, Architectures, Interrupts and Stacks)
1. Review the lecture slides on types of memory and provide a short answers to the following questions
(using your own words):
1.1. What is ROM and what is its primary purpose ?
ROM is read only memory. Its primary purpose is to give instructions for
communication between hardware components.
1.2. What is RAM and how is it different from ROM ?
RAM is random access memory. RAM store data temporarily, while ROM store
data permanently.
1.3. What is the difference between static RAM and dynamics RAM ?
Static RAM uses less power and is faster, but it holds less data than dynamics
RAM.
1.4. What type of memory is typically used in USB thumb drives ? Why shouldn’t we rely on
this for critical data storage ?
Flash memory is typically used in USB thumb drives. We shouldn’t rely on this for critical data
storage because it can become unreadable after a specific number of writes.
2. Consider a computer with 1GB RAM (1024 MB). Given memory addressing is for each byte,
how many bits are needed to address all bytes in the system’s RAM ?
30 bits are needed to address all bytes in the system’s RAM
3. Give a brief description of the Von Neumann and Harvard computing architectures. What are the
fundamental differences between the two and for what is is each designed to achieve ?
Von Neumann architectures store program data and instruction data in the same memory.
Harvard architectures store program data and instruction data in separate memory.
The fundamental difference between the two is the way they use physical memory to
store instructions and data. Von Neumann architecture is designed to make the design and
Page 1 of 6
development of Control Unit simplified, cheaper and faster. The Harvard
architecture is designed to overcome the bottleneck of Von Neumann Architecture.
4. What is cache memory and what is its primary role ?.
Cache memory is frequently accessed high- Its primary role is to load speed memory. Its primary role is to load
instructions and Data at the same time and save power.
5. Explain the concept of an interrupt, and list four common types.
An interrupt is a signal that tells the operating system to look at it and figure out what to do.
The four common types of interrupts are: Maskable interrupt, non-maskable interrupt, normal
interrupts and exception.
5.1. Polling is an alternative to interrupts ? Briefly explain polling and why it is not com- monly
used.
Polling is an alternative approach to interrupt. Polling check state or input of each
hardware device in defined sequence. It is not commonly used because it waste time
checking hardware which I s doing nothing, doesn’t take advantage of the stack and. if one device
freezes, the entire computer can be unresponsive.
6. Explain the general concept of a stack - how do they work, and what is their primary pur- pose.
Stack is memory unit with an address register. This register influences the address for the stack
which is known as stack pointer (SP). The SP continually influences the address of the element that
is located at the top of the stack. It can insert an element into or delete an element from the stack.
The way stack store data is Last In First Out (FILO). Which means that the last data stored would be
the first to be retrieved.
1.1. How are stacks useful for handling interrupts ?
Stacks are useful for handling interrupts by maintaining the context of the CPU before an interrupt occurs.
When an interrupt is triggered, the current state (including the program counter and registers) is pushed onto
the stack
1.2. How are stacks useful in programming ?
Stacks are essential in programming for managing function calls, supporting recursion, implementing undo
features, evaluating expressions, and facilitating backtracking by efficiently tracking temporary data and control
flow
Provide all the answers to the above questions in your submission ocument. Practical - Stacks of
Stacks ! (please re-design and explain how it work)
Page 2 of 6
2. Start Logisim and open a new canvas
3. Review the lecture slides on building a stack at the top of this lab sheet. We are going to build a 5-bit
deep, 1-bit wide stack.
4. Start by building a simple shift register that moves bits from one flip flop to the next each clock pulse.
For this you will need a “Data In” pin which sets the next bit to be pushed to the stack, and a clock to
invoke the shifting.
5. For your shift register to work as a stack, it needs to be bi-directional. This means the in- put to any
Flip Flop could come from two places - the left or the right. In lectures we dis- cussed a simple
“encoder” circuit that selects which of two data inputs is allowed through, based on a third selection bit.
Design the logic for this 2-bit encoder, and demonstrate it to your lab demonstrator.
6. Now incorporate your encoder above to allow bi-directional shifting of your stack. Your stack should:
6.1. push and pop bits onto and off the stack, using clock pulses and a direction toggle switch
6.2. show the state of each Flip Flop using LEDs.
Page 3 of 6
Export your circuit as an image and include it in your submission document. Demon- strate your
working stack to your lab demonstrator.
7. Modify your stack so that it has the option to read out its contents in parallel to a sepa- rate register of D
Flip Flops. This should only occur when a “stack dump” toggle switch (i.e., pin) is enabled. When the
toggle is disabled, the register of D Flip Flops should re- tain the last state read in (and should have
LEDs connected to each Flip Flop out showing its state).
Page 4 of 6
Export your circuit as an image and include it in your submission document. Demon- strate your
working stack to your lab demonstrator.
Page 5 of 6
Page 6 of 6