CPE 315
Professor Stearns
Winter 2008
Laboratory Project #6 - Virtual Memory
Formal lab deliverable due by March 14th at 3:30 in CSC drop box.
This lab counts as 2 labs (MMU only) + 4 labs extra credit.


Lab 6 FAQ
Notes:
  1. All submission and plagiarism rules are in effect.
  2. You can avoid the need for screen prints if you demo on Marcy 13th.

Objectives: to understand virtual memory and MMUs.

Files
makefile

machine code test file and .asm file

Page table file

Description:
  1. Extend your Lab #4 to include virtual memory.
    This work is not difficult if you understand virtual memory concepts.
    Even if you don't complete the lab, you can gain understanding (and full credit) with a working MMU.
    This lab will also prepare you for virutal memory questions on the final examination.

  2. Add a MMU to your lab #4 computer.
    Note the MMU must support both memory modules - the instruction memory and data memory. This requires you to modify the fetch module.
    You must design one MMU with two instances; do not design two different MMUs.

  3. Page table
    Operating Systems store page tables in RAM; the MMU accesses them via the Page Table Register.
    To simplify your MMU, our single page table is hard-coded and stored in a ROM inside the MMU; set word size to 8 bits.
    Each byte in the page table is a descriptor with the following format:

    Bit 7 Bits 6 Bits 5-0
    P Valid Physical Page #

    P == 1 => page exists in the program
    P == 0 => page doesn't exist; access causes a Segmentation Fault

    Valid == 1 => page is loaded in memory
    Valid == 0 => page is on the disk; access causes a Page Fault

  4. PC is now a virtual address.
    Be sure to keep the PC as a virtual address at all times; don't be tempted to load real addresses into the PC.
    The PC sequence starts: 8, C, 10, 1F8, 1FC, 200, ...

  5. Test Program and Memory Sizes
    The test program contains addresses upto 0x14xx; the upper addresses don't exist in physical memory.
    Your instruction ROM must be configured with exactly 512 words loaded from the machine code test file
    Your data RAM must be configured with exactly 256 words.
    This will help you understand why this feature is called virtual memory.

Deliverables:
  1. You will receive full credit if your MMU works.
    Prove this by fetching instructions properly.
  2. You will receive much extra credit if you can run the test program correctly.
  3. A formal, professional lab submission.
    You only need submit source files that are changed from Lab #4.
  4. Appropriate screen prints that prove the testfile program is working.
    You must include, at a minimum, the screen prints designated on the .asm version of the lab 6 test file
    Each screen print must include the PC and the appropriate register. or a scheduled demonstration of your simulation.
  5. Highlights and annotations on each screen print illustrating correct execution.

  6. You MUST email your source code, in a zip file, to dstearns22@earthlink.net

Memory Loading Maps
The page table reflects the following memory map.
Note that one MMU works for both memory units.


Instruction Memory Loading Map
8 physical pages, page size = 256 bytes
Data Memory Loading Map
4 physical pages, page size = 256 bytes
not used not used
Page 14 Page 14
not used not used
Page 0 Page 0
Page 2 doesn't exist
Page 1 doesn't exist
not used doesn't exist
not used doesn't exist

Last updated on 3/3/08