Skip to content

Commit

Permalink
Add ISA extension descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mortbopet committed Nov 16, 2021
1 parent 3694cbd commit fe4b16e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For bugs or issues, please report these at the [issues page](https://github.com/

## Usage
Ripes may be used to explore concepts such as:
- How machine code is executed on a variety of microarchitectures (RV32IM/RV64IM based)
- How machine code is executed on a variety of microarchitectures (RV32IMC/RV64IMC based)
- How different cache designs influence performance
- How C and assembly code is compiled and assembled to executable machine code
- How a processor interacts with memory-mapped I/O
Expand Down
13 changes: 13 additions & 0 deletions src/STLExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,19 @@ template <typename R, typename OutputIt, typename UnaryFunction>
OutputIt transform(R&& Range, OutputIt d_first, UnaryFunction F) {
return std::transform(adl_begin(Range), adl_end(Range), d_first, F);
}

/// Provide wrappers to std::find_if which take ranges instead of having to pass
/// begin/end explicitly.
template <typename R, typename UnaryPredicate>
auto find_if(R&& Range, UnaryPredicate P) {
return std::find_if(adl_begin(Range), adl_end(Range), P);
}

template <typename R, typename UnaryPredicate>
auto find_if_not(R&& Range, UnaryPredicate P) {
return std::find_if_not(adl_begin(Range), adl_end(Range), P);
}

} // namespace llvm

#endif // LLVM_ADT_STLEXTRAS_H
1 change: 1 addition & 0 deletions src/isa/isainfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class ISAInfoBase {
virtual const QStringList& enabledExtensions() const = 0;
bool extensionEnabled(const QString& ext) const { return enabledExtensions().contains(ext); }
bool supportsExtension(const QString& ext) const { return supportedExtensions().contains(ext); }
virtual QString extensionDescription(const QString& ext) const = 0;

/**
* ISA equality is defined as a separate function rather than the == operator, given that we might need to check for
Expand Down
7 changes: 7 additions & 0 deletions src/isa/rvisainfo_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ class RVISAInfoBase : public ISAInfoBase {

const QStringList& supportedExtensions() const override { return m_supportedExtensions; }
const QStringList& enabledExtensions() const override { return m_enabledExtensions; }
QString extensionDescription(const QString& ext) const override {
if (ext == "M")
return "Integer multiplication and division";
if (ext == "C")
return "Compressed instructions";
Q_UNREACHABLE();
}

protected:
QStringList m_enabledExtensions;
Expand Down
6 changes: 4 additions & 2 deletions src/processorselectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ void ProcessorSelectionDialog::selectionChanged(QTreeWidgetItem* current, QTreeW

const ProcessorID id = qvariant_cast<ProcessorID>(current->data(ProcessorColumn, Qt::UserRole));
const auto& desc = ProcessorRegistry::getAvailableProcessors().at(id);
auto isaInfo = desc->isaInfo();

// Update information widgets with the current processor info
m_selectedID = id;
m_ui->name->setText(desc->name);
m_ui->ISA->setText(desc->isaInfo().isa->name());
m_ui->ISA->setText(isaInfo.isa->name());
m_ui->description->setPlainText(desc->description);
m_ui->regInitWidget->processorSelectionChanged(id);

Expand All @@ -140,8 +141,9 @@ void ProcessorSelectionDialog::selectionChanged(QTreeWidgetItem* current, QTreeW
delete item;
}

for (const auto& ext : desc->isaInfo().supportedExtensions) {
for (const auto& ext : isaInfo.supportedExtensions) {
auto chkbox = new QCheckBox(ext);
chkbox->setToolTip(isaInfo.isa->extensionDescription(ext));
m_ui->extensions->addWidget(chkbox);
if (m_selectedExtensionsForID[desc->id].contains(ext)) {
chkbox->setChecked(true);
Expand Down

0 comments on commit fe4b16e

Please sign in to comment.