@@ -195,13 +195,38 @@ void Greenpak4NetlistModule::AddWireAttribute(string target, string name, string
195
195
// Find the cell that drove the wire and tag it
196
196
auto net = m_nets[target];
197
197
auto driver = net->m_driver ;
198
+ if (driver.m_cell != NULL )
199
+ {
200
+ LogDebug (" Wire is driven by cell %s, constraining that instead\n " , driver.m_cell ->m_name .c_str ());
201
+ driver.m_cell ->m_attributes [name] = value;
202
+ return ;
203
+ }
204
+
205
+ // If the wire is undriven, maybe it's a top-level input! Should be driving a single GP_I[O]BUF cell
206
+ if (net->m_nodeports .size () != 1 )
207
+ {
208
+ LogWarning (" Couldn't constrain object \" %s\" because it has no driver and more than one load\n " , target.c_str ());
209
+ return ;
210
+ }
211
+ driver = net->m_nodeports [0 ];
198
212
if (driver.m_cell == NULL )
199
213
{
200
- LogWarning (" Couldn't constrain object \" %s\" because it has no driver\n " , target.c_str ());
214
+ LogWarning (" Couldn't constrain object \" %s\" because it has no driver and no loads \n " , target.c_str ());
201
215
return ;
202
216
}
203
- LogDebug (" Wire is driven by cell %s, constraining that instead\n " , driver.m_cell ->m_name .c_str ());
204
- driver.m_cell ->m_attributes [name] = value;
217
+
218
+ if ( (driver.m_portname == " IN" ) && (driver.m_cell ->m_type == " GP_IBUF" ) )
219
+ {
220
+ LogDebug (" Wire drives input buffer %s, constraining that instead\n " , driver.m_cell ->m_name .c_str ());
221
+ driver.m_cell ->m_attributes [name] = value;
222
+ }
223
+ else if ( (driver.m_portname == " IO" ) && (driver.m_cell ->m_type == " GP_IOBUF" ) )
224
+ {
225
+ LogDebug (" Wire drives input/output buffer %s, constraining that instead\n " , driver.m_cell ->m_name .c_str ());
226
+ driver.m_cell ->m_attributes [name] = value;
227
+ }
228
+ else
229
+ LogWarning (" Couldn't constrain object \" %s\" because it has no driver and does not drive a GP_I[O]BUF\n " , target.c_str ());
205
230
}
206
231
207
232
void Greenpak4NetlistModule::LoadAttributes (json_object* object)
0 commit comments