Fit processor to view when selecting a new processor
MODIFY
external/VSRTL
external/VSRTL
-Subproject commit 91d4203a869a4f8e316e3c925b3ede5052b3ff2e
+Subproject commit 14f35d1dabdfc23e68e997c53c2545216f4dbdeb

MODIFY
src/mainwindow.cpp
src/mainwindow.cpp
@@ -58,7 +58,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), m_ui(new Ui::Main
m_ui->tabbar->addFancyTab(QIcon(":/icons/cpu.svg"), "Processor");
m_ui->tabbar->addFancyTab(QIcon(":/icons/ram-memory.svg"), "Memory");
connect(m_ui->tabbar, &FancyTabBar::activeIndexChanged, m_stackedTabs, &QStackedWidget::setCurrentIndex);
- m_ui->tabbar->setActiveIndex(0);
+ m_ui->tabbar->setActiveIndex(1);
setupMenus();
@@ -78,6 +78,13 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), m_ui(new Ui::Main
connect(m_ui->actionOpen_wiki, &QAction::triggered, this, &MainWindow::wiki);
connect(m_ui->actionVersion, &QAction::triggered, this, &MainWindow::version);
+
+ // fitToView performs unexpectetly if the eventloop has not been processed (presumably this has something to do with
+ // the visibility state of the VSRTLView within the VSRTL widget. Whilst not pretty, it has been found that updating
+ // the entire Ripes widget and processing all events will result in correct fitting.
+ update();
+ QCoreApplication::processEvents();
+ m_processorTab->fitToView();
}
void MainWindow::setupMenus() {

MODIFY
src/processortab.cpp
src/processortab.cpp
@@ -195,6 +195,10 @@ void ProcessorTab::pause() {
m_reverseAction->setEnabled(m_vsrtlWidget->isReversible());
}
+void ProcessorTab::fitToView() {
+ m_vsrtlWidget->zoomToFit();
+}
+
void ProcessorTab::loadProcessorToWidget(const Layout& layout) {
ProcessorHandler::get()->loadProcessorToWidget(m_vsrtlWidget);
@@ -209,6 +213,7 @@ void ProcessorTab::loadProcessorToWidget(const Layout& layout) {
}
loadLayout(layout);
updateInstructionLabels();
+ fitToView();
}
void ProcessorTab::processorSelection() {
@@ -217,6 +222,7 @@ void ProcessorTab::processorSelection() {
if (diag.exec()) {
// New processor model was selected
m_vsrtlWidget->clearDesign();
+ m_stageInstructionLabels.clear();
ProcessorHandler::get()->selectProcessor(diag.getSelectedId(), diag.getRegisterInitialization());
loadProcessorToWidget(diag.getSelectedLayout());
m_vsrtlWidget->reset();

MODIFY
src/processortab.h
src/processortab.h
@@ -49,6 +49,7 @@ public slots:
void runFinished();
void updateStatistics();
void updateInstructionLabels();
+ void fitToView();
void processorSelection();

Fit processor to view when selecting a new processor