aboutsummaryrefslogtreecommitdiff
path: root/qtmips_cli/tracer.h
blob: 913687ca45872cb8045ef1312076e4d684739da0 (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
#ifndef TRACER_H
#define TRACER_H

#include <QObject>
#include "qtmipsmachine.h"

class Tracer : public QObject {
    Q_OBJECT
public:
    Tracer(machine::QtMipsMachine *machine);

    // Trace fetched instruction
    void fetch();
    // Trace registers
    void reg_pc();
    void reg_gp(std::uint8_t i);
    void reg_lo();
    void reg_hi();

private slots:
    void instruction_fetch(machine::Instruction &inst);
    // TODO fetch
    void regs_pc_update(std::uint32_t val);
    void regs_gp_update(std::uint8_t i, std::uint32_t val);
    void regs_hi_lo_update(bool hi, std::uint32_t val);

private:
    machine::QtMipsMachine *machine;

    bool gp_regs[32];
    bool r_hi, r_lo;

    bool con_fetch, con_regs_pc, con_regs_gp, con_regs_hi_lo;
};

#endif // TRACER_H