summaryrefslogtreecommitdiff
path: root/gui/gui.cc
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-21 18:55:26 -0400
committerbd <bdunahu@operationnull.com>2025-04-21 18:55:26 -0400
commitefc4ce2d15aeb54dccf9493c11de9bb8467033c1 (patch)
tree599082f31a76228cdff6c7180ea1a9082f027a39 /gui/gui.cc
parent812a0036787bea3833bdbf2684a706d4a7165cf1 (diff)
Untested multi-cache-view
Diffstat (limited to 'gui/gui.cc')
-rw-r--r--gui/gui.cc58
1 files changed, 39 insertions, 19 deletions
diff --git a/gui/gui.cc b/gui/gui.cc
index 30c4a07..496a443 100644
--- a/gui/gui.cc
+++ b/gui/gui.cc
@@ -49,8 +49,8 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent), ui(new Ui::GUI)
worker->moveToThread(&workerThread);
// find all the labels
- QList<DigitLabel*> labels = this->findChildren<DigitLabel*>();
- for (DigitLabel* label : labels) {
+ QList<DigitLabel *> labels = this->findChildren<DigitLabel *>();
+ for (DigitLabel *label : labels) {
connect(this, &GUI::hex_toggled, label, &DigitLabel::on_hex_toggle);
}
emit this->hex_toggled(this->is_hex);
@@ -68,11 +68,8 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent), ui(new Ui::GUI)
connect(worker, &Worker::wb_info, this, &GUI::onWorkerWriteBackInfo);
- // Display dram
- connect(worker, &Worker::dram_storage, this, &GUI::onWorkerShowDram);
-
// Display cache
- connect(worker, &Worker::cache_storage, this, &GUI::onWorkerShowCache);
+ connect(worker, &Worker::storage, this, &GUI::onWorkerShowStorage);
// Display registers
connect(
@@ -246,21 +243,16 @@ void GUI::onWorkerWriteBackInfo(const std::vector<int> info)
}
}
-void GUI::onWorkerShowDram(
- const std::vector<std::array<signed int, LINE_SIZE>> data)
-{
- displayTableHTML(ui->dram_table, data);
-}
-
-void GUI::onWorkerShowCache(
- const std::vector<std::array<signed int, LINE_SIZE>> data)
+void GUI::onWorkerShowStorage(
+ const std::vector<std::array<signed int, LINE_SIZE>> data, int i)
{
- displayTableHTML(ui->cache_table, data);
+ std::cout << this->tab_text_boxes.size() << std::endl;
+ displayTableHTML(this->tab_text_boxes.at(i), data);
}
void GUI::onWorkerShowRegisters(const std::array<int, GPR_NUM> &data)
{
- displayArrayHTML(ui->register_table, data);
+ displayArrayHTML(this->tab_text_boxes.at(0), data);
}
void GUI::onWorkerFinished() { qDebug() << "Worker has finished processing."; }
@@ -269,9 +261,9 @@ void GUI::on_upload_intructions_btn_clicked()
{
qDebug() << "Upload intructions button clicked.";
- // why register_table?
+ // why ui->register_table, or now ui->storage
QString filePath = QFileDialog::getOpenFileName(
- ui->register_table, "Open Binary File", QDir::homePath(),
+ ui->storage, "Open Binary File", QDir::homePath(),
"Binary Files (*.bin *.rv);;All Files (*.*)");
QFile file(filePath);
if (filePath.isEmpty() || !file.open(QIODevice::ReadOnly)) {
@@ -353,7 +345,7 @@ void GUI::on_config_clicked()
continue;
i = dwe->parse_valid_way(s);
- if (i != -1) {
+ if (i >= 0) {
ways.push_back((unsigned int)i);
} else {
this->set_status(get_bad_cache, "angry");
@@ -377,6 +369,34 @@ void GUI::on_config_clicked()
this->set_status(get_initialize, "happy");
emit sendConfigure(ways, this->p, is_pipelined);
+ make_tabs(2 + ways.size());
+}
+
+void GUI::make_tabs(int num)
+{
+ int i;
+ QStringList names;
+ QTextEdit *e;
+ QString n;
+
+ names = {"Registers", "DRAM"};
+
+ ui->storage->clear();
+ this->tab_text_boxes.clear();
+
+ for (i = 0; i < num; ++i) {
+ e = new QTextEdit();
+ e->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+
+ // make the name
+ if (i < names.size())
+ n = names[i];
+ else
+ n = QString("Level %1").arg(i - 1);
+
+ ui->storage->addTab(e, n);
+ this->tab_text_boxes.push_back(e);
+ }
}
void GUI::set_status(