aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/coreview/multiplexer.h
blob: 2cfc90d87ce869ebeaa90c6aa4f0383548aee111 (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
#ifndef COREVIEW_MULTIPLEXER_H
#define COREVIEW_MULTIPLEXER_H

#include <QGraphicsItem>
#include "qtmipsexception.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 (indexing from  1 where 0 is no line)
    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;
};

}

#endif // COREVIEW_MULTIPLEXER_H