Rev Author Line No. Line
3091 miho 1 @echo off
2 rem Batch generates bitfile for Logic Analyser Demo
3 rem
4 rem Parameters:
5 rem
6 rem 18x1024|9x2048 ... select analyser size (width and depth)
7 rem
8 rem Do not modify srouce files directory structure
9 rem
10 rem Tested with Xilinx ISE WebPack 14.5 with ChipScope License
11 rem
12  
13 rem ----- first parameter
14 set product=%1%
15 if "%product%"=="18x1024" (
16 echo 18x1024
17 ) else if "%product%" == "9x2048" (
18 echo 9x2048
19 ) else (
20 echo Missing parameter %product%
21 echo usage: %0% 18x1024^|9x2048
22 pause
23 exit 1
24 )
25 echo.
26 echo Product: %product%
27 echo.
28  
29 rem ----- Set core (top VHDL entity) name
30 set core=S3AN01_ChipScope
31  
32 rem ----- Set FPGA part
33 set fpgaPart=xc3s50an-tqg144-4
34  
35 rem ----- Find and Set Xilinx Tools
36 call FindXilinxTools.cmd
37  
38 rem ----- Set WORK dir
39 if exist WORK_%core%_%product% rmdir /S /Q WORK_%core%_%product%
40 mkdir WORK_%core%_%product%
41 cd WORK_%core%_%product%
42  
43 rem ----- Set TEMP dir (relative to WORK dir)
44 mkdir TMP
45 set TMP=TMP
46  
47 rem ----- INPUT UCF and VHDL files (linux format c:/.../... )
48 set srcPath=../..
49 set ucfFile=VHDL/S3AN01_ChipScope.ucf
50  
51 echo vhdl work "%srcPath%/COREGEN/ChipScope_ICON.vhd" > srcFiles.prj
52 echo vhdl work "%srcPath%/COREGEN/ChipScope_VIO_FreqSel.vhd" >>srcFiles.prj
53 echo vhdl work "%srcPath%/COREGEN/ChipScope_ILA_9_2048.vhd" >>srcFiles.prj
54  
55 echo vhdl work "%srcPath%/VHDL/S3AN01_ChipScope.vhd" >>srcFiles.prj
56  
57 rem ----- SET XST setting
58 echo set -xsthdpdir "xst" > setXst.xst
59 echo run >>setXst.xst
60 echo -ifn "srcFiles.prj" >>setXst.xst
61 echo -ofn %core% >>setXst.xst
62 echo -ofmt NGC >>setXst.xst
63 echo -top %core% >>setXst.xst
64 echo -iob True >>setXst.xst
65 echo -p %fpgaPart% >>setXst.xst
66  
67 if "%product%"=="18x1024" (
68 echo -generics { ILA_WIDE=TRUE } >>setXst.xst
69 ) else (
70 echo -generics { ILA_WIDE=FALSE } >>setXst.xst
71 )
72  
73 rem ----- SET BITGEN setting
74 echo -w > setBitGen.ut
75 echo -g ConfigRate:25 >>setBitGen.ut
76 echo -g UnusedPin:PullUp >>setBitGen.ut
77 echo -g DriveDone:Yes >>setBitGen.ut
78  
79  
80 call xst -ifn "setXst.xst" -ofn "%core%.log"
81 if %errorlevel% NEQ 0 (
82 echo.
83 echo.
84 echo ERROR in xst
85 echo ============
86 pause
87 exit 1
88 )
89  
90 call ngdbuild -intstyle ise -dd _ngo -sd ../../COREGEN -nt timestamp -uc "%srcPath%/%ucfFile%" -p %fpgaPart% %core%.ngc %core%.ngd
91 if %errorlevel% NEQ 0 (
92 echo.
93 echo.
94 echo ERROR in ngdbuild
95 echo =================
96 pause
97 exit 1
98 )
99  
100 call map -intstyle ise -p %fpgaPart% -cm area -ir off -pr off -c 100 -o %core%.ncd %core%.ngd %core%.pcf
101 if %errorlevel% NEQ 0 (
102 echo.
103 echo.
104 echo ERROR in map
105 echo ============
106 pause
107 exit 1
108 )
109  
110 call par -w -intstyle ise -ol high -t 1 %core%.ncd %core%.ncd %core%.pcf
111 if %errorlevel% NEQ 0 (
112 echo.
113 echo.
114 echo ERROR in par
115 echo ============
116 pause
117 exit 1
118 )
119  
120 call trce -intstyle ise -v 3 -s 4 -n 3 -fastpaths -xml %core%.twx %core%.ncd -o %core%.twr %core%.pcf
121 if %errorlevel% NEQ 0 (
122 echo.
123 echo.
124 echo ERROR in trace
125 echo ==============
126 pause
127 exit 1
128 )
129  
130 call bitgen -f "setBitGen.ut" %core%.ncd
131 if %errorlevel% NEQ 0 (
132 echo.
133 echo.
134 echo ERROR in bidgen
135 echo ===============
136 pause
137 exit 1
138 )
139  
140 rem ----- Verify Timing
141 findstr /B /C:"All constraints were met." %core%.par
142 if %errorlevel% NEQ 0 (
143 echo.
144 echo.
145 echo ERROR in Timing
146 echo ===============
147 pause
148 exit 1
149 )
150  
151 if exist ..\BIN\%XILINX_VERSION% (
152 rem ----- Copy result to BIN\{ISE_VER} directory
153 copy /Y %core%.bit ..\BIN\%XILINX_VERSION%\%core%_%product%.bit
154 rem copy /Y %core%.par ..\BIN\%XILINX_VERSION%\%core%_%product%.par
155 rem ----- Remove WORK dir
156 rem (bitgen starts wbtc.exe as a secondary process)
157 cd ..
158  
159 rem Wait for xwebtalk has finished its work (sending stat data to Xilinx)
160 echo | set /p=Waiting for WebTalk...
161 :StartLoop
162 tasklist | findstr /i /c:"wbtc.exe" > nul
163 if %errorlevel% NEQ 0 (
164 goto ExitLoop
165 )
166 sleep 1
167 echo | set /p=*
168 goto StartLoop
169 )
170 :ExitLoop
171  
172 rem Tohle nefunguje, protože výstup wmic je UTF-16 a to finstr neumí
173 rem wmic process | findstr /c:"%core%_%product%"
174 rem wmic process > ..\"%core%_%product%".wmic
175  
176 rmdir /S /Q WORK_%core%_%product%
177 exit 0
178 )
179 exit 1