blob: c732687d360fb38a691221b5358de7006141b15a (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#include "memory.h"
using namespace coreview;
//////////////////////
#define WIDTH 80
#define HEIGHT 100
#define PENW 1
//////////////////////
Memory::Memory(machine::QtMipsMachine *machine) : QGraphicsObject(nullptr) {
#define CON_INIT(X) do { \
X.in = new Connector(); \
X.out = new Connector(); \
X.read = new Connector(); \
X.write = new Connector(); \
} while(false)
CON_INIT(con_program);
CON_INIT(con_data);
#undef CON_INIT
// TODO cache?
}
QRectF Memory::boundingRect() const {
// TODO
}
void Memory::paint(QPainter *painter, const QStyleOptionGraphicsItem *option __attribute__((unused)), QWidget *widget __attribute__((unused))) {
// TODO
}
void Memory::setPos(qreal x, qreal y) {
QGraphicsObject::setPos(x, y);
// TODO con
}
const Connector *Memory::connector_in(bool program) const {
if (program)
return con_program.in;
else
return con_data.in;
}
const Connector *Memory::connector_out(bool program) const {
if (program)
return con_program.out;
else
return con_data.out;
}
const Connector *Memory::connector_read(bool program) const {
if (program)
return con_program.read;
else
return con_data.read;
}
const Connector *Memory::connector_write(bool program) const {
if (program)
return con_program.write;
else
return con_data.write;
}
|