14 #include <QGridLayout>
16 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
17 #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts
19 #define SKIP_EMPTY_PARTS QString::SkipEmptyParts
50 mGateLibrary = gateLibrary;
52 mPinModel =
new PinModel(
this,
true);
55 if (mGateType ==
nullptr)
71 ramportPage->
setData(mGateType);
92 std::set<GateTypeProperty> properties_set;
95 properties_set.insert(prop);
104 std::vector<GatePin*> gatepins;
105 for (
auto it : pingroup->getChildren())
113 gatepins.push_back(res.get());
119 mGateType->
create_pin_group(pingroup->getName().toStdString(), gatepins, pingroup->getDirection(), pingroup->getPinType());
134 std::vector<GatePin*> gatepins;
135 for (
auto it : pingroup->getChildren())
143 gatepins.push_back(res.get());
149 mNewGateType->
create_pin_group(pingroup->getName().toStdString(), gatepins, pingroup->getDirection(), pingroup->getPinType());
165 void GateLibraryWizard::handleWasEdited()
204 std::unique_ptr<GateTypeComponent> parentComponent;
211 std::vector<std::string> input_pin_names;
213 input_pin_names.push_back(pi->getName().toStdString());
214 std::unordered_map<std::string, LUTComponent::LUTOutputConfig> lut_configs;
217 lut_configs.emplace(entry.pinName.toStdString(),
224 std::vector<std::string> identifiers;
227 identifiers.push_back(
id.toStdString());
229 std::unique_ptr<GateTypeComponent> init_component =
InitComponent::create(initPage->mCategory->
text().toStdString(), identifiers);
230 std::unique_ptr<GateTypeComponent> state_component =
231 StateComponent::create(std::move(init_component), statePage->mStateIdentifier->
text().toStdString(), statePage->mNegStateIdentifier->
text().toStdString());
238 if (next_state_res.is_ok())
240 next_state_bf = next_state_res.get();
242 if (clock_bf_res.is_ok())
244 clock_bf = clock_bf_res.get();
247 std::unique_ptr<GateTypeComponent> component =
FFComponent::create(std::move(state_component), next_state_bf, clock_bf);
252 if (async_reset_res.is_ok())
254 async_reset = async_reset_res.get();
260 if (async_set_res.is_ok())
262 async_set = async_set_res.get();
269 parentComponent = std::move(component);
273 std::unique_ptr<GateTypeComponent> state_component =
281 if (data_in_res.is_ok())
285 if (enable_res.is_ok())
292 if (async_reset_res.is_ok())
294 async_reset = async_reset_res.get();
300 if (async_set_res.is_ok())
302 async_set = async_set_res.get();
310 parentComponent = std::move(component);
314 std::unique_ptr<GateTypeComponent> sub_component =
nullptr;
315 std::vector<std::string> identifiers;
318 identifiers.push_back(
id.toStdString());
325 if (clocked_on_res.is_ok())
327 clocked_on_bf = clocked_on_res.get();
332 if (enabled_on_res.is_ok())
334 enabled_on_bf = enabled_on_res.get();
338 std::move(sub_component), rpEdit.dataGroup->text().toStdString(), rpEdit.addressGroup->text().toStdString(), clocked_on_bf, enabled_on_bf, rpEdit.isWritePort->isChecked());
343 return std::move(parentComponent);
std::unordered_map< std::string, BooleanFunction > getBoolFunctions()
void setData(GateType *gate)
static Result< BooleanFunction > from_string(const std::string &expression)
void set_async_set_reset_behavior(const AsyncSetResetBehavior behav_state, const AsyncSetResetBehavior behav_neg_state)
void set_async_set_function(const BooleanFunction &async_set_bf)
static std::unique_ptr< FFComponent > create(std::unique_ptr< GateTypeComponent > component, const BooleanFunction &next_state_bf, const BooleanFunction &clock_bf)
void set_async_reset_function(const BooleanFunction &async_reset_bf)
void setData(GateType *gate)
GateType * replace_gate_type(u32 id, const std::string &name, std::set< GateTypeProperty > properties={GateTypeProperty::combinational}, std::unique_ptr< GateTypeComponent > component=nullptr)
GateType * create_gate_type(const std::string &name, std::set< GateTypeProperty > properties={GateTypeProperty::combinational}, std::unique_ptr< GateTypeComponent > component=nullptr)
friend class RAMPortWizardPage
bool isDefinedByLut(const PinItem *pin) const
bool requiresBooleanFunctions() const
friend class PinsWizardPage
friend class BoolWizardPage
void triggerUnsavedChanges()
int nextId() const override
QList< PinItem * > getPingroups()
friend class LatchWizardPage
friend class StateWizardPage
GateType * getRecentCreatedGate()
friend class FlipFlopWizardPage
std::unique_ptr< GateTypeComponent > setComponents()
friend class InitWizardPage
GateLibraryWizard(GateLibrary *gateLibrary, GateType *gateType=nullptr, QWidget *parent=nullptr)
friend class LUTWizardPage
friend class GeneralInfoWizardPage
Result< GatePin * > create_pin(const u32 id, const std::string &name, PinDirection direction, PinType type=PinType::none, bool create_group=true)
std::vector< GateTypeProperty > get_property_list() const
const std::string & get_name() const
Result< PinGroup< GatePin > * > create_pin_group(const u32 id, const std::string &name, const std::vector< GatePin * > pins={}, PinDirection direction=PinDirection::none, PinType type=PinType::none, bool ascending=true, i32 start_index=0, bool delete_empty_groups=true)
void add_boolean_functions(const std::unordered_map< std::string, BooleanFunction > &functions)
QList< GateTypeProperty > getProperties() const
void setData(QString name, const std::vector< GateTypeProperty > &properties)
static std::unique_ptr< InitComponent > create(const std::string &init_category, const std::vector< std::string > &init_identifiers)
void setData(GateType *gate)
static std::unique_ptr< LUTComponent > create(std::unordered_map< std::string, LUTOutputConfig > configs={})
void setData(GateType *gate)
QVector< OutputPinEntry > getOutputPinConfigs() const
void set_async_reset_function(const BooleanFunction &async_reset_bf)
void set_async_set_reset_behavior(AsyncSetResetBehavior behav_state, AsyncSetResetBehavior behav_neg_state)
void set_enable_function(const BooleanFunction &enable_bf)
void set_async_set_function(const BooleanFunction &async_set_bf)
void set_data_in_function(const BooleanFunction &data_in_bf)
static std::unique_ptr< LatchComponent > create(std::unique_ptr< GateTypeComponent > component)
void setData(GateType *gate)
PinDirection getDirection() const
TreeItemType getItemType() const
PinType getPinType() const
QList< PinItem * > getInputPins()
QList< PinItem * > getOutputPins()
QList< PinItem * > getPinGroups() const
static std::unique_ptr< RAMComponent > create(std::unique_ptr< GateTypeComponent > component, const u32 bit_size, const std::vector< std::string > &init_identifiers={})
static std::unique_ptr< RAMPortComponent > create(std::unique_ptr< GateTypeComponent > component, const std::string &data_group, const std::string &addr_group, const BooleanFunction &clock_bf, const BooleanFunction &enable_bf, bool is_write)
QList< RAMPort > getRamPorts()
void setData(GateType *gate)
void setData(GateType *gate)
static std::unique_ptr< StateComponent > create(std::unique_ptr< GateTypeComponent > component, const std::string &state_identifier, const std::string &neg_state_identifier)
void setData(GateType *gate)
FileStatusManager * gFileStatusManager
bool contains(const T &value) const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QStringList split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
QString fromStdString(const std::string &str)
std::string toStdString() const const
QString toPlainText() const const
void setButtonText(QWizard::WizardButton which, const QString &text)
void setPage(int id, QWizardPage *page)