100100
101101'''
102102PATTERNS = {
103- "clock" : ["clk*" , "*clk* " , "clk[0-9]* " , "clock_* " ],
104- "port" : ["*_in " , "*_out " , "data* " , "port* " ],
105- "pin" : ["pin *" , "*/Q" , "* /D" , "*/CLK " ],
103+ "clock" : ["clk*" , "clk_gen " , "clock " , "clk1 " ],
104+ "port" : ["data* " , "*in " , "*out " , "valid_in " ],
105+ "pin" : ["u1/ *" , "*/Q" , "u2 /D" , "*/clk " ],
106106 "cell" : ["inst*" , "reg_*" , "*_buffer" ],
107107 "net" : ["net*" , "n[0-9]*" , "*_data" ]
108108 }
@@ -235,11 +235,11 @@ def generate_create_clock():
235235
236236def generate_get_ports ():
237237 '''
238- Optional: -filter, - regexp, -nocase(Legal only with -regexp), -quiet, -of_objects, patterns
238+ Optional: -regexp, -nocase(Legal only with -regexp), -quiet
239239 '''
240240 commands = [] #List containing all possible combinations of options
241241
242- optional_options = ["-filter" , "- regexp" , "-nocase" , "-quiet" , "-of_objects" , "patterns " ]
242+ optional_options = ["-regexp" , "-nocase" , "-quiet" ]
243243
244244 for i in range (len (optional_options ) + 1 ):
245245 for option_combination in combinations (optional_options , i ):
@@ -249,12 +249,6 @@ def generate_get_ports():
249249 continue
250250
251251 pieces = ["get_ports" ]
252-
253- if "-filter" in option_combination :
254- #FIXME: Random filter type
255- filter_type = choose_filter_type ()
256- expr = generate_filter (filter_type , "port" )
257- pieces .append (f"-filter { expr } " )
258252
259253 if "-regexp" in option_combination :
260254 pieces .append ("-regexp" )
@@ -264,30 +258,25 @@ def generate_get_ports():
264258
265259 if "-quiet" in option_combination :
266260 pieces .append ("-quiet" )
267-
268- if "-of_objects" in option_combination :
269- #FIXME: Do not make this random.
270- #The name of net or list of nets
271- net_list = random .choice (NETS )
272- pieces .append (f"-of_objects { net_list } " )
273261
274- if "patterns" in option_combination :
275- #FIXME: Do not make this random.
276- #A list of port name patterns
277- pattern = generate_pattern ("port" )
278- pieces .append (pattern )
279-
280- commands .append (" " .join (pieces ))
262+ #A list of port name patterns
263+ pattern = generate_pattern ("port" )
264+ pieces .append (pattern )
265+
266+ #Join the options to create a proper command
267+ pieces = " " .join (pieces )
268+ #Add create_clock prerequisites
269+ pieces = ("create_clock -period 10 -name clk [get_ports clk]\n " + pieces )
270+ commands .append (pieces )
281271
282272 return commands
283273
284274def generate_get_clocks ():
285275 '''
286- Required:
287- Optional: -filter, -regexp, -nocase(Legal only with -regexp), -quiet, patterns
276+ Optional: -regexp, -nocase(Legal only with -regexp), -quiet
288277 '''
289278 commands = [] #List containing all possible combinations of options
290- optional_options = ["-filter" , "- regexp" , "-nocase" , "-quiet" , "patterns " ]
279+ optional_options = ["-regexp" , "-nocase" , "-quiet" ]
291280
292281 for i in range (len (optional_options ) + 1 ):
293282 for option_combination in combinations (optional_options , i ):
@@ -298,12 +287,6 @@ def generate_get_clocks():
298287
299288 pieces = ["get_clocks" ]
300289
301- if "-filter" in option_combination :
302- #Filter expression with object type "clock"
303- filter_type = choose_filter_type ()
304- expr = generate_filter (filter_type , "clock" )
305- pieces .append (f"-filter { expr } " )
306-
307290 if "-regexp" in option_combination :
308291 pieces .append ("-regexp" )
309292
@@ -313,12 +296,18 @@ def generate_get_clocks():
313296 if "-quiet" in option_combination :
314297 pieces .append ("-quiet" )
315298
316- if "patterns" in option_combination :
317- #FIXME: Do not make this random.
318- pattern = generate_pattern ("clock" )
319- pieces .append (pattern )
320-
321- commands .append (" " .join (pieces ))
299+ pattern = generate_pattern ("clock" )
300+ pieces .append (pattern )
301+
302+ #Join the options to create a proper command
303+ pieces = " " .join (pieces )
304+ #Add create_clock prerequisites
305+ pieces = ("create_clock -period 10 -name clk1 [get_ports clk1]\n " +
306+ "create_clock -period 10 -name clk2 [get_ports clk2]\n " +
307+ "create_clock -period 10 -name clk_gen [get_ports clk_gen]\n " +
308+ "create_clock -period 10 -name clock [get_ports clock]\n " +
309+ pieces )
310+ commands .append (pieces )
322311
323312 return commands
324313
@@ -338,26 +327,8 @@ def generate_get_pins():
338327 if "-nocase" in option_combination and "-regexp" not in option_combination :
339328 continue #Skip this invalid combination
340329
341- #Constraint 2: -hierarchical cannot be used with -of_objects
342- if "-hierarchical" in option_combination and "-of_objects" in option_combination :
343- continue #Skip this invalid combination
344-
345330 pieces = ["get_pins" ]
346331
347- if "-hierarchical" in option_combination :
348- pieces .append ("-hierarchical" )
349-
350- if "-hsc" in option_combination :
351- #FIXME: Do not make this random.
352- separator = random .choice (SEPARATOR )
353- pieces .append (f"-hsc { separator } " )
354-
355- if "-filter" in option_combination :
356- #Filter expression with object type "pin"
357- filter_type = choose_filter_type ()
358- expr = generate_filter (filter_type , "pin" )
359- pieces .append (f"-filter { expr } " )
360-
361332 if "-regexp" in option_combination :
362333 pieces .append ("-regexp" )
363334
@@ -367,18 +338,15 @@ def generate_get_pins():
367338 if "-quiet" in option_combination :
368339 pieces .append ("-quiet" )
369340
370- if "-of_objects" in option_combination :
371- #FIXME: Do not make this random.
372- #The name or list of nets or instances.
373- net_inst_list = random .choice (NETS + INSTANCES )
374- pieces .append (f"-of_objects { net_inst_list } " )
375-
376- if "patterns" in option_combination :
377- #A list of pin name patterns
378- pattern = generate_pattern ("pin" )
379- pieces .append (pattern )
341+ pattern = generate_pattern ("pin" )
342+ pieces .append (pattern )
380343
381- commands .append (" " .join (pieces ))
344+
345+ #Join the options to create a proper command
346+ pieces = " " .join (pieces )
347+ #Add create_clock prerequisites
348+ pieces = ("create_clock -period 10 -name clk [get_ports clk]\n " + pieces )
349+ commands .append (pieces )
382350
383351 return commands
384352
0 commit comments