fp.isa revision 2632:1bb2f91485ea
1// -*- mode:c++ -*-
2
3////////////////////////////////////////////////////////////////////
4//
5// Floating Point operate instructions
6//
7
8output header {{
9        /**
10         * Base class for FP operations.
11         */
12        class FPOp : public MipsStaticInst
13        {
14                protected:
15
16                /// Constructor
17                FPOp(const char *mnem, MachInst _machInst, OpClass __opClass) : MipsStaticInst(mnem, _machInst, __opClass)
18                {
19                }
20
21                std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
22        };
23}};
24
25output decoder {{
26        std::string FPOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
27        {
28                return "Disassembly of integer instruction\n";
29        }
30}};
31
32
33// Primary format for float operate instructions:
34def format FloatOp(code, *flags) {{
35        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
36        header_output = BasicDeclare.subst(iop)
37        decoder_output = BasicConstructor.subst(iop)
38        decode_block = BasicDecode.subst(iop)
39        exec_output = BasicExecute.subst(iop)
40}};
41
42def format FloatCompareOp(code, *flags) {{
43        code = 'bool cond;\n' + code
44        code += 'FCSR = makeCCVector(FCSR, CC,cond);\n'
45        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
46        header_output = BasicDeclare.subst(iop)
47        decoder_output = BasicConstructor.subst(iop)
48        decode_block = BasicDecode.subst(iop)
49        exec_output = BasicExecute.subst(iop)
50}};
51
52def format FloatCompareWithXcptOp(code, *flags) {{
53        code = 'bool cond;\n' + code
54        code += 'FCSR = makeCCVector(FCSR, CC,cond);\n'
55        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
56        header_output = BasicDeclare.subst(iop)
57        decoder_output = BasicConstructor.subst(iop)
58        decode_block = BasicDecode.subst(iop)
59        exec_output = BasicExecute.subst(iop)
60}};
61
62def format FloatConvertOp(code, *flags) {{
63        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
64        header_output = BasicDeclare.subst(iop)
65        decoder_output = BasicConstructor.subst(iop)
66        decode_block = BasicDecode.subst(iop)
67        exec_output = BasicExecute.subst(iop)
68}};
69
70// Primary format for float64 operate instructions:
71def format Float64Op(code, *flags) {{
72        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
73        header_output = BasicDeclare.subst(iop)
74        decoder_output = BasicConstructor.subst(iop)
75        decode_block = BasicDecode.subst(iop)
76        exec_output = BasicExecute.subst(iop)
77}};
78
79def format Float64ConvertOp(code, *flags) {{
80        code = 'bool cond;\n' + code
81        code += 'FCSR = makeCCVector(FCSR, CC,cond);\n'
82        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
83        header_output = BasicDeclare.subst(iop)
84        decoder_output = BasicConstructor.subst(iop)
85        decode_block = BasicDecode.subst(iop)
86        exec_output = BasicExecute.subst(iop)
87}};
88
89def format FloatPSCompareOp(code, *flags) {{
90        code = 'bool cond1;\nbool cond2;\n' + code
91        code += 'FCSR = makeCCVector(FCSR, CC+1, cond1);\n'
92        code += 'FCSR = makeCCVector(FCSR, CC, cond2);\n'
93        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
94        header_output = BasicDeclare.subst(iop)
95        decoder_output = BasicConstructor.subst(iop)
96        decode_block = BasicDecode.subst(iop)
97        exec_output = BasicExecute.subst(iop)
98}};
99
100def format FloatPSCompareWithXcptOp(code, *flags) {{
101        code = 'bool cond1;\nbool cond2;\n' + code
102        code += 'FCSR = makeCCVector(FCSR, CC+1, cond1);\n'
103        code += 'FCSR = makeCCVector(FCSR, CC, cond2);\n'
104        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
105        header_output = BasicDeclare.subst(iop)
106        decoder_output = BasicConstructor.subst(iop)
107        decode_block = BasicDecode.subst(iop)
108        exec_output = BasicExecute.subst(iop)
109}};
110