@@ -84,7 +84,12 @@ class SelectorEnum(Enum):
84
84
@click .option (
85
85
"--build-dir" ,
86
86
default = None ,
87
- help = "<Optional> Absolute path of build directory." "Required for --mmap-ilp." ,
87
+ help = "<Optional> Absolute path of build directory." ,
88
+ )
89
+ @click .option (
90
+ "--tar" ,
91
+ default = None ,
92
+ help = "<Optional> File name for the build directory tar." "Exclude '.tar.gz'." ,
88
93
)
89
94
@click .option (
90
95
"--top-mod-name" ,
@@ -98,6 +103,15 @@ def parse_arguments(**kwargs: dict[str, Any]) -> dict[str, Any]:
98
103
Returns a dictionary containing the parsed command-line arguments.
99
104
"""
100
105
106
+ # Print all options that were used
107
+ print ("Used options:" )
108
+ for option , value in kwargs .items ():
109
+ if value is not None :
110
+ print (f"{ option } : { value } " )
111
+
112
+ if kwargs ["build_dir" ] and kwargs ["tar" ]:
113
+ raise click .BadParameter ("Choose either --build-dir or --tar." )
114
+
101
115
if not kwargs ["rapidstream_json" ] and not kwargs ["tapa_xo" ]:
102
116
raise click .BadParameter (
103
117
"Either --rapidstream-json or --tapa-xo inputs is required."
@@ -126,6 +140,7 @@ def parse_arguments(**kwargs: dict[str, Any]) -> dict[str, Any]:
126
140
mmap_port_json = args ["mmap_port_json" ]
127
141
selector = args ["selector" ]
128
142
build_dir = args ["build_dir" ]
143
+ tar = args ["tar" ]
129
144
top_mod_name = args ["top_mod_name" ]
130
145
mmap_ilp = args ["mmap_ilp" ]
131
146
@@ -211,23 +226,27 @@ def parse_arguments(**kwargs: dict[str, Any]) -> dict[str, Any]:
211
226
else :
212
227
raise NotImplementedError
213
228
229
+ if tar :
230
+ build_dir = tar
231
+ # build_dir = f"{os.getcwd()}/{tar}"
232
+
214
233
if build_dir :
215
234
if os .path .exists (build_dir ):
216
235
print (f"The folder '{ build_dir } ' already exists. Aborting." )
217
236
sys .exit (1 )
218
- else :
219
- zsh_cmds = f"""
237
+
238
+ zsh_cmds = f"""
220
239
mkdir { build_dir }
221
240
cp { mmap_port_json } { build_dir } /{ I_MMAP_PORT_JSON }
222
241
"""
223
- if rapidstream_json :
224
- zsh_cmds += f"cp { rapidstream_json } { build_dir } /"
225
- elif tapa_xo :
226
- zsh_cmds += f"cp { tapa_xo } { build_dir } /"
227
- else :
228
- raise NotImplementedError
229
- print (zsh_cmds )
230
- subprocess .run (["zsh" , "-c" , zsh_cmds ], check = True )
242
+ if rapidstream_json :
243
+ zsh_cmds += f"cp { rapidstream_json } { build_dir } /"
244
+ elif tapa_xo :
245
+ zsh_cmds += f"cp { tapa_xo } { build_dir } /"
246
+ else :
247
+ raise NotImplementedError
248
+ print (zsh_cmds )
249
+ subprocess .run (["zsh" , "-c" , zsh_cmds ], check = True )
231
250
232
251
# Select MMAP ports to put over NoC
233
252
@@ -444,6 +463,14 @@ def parse_arguments(**kwargs: dict[str, Any]) -> dict[str, Any]:
444
463
with open (f"{ build_dir } /{ DUMP_NEG_PATHS_TCL } " , "w" , encoding = "utf-8" ) as file :
445
464
file .write ("\n " .join (tcl ))
446
465
466
+ if tar :
467
+ zsh_cmds = f"tar -czf { build_dir } .tar.gz { build_dir } \n "
468
+ # delete the temporary tar directory
469
+ zsh_cmds += f"rm -rf { build_dir } \n "
470
+ print (zsh_cmds )
471
+ subprocess .run (["zsh" , "-c" , zsh_cmds ], check = True )
472
+ sys .exit (1 )
473
+
447
474
# launch vivado
448
475
zsh_cmds = f"""
449
476
source ~/.zshrc && amd
0 commit comments