10 #include <QGridLayout>
12 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
13 #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts
15 #define SKIP_EMPTY_PARTS QString::SkipEmptyParts
46 mGateLibrary = gateLibrary;
48 mPinModel =
new PinModel(
this,
true);
51 if(mGateType ==
nullptr)
67 ramportPage->
setData(mGateType);
88 std::set<GateTypeProperty> properties_set;
90 properties_set.insert(prop);
98 std::vector<GatePin*> gatepins;
99 for (
auto it : pingroup->getChildren()) {
104 if(res.is_ok()) gatepins.push_back(res.get());
108 mGateType->
create_pin_group(pingroup->getName().toStdString(), gatepins, pingroup->getDirection(), pingroup->getPinType());
122 std::vector<GatePin*> gatepins;
123 for (
auto it : pingroup->getChildren()) {
128 if(res.is_ok()) gatepins.push_back(res.get());
132 mNewGateType->
create_pin_group(pingroup->getName().toStdString(), gatepins, pingroup->getDirection(), pingroup->getPinType());
144 void GateLibraryWizard::handleWasEdited()
161 std::unique_ptr<GateTypeComponent> parentComponent;
167 std::vector<std::string> identifiers;
169 identifiers.push_back(
id.toStdString());
176 std::vector<std::string> identifiers;
178 identifiers.push_back(
id.toStdString());
182 statePage->mStateIdentifier->
text().toStdString(),
183 statePage->mNegStateIdentifier->
text().toStdString());
190 if(next_state_res.is_ok()) next_state_bf = next_state_res.get();
191 if(clock_bf_res.is_ok()) clock_bf = clock_bf_res.get();
200 if(async_reset_res.is_ok()) async_reset = async_reset_res.get();
205 if(async_set_res.is_ok()) async_set = async_set_res.get();
211 parentComponent = std::move(component);
216 statePage->mStateIdentifier->
text().toStdString(),
217 statePage->mNegStateIdentifier->
text().toStdString());
229 if(async_reset_res.is_ok()) async_reset = async_reset_res.get();
234 if(async_set_res.is_ok()) async_set = async_set_res.get();
241 parentComponent = std::move(component);
245 std::unique_ptr<GateTypeComponent> sub_component =
nullptr;
246 std::vector<std::string> identifiers;
248 identifiers.push_back(
id.toStdString());
254 if(clocked_on_res.is_ok()) clocked_on_bf = clocked_on_res.get();
258 if(enabled_on_res.is_ok()) enabled_on_bf = enabled_on_res.get();
261 std::move(sub_component),
262 rpEdit.dataGroup->text().toStdString(),
263 rpEdit.addressGroup->text().toStdString(),
266 rpEdit.isWritePort->isChecked());
271 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)
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
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 GeneralInfoWizardPage
static std::unique_ptr< GateTypeComponent > create_state_component(std::unique_ptr< GateTypeComponent > component, const std::string &state_identifier, const std::string &neg_state_identifier)
static std::unique_ptr< GateTypeComponent > create_lut_component(std::unique_ptr< GateTypeComponent > component, bool init_ascending)
static std::unique_ptr< GateTypeComponent > create_init_component(const std::string &init_category, const std::vector< std::string > &init_identifiers)
static std::unique_ptr< GateTypeComponent > create_latch_component(std::unique_ptr< GateTypeComponent > component)
static std::unique_ptr< GateTypeComponent > create_ram_component(std::unique_ptr< GateTypeComponent > component, const u32 bit_size)
static std::unique_ptr< GateTypeComponent > create_ff_component(std::unique_ptr< GateTypeComponent > component, const BooleanFunction &next_state_bf, const BooleanFunction &clock_bf)
static std::unique_ptr< GateTypeComponent > create_ram_port_component(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)
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)
void setData(GateType *gate)
void setData(GateType *gate)
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)
void setData(GateType *gate)
PinDirection getDirection() const
TreeItemType getItemType() const
PinType getPinType() const
QList< PinItem * > getPinGroups() const
QList< RAMPort > getRamPorts()
void setData(GateType *gate)
void setData(GateType *gate)
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)