Previous

Verifying the Design Using a Demonstration Board

This section contains information on verifying the design using a demonstration board by creating and downloading the bitstream. This section also contains information about testing the design.

Creating and Downloading the Bitstream

The Configure stage in the Flow Engine created a bitstream. You can now download the bitstream using a parallel download cable or the more versatile XChecker cable connected to your workstation. You can download the XC4000E version of the Calc design into an FPGA demonstration board available from Xilinx.

Use Hardware Debugger to download. To invoke Hardware Debugger, select Tools Hardware Debugger from the menu bar, or click the Hardware Debugger icon on the toolbar. See the next figure. If using an XChecker cable, you can also use the Hardware Debugger to read back information from the device to verify both the configuration as well as the state of memories and registers in the device.

figures/hw_icon.gif

A separate tutorial explains Hardware Debugger. Refer to the Hardware Debugger Reference/User Guide. Before starting this tutorial, select the ver1 rev1 revision of the design in the project view.

Testing the Design


NOTE

You can physically test this design only on an FPGA demoboard because no demoboard exists for CPLDs.


As described earlier, the Calc design is a 4-bit processor with a stack similar to a calculator that uses reverse polish notation. You must supply three types of input: an opcode, data, and an execute command.

Each demonstration board contains a row of eight rocker switches that provide input to the design (SW3 on the XC3000A/XC4000E board, SW5 on the XC4000E board). The left-most switch, labeled “1,” is the Execute command, activated by toggling the switch twice. The next three switches (labeled 2-4) select the opcode. Opcode encoding appears in the following table. Use the right-most four switches (labeled 5-8) to input data. When you select the extended instruction set with opcode 111, these switches provide additional bits of opcode.

Table 8_3 Processor Operations

2
3
4
5
6
7
8
Operation
0
0
0
Data
ADD between switches and register
0
0
1
Data
AND between switches and register
0
1
0
Data
OR between switches and register
0
1
1
Data
XOR between switches and register
1
0
0
Data
SUB switch value from register
1
0
1
X
X
X
X
CLEAR register
1
1
0
Data
LOAD register
1
1
1
0
0
0
X
ADD between stack and register
1
1
1
0
0
1
X
AND between stack and register
1
1
1
0
1
0
X
OR between stack and register
1
1
1
0
1
1
X
XOR between stack and register
1
1
1
1
0
0
X
SUB stack value from register
1
1
1
1
0
1
X
PUSH register value to stack
1
1
1
1
1
0
X
POP stack value to register
1
1
1
1
1
1
X
NOP

To perform an operation, set the data on the right-most “nibble.” “On” is a one; “Off” is a zero. Look up the correct opcode for the operation you want to perform and set the three opcode switches to the correct value. Then toggle the left-most Execute switch twice. If the switch is already On, switch it Off, wait a moment, and then return it to the On position.

The contents of the ALU register display in hexadecimal on the seven-segment display. The top value in the stack displays in binary on the right bank of LEDs. A gauge indicating the number of items on the stack displays on the left bank of LEDs.

  1. Verify that the initial contents of both ALU and stack are all zeros. The decimal display says “0,” and the LED bar is all Off. Now put a 1 on the data switches and load the switch value to the ALU register. The op code is 110.

  2. Set the seven right-most switches to 110-0001.

  3. Toggle the left-most switch to execute the command. The decimal display shows the contents of the ALU register, now “1.” The stack is still empty. Add 13 to the ALU register. The opcode is 000.

  4. Set the seven right-most switches to 000-1101.

  5. Toggle the left-most switch twice to execute the command. The decimal display shows the contents of the ALU register, which is now “E.” The stack remains empty. Push the register value onto the stack. The opcode is 111, the extended opcode. Set the data to 101x, where the x is a don't-care.

  6. Set the seven right-most switches to 111-1011.

  7. Toggle the left-most switch twice to execute the command. The decimal display still shows “E.” The stack value is also “E,” so the LED bar shows 1110 in the right-hand nibble. Perform an XOR operation between the switch value and the register. The opcode is 011. Set the data to all ones.

  8. Set the seven right-most switches to 011-1111.

  9. Toggle the left-most switch twice to execute the command. The decimal display changes to “1.” The stack value on the LED display is still “E,” 1110. Pop the value from the stack. The opcode is 111, the extended opcode. Set the data to 110x, where the x is a don't-care.

  10. Set the seven right-most switches to 111-1101.

  11. Toggle the left-most switch twice to execute the command. The decimal display changes to “E.” The stack value returns to “0.” Clear the ALU register. The opcode is 101. The data is ignored.

  12. Set the seven right-most switches to 101-1101.

  13. Toggle the left-most switch twice to execute the command. The decimal display changes to “0.” The stack value remains at “0.”

  14. Try any other commands that you want.

Next