From 95956a7457a1237385a314212c4e106bed88f05d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 17 Apr 2018 12:44:44 +0200 Subject: Initial implementation of cache view It needs some more work to look nice but it already works. --- qtmips_gui/cacheview.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 qtmips_gui/cacheview.h (limited to 'qtmips_gui/cacheview.h') diff --git a/qtmips_gui/cacheview.h b/qtmips_gui/cacheview.h new file mode 100644 index 0000000..1fb224f --- /dev/null +++ b/qtmips_gui/cacheview.h @@ -0,0 +1,39 @@ +#ifndef CACHEVIEW_H +#define CACHEVIEW_H + +#include +#include +#include +#include "graphicsview.h" +#include "qtmipsmachine.h" + +class CacheViewBlock : public QGraphicsObject { + Q_OBJECT +public: + CacheViewBlock(const machine::Cache *cache, unsigned block); + ~CacheViewBlock(); + + QRectF boundingRect() const; + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + +private slots: + void cache_update(unsigned associat, unsigned set, bool valid, bool dirty, std::uint32_t tag, const std::uint32_t *data); + +private: + unsigned block; + unsigned rows, columns; + QGraphicsSimpleTextItem **validity, **dirty, **tag, ***data; +}; + +class CacheViewScene : public QGraphicsScene { + Q_OBJECT +public: + CacheViewScene(const machine::Cache *cache); + +private: + unsigned associativity; + CacheViewBlock **block; +}; + +#endif // CACHEVIEW_H -- cgit v1.2.3