





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Lab 4 of the eecs 373 course, where students are required to implement a 256-byte memory module on an fpga and interface it to the mpc823 bus. The objective is to understand the overheads involved in handling unaligned accesses. Students will write an assembly-language program to read and write the memory using slide switches and led displays, maintaining a 'current memory location' and updating it based on switch inputs.
Typology: Lab Reports
1 / 9
This page cannot be seen from the preview
Don't miss anything!






7/29/
See posted lab schedule for pre-lab, in-lab and post-lab due dates.slide
The purpose of this lab is to:
This lab expands on Lab 3, adding a small memory module to your hardware design. For simplicity, in Lab 3 you assumed that any access to your I/O registers was a 32-bit access. Unlike the lab 3 I/O register, a general-purpose memory module must handle any access size the CPU may generate—byte, half-word, or word, in the case of the MPC823. Also unlike your I/O registers, your memory module will occupy a range of bus locations. As a result, your design will use different portions of the address supplied by the MPC823 for different purposes. Some of the address bits will determine whether or not your memory module is being accessed; some will determine which word within the module is being accessed; and, if the access size is less than a word, some of the address bits will determine which byte or bytes within the word are being accessed. To exercise your memory module, you will write a small program to read and write the memory using the slide switches and LED displays. You will reuse the I/O registers from your Lab 3 design to interface with the switches and LEDs.
Hardware Implement a 256-byte memory module on the FPGA (using 32x8 memory parts from the device library) and interface it to the MPC823 bus. This memory should occupy 256 con- secutive byte addresses starting at address 0x3300000. The module should correctly han- dle aligned byte, halfword, and word reads and writes. (Recall that the MPC823 will only generate aligned accesses on the bus.) Your memory module should be integrated with your hardware design from Lab 3, so that your Lab 3 I/O registers can be used in conjunc- tion with the memory. Software Write an assembly-language program that lets you use the switches and LED displays on the expansion board to direct the processor to read and write your memory one byte at a time. The resulting operation is reminiscent of the front panel of several old computer models (like the DEC PDP-11 series), where a bank of toggle switches and LEDs could be used to read and write memory locations. On these old machines, the front panel switches controlled hardware that directly performed read and write transactions: the purpose of the front panel was to let users access memory even when the CPU couldn’t. For example, the front panel could be used to manually enter an instruction sequence (in binary!) to boot the
machine, or to examine memory locations to debug the system when it had crashed so hard that the CPU was not responding. Your program will be emulating this front panel operation in software by reading the switches, performing any appropriate memory accesses, and displaying the results on the LEDs. Note that, unlike the old-time front panels, the switches and LEDs will not talk directly to the memory module; although they share the same data bus, all interaction between the switches, LEDs, and memory is performed in software by the CPU. Your program must operate as follows:
PB S2 SPB S3 New current location
(either) pressed value on slide switches
pressed (either) (current location – 1) mod 256
not pressed not pressed (current location + 1) mod 256
lbz r5, 5(r3) stb r5, 1(r3) lhz r6, 0(r3) lhz r7, 1(r3) lhz r8, 3(r3) lwz r9, 0(r3) lwz r10, 1(r3) stw r10, 3(r3) lwz r11, 2(r3)
a. List the values of registers r4 through r11 after executing the fragment. ( 8 points )
b. Which (if any) of these instructions cause unaligned accesses? ( 3 points )
c. For the following instructions, complete the table listing the sequence of bus accesses. Assume r3 = 0x02900000, r4 = 0x11223344, r5 = 0x 02900008, 0x 02900008 = 0x55667788 and 0x290000c = 0xaabbccdd. The instructions exe- cute independently of one another. Space is provided for three cycles whether needed or not. The first entry is an example. Use - for unknown values..( 6
points)
Instruction Access Cycle
TSIZE Address Bus Contents
Data Bus Contents
stw r4, 2(r3) 1 0x0290 0002 0x
2 0x0290 0004 0x3344----
stw r4, 3(r3)
stb r4, 3(r3)
lwz r4, 3(r5)
lwz r4, 1(r5)
lhz r4, 1(r5)
a. First, hardwire the address lines to a fixed address (i.e. the first location). In this way you will know you are always accessing the same address for any transac- tion.
b. To test the write path, hardwire a fixed value to the data path into the memory module. Make a simple bus test module that has an output bus with a known value. Disconnect the data path from the processor and connect your known value module to the input of the module.
c. Similarly, to test the read path, disconnect the memory module for the data path from to the processor and connect the bus test module in its place.
d. Be sure to observe all relevant logic control signals and address and data buses with the logic analyzer for the transaction in question.
a. Which (if any) unaligned half-word accesses could be performed in fewer trans- actions?
b. Which (if any) unaligned word accesses could be performed in fewer transac- tions. What changes would be required to the MPC823 bus to make this feasi- ble?
FF000000 – FF003FFF MPC823 (on-chip) memory and device registers
F0008000 – FEFFFFFF (not used)
F0000000 – F0007FFF Board device registers
00400000 – EFFFFFFF (not used)
00000000 – 003FFFFF Main memory (DRAM)
Address Range Contents
Indicate which control signals should be activated for each action listed in column 1. Use the letter ‘
’ to indicate Enable. Assume empty cells indi-
cate the corresponding control signal is not enabled. MW B0 EN means Memory Write Byte 0 Enable, etc. Assume the memory write enable signalsenables a Clock Enable or Memory Write Enable signal. MR B0 EN means Memory Read Byte 0 enable.Assume the memory read enable signalsenables a tristate enable for the respective byte wide data path.Assume that BAR and 7Segment Led registers are enabled by LEDs Register Enable.
Enable Control
Action
Switches-TriStateEnable
LEDs Regis-ter Enable(CE)
Memory Write Byte 0Memory Write Byte 1Memory Write Byte 2Memory Write Byte 3Memory Write 1/2 Word B0-B1Memory Write 1/2 Word B2-B3Memory Write WordMemory Read Byte 0Memory Read 1/2 Word B0-B1Memory Read WordMemory Read Byte 3Switches ReadLEDs Write