@@ -29,6 +29,10 @@ class Vpr(Edatool):
29
29
"type" : "str" ,
30
30
"desc" : "Path to target architecture in XML format" ,
31
31
},
32
+ "gen_constraints" : {
33
+ "type" : "list" ,
34
+ "desc" : "A list to be used for inserting two commands between the pack and place step" ,
35
+ },
32
36
"vpr_options" : {
33
37
"type" : "str" ,
34
38
"desc" : "Additional options for VPR." ,
@@ -67,16 +71,21 @@ def configure(self, edam):
67
71
"""
68
72
super ().configure (edam )
69
73
70
- src_files = []
71
- incdirs = set ()
72
-
73
- file_netlist = []
74
+ netlist_file = ""
74
75
timing_constraints = []
75
76
76
- for f in src_files :
77
- if f .file_type in ["blif" , "eblif" ]:
78
- file_netlist .append (f .name )
79
- if f .file_type in ["SDC" ]:
77
+ for f in self .files :
78
+ file_type = f .get ("file_type" , "" )
79
+
80
+ if file_type in ["blif" , "eblif" ]:
81
+ if netlist_file :
82
+ raise RuntimeError (
83
+ "VPR only supports one netlist file. Found {} and {}" .format (
84
+ netlist_file , f ["name" ]
85
+ )
86
+ )
87
+ netlist_file = f ["name" ]
88
+ if file_type in ["SDC" ]:
80
89
timing_constraints .append (f .name )
81
90
82
91
arch_xml = self .tool_options .get ("arch_xml" )
@@ -90,27 +99,59 @@ def configure(self, edam):
90
99
91
100
commands = EdaCommands ()
92
101
93
- depends = self . name + ".blif"
102
+ depends = netlist_file
94
103
targets = self .name + ".net"
95
- command = ["vpr" , arch_xml , self . name + ".blif" , "--pack" ]
104
+ command = ["vpr" , arch_xml , netlist_file , "--pack" ]
96
105
command += sdc_opts + vpr_options
97
106
commands .add (command , [targets ], [depends ])
98
107
99
- depends = self .name + ".net"
108
+ # First, check if gen_constraint value list is passed in and is the correct size
109
+ gen_constr_list = []
110
+ if (
111
+ self .tool_options .get ("gen_constraints" )
112
+ and len (self .tool_options .get ("gen_constraints" )) == 4
113
+ ):
114
+ gen_constr_list = self .tool_options .get ("gen_constraints" )
115
+
116
+ # Run generate constraints scripts if correct list exists
117
+ if gen_constr_list :
118
+ depends = self .name + ".net"
119
+ targets = gen_constr_list [0 ]
120
+ commands .add (
121
+ ["python3" , gen_constr_list [2 ]],
122
+ [targets ],
123
+ [depends ],
124
+ )
125
+
126
+ depends = gen_constr_list [0 ]
127
+ targets = gen_constr_list [1 ]
128
+ commands .add (
129
+ ["python3" , gen_constr_list [3 ]],
130
+ [targets ],
131
+ [depends ],
132
+ )
133
+
100
134
targets = self .name + ".place"
101
- command = ["vpr" , arch_xml , self .name + ".blif" , "--place" ]
135
+ command = ["vpr" , arch_xml , netlist_file ]
136
+ # Modify place stage if running generate constraints script
137
+ if gen_constr_list :
138
+ depends = gen_constr_list [1 ]
139
+ command += [f"--fix_clusters { gen_constr_list [1 ]} " ]
140
+ else :
141
+ depends = self .name + ".net"
142
+ command += ["--place" ]
102
143
command += sdc_opts + vpr_options
103
144
commands .add (command , [targets ], [depends ])
104
145
105
146
depends = self .name + ".place"
106
147
targets = self .name + ".route"
107
- command = ["vpr" , arch_xml , self . name + ".blif" , "--route" ]
148
+ command = ["vpr" , arch_xml , netlist_file , "--route" ]
108
149
command += sdc_opts + vpr_options
109
150
commands .add (command , [targets ], [depends ])
110
151
111
152
depends = self .name + ".route"
112
153
targets = self .name + ".analysis"
113
- command = ["vpr" , arch_xml , self . name + ".blif" , "--analysis" ]
154
+ command = ["vpr" , arch_xml , netlist_file , "--analysis" ]
114
155
command += sdc_opts + vpr_options
115
156
commands .add (command , [targets ], [depends ])
116
157
0 commit comments