13 const QString PyCodeProvider::gateCodePrefix =
"netlist.get_gate_by_id(%1)";
14 const QString PyCodeProvider::netCodePrefix =
"netlist.get_net_by_id(%1)";
15 const QString PyCodeProvider::moduleCodePrefix =
"netlist.get_module_by_id(%1)";
16 const QString PyCodeProvider::groupingCodePrefix =
"netlist.get_grouping_by_id(%1)";
25 return gateCodePrefix.
arg(gateId);
30 const QString suffix =
"get_id()";
32 return buildPyCode(gateCodePrefix, suffix, gateId);
37 const QString suffix =
"get_name()";
39 return buildPyCode(gateCodePrefix, suffix, gateId);
44 const QString suffix =
"get_type()";
46 return buildPyCode(gateCodePrefix, suffix, gateId);
66 const QString suffix =
".get_input_pins()";
73 const QString suffix =
".get_output_pins()";
80 const QString suffix =
QString(
"get_boolean_function(\"%1\")").
arg(booleanFunctionName);
82 return buildPyCode(gateCodePrefix, suffix, gateId);
91 QString pyString =
pyCodeGateType(gateId) +
".get_component(filter = lambda f: hal_py.%1.is_class_of(f)).get_async_set_reset_behavior()";
94 pyString = pyString.
arg(
"FFComponent");
96 pyString = pyString.
arg(
"LatchComponent");
106 return buildPyCode(gateCodePrefix, suffix, gateId);
111 return pyCodeGateType(gateId) +
".get_component(filter = hal_py.StateComponent.is_class_of)";
126 return pyCodeGateType(gateId) +
".get_component(filter = hal_py.FFComponent.is_class_of)";
136 return pyCodeFFComp(gateId) +
".get_next_state_function()";
141 return pyCodeFFComp(gateId) +
".get_async_set_function()";
146 return pyCodeFFComp(gateId) +
".get_async_reset_function()";
151 return pyCodeFFComp(gateId) +
".get_async_set_reset_behavior()";
156 return pyCodeGateType(gateId) +
".get_component(filter = hal_py.LatchComponent.is_class_of)";
186 const QString suffix =
"get_type().get_properties()";
188 return buildPyCode(gateCodePrefix, suffix, gateId);
193 const QString suffix =
"get_location()";
195 return buildPyCode(gateCodePrefix, suffix, gateId);
200 const QString suffix =
"get_module()";
202 return buildPyCode(gateCodePrefix, suffix, gateId);
209 return buildPyCode(gateCodePrefix, suffix, gateId);
216 return buildPyCode(gateCodePrefix, suffix, gateId);
221 return netCodePrefix.
arg(netId);
226 const QString suffix =
"get_id()";
228 return buildPyCode(netCodePrefix, suffix, netId);
233 const QString suffix =
"get_name()";
235 return buildPyCode(netCodePrefix, suffix, netId);
242 const QString check1 = prefix +
".is_global_input_net()";
243 const QString check2 = prefix +
".is_global_output_net()";
244 const QString check3 = prefix +
".is_unrouted()";
246 const QString result1 =
"\"Global Input\"";
247 const QString result2 =
"\"Global Output\"";
248 const QString result3 =
"\"Unrouted\"";
249 const QString result4 =
"\"Internal\"";
251 const QString pyCode = result1 +
" if " + check1 +
" else " + result2 +
" if " + check2 +
" else " + result3 +
" if " + check3 +
" else " + result4;
258 const QString suffix =
"get_sources()";
260 return buildPyCode(netCodePrefix, suffix, netId);
265 const QString suffix =
"get_destinations()";
267 return buildPyCode(netCodePrefix, suffix, netId);
274 return buildPyCode(netCodePrefix, suffix, netId);
280 return buildPyCode(netCodePrefix, suffix, netId);
285 return moduleCodePrefix.
arg(moduleId);
290 const QString suffix =
"get_id()";
292 return buildPyCode(moduleCodePrefix, suffix, moduleId);
297 const QString suffix =
"get_name()";
299 return buildPyCode(moduleCodePrefix, suffix, moduleId);
304 const QString suffix =
"get_type()";
306 return buildPyCode(moduleCodePrefix, suffix, moduleId);
312 const QString suffix =
"get_parent_module()";
314 return buildPyCode(moduleCodePrefix, suffix, moduleId);
319 const QString suffix =
"get_submodules()";
321 return buildPyCode(moduleCodePrefix, suffix, moduleId);
327 const QString suffix =
"get_gates(%2)";
333 const QString suffix =
"get_nets()";
335 return buildPyCode(moduleCodePrefix, suffix, moduleId);
340 const QString suffix =
"get_input_nets()";
342 return buildPyCode(moduleCodePrefix, suffix, moduleId);
347 const QString suffix =
"get_output_nets()";
349 return buildPyCode(moduleCodePrefix, suffix, moduleId);
354 const QString suffix =
"get_pins(lambda pin: pin.get_direction() == hal_py.PinDirection.input)";
356 return buildPyCode(moduleCodePrefix, suffix, moduleId);
361 const QString suffix =
"get_pins(lambda pin: pin.get_direction() == hal_py.PinDirection.output)";
363 return buildPyCode(moduleCodePrefix, suffix, moduleId);
368 const QString suffix =
"get_internal_nets()";
370 return buildPyCode(moduleCodePrefix, suffix, moduleId);
375 const QString suffix =
"is_top_module()";
377 return buildPyCode(moduleCodePrefix, suffix, moduleId);
384 return buildPyCode(moduleCodePrefix, suffix, moduleId);
390 return buildPyCode(moduleCodePrefix, suffix, moduleId);
397 return buildPyCode(moduleCodePrefix, suffix, moduleId);
402 const QString suffix =
"get_pin_groups()";
404 return buildPyCode(moduleCodePrefix, suffix, moduleId);
416 return buildPyCode(moduleCodePrefix, suffix, moduleId);
436 static QString suffix =
"get_pins()";
438 return buildPyCode(moduleCodePrefix, suffix, moduleId);
443 return groupingCodePrefix.
arg(groupingId);
450 return buildPyCode(groupingCodePrefix, suffix, groupingId);
457 return buildPyCode(groupingCodePrefix, suffix, groupingId);
GateType * get_type() const
T * get_component_as(const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const
Gate * get_gate_by_id(const u32 gate_id) const
static QString pyCodeModulePinDirection(u32 moduleId, u32 pinId)
static QString pyCodeModuleIsTopModule(u32 moduleId)
static QString pyCodeFFComp(u32 gateId)
static QString pyCodeGateLocation(u32 gateId)
static QString pyCodeGateTypePinDirection(u32 gateId, QString pin)
static QString pyCodeNetSources(u32 netId)
static QString pyCodeGrouping(u32 groupingId)
static QString pyCodeStateCompNegState(u32 gateId)
static QString pyCodeModulePinType(u32 moduleId, u32 pinId)
static QString pyCodeModuleType(u32 moduleId)
static QString pyCodeLatchCompAsyncSetFunc(u32 gateId)
static QString pyCodeStateCompPosState(u32 gateId)
static QString pyCodeLatchCompAsyncResetFunc(u32 gateId)
static QString pyCodeGateTypePinByName(u32 gateId, QString pin)
static QString pyCodeGateTypePinType(u32 gateId, QString pin)
static QString pyCodeModuleOutputNets(u32 moduleId)
static QString pyCodeLatchComp(u32 gateId)
static QString pyCodeGateInputPins(u32 gateId)
static QString pyCodeLatchCompEnableFunc(u32 gateId)
static QString pyCodeModule(u32 moduleId)
static QString pyCodeModuleInternalNets(u32 moduleId)
static QString pyCodeGateType(u32 gateId)
static QString pyCodeLatchCompDataInFunc(u32 gateId)
static QString pyCodeGateData(u32 gateId, QString category, QString key)
static QString pyCodeProperties(u32 gateId)
static QString pyCodeNet(u32 netId)
static QString pyCodeGateBooleanFunction(u32 gateId, QString booleanFunctionName)
static QString pyCodeGroupingName(u32 groupingId)
static QString pyCodeModuleInputNets(u32 moduleId)
static QString pyCodeModuleDataMap(u32 moduleId)
static QString pyCodeGate(u32 gateId)
static QString pyCodeModulePinGroup(u32 moduleId, u32 groupId)
static QString pyCodeGateModule(u32 gateId)
static QString pyCodeNetType(u32 netId)
static QString pyCodeModuleNets(u32 moduleId)
static QString pyCodeModulePins(u32 moduleId)
static QString pyCodeModulePinById(u32 moduleId, u32 pinId)
static QString pyCodeModulePinName(u32 moduleId, u32 pinId)
static QString pyCodeNetDataMap(u32 netId)
static QString pyCodeModuleInputPins(u32 moduleId)
static QString pyCodeStateComp(u32 gateId)
static QString pyCodeGroupingId(u32 groupingId)
static QString pyCodeNetId(u32 netId)
static QString pyCodeModuleModule(u32 moduleId)
static QString pyCodeFFCompSetResetBehav(u32 gateId)
static QString pyCodeFFCompAsyncSetFunc(u32 gateId)
static QString pyCodeModulePinGroupName(u32 moduleId, u32 groupId)
static QString pyCodeNetDestinations(u32 netId)
static QString pyCodeModuleOutputPins(u32 moduleId)
static QString pyCodeFFCompAsyncResetFunc(u32 gateId)
static QString pyCodeModuleId(u32 moduleId)
static QString pyCodeNetData(u32 netId, QString category, QString key)
static QString pyCodeModuleSubmodules(u32 moduleId)
static QString pyCodeModuleData(u32 moduleId, QString category, QString key)
static QString pyCodeModuleGates(u32 moduleId, bool recursively=false)
static QString pyCodeGateOutputPins(u32 gateId)
static QString pyCodeGateParameterValue(u32 gateId, QString name)
static QString pyCodeGateName(u32 gateId)
static QString pyCodeGateAsyncSetResetBehavior(u32 gateId)
static QString pyCodeGateId(u32 gateId)
static QString pyCodeFFCompNextStateFunc(u32 gateId)
static QString pyCodeModulePinGroups(u32 moduleId)
static QString pyCodeModuleName(u32 moduleId)
static QString pyCodeFFCompClockFunc(u32 gateId)
static QString pyCodeLatchCompSetResetBehav(u32 gateId)
static QString pyCodeGateDataMap(u32 gateId)
static QString pyCodeNetName(u32 netId)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString number(int n, int base)