@@ -194,16 +194,41 @@ void InferExtraNodes(
194
194
auto vdd = top->GetNet (" GP_VDD" );
195
195
auto vddn = device->GetPowerRail (true )->GetPARNode ();
196
196
197
- // Look for IOBs driven by GP_VREF cells
197
+ // Look for DACs driven by counters and infer DCMP if one isn't already there
198
198
Greenpak4NetlistModule* module = netlist->GetTopModule ();
199
199
for (auto it = module->cell_begin (); it != module->cell_end (); it ++)
200
+ {
201
+ // Skip anything but DACs
202
+ Greenpak4NetlistCell* cell = it->second ;
203
+ if (cell->m_type != " GP_DAC" )
204
+ continue ;
205
+
206
+ // If we're driven by a power rail, skip it - input is constant
207
+ if (cell->m_connections .find (" DIN" ) == cell->m_connections .end ())
208
+ continue ;
209
+ auto net = cell->m_connections [" DIN" ][0 ];
210
+ auto driver = net->m_driver ;
211
+ if (driver.IsNull ())
212
+ continue ;
213
+ if (driver.m_cell ->IsPowerRail () )
214
+ continue ;
215
+ Greenpak4NetlistCell* netsrc = driver.m_cell ;
216
+
217
+ // We found the source of the net!
218
+ LogVerbose (" Found a DAC not driven by a power rail\n " );
219
+ }
220
+
221
+ // Look for IOBs driven by GP_VREF cells
222
+ for (auto it = module->cell_begin (); it != module->cell_end (); it ++)
200
223
{
201
224
// See if we're an IOB
202
225
Greenpak4NetlistCell* cell = it->second ;
203
226
if (!cell->IsIOB ())
204
227
continue ;
205
228
206
229
// See if we're driven by a GP_VREF
230
+ if (cell->m_connections .find (" IN" ) == cell->m_connections .end ())
231
+ continue ;
207
232
auto net = cell->m_connections [" IN" ][0 ];
208
233
auto driver = net->m_driver ;
209
234
if (driver.IsNull ())
@@ -298,6 +323,8 @@ void InferExtraNodes(
298
323
// LogDebug("vref %s\n", cell->m_name.c_str());
299
324
300
325
// See what we drive
326
+ if (cell->m_connections .find (" VOUT" ) == cell->m_connections .end ())
327
+ continue ;
301
328
auto net = cell->m_connections [" VOUT" ][0 ];
302
329
bool found_target = false ;
303
330
for (int i=net->m_nodeports .size ()-1 ; i>=0 ; i--)
0 commit comments