Lab 1.1 - Memory Lab
The purpose of this lab is to demonstrate various concepts related
to computer memory, such as data representation, endianness, and using
control signals to communicate with memory devices and tell them "what
to do". It will also give you some experience with reading and interpreting
hardware datasheets from manufacturers.
Preparation
In your lab preparation, you should answer all 7 of the Lab Prep questions found below. Each of them are prefixed with "Lab Prep x:", where x is the question number. Make sure you have this ready to be marked before you come to the lab.
Part 1 - Read Documentation
- Download the SRAM's datasheet file 61LV25616.pdf, and familiarize yourself
with the SRAM memory device that is found on the DE2 board. You will be
working with a software program that simulates the behaviour of this device.
You do not have to read everything; in particular, you might find the truth
table on page 2 to be quite useful.
- Download the Memory Simulator program.
- Read the guide on how to use the simulation
software program.
- Be prepared to answer questions about memory and data representation, as
was taught in class.
Lab Prep 1: How many data pins does the SRAM have? How many address pins does it have? Use these two numbers to help you calculate the amount of storage in the SRAM (measured in KiloBytes).
WARNING: Processors tend to assume a byte-addressable memory space,
however the SRAM device (and the simulator) is half-word-addressable. In other
words, every memory location has 16-bits instead of 8-bits. The !LDS and !UDS
signals are used to individually select the top or bottom byte, or both of
them.
Part 2 - Controlling the Memory Device
To get acquainted with the program, follow the following procedure. For more
information on the specific control signals involved, consult the memory device
datasheet.
- Set the !WE, !LB, and !UB signals to "low" by moving the corresponding sliders
down.
- Set the address to "0xA" by moving the first and third sliders (from the left)
up.
- Set the data input to "0xABCD" either by double clicking on the "0x0000" beside
the "Data Input" field and entering "ABCD", or by moving the 16 sliders above to
the correct binary positions.
- Set the !CE signal to "low" by moving the corresponding slider down. Lab Prep 2: Record any changes in the memory contents.
- Raise the !CE signal back to "high".
Next, perform the necessary steps to achieve the following tasks.
You must perform the tasks in the order in which they are listed and use the results
from the previous operations when performing a particular task.
- Store the value 0xABCD into the memory location 0xB.
- Store the value 0xFFCD into the memory location 0xF.
- Copy the value of location 0xF into location 0xE.
Hint: you may double-click on the value of the "Data Read" field to
copy its data to the "Data Input" field.
- Store the value 0x12345678 into the memory locations starting at 0x0 in big
endian notation.
At this point, set all control signals to "high". Do not quit the program.
Lab Prep 3: Record the memory contents.
Part 3 - Data Representation
As was taught in class, the data stored in memory can be interpreted
differently, depending on the data type. The memory device simulation program
allows you to explore how several common data types look in memory. When a data
type spans multiple memory locations, there are several possibilities with
regards to the order in which data can be interpreted. The most common ones are
"big endian" and "little endian", about which you have learned in class. The
program allows you to explore both representations, by allowing you to select
the one you want.
To get familiar with this feautre, follow these steps:
- Set the current address to "0x0". Then, note the "Data Type Representation" panel. In particular, note the value of "Byte (unsigned)".
- Under "Treat representation as", select "Little endian". Lab Prep 4: Explain this change given what you learned in class.
Next, perform the following tasks, keep the representation at Little endian.
- Load the signed integer -2 into memory location 0x2.
- By modifying just one bit (any bit in the memory), make the Integer (signed)
contained in location 0x2 a positive number. Lab Prep 5: Write down how you did this, and explain why the signed byte and short values are still negative.
- Make the necessary change to display a positive value for the Short (signed).
- Store the Float value 75 at memory location 0x4.
Lab Prep 6: Record the memory contents.
Lab Prep 7: Write down the single-precision floating point representation for the number 0.75.
In the Lab
- Be prepared to answer any questions about the SRAM, the simulator, or any of the memory concepts.