diff options
author | bd <bdunahu@operationnull.com> | 2025-04-19 03:37:43 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-19 03:37:43 -0400 |
commit | bb3d940fb4ce0dd3efc56b934a7b4ea8ffab4b13 (patch) | |
tree | 857e9ee14530e4492c6e6f612bce227a3197fd48 /gui/gui.h | |
parent | 327ba8b631436cf21866c05c6c7cae239fe54a5c (diff) |
GUI validate program
Diffstat (limited to 'gui/gui.h')
-rw-r--r-- | gui/gui.h | 27 |
1 files changed, 19 insertions, 8 deletions
@@ -5,8 +5,8 @@ #include <QFile> #include <QFileDialog> #include <QInputDialog> +#include <QLabel> #include <QMainWindow> -#include <QMessageBox> #include <QTextEdit> #include <QTextStream> #include <QThread> @@ -42,6 +42,7 @@ class GUI : public QMainWindow void sendRefreshCache(); void sendRefreshRegisters(); void sendRunSteps(int steps); + void sendConfigure(std::vector<unsigned int> ways, bool is_pipelined); private slots: void onWorkerClockCycles(int value, int pc); @@ -77,10 +78,23 @@ class GUI : public QMainWindow void on_save_program_state_btn_clicked(); + /** + * Validates that the user has provided a valid program and cache. + * If so, `this->ready' is set and the user options are passed to the + * worker. + * If not, rudely complains. + */ + void on_config_clicked(); + private: Ui::GUI *ui; /** + * Indicates if the program has been initialized. + */ + bool ready; + + /** * The message displayed on the status bar. */ QLabel *status_label; @@ -91,21 +105,19 @@ class GUI : public QMainWindow std::vector<signed int> p; /** - * The current cache configurations. + * If this stage is pipelined or not. */ - std::vector<unsigned int> c; + bool is_pipelined = false; /** - * If this stage is pipelined or not. + * The possible step slider values. */ - bool is_pipelined = false; + QVector<int> step_values = {1, 5, 20, 50, 250, 1000, 10000}; QThread workerThread; Worker *worker; - QVector<int> step_values = {1, 5, 20, 50, 250, 1000, 10000}; - const std::map<Mnemonic, QString> mnemonicNameMap = { {Mnemonic::ADD, "ADD"}, {Mnemonic::SUB, "SUB"}, {Mnemonic::MUL, "MUL"}, {Mnemonic::QUOT, "QUOT"}, @@ -132,6 +144,5 @@ class GUI : public QMainWindow auto it = mnemonicNameMap.find(mnemonic); return (it != mnemonicNameMap.end()) ? it->second : "Unknown"; } - }; #endif // GUI_H |