aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/coreview/multiplexer.h
blob: 16378fe6f40534f4b38af4bf69d3429af20f187d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef COREVIEW_MULTIPLEXER_H
#define COREVIEW_MULTIPLEXER_H

#include <QGraphicsItem>
#include "qtmipsexception.h"
#include "../coreview.h"
#include "connection.h"

namespace coreview {

class Multiplexer : public QGraphicsItem {
public:
    Multiplexer(unsigned size);
    ~Multiplexer();

    QRectF boundingRect() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

    void setPos(qreal x, qreal y);
    const Connector *connector_ctl() const; // Control input
    const Connector *connector_out() const; // Output
    const Connector *connector_in(unsigned i) const; // Inputs

    void set(unsigned i); // Set what value should be set as connected
    void setCtl(bool up); // Set if control signal is from up or down (in default down)

private:
    bool ctlfrom;
    unsigned size, seton;
    Connector *con_ctl, *con_out, **con_in;
};

}

#else

namespace coreview {
    class Multiplexer;
}

#endif // COREVIEW_MULTIPLEXER_H