ECE 371 Lab 2 -- PLD Experiment

OBJECTIVE:  Design and implement a decoder using a Programmable Logic Device (PLD) that decodes an I/O address on the address bus and asserts a chip select whenever there is a match to the desired address range. The PALASM4 Version 1.5 tools will be used to assist with this design. (The program will essentially map the boolean equation that you determine for the chip select (CS) in the PLD.  You could view this like a C compiler mapping a High Level Description to the particular machine arichtecture.)  This assignment will be VERY important because it will be used in several later laboratories.

EQUIPMENT NECESSARY:
PB-88/4 Breadboarding Station
PLD  (AMD PALCE22V10 chip)
MOD-EMUP Universal Programmer
Textronix 2215 CRO
PC
Borland Turbo C/C++
PALASM4 Version 1.5
Basic Logic Gates
PAL Programming Software "ACCESS"

PRE-LAB:
1.  Read the document that describes the PALASM4 tool set for desiging and implementing designs using PLDs.
2.  Using A15, A14, ..., A3 and /CS (remember here that the '/' denotes NOT or Active Low operation) for the symbolic names of the inputs and outputs of your design.  Based on the pinout of the chip you are using, determine a mapping between pins and these signals.
3.  Determine the boolean equation that defines the relationship between the chip select (CS) output and the address inputs that asserts the chip select whenever the address is in the range of 180H to 187H.
4.  Draw a schematic of a test circuit which contains a type RS flip-flip (F/F).  If the chip select is asserted and the IOR is asserted, then the F/F should be set.  If the chip select is asserted and the IOW is asserted, then the F/F should be cleared. This test circuitry should use simple NAND and NOR gates.
5.  Write a C program to test your design when connected to the test circuit.  The program should prompt the user for a 16-bit address, read and write the I/O port as the address prompted for.  It should do this continually in a loop, and exit when any key is pressed on the keyboard.  The program should then prompt the operator for a new address and repeat the test procedure.

DURING LAB:
1.  Using the File option of the PALASM program,  use the Begin option, enter your design.  Be sure that the pins you assign as inputs are actually inputs and vica-versa for outputs.
2.  After inputing the design, press F10 (I think) to move to the next step.  You'll now have a chance to enter the boolean equation you have made for the operation of the /CS.  After you are sure this is correct, compile the specification into a JEDEC file.
3.  Copy the JEDEC file to your floppy disk and take over to the machine with the PAL Programmer attached.
4.  After starting the JEDEC loader program:  (a)  Make sure the chip is clean and clear of errors. (b) Load your JEDEC file into memory. (c) Write your JEDEC file to the chip. (d) Verify the Write operation (e) Move on so the next student can have a chance :-) )
5.  Interface the decoder with the test circuit described in the PRE-LAB section and verify the correct operation using your test program and the OCR.
6.  Incorporate an additional option into your program that would allow the chip to be tested from 000H to FFFH.  Just make write or read operations to the addresses and have the CRO attaced to the /CS output from the PLD.  What you should see is that the output is high while outside the range and low inside the range. (Be sure to print the address you are writing to (or reading from) to the screen)
7.  MAKE ABSOLUTELY SURE THAT THE TA _SEES_ YOUR DESIGN OPERATING SUCCESSFULLY.

POST LAB:
1.  Write a report in the specified format.  Your report should include  a commented listing of your PALASM program, as well as a well commented listing of your C program.  You should also include a neatly drawn schematic of your test circuitry.

PROGRAMMING COMMENTS:
The following C instructions can be used to read and write from and to the selected port.
--------------------------------
        unsigned char c;
        unsigned int address;
        // inports reads from location 'address' and places the 8-bit contents into variable 'c'
        c = inport(address);
        // outport writes the 8-bit value 'c' to location 'address'
        outportb(address, c);
--------------------------------

The following code fragment can be used to determine whether a key has been pressed on the keyboard

--------------------------------
        #include <stdio.h>
        #include <conio.h>
        #include <dos.h>
--------------
        while(!kbhit())
            {
                 /* code to be executed while the keyboard is not being hit */
            }
--------------------------------

HINTS:
The primary purpose is to program a PLD. We will be using the AMD PALCE 22V10 chip from Lattice Semiconductors.  You may go to this website to download software and manuals for various products, however the DATA SHEET for the 22V10 chip has already been downloaded to this location:  p22v10.pdf.

This file can be viewed with Adobe Acrobat Reader.  If you do not already have this installed, you can download it from:  http://www.adobe.com/products/acrobat/readstep.html. Or you may download the the Windows 98 Version from our site: ar405eng.exe

The DATA Sheet is a 34 page document.  The first few pages of general description and block diagrams are useful.  Also the pin layout on page 33 is required for the lab assignment.

To program the 22V10, we will be using the PALASM4 Version 1.5 tool, which is installed on the machines in the lab.  The lab manual has provided a good description of how to program various chips.  Refer to the data sheets for the 22V10 provided above to determine the specifics (pin layouts, etc).  Together with the examples in the lab manual, you should be able to program the 22V10 to select the address range described in the manual.

For creating the boolean equation:

Convert the range to binary format.  Look at the bits that stay the same and the ones that remain the same over the entire range.  Enumerate all numbers in that range if necessary to understand what is going on.

For creating the program:

The program could be implemented in a doubly nested loop.  The outer one prompting for the address and the inner on doing the read and writting. Then just test the RS FF with the CRO.