aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/machineconfig.h
blob: 10b8458b6b6faa9923ceebfb7a6cae903de82e1a (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
64
65
66
#ifndef MACHINECONFIG_H
#define MACHINECONFIG_H

#include <QString>

namespace machine {

class MachineConfigCache {
public:
    MachineConfigCache();
    MachineConfigCache(const MachineConfigCache *cc);

    // TODO

    bool operator ==(const MachineConfigCache &c) const;
    bool operator !=(const MachineConfigCache &c) const;

private:
    // TODO
};

class MachineConfig {
public:
    MachineConfig();
    MachineConfig(const MachineConfig *cc);

    enum HazardUnit {
        HU_NONE,
        HU_STALL,
        HU_STALL_FORWARD
    };

    // Configure if CPU is pipelined
    // In default disabled.
    void set_pipelined(bool);
    // Configure if cpu should simulate delay slot in non-pipelined core
    // In default enabled. When disabled it also automatically disables pipelining.
    void set_delay_slot(bool);
    // Set path to source elf file. This has to be set before core is initialized.
    void set_elf(QString path);
    // Configure cache
    void set_cache_program(const MachineConfigCache&);
    void set_cache_data(const MachineConfigCache&);
    // Hazard unit
    void set_hazard_unit(enum HazardUnit);

    bool pipelined() const;
    bool delay_slot() const;
    QString elf() const;
    MachineConfigCache cache_program() const;
    MachineConfigCache cache_data() const;
    enum HazardUnit hazard_unit() const;

    bool operator ==(const MachineConfig &c) const;
    bool operator !=(const MachineConfig &c) const;

private:
    bool pipeline, delayslot;
    QString elf_path;
    MachineConfigCache cch_program, cch_data;
    enum HazardUnit hunit;
};

}

#endif // MACHINECONFIG_H