summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/dspp/dsppfe.h
blob: a90dc5d02253f896344407bbcce064b12d2b07e1 (plain) (blame)
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
67
68
69
70
71
72
// license:BSD-3-Clause
// copyright-holders:Philip Bennett
/***************************************************************************

    dsppfe.h

    Front-end for DSPP recompiler

***************************************************************************/

#ifndef DEVICES_CPU_DSPP_DSPPFE_H
#define DEVICES_CPU_DSPP_DSPPFE_H

#include "dspp.h"
#include "cpu/drcfe.h"


//**************************************************************************
//  MACROS
//**************************************************************************

// register flags 0
#define REGFLAG_R(n)                    (1 << (n))
#define REGFLAG_RZ(n)                   (((n) == 0) ? 0 : REGFLAG_R(n))

// register flags 1
#define REGFLAG_FR(n)                   (1 << (n))

// register flags 2
#define REGFLAG_CR(n)                   (0xf0000000 >> (4 * (n)))
#define REGFLAG_CR_BIT(n)               (0x80000000 >> (n))

// register flags 3
#define REGFLAG_XER_CA                  (1 << 0)
#define REGFLAG_XER_OV                  (1 << 1)
#define REGFLAG_XER_SO                  (1 << 2)
#define REGFLAG_XER_COUNT               (1 << 3)
#define REGFLAG_CTR                     (1 << 4)
#define REGFLAG_LR                      (1 << 5)
#define REGFLAG_FPSCR(n)                (1 << (6 + (n)))



//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

class dspp_frontend : public drc_frontend
{
public:
	// construction/destruction
	dspp_frontend(dspp_device *dspp, uint32_t window_start, uint32_t window_end, uint32_t max_sequence);

protected:
	// required overrides
	virtual bool describe(opcode_desc &desc, const opcode_desc *prev) override;

private:
	// inlines

	// internal helpers
	bool describe_special(uint16_t op, opcode_desc &desc);
	bool describe_branch(uint16_t op, opcode_desc &desc);
	bool describe_complex_branch(uint16_t op, opcode_desc &desc);
	bool describe_arithmetic(uint16_t op, opcode_desc &desc);

	// internal state
	dspp_device *m_dspp;
};


#endif /* DEVICES_CPU_DSPP_DSPPFE_H */