USB to JATG 장비가 다른 곳에 출장중인지라, linux에서 프로그래밍을 하려고 이것저것 해봤습니다.(논문은??? -_-) 어제 밤에 찾아본 방법중에 하나가 xc3prog라는 프로그램을 이용해서 사용하는 방법이 있었는데 잠들기 전에 찾다가 보니 libusb-driver를 사용하는 방법이 있더군요.
기본적으로 iMPACT의 JTAG케이블은 windrvr6라는 라이브러리를 사용하게 되어있습니다만 이게 한번에 구하기 쉽지 않더라구요. 그리고 xilinx에서 제공하고 있는 라이브러리의 경우는 컴파일에서 문제가 되는 경우가 생겨서(아마 커널 소스가 필요한거 같은데 안 받아놓은지라.. -_-)... 커널컴파일쪽은 자신이 많이 없어서 그냥 다른 방법으로 가기로 했습니다. ㅋㅋㅋ
1. 우선 libusb-driver의 소스를 받습니다. 요기~ 2. 받은 소스를 가지고 make를 이용해 libusb-driver.so와 libusb-driver-debug.so를 만들어줍니다. 3. 만들어진 라이브러리를 실행파일이 있는 폴더 $XILINX/bin/lin에 복사를 합니다. 4. iMPACT실행시 windrvr을 사용하지않고 libusb-driver를 사용하도록 실행파일을 변경해 줘야 합니다. _impact 를 _impact.bin으로 복사합니다. 5. _impact를 만들어 줍니다.
Xilinx에서 ISE를 사용하다가 보니 PACE에서 문제가 되더라구요. pin의 assign이 안되는 경우가 많아서.. (뭐.. ucf파일을 직접 수정하면 됩니다만.. 머리가 나쁜 저로서는.. ) 하여간, 문제가 되는 부분이 libXm.so.3가 문제가 되더라구요. 깔려고 알아보다가 보니 rpmfind에서 찾아보니 openmotif22-2.2.4-18.i386.rpm을 깔아야 되는데 또 libXP.so.6을 깔아야 하더라구요. 이걸 또 깔려면, yum을 통해서 lesstif 패키지와 lesstif-devel 패키지를 설치하면 설치가 가능하더라구요. 뭐.. 멍청한 방법이긴 하지만 까먹을까봐 적어둡니다. ^^
ps. iMPACT에서 JTAG케이블이 연결이 안되는 문제는 windrvr을 설치해야 하지만 Spartan3 JTAG programming tools for GNU/LINUX로 해결했습니다. (사실은 설치하다가 GG쳤습니다. ㅠㅠ) : 관련링크 - http://www.roqerstech.co.uk/xc3sprog/
Step 1: create a PLI application program in C, such as, a "Hello world" as hereafter.
/********************************************************************** * $hello example -- PLI application using VPI routines * * C source to print "Hello World" as a PLI application. * * Usage: $hello; * * *********************************************************************/
#include /* ANSI C standard library */ #include /* ANSI C standard input/output library */ #include /* IEEE 1364 PLI VPI routine library */
/********************************************************************** * $hello Registration Data * (add this function name to the vlog_startup_routines array) *********************************************************************/ void hello_register() { s_vpi_systf_data tf_data;
Step 3: compiling and linking the $hello system task g++ -c -I/[install_dir]/modeltech/include [app-source-files] ld -G -B symbolic -o mti_pli_apps.so [pli_app_object_files]
In above $hello example, we do as follows: g++ -c -I/[install_dir]/modeltech/include hello_vpi.c g++ -c -I/[install_dir]/modeltech/include hello_register.c ld -G -B symbolic -o mti_pli_apps.so hello_vpi.o hello_register.o
Step 4: Modify the ModelSim .ini file at /[install_dir]/modeltech/modelsim.ini specify the names of the shared object libraries in the Veriuser variable. This variable is typically found towards the middle of the modelsim.ini file, and by default it is commented out. Any number of shared object files may be listed, separated by a white space. As an example, the $hello system task has shared object mti_pli_apps.so, then the Verisuer variable would be set to:
;List of dynamically loaded objects for Verilog PLI applications Veriuser=mti_pli_apps.so
Step 5: Create a verilog file to use $hello system task
hello.v
module hello(clk, reset); input clk, reset; initial begin $hello(); end
endmodule
Step 6: Create do files to run hello.v in ModelSim command-line mode
File test.do: #this is to run hello in cmd mode do test_stim.do quit -f
File test_stim.do
# setup an oscillator on the CLK input force clk 1 50 -r 100 force clk 0 100 -r 100
# reset the clock and then count to 100 force reset 1 run 100
force reset 0 run 10000
Step 7: Simulate Hello.v in modelSim
Type following command in Dos/Unix prompt $vsim -c -do test.do test -wlf test.wlf
The -c argument instructs ModelSim not to invoke the GUI. The -wlf argument saves the simulation results in a WLF file. This allows you to view the simulation results in the GUI for debugging purposes.