aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/coreview/multiplexer.h
blob: 6aa11a6d8b637486dad5206460111af9045a1b23 (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 MULTIPLEXER_H
#define 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 // MULTIPLEXER_H