Professional Documents
Culture Documents
Contents
Requirements and Prerequisites Step 1: Set Up FPGA Development Board Step 2: Set Up Gigabit Ethernet Network Adapter Step 3: Prepare Example Resources Step 4: Launch FPGA-in-the-Loop (FIL) Wizard Step 5: Specify Hardware Options in FIL Wizard Step 6: Specify HDL Files in the FIL Wizard Step 7: Review I/O Ports in FIL Wizard Step 8: Review Build Options in FIL Wizard Step 9: Set Up Model Step 10: Program FPGA Step 11: Set Up Parameters of FIL Block Step 12: Run FIL
MATLAB Simulink Fixed-Point Toolbox Simulink Fixed Point HDL Verifier FPGA design software (Xilinx ISE design suite or Altera Quartus II design software) One of the supported FPGA development boards and accessories Gigabit Ethernet Adapter installed on host computer, Gigabit Ethernet crossover cable
Prerequisites:
MATLAB and FPGA design software can either be locally installed on your computer or on a network accessible device. If you use software from the network you will need a second network adapter installed in your computer to provide a private network to the FPGA development board. Consult the hardware and networking guides for your computer to learn how to install the network adapter.
On Windows Vista, do the following steps: 1. Open the Control Panel. 2. Click Network and Sharing Center, and then click Manage network connections. 3. Right click the connection icon to your FPGA development board and select Properties from the pop-up menu. 4. Under This connection uses the following items, select Internet Protocol Version 4 (TCP/IPv4) and click Properties. 5. Select Use the following IP address:. Set IP address to 192.168.0.1. If this address is in use by another computer on your network, change it to any available IP address on this subnet, such as 192.168.0.100. This is your host computer address. Set the Subnet mask to 255.255.255.0. On Windows XP, do the following steps: 1. Open the Control Panel. 2. Open Network connections. 3. Right click the connection icon to your FPGA development board and select Properties from the pop-up menu.
4. Under This connection uses the following items, select Internet Protocol (TCP/IP) and click Properties. 5. Select Use the following IP address:. Set IP address to 192.168.0.1. If this address is in use by another computer on your network, change it to any available IP address on this subnet, such as 192.168.0.100. This is your host computer address. Set the Subnet mask to 255.255.255.0. On Linux: Use the ifconfig command to set up your local address. For example: % ifconfig eth1 192.168.0.1 In this example, eth1 is the second Ethernet adapter on the Linux computer. Check your system to determine which Ethernet adapter is connected to the FPGA development board. The above command sets the local IP address to 192.168.0.1. If this address is in use by another computer on your network, change it to any available IP address on this subnet, such as 192.168.0.100.
This command copies all the source files under matlabroot\toolbox\shared\eda\fil\fildemos\fil_pid to your current directory. matlabroot is the MATLAB root directory on your system. You should have the following files in your working directory:
Before using FPGA-in-the-Loop, make sure your system environment is set up properly for accessing FPGA design software. You can use the function hdlsetuptoolpath to add ISE or Quartus II to the system path for the current MATLAB session. For Xilinx FPGA boards, run
hdlsetuptoolpath('ToolName', 'Xilinx ISE', 'ToolPath', 'C:\Xilinx\13.1\ISE_DS\IS E\bin\nt64\ise.exe');
This example assumes that the Xilinx ISE executable is C:\Xilinx\13.1\ISE_DS\ISE\bin\nt64\ise.exe. Substitute with your actual executable if it is different. For Altera boards, run
hdlsetuptoolpath('ToolName','Altera Quartus II','ToolPath','C:\altera\11.0\quart us\bin\quartus.exe');
This example assumes that the Altera Quartus II executable is C:\altera\11.0\quartus\bin\quartus.exe. Substitute with your actual executable if it is different. 5. Open the fil_pid.mdl model. This model contains a fixed-point PID controller implemented with basic Simulink blocks. This model also contains a DC motor model controlled by this PID controller as well as the desired DC motor position as the input stimulus. Run this model now and observe the desired and actual motor positions in the scope.
Alternatively, you can enter the filWizard command at the MATLAB command prompt.
filWizard
2. If you changed your computer's IP address to a different subnet from 192.168.0.x when you set up the network adapter, or if the default board IP address 192.168.0.2 is in use by another
device, expand Advanced Options and change the Board IP address according to the following guidelines:
The subnet address, typically the first three bytes of board IP address, must be the same as those of the host IP address. The last byte of the board IP address must be different from that of the host IP address. The board IP address must not conflict with the IP addresses of other computers.
For example, if the host IP address is 192.168.8.2, then you can use 192.168.8.3 if it is available. Do not change Board MAC address.
These are the HDL design files to be verified on the FPGA board. 3. In the Source Files table, check the checkbox on the row of file Controller.vhd to specify that this HDL file contains the top-level HDL module.
The FIL Wizard automatically fills the Top-level module name field with the name of the selected HDL file; in this case, Controller. In this example, the top-level module name matches the file name so that you do not need to change it. If the top-level module name and file name did not match, you would manually correct the top-level module name in this dialog. Click Next to continue.
2. Click Build to start the build process. During the build process, the following actions occur:
A FIL block named Controller is generated in a new model as shown in the following figure. Do not close this model.
After new model generation, the FIL Wizard opens a command window where the FPGA design software performs synthesis, fit, place-and-route, timing analysis, and FPGA programming file generation.
When the FPGA design software process is finished, a message in the command-line window lets you know you can close the window. Close the window and proceed to the next step.
If your board is connected to the host computer through the JTAG cable properly, a message window displays to indicate that the FPGA programming file is loaded successfully. Click OK to dismiss this dialog.
4. You can test if the FPGA board is connected to your host computer properly through the ping test. Launch a command-line window and enter the following command:
C:\MyTests> ping 192.168.0.2
If you changed the board IP address when you set up the network adapter, replace 192.168.0.2 with your board IP address. If the Gigabit Ethernet connection has been set up properly, you should see the ping reply from the FPGA development board.