55# 
66
77#  Command line arguments:
8- #  Arg 1: path to design sources
9- #  Arg 2: path to sim sources
10- #  Arg 3: path to test sources
11- #  Arg 4: path to include sources
12- #  Arg 5: mode
13- #  Arg 6: debug
14- #  Arg 7: alu_ena
15- #  Arg 8: mul_ena
16- #  Arg 9: target clock period
17- #  Arg 10: target II for GEMM
18- #  Arg 11: target II for tensor ALU
19- #  Arg 12: input type width (log)
20- #  Arg 13: weight type width (log)
21- #  Arg 14: accum type width (log)
22- #  Arg 15: output type width (log)
23- #  Arg 16: batch size (log)
24- #  Arg 17: in block size (log)
25- #  Arg 18: out block size (log)
26- #  Arg 19: uop buffer size in B (log)
27- #  Arg 20: inp buffer size in B (log)
28- #  Arg 21: wgt buffer size in B (log)
29- #  Arg 22: acc buffer size in B (log)
30- #  Arg 23: out buffer size in B (log)
31- 
32- if  { [llength  $argv ] eq 25 } {
33- 	set  src_dir [lindex  $argv  2]
34- 	set  sim_dir [lindex  $argv  3]
35- 	set  test_dir [lindex  $argv  4]
36- 	set  include_dir [lindex  $argv  5]
37- 	set  mode [lindex  $argv  6]
38- 	set  debug [lindex  $argv  7]
39- 	set  alu_ena [lindex  $argv  8]
40- 	set  mul_ena [lindex  $argv  9]
41- 	set  target_period [lindex  $argv  10]
42- 	set  target_gemm_ii [lindex  $argv  11]
43- 	set  target_alu_ii [lindex  $argv  12]
44- 	set  inp_width [lindex  $argv  13]
45- 	set  wgt_width [lindex  $argv  14]
46- 	set  acc_width [lindex  $argv  15]
47- 	set  out_width [lindex  $argv  16]
48- 	set  batch [lindex  $argv  17]
49- 	set  block_in [lindex  $argv  18]
50- 	set  block_out [lindex  $argv  19]
51- 	set  uop_buff_size [lindex  $argv  20]
52- 	set  inp_buff_size [lindex  $argv  21]
53- 	set  wgt_buff_size [lindex  $argv  22]
54- 	set  acc_buff_size [lindex  $argv  23]
55- 	set  out_buff_size [lindex  $argv  24]
8+ #  Arg 1: target (FPGA)
9+ #  Arg 2: path to design sources
10+ #  Arg 3: path to sim sources
11+ #  Arg 4: path to test sources
12+ #  Arg 5: path to include sources
13+ #  Arg 6: mode
14+ #  Arg 7: debug
15+ #  Arg 8: alu_ena
16+ #  Arg 9: mul_ena
17+ #  Arg 10: target clock period
18+ #  Arg 11: target II for GEMM
19+ #  Arg 12: target II for tensor ALU
20+ #  Arg 13: input type width (log)
21+ #  Arg 14: weight type width (log)
22+ #  Arg 15: accum type width (log)
23+ #  Arg 16: output type width (log)
24+ #  Arg 17: batch size (log)
25+ #  Arg 18: in block size (log)
26+ #  Arg 19: out block size (log)
27+ #  Arg 20: uop buffer size in B (log)
28+ #  Arg 21: inp buffer size in B (log)
29+ #  Arg 22: wgt buffer size in B (log)
30+ #  Arg 23: acc buffer size in B (log)
31+ #  Arg 24: out buffer size in B (log)
32+ 
33+ if  { [llength  $argv ] eq 26 } {
34+ 	set  target [lindex  $argv  2]
35+ 	set  src_dir [lindex  $argv  3]
36+ 	set  sim_dir [lindex  $argv  4]
37+ 	set  test_dir [lindex  $argv  5]
38+ 	set  include_dir [lindex  $argv  6]
39+ 	set  mode [lindex  $argv  7]
40+ 	set  debug [lindex  $argv  8]
41+ 	set  alu_ena [lindex  $argv  9]
42+ 	set  mul_ena [lindex  $argv  10]
43+ 	set  target_period [lindex  $argv  11]
44+ 	set  target_gemm_ii [lindex  $argv  12]
45+ 	set  target_alu_ii [lindex  $argv  13]
46+ 	set  inp_width [lindex  $argv  14]
47+ 	set  wgt_width [lindex  $argv  15]
48+ 	set  acc_width [lindex  $argv  16]
49+ 	set  out_width [lindex  $argv  17]
50+ 	set  batch [lindex  $argv  18]
51+ 	set  block_in [lindex  $argv  19]
52+ 	set  block_out [lindex  $argv  20]
53+ 	set  uop_buff_size [lindex  $argv  21]
54+ 	set  inp_buff_size [lindex  $argv  22]
55+ 	set  wgt_buff_size [lindex  $argv  23]
56+ 	set  acc_buff_size [lindex  $argv  24]
57+ 	set  out_buff_size [lindex  $argv  25]
5658} else  {
59+ 	set  target " pynq" 
5760	set  src_dir " ../src" 
5861	set  sim_dir " ../sim" 
5962	set  test_dir " ../../src/test" 
@@ -83,16 +86,20 @@ if { [llength $argv] eq 25 } {
8386#  Initializes the HLS design and sets HLS pragmas for memory partitioning.
8487#  This is necessary because of a Vivado restriction that doesn't allow for
8588#  buses wider than 1024 bits.
86- proc  init_design  {per g_ii a_ii inp_width wgt_width out_width acc_width batch block_in block_out alu_ena} {
89+ proc  init_design  {target  per g_ii a_ii inp_width wgt_width out_width acc_width batch block_in block_out alu_ena} {
8790
8891	#  Set device number
89- 	set_part {xc7z020clg484-1}
92+ 	if  {$target ==" pynq"  } {
93+ 		set_part {xc7z020clg484-1}
94+ 	} elseif  {$target ==" ultra96"  } {
95+ 		set_part {xczu3eg-sbva484-1-e}
96+ 	}
9097
9198	#  Max bus width (supported by Vivado)
9299	set  max_width 1024
93100
94101	#  Set axi width (TODO derive from top level config)
95- 	set  axi_width 64 
102+ 	set  axi_width 128 
96103
97104	#  Set the clock frequency
98105	create_clock -period $per  -name default
@@ -178,7 +185,7 @@ if {$mode=="all" || $mode=="sim"} {
178185	add_files -tb $sim_dir /vta_test.cc -cflags $cflags 
179186	add_files -tb $test_dir /test_lib.cc -cflags $cflags 
180187	open_solution " solution0" 
181- 	init_design $target_period  $target_gemm_ii  $target_alu_ii  $inp_width  $wgt_width  $out_width  $acc_width  $batch  $block_in  $block_out  $alu_ena 
188+ 	init_design $target    $ target_period  $target_gemm_ii  $target_alu_ii  $inp_width  $wgt_width  $out_width  $acc_width  $batch  $block_in  $block_out  $alu_ena 
182189	csim_design -clean
183190	close_project
184191}
@@ -189,7 +196,7 @@ if {$mode=="all" || $mode=="skip_sim" || $mode=="fetch"} {
189196	set_top fetch
190197	add_files $src_dir /vta.cc -cflags $cflags 
191198	open_solution " solution0" 
192- 	init_design $target_period  $target_gemm_ii  $target_alu_ii  $inp_width  $wgt_width  $out_width  $acc_width  $batch  $block_in  $block_out  $alu_ena 
199+ 	init_design $target    $ target_period  $target_gemm_ii  $target_alu_ii  $inp_width  $wgt_width  $out_width  $acc_width  $batch  $block_in  $block_out  $alu_ena 
193200	csynth_design
194201	if  {$mode ==" all"   || $mode ==" skip_sim"  } {
195202		export_design -format ip_catalog
@@ -203,7 +210,7 @@ if {$mode=="all" || $mode=="skip_sim" || $mode=="load"} {
203210	set_top load
204211	add_files $src_dir /vta.cc -cflags $cflags 
205212	open_solution " solution0" 
206- 	init_design $target_period  $target_gemm_ii  $target_alu_ii  $inp_width  $wgt_width  $out_width  $acc_width  $batch  $block_in  $block_out  $alu_ena 
213+ 	init_design $target    $ target_period  $target_gemm_ii  $target_alu_ii  $inp_width  $wgt_width  $out_width  $acc_width  $batch  $block_in  $block_out  $alu_ena 
207214	csynth_design
208215	if  {$mode ==" all"   || $mode ==" skip_sim"  } {
209216		export_design -format ip_catalog
@@ -217,7 +224,7 @@ if {$mode=="all" || $mode=="skip_sim" || $mode=="compute"} {
217224	set_top compute
218225	add_files $src_dir /vta.cc -cflags $cflags 
219226	open_solution " solution0" 
220- 	init_design $target_period  $target_gemm_ii  $target_alu_ii  $inp_width  $wgt_width  $out_width  $acc_width  $batch  $block_in  $block_out  $alu_ena 
227+ 	init_design $target    $ target_period  $target_gemm_ii  $target_alu_ii  $inp_width  $wgt_width  $out_width  $acc_width  $batch  $block_in  $block_out  $alu_ena 
221228	csynth_design
222229	if  {$mode ==" all"   || $mode ==" skip_sim"  } {
223230		export_design -format ip_catalog
@@ -231,7 +238,7 @@ if {$mode=="all" || $mode=="skip_sim" || $mode=="store"} {
231238	set_top store
232239	add_files $src_dir /vta.cc -cflags $cflags 
233240	open_solution " solution0" 
234- 	init_design $target_period  $target_gemm_ii  $target_alu_ii  $inp_width  $wgt_width  $out_width  $acc_width  $batch  $block_in  $block_out  $alu_ena 
241+ 	init_design $target    $ target_period  $target_gemm_ii  $target_alu_ii  $inp_width  $wgt_width  $out_width  $acc_width  $batch  $block_in  $block_out  $alu_ena 
235242	csynth_design
236243	if  {$mode ==" all"   || $mode ==" skip_sim"  } {
237244		export_design -format ip_catalog
0 commit comments