Activity 5.3B – A Basic Problem
Purpose
1.To understand and apply the steps necessary to program a PLD
2.To understand and apply the programming syntax of the WinCUPL language
3.To understand and apply the steps needed to program a programmable IC
Equipment
ICs: gal22v10D
EMP 11
Breadboard and jumper wires
LEDs and current limiting resistors
5 volt power supply
Switches
Procedure
The intent of this activity is to use it as you would a tutorial. At the end you will have a programmed chip to breadboard, test and demonstrate its function to your instructor.
The Basics:
The sequence for programming a PLD is as follows:
- Design the logic circuit by creating a truth table or logic schematic
- Write a series of Boolean equations in a SOP (Sum of Products) form. (Please note: it is also possible to program the compiler using truth tables or schematic diagrams, we will only be using Boolean equations.)
- Enter preliminary information into the compiler such as name, description of project, chip being used, description of design, number of input pins, number of output pins
- Enter pin assignments and associated variable names
- Enter the equations into the compiler program
- Compile and check the entered program for syntax errors. The program creates the JEDEC file.
- Enter the JEDEC file into the programmer
- Program the chip
- Breadboard and test
The Compiler Program: WinCUPL
WinCUPL is the compiling program that we use. As with any program, it has a syntax language that you need to be aware of. There are four logical operators (symbols) available for use. The chart below shows the operators and their order of precedence (shown from highest to lowest).
Symbol / Ex. / Description / Order ofPrecedence
! / !A / NOT / 1
A&B / AND / 2
# / A#B / OR / 3
$ / A$B / XOR / 4
Fig. 1
There are Arithmetic operators available and these are used when programming sequential logic which will be covered later in the curriculum.
The programmer used is the EMP 11. This uses a windows based interface program.
Sample Program:
In order to understand the compiler program and the programmer program, let’s start with a relatively uncomplicated problem:
The specifications for a submarine state that a SURFACE command shall be initiated automatically under conditions related to oxygen Level (X), battery charge (B) and fresh water supply (W). Each of these variables becomes 0 if the quantity it represents is dangerously low. The SURFACE command is to be initiated if:
- Battery charge and oxygen level are both low; OR
- Fresh water is low, battery charge is high and oxygen level is low; OR
- Fresh water is high and oxygen level is low; OR
- Fresh water and battery charge are both low.
Create, wire and test a chip that will turn a LED on when the SURFACE command is initiated.
Step 1: Create a Truth table of the problem
oxygenX / battery
B / water
W / surface
S
0 / 0 / 0 / 1
0 / 0 / 1 / 1
0 / 1 / 0 / 1
0 / 1 / 1 / 1
1 / 0 / 0 / 1
1 / 0 / 1 / 0
1 / 1 / 0 / 0
1 / 1 / 1 / 0
Step 2: Create SOP equation(s)
S = X’B’W’ + X’B’W + X’BW’ + X’BW + XB’W’
Step 3: Start the WinCupl program and begin to enter information.
When you start the program you will see the screen shown in below:
Fig. 2
Start by creating a New Project (under File >New>Project)
The Design Property dialog box appears, figure 3.
Fig. 3
The Name specified is the name that the project will be saved under. (Hint: This part of the program goes back to old DOS rules, therefore you need to choose a name which is less than 8 characters in length and has no spaces.)
Designer: Enter your name
Device: Enter g22v10 (This is the chip that we will later be programming.)
Fig. 4 Completed Dialog Box
Click ok.
Next you will see 3 dialog boxes appear.
The first will be the number of inputs. Enter 3
The second will be the number of outputs. Enter 1
The last is the number of pinnodes. Enter 0
(The gal22v10 does not support pinnodes.)
Click OK after each dialog box.
The compiler program will look like Figure 5.
Fig. 5
Notice that there are 3 spots under the Input Pins, and 1 spot under the Output Pin. These are the sections where we will specify the pins to use and the variable names assigned. After the semi-colon is a place to enter comments, which is a good programming practice.
To assign the pin names and numbers, we first need to look at the pin configuration of a gal22v10 chip. (Figure 6)
Fig. 6
From the data sheet on the gal22v10, we see that pin number 1 can use used as a clock or an input. Pins 2-11, and pin 13 are inputs only. Pins 14-23 can be assigned to be an input OR an output, depending on the programmer’s needs. (If you don’t have a data sheet on the gal22v10, it might be a good idea to take a few minutes at this time and download one.)
Define, under input:
Pin 5 = X
Pin 6 = B
Pin 7 = W
Define, under output:
Pin 18 = S
Your program should look like Figure 7.
Fig. 7 Pins, Variable and comments
The formulae go under the output section. Also, notice that all lines end with a semi-colon. The equations we enter have to end the same way.
Remember the Boolean equation for this problem written earlier:
S = X’B’W’ + X’B’W + X’BW’ + X’BW + XB’W’
This needs to now be entered in the compile program, following the syntax specified earlier (look back at figure 1 to refresh your memory).
This becomes:
S = !X & !B & !W # !X & !B & W # !X & B & !W # !X & B & W # X & !B & !W;
Enter that equation under the output line. (Remember that semi-colon at the end of the equation!) (For space considerations, the equation was slit among several lines. It is not necessary to do that.)
Fig. 8 Formula entered
Now we are ready to compile the equation, let the program check for syntax errors, and have a JEDEC file created.
Fig. 9
Under the Run pull down menu, choose Device Dependent Compile.
You might be reminded to save the file first – if so, say yes. By default, all of the projects that you create in WinCUPL are saved in the WinCupl folder on your hard drive.
IF your compilation is correct you will see the message shown in Figure 10.
Fig. 10
When you click OK, you will see 3 new files appear in the browser on the right.
Fig. 11
Click on each one in turn, and notice how the work window’s program changes. The * *.jed is the JEDEC file we want.
Double click on this file so that it opens in the project window and “SAVEAS” to a folder of your choice.
(Hint: save this file to a floppy disk so that it can be transported to the computer where the programmer is attached.) Be sure that the extension stays “.jed”. (Another way to handle this is to copy this file using windows explorer.)
Step 4: Programming the Chip
Find the EMP11 folder and open the programming language.
When you first start the program, the computer might need to search for the programmer itself. If the dialog box below appears, make the changes as shown in figure 12.
Fig. 12
There is some additional setup information that might be requested: that of the company and the chip being programmed. Figure 13 shows the information for the Lattice gal22v10 – the chip we use.
Fig. 13
The main dialog box appears. There is a log file kept in the center section, notice that the device chosen above now is specified.
Fig. 14
Click each of the boxes on the left side in turn:
Device allows you to change the name of the company or the chip being used.
Edit Buffer is the place we will go to load the * *.jed program created earlier in the WinCUPL program. There will be more on this in a while.
Erase erases the chip. When a chip is programmed the programmer automatically erases all the information already stored there. Erasing first is simply a way to be absolutely sure that the chip has been completely erased before you begin.
Blank Check makes sure that the chip has been erased and is totally free from all data.
Program takes the information stored in the buffer (your program) and enters that information onto the chip
Verify does exactly that – it verifies that the chip has been programmed.
Start by choosing the “Edit Buffer” button.
Fig. 15
This is the place where your program needs to be entered and where the information is stored until it is either over-written or cleared.
Choose File> Open
Browse and find the * *.jed file you saved. (Most likely you saved it to a floppy.)
When asked to confirm the file type (that it is a JEDEC file), choose Yes.
It will ask if you are sure you want to open that file, choose Yes.
The next dialog box will then tell you that the file has been successfully loaded.
Choose OK to close the box.
Scroll up and down the box. You will notice that the information (in the form of 1’s and 0’s) has now changed.
Close the Buffer Editor box (“x” in upper right corner).
Read the information in the Log box. You will see statements referring to the fact that the file appears to be JEDEC and the number of fuses that were successfully loaded.
Next, be sure that the Chip has been loaded into the programmer, and that the correct memory module has been installed. (Verify this with your instructor.)
Next choose the Program button.
A small dialog box will appear that will remind you that you are going to change the data on the chip, and are you sure that you want to do this.
Choose Yes
The information will now be transferred to the chip from the programmer.
Remove the chip from its socket.
Breadboard the circuit and be sure that it performs as it was intended.
Test that the chip correctly matches the information in the established truth table above.
Demonstrate the operation of the circuit to your teacher and get signature:
______
Conclusion
1.Write the Boolean expression shown as if it were to be entered into the compiler: A’BC + ABC’ + AB’C’