Merge pull request #70 from antonblanchard/badly-named-carry
[microwatt.git] / decode1.vhdl
1 library ieee;
2 use ieee.std_logic_1164.all;
3 use ieee.numeric_std.all;
4
5 library work;
6 use work.common.all;
7 use work.decode_types.all;
8
9 entity decode1 is
10 port (
11 clk : in std_ulogic;
12 rst : in std_ulogic;
13
14 stall_in : in std_ulogic;
15 flush_in : in std_ulogic;
16
17 f_in : in Fetch2ToDecode1Type;
18 d_out : out Decode1ToDecode2Type
19 );
20 end entity decode1;
21
22 architecture behaviour of decode1 is
23 signal r, rin : Decode1ToDecode2Type;
24
25 type decode_rom_array_t is array(ppc_insn_t) of decode_rom_t;
26
27 -- Note: reformat with column -t -o ' '
28 constant decode_rom_array : decode_rom_array_t := (
29 -- unit internal in1 in2 in3 out const const const CR CR cry cry ldst BR sgn upd rsrv mul mul rc lk sgl
30 -- op 1 2 3 in out in out len ext 32 sgn pipe
31 PPC_ILLEGAL => (ALU, OP_ILLEGAL, NONE, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
32 PPC_ADD => (ALU, OP_ADD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
33 PPC_ADDC => (ALU, OP_ADDE, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '1', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
34 PPC_ADDE => (ALU, OP_ADDE, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '1', '1', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
35 --PPC_ADDEX
36 PPC_ADDI => (ALU, OP_ADD, RA_OR_ZERO, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
37 PPC_ADDIC => (ALU, OP_ADDE, RA, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '1', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
38 PPC_ADDIC_RC => (ALU, OP_ADDE, RA, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '1', NONE, '0', '0', '0', '0', '0', '0', ONE, '0', '1'),
39 PPC_ADDIS => (ALU, OP_ADD, RA_OR_ZERO, CONST_SI_HI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '1', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
40 --PPC_ADDME
41 --PPC_ADDPCIS
42 PPC_ADDZE => (ALU, OP_ADDE, RA, NONE, NONE, RT, NONE, NONE, NONE, '0', '0', '1', '1', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
43 PPC_AND => (ALU, OP_AND, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
44 PPC_ANDC => (ALU, OP_ANDC, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
45 PPC_ANDI_RC => (ALU, OP_AND, RS, CONST_UI, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', ONE, '0', '1'),
46 PPC_ANDIS_RC => (ALU, OP_AND, RS, CONST_UI_HI, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', ONE, '0', '1'),
47 PPC_ATTN => (ALU, OP_ILLEGAL, NONE, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
48 PPC_B => (ALU, OP_B, NONE, CONST_LI, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '1', '1'),
49 --PPC_BA
50 PPC_BC => (ALU, OP_BC, NONE, CONST_BD, NONE, NONE, BO, BI, NONE, '1', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '1', '1'),
51 --PPC_BCA
52 PPC_BCCTR => (ALU, OP_BCCTR, NONE, NONE, NONE, NONE, BO, BI, BH, '1', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '1', '1'),
53 --PPC_BCLA
54 PPC_BCLR => (ALU, OP_BCLR, NONE, NONE, NONE, NONE, BO, BI, BH, '1', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '1', '1'),
55 --PPC_BCTAR
56 --PPC_BPERM
57 PPC_CMP => (ALU, OP_CMP, RA, RB, NONE, NONE, BF, L, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
58 PPC_CMPB => (ALU, OP_CMPB, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
59 --PPC_CMPEQB
60 PPC_CMPI => (ALU, OP_CMP, RA, CONST_SI, NONE, NONE, BF, L, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
61 PPC_CMPL => (ALU, OP_CMPL, RA, RB, NONE, NONE, BF, L, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
62 PPC_CMPLI => (ALU, OP_CMPL, RA, CONST_UI, NONE, NONE, BF, L, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
63 --PPC_CMPRB
64 PPC_CNTLZD => (ALU, OP_CNTLZD, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
65 PPC_CNTLZW => (ALU, OP_CNTLZW, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
66 PPC_CNTTZD => (ALU, OP_CNTTZD, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
67 PPC_CNTTZW => (ALU, OP_CNTTZW, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
68 --PPC_CRAND
69 --PPC_CRANDC
70 --PPC_CREQV
71 --PPC_CRNAND
72 --PPC_CRNOR
73 --PPC_CROR
74 --PPC_CRORC
75 --PPC_CRXOR
76 --PPC_DARN
77 PPC_DCBF => (ALU, OP_NOP, NONE, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
78 PPC_DCBST => (ALU, OP_NOP, NONE, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
79 PPC_DCBT => (ALU, OP_NOP, NONE, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
80 PPC_DCBTST => (ALU, OP_NOP, NONE, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
81 --PPC_DCBZ
82 PPC_DIVD => (ALU, OP_DIVD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
83 --PPC_DIVDE
84 --PPC_DIVDEU
85 PPC_DIVDU => (ALU, OP_DIVDU, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
86 PPC_DIVW => (ALU, OP_DIVW, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
87 --PPC_DIVWE
88 --PPC_DIVWEU
89 PPC_DIVWU => (ALU, OP_DIVWU, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
90 PPC_EQV => (ALU, OP_EQV, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
91 PPC_EXTSB => (ALU, OP_EXTSB, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
92 PPC_EXTSH => (ALU, OP_EXTSH, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
93 PPC_EXTSW => (ALU, OP_EXTSW, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
94 --PPC_EXTSWSLI
95 --PPC_ICBI
96 PPC_ICBT => (ALU, OP_NOP, NONE, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
97 PPC_ISEL => (ALU, OP_ISEL, RA_OR_ZERO, RB, NONE, RT, BC, NONE, NONE, '1', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
98 PPC_ISYNC => (ALU, OP_NOP, NONE, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
99 PPC_LBARX => (LDST, OP_LOAD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is1B, '0', '0', '0', '1', '0', '0', NONE, '0', '1'),
100 --CONST_LI matches CONST_SI, so reuse it
101 PPC_LBZ => (LDST, OP_LOAD, RA_OR_ZERO, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is1B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
102 PPC_LBZU => (LDST, OP_LOAD, RA, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is1B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
103 PPC_LBZUX => (LDST, OP_LOAD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is1B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
104 PPC_LBZX => (LDST, OP_LOAD, RA_OR_ZERO, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is1B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
105 PPC_LD => (LDST, OP_LOAD, RA_OR_ZERO, CONST_DS, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
106 PPC_LDARX => (LDST, OP_LOAD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '0', '0', '0', '1', '0', '0', NONE, '0', '1'),
107 PPC_LDBRX => (LDST, OP_LOAD, RA_OR_ZERO, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '1', '0', '0', '0', '0', '0', NONE, '0', '1'),
108 PPC_LDU => (LDST, OP_LOAD, RA, CONST_DS, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
109 PPC_LDUX => (LDST, OP_LOAD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
110 PPC_LDX => (LDST, OP_LOAD, RA_OR_ZERO, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
111 PPC_LHA => (LDST, OP_LOAD, RA_OR_ZERO, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '1', '0', '0', '0', '0', NONE, '0', '1'),
112 PPC_LHARX => (LDST, OP_LOAD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '0', '0', '1', '0', '0', NONE, '0', '1'),
113 PPC_LHAU => (LDST, OP_LOAD, RA, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '1', '1', '0', '0', '0', NONE, '0', '1'),
114 PPC_LHAUX => (LDST, OP_LOAD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '1', '1', '0', '0', '0', NONE, '0', '1'),
115 PPC_LHAX => (LDST, OP_LOAD, RA_OR_ZERO, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '1', '0', '0', '0', '0', NONE, '0', '1'),
116 PPC_LHBRX => (LDST, OP_LOAD, RA_OR_ZERO, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '1', '0', '0', '0', '0', '0', NONE, '0', '1'),
117 PPC_LHZ => (LDST, OP_LOAD, RA_OR_ZERO, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
118 PPC_LHZU => (LDST, OP_LOAD, RA, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
119 PPC_LHZUX => (LDST, OP_LOAD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
120 PPC_LHZX => (LDST, OP_LOAD, RA_OR_ZERO, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
121 PPC_LWA => (LDST, OP_LOAD, RA_OR_ZERO, CONST_DS, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '1', '0', '0', '0', '0', NONE, '0', '1'),
122 PPC_LWARX => (LDST, OP_LOAD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '0', '0', '1', '0', '0', NONE, '0', '1'),
123 PPC_LWAUX => (LDST, OP_LOAD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '1', '1', '0', '0', '0', NONE, '0', '1'),
124 PPC_LWAX => (LDST, OP_LOAD, RA_OR_ZERO, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '1', '0', '0', '0', '0', NONE, '0', '1'),
125 PPC_LWBRX => (LDST, OP_LOAD, RA_OR_ZERO, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '1', '0', '0', '0', '0', '0', NONE, '0', '1'),
126 PPC_LWZ => (LDST, OP_LOAD, RA_OR_ZERO, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
127 PPC_LWZU => (LDST, OP_LOAD, RA, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
128 PPC_LWZUX => (LDST, OP_LOAD, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
129 PPC_LWZX => (LDST, OP_LOAD, RA_OR_ZERO, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
130 --PPC_MADDHD
131 --PPC_MADDHDU
132 --PPC_MADDLD
133 --PPC_MCRF
134 --PPC_MCRXR
135 --PPC_MCRXRX
136 PPC_MFCR => (ALU, OP_MFCR, NONE, NONE, NONE, RT, NONE, NONE, NONE, '1', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
137 PPC_MFOCRF => (ALU, OP_MFOCRF, NONE, NONE, NONE, RT, FXM, NONE, NONE, '1', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
138 PPC_MFCTR => (ALU, OP_MFCTR, NONE, NONE, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
139 PPC_MFLR => (ALU, OP_MFLR, NONE, NONE, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
140 PPC_MFTB => (ALU, OP_MFTB, NONE, NONE, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
141 PPC_MTCTR => (ALU, OP_MTCTR, RS, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
142 PPC_MTLR => (ALU, OP_MTLR, RS, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
143 --PPC_MFSPR
144 --PPC_MODSD
145 --PPC_MODSW
146 --PPC_MODUD
147 --PPC_MODUW
148 PPC_MTCRF => (ALU, OP_MTCRF, RS, NONE, NONE, NONE, FXM, NONE, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
149 PPC_MTOCRF => (ALU, OP_MTOCRF, RS, NONE, NONE, NONE, FXM, NONE, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
150 --PPC_MTSPR
151 PPC_MULHD => (MUL, OP_MUL_H64, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '1', RC, '0', '1'),
152 PPC_MULHDU => (MUL, OP_MUL_H64, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
153 PPC_MULHW => (MUL, OP_MUL_H32, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '1', '1', RC, '0', '1'),
154 PPC_MULHWU => (MUL, OP_MUL_H32, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '1', '0', RC, '0', '1'),
155 PPC_MULLD => (MUL, OP_MUL_L64, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '1', RC, '0', '1'),
156 PPC_MULLI => (MUL, OP_MUL_L64, RA, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '0', '1', NONE, '0', '1'),
157 PPC_MULLW => (MUL, OP_MUL_L64, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '1', '0', '0', NONE, '0', '0', '0', '0', '1', '1', RC, '0', '1'),
158 PPC_NAND => (ALU, OP_NAND, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
159 PPC_NEG => (ALU, OP_NEG, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
160 PPC_NOP => (ALU, OP_NOP, NONE, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
161 PPC_NOR => (ALU, OP_NOR, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
162 PPC_OR => (ALU, OP_OR, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
163 PPC_ORC => (ALU, OP_ORC, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
164 PPC_ORI => (ALU, OP_OR, RS, CONST_UI, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
165 PPC_ORIS => (ALU, OP_OR, RS, CONST_UI_HI, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
166 PPC_POPCNTB => (ALU, OP_POPCNTB, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
167 PPC_POPCNTD => (ALU, OP_POPCNTD, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
168 PPC_POPCNTW => (ALU, OP_POPCNTW, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
169 PPC_PRTYD => (ALU, OP_PRTYD, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
170 PPC_PRTYW => (ALU, OP_PRTYW, RS, NONE, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
171 PPC_RLDCL => (ALU, OP_RLDCL, RS, RB, NONE, RA, NONE, MB, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
172 PPC_RLDCR => (ALU, OP_RLDCR, RS, RB, NONE, RA, NONE, MB, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
173 PPC_RLDIC => (ALU, OP_RLDIC, RS, NONE, NONE, RA, SH, MB, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
174 PPC_RLDICL => (ALU, OP_RLDICL, RS, NONE, NONE, RA, SH, MB, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
175 PPC_RLDICR => (ALU, OP_RLDICR, RS, NONE, NONE, RA, SH, ME, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
176 PPC_RLDIMI => (ALU, OP_RLDIMI, RA, RS, NONE, RA, SH, MB, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
177 PPC_RLWIMI => (ALU, OP_RLWIMI, RA, RS, NONE, RA, SH32, MB32, ME32, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
178 PPC_RLWINM => (ALU, OP_RLWINM, RS, NONE, NONE, RA, SH32, MB32, ME32, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
179 PPC_RLWNM => (ALU, OP_RLWNM, RS, RB, NONE, RA, NONE, MB32, ME32, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
180 --PPC_SETB
181 PPC_SLD => (ALU, OP_SLD, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
182 PPC_SLW => (ALU, OP_SLW, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
183 PPC_SRAD => (ALU, OP_SRAD, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
184 PPC_SRADI => (ALU, OP_SRADI, RS, NONE, NONE, RA, SH, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
185 PPC_SRAW => (ALU, OP_SRAW, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
186 PPC_SRAWI => (ALU, OP_SRAWI, RS, NONE, NONE, RA, SH, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
187 PPC_SRD => (ALU, OP_SRD, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
188 PPC_SRW => (ALU, OP_SRW, RS, RB, RS, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
189 PPC_STB => (LDST, OP_STORE, RA_OR_ZERO, CONST_SI, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is1B, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
190 PPC_STBCX => (LDST, OP_STORE, RA, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is1B, '0', '0', '0', '1', '0', '0', RC, '0', '1'),
191 PPC_STBU => (LDST, OP_STORE, RA, CONST_SI, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is1B, '0', '0', '1', '0', '0', '0', RC, '0', '1'),
192 PPC_STBUX => (LDST, OP_STORE, RA, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is1B, '0', '0', '1', '0', '0', '0', RC, '0', '1'),
193 PPC_STBX => (LDST, OP_STORE, RA_OR_ZERO, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is1B, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
194 PPC_STD => (LDST, OP_STORE, RA_OR_ZERO, CONST_DS, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
195 PPC_STDBRX => (LDST, OP_STORE, RA_OR_ZERO, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '1', '0', '0', '0', '0', '0', NONE, '0', '1'),
196 PPC_STDCX => (LDST, OP_STORE, RA, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '0', '0', '0', '1', '0', '0', NONE, '0', '1'),
197 PPC_STDU => (LDST, OP_STORE, RA, CONST_DS, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
198 PPC_STDUX => (LDST, OP_STORE, RA, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
199 PPC_STDX => (LDST, OP_STORE, RA_OR_ZERO, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is8B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
200 PPC_STH => (LDST, OP_STORE, RA, CONST_SI, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
201 PPC_STHBRX => (LDST, OP_STORE, RA_OR_ZERO, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '1', '0', '0', '0', '0', '0', NONE, '0', '1'),
202 PPC_STHCX => (LDST, OP_STORE, RA, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '0', '0', '1', '0', '0', NONE, '0', '1'),
203 PPC_STHU => (LDST, OP_STORE, RA, CONST_SI, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
204 PPC_STHUX => (LDST, OP_STORE, RA, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
205 PPC_STHX => (LDST, OP_STORE, RA_OR_ZERO, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is2B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
206 PPC_STW => (LDST, OP_STORE, RA_OR_ZERO, CONST_SI, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
207 PPC_STWBRX => (LDST, OP_STORE, RA_OR_ZERO, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '1', '0', '0', '0', '0', '0', NONE, '0', '1'),
208 PPC_STWCX => (LDST, OP_STORE, RA, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '0', '0', '1', '0', '0', NONE, '0', '1'),
209 PPC_STWU => (LDST, OP_STORE, RA, CONST_SI, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
210 PPC_STWUX => (LDST, OP_STORE, RA, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '0', '1', '0', '0', '0', NONE, '0', '1'),
211 PPC_STWX => (LDST, OP_STORE, RA_OR_ZERO, RB, RS, NONE, NONE, NONE, NONE, '0', '0', '0', '0', is4B, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
212 PPC_SUBF => (ALU, OP_SUBF, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
213 PPC_SUBFC => (ALU, OP_SUBFE, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '1', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
214 PPC_SUBFE => (ALU, OP_SUBFE, RA, RB, NONE, RT, NONE, NONE, NONE, '0', '0', '1', '1', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
215 PPC_SUBFIC => (ALU, OP_SUBFE, RA, CONST_SI, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '1', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
216 --PPC_SUBFME
217 PPC_SUBFZE => (ALU, OP_SUBFE, RA, NONE, NONE, RT, NONE, NONE, NONE, '0', '0', '1', '1', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
218 PPC_SYNC => (ALU, OP_NOP, NONE, NONE, NONE, NONE, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
219 --PPC_TD
220 PPC_TDI => (ALU, OP_TDI, RA, CONST_SI, NONE, NONE, TOO, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
221 PPC_TW => (ALU, OP_TW, RA, RB, NONE, NONE, TOO, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
222 --PPC_TWI
223 PPC_XOR => (ALU, OP_XOR, RS, RB, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', RC, '0', '1'),
224 PPC_XORI => (ALU, OP_XOR, RS, CONST_UI, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
225 PPC_XORIS => (ALU, OP_XOR, RS, CONST_UI_HI, NONE, RA, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
226 PPC_SIM_CONFIG => (ALU, OP_SIM_CONFIG,NONE, NONE, NONE, RT, NONE, NONE, NONE, '0', '0', '0', '0', NONE, '0', '0', '0', '0', '0', '0', NONE, '0', '1'),
227
228 others => decode_rom_init
229 );
230
231 begin
232 decode1_0: process(clk)
233 begin
234 if rising_edge(clk) then
235 -- Output state remains unchanged on stall, unless we are flushing
236 if rst = '1' or flush_in = '1' or stall_in = '0' then
237 r <= rin;
238 end if;
239 end if;
240 end process;
241
242 decode1_1: process(all)
243 variable v : Decode1ToDecode2Type;
244 variable ppc_insn: ppc_insn_t;
245 begin
246 v := r;
247
248 v.valid := f_in.valid;
249 v.nia := f_in.nia;
250 v.insn := f_in.insn;
251 v.stop_mark := f_in.stop_mark;
252
253 ppc_insn := PPC_ILLEGAL;
254
255 if f_in.valid = '1' then
256 report "Decode insn " & to_hstring(f_in.insn) & " at " & to_hstring(f_in.nia);
257
258 if std_match(f_in.insn, "011111---------------0100001010-") then
259 report "PPC_add";
260 ppc_insn := PPC_ADD;
261 elsif std_match(f_in.insn, "011111---------------0000001010-") then
262 report "PPC_addc";
263 ppc_insn := PPC_ADDC;
264 elsif std_match(f_in.insn, "011111---------------0010001010-") then
265 report "PPC_adde";
266 ppc_insn := PPC_ADDE;
267 elsif std_match(f_in.insn, "011111---------------0010101010-") then
268 report "PPC_addex";
269 ppc_insn := PPC_ADDEX;
270 elsif std_match(f_in.insn, "001110--------------------------") then
271 report "PPC_addi";
272 ppc_insn := PPC_ADDI;
273 elsif std_match(f_in.insn, "001100--------------------------") then
274 report "PPC_addic";
275 ppc_insn := PPC_ADDIC;
276 elsif std_match(f_in.insn, "001101--------------------------") then
277 report "PPC_addic.";
278 ppc_insn := PPC_ADDIC_RC;
279 elsif std_match(f_in.insn, "001111--------------------------") then
280 report "PPC_addis";
281 ppc_insn := PPC_ADDIS;
282 elsif std_match(f_in.insn, "011111---------------0011101010-") then
283 report "PPC_addme";
284 ppc_insn := PPC_ADDME;
285 elsif std_match(f_in.insn, "010011--------------------00010-") then
286 report "PPC_addpcis";
287 ppc_insn := PPC_ADDPCIS;
288 elsif std_match(f_in.insn, "011111---------------0011001010-") then
289 report "PPC_addze";
290 ppc_insn := PPC_ADDZE;
291 elsif std_match(f_in.insn, "011111---------------0000011100-") then
292 report "PPC_and";
293 ppc_insn := PPC_AND;
294 elsif std_match(f_in.insn, "011111---------------0000111100-") then
295 report "PPC_andc";
296 ppc_insn := PPC_ANDC;
297 elsif std_match(f_in.insn, "011100--------------------------") then
298 report "PPC_andi.";
299 ppc_insn := PPC_ANDI_RC;
300 elsif std_match(f_in.insn, "011101--------------------------") then
301 report "PPC_andis.";
302 ppc_insn := PPC_ANDIS_RC;
303 elsif std_match(f_in.insn, "000000---------------0100000000-") then
304 report "PPC_attn";
305 ppc_insn := PPC_ATTN;
306 elsif std_match(f_in.insn, "010010------------------------0-") then
307 report "PPC_b";
308 ppc_insn := PPC_B;
309 elsif std_match(f_in.insn, "010010------------------------1-") then
310 report "PPC_ba";
311 ppc_insn := PPC_BA;
312 elsif std_match(f_in.insn, "010000------------------------0-") then
313 report "PPC_bc";
314 ppc_insn := PPC_BC;
315 elsif std_match(f_in.insn, "010000------------------------10") then
316 report "PPC_bca";
317 ppc_insn := PPC_BCA;
318 elsif std_match(f_in.insn, "010011---------------1000010000-") then
319 report "PPC_bcctr";
320 ppc_insn := PPC_BCCTR;
321 elsif std_match(f_in.insn, "010000------------------------11") then
322 report "PPC_bcla";
323 ppc_insn := PPC_BCLA;
324 elsif std_match(f_in.insn, "010011---------------0000010000-") then
325 report "PPC_bclr";
326 ppc_insn := PPC_BCLR;
327 elsif std_match(f_in.insn, "010011---------------1000110000-") then
328 report "PPC_bctar";
329 ppc_insn := PPC_BCTAR;
330 elsif std_match(f_in.insn, "011111---------------0011111100-") then
331 report "PPC_bperm";
332 ppc_insn := PPC_BPERM;
333 elsif std_match(f_in.insn, "011111---------------0000000000-") then
334 report "PPC_cmp";
335 ppc_insn := PPC_CMP;
336 elsif std_match(f_in.insn, "011111---------------0111111100-") then
337 report "PPC_cmpb";
338 ppc_insn := PPC_CMPB;
339 elsif std_match(f_in.insn, "011111---------------0011100000-") then
340 report "PPC_cmpeqb";
341 ppc_insn := PPC_CMPEQB;
342 elsif std_match(f_in.insn, "001011--------------------------") then
343 report "PPC_cmpi";
344 ppc_insn := PPC_CMPI;
345 elsif std_match(f_in.insn, "011111---------------0000100000-") then
346 report "PPC_cmpl";
347 ppc_insn := PPC_CMPL;
348 elsif std_match(f_in.insn, "001010--------------------------") then
349 report "PPC_cmpli";
350 ppc_insn := PPC_CMPLI;
351 elsif std_match(f_in.insn, "011111---------------0011000000-") then
352 report "PPC_cmprb";
353 ppc_insn := PPC_CMPRB;
354 elsif std_match(f_in.insn, "011111---------------0000111010-") then
355 report "PPC_cntlzd";
356 ppc_insn := PPC_CNTLZD;
357 elsif std_match(f_in.insn, "011111---------------0000011010-") then
358 report "PPC_cntlzw";
359 ppc_insn := PPC_CNTLZW;
360 elsif std_match(f_in.insn, "011111---------------1000111010-") then
361 report "PPC_cnttzd";
362 ppc_insn := PPC_CNTTZD;
363 elsif std_match(f_in.insn, "011111---------------1000011010-") then
364 report "PPC_cnttzw";
365 ppc_insn := PPC_CNTTZW;
366 elsif std_match(f_in.insn, "010011---------------0100000001-") then
367 report "PPC_crand";
368 ppc_insn := PPC_CRAND;
369 elsif std_match(f_in.insn, "010011---------------0010000001-") then
370 report "PPC_crandc";
371 ppc_insn := PPC_CRANDC;
372 elsif std_match(f_in.insn, "010011---------------0100100001-") then
373 report "PPC_creqv";
374 ppc_insn := PPC_CREQV;
375 elsif std_match(f_in.insn, "010011---------------0011100001-") then
376 report "PPC_crnand";
377 ppc_insn := PPC_CRNAND;
378 elsif std_match(f_in.insn, "010011---------------0000100001-") then
379 report "PPC_crnor";
380 ppc_insn := PPC_CRNOR;
381 elsif std_match(f_in.insn, "010011---------------0111000001-") then
382 report "PPC_cror";
383 ppc_insn := PPC_CROR;
384 elsif std_match(f_in.insn, "010011---------------0110100001-") then
385 report "PPC_crorc";
386 ppc_insn := PPC_CRORC;
387 elsif std_match(f_in.insn, "010011---------------0011000001-") then
388 report "PPC_crxor";
389 ppc_insn := PPC_CRXOR;
390 elsif std_match(f_in.insn, "011111---------------1011110011-") then
391 report "PPC_darn";
392 ppc_insn := PPC_DARN;
393 elsif std_match(f_in.insn, "011111---------------0001010110-") then
394 report "PPC_dcbf";
395 ppc_insn := PPC_DCBF;
396 elsif std_match(f_in.insn, "011111---------------0000110110-") then
397 report "PPC_dcbst";
398 ppc_insn := PPC_DCBST;
399 elsif std_match(f_in.insn, "011111---------------0100010110-") then
400 report "PPC_dcbt";
401 ppc_insn := PPC_DCBT;
402 elsif std_match(f_in.insn, "011111---------------0011110110-") then
403 report "PPC_dcbtst";
404 ppc_insn := PPC_DCBTST;
405 elsif std_match(f_in.insn, "011111---------------1111110110-") then
406 report "PPC_dcbz";
407 ppc_insn := PPC_DCBZ;
408 elsif std_match(f_in.insn, "011111---------------0111101001-") then
409 report "PPC_divd";
410 ppc_insn := PPC_DIVD;
411 elsif std_match(f_in.insn, "011111---------------0110101001-") then
412 report "PPC_divde";
413 ppc_insn := PPC_DIVDE;
414 elsif std_match(f_in.insn, "011111---------------0110001001-") then
415 report "PPC_divdeu";
416 ppc_insn := PPC_DIVDEU;
417 elsif std_match(f_in.insn, "011111---------------0111001001-") then
418 report "PPC_divdu";
419 ppc_insn := PPC_DIVDU;
420 elsif std_match(f_in.insn, "011111---------------0111101011-") then
421 report "PPC_divw";
422 ppc_insn := PPC_DIVW;
423 elsif std_match(f_in.insn, "011111---------------0110101011-") then
424 report "PPC_divwe";
425 ppc_insn := PPC_DIVWE;
426 elsif std_match(f_in.insn, "011111---------------0110001011-") then
427 report "PPC_divweu";
428 ppc_insn := PPC_DIVWEU;
429 elsif std_match(f_in.insn, "011111---------------0111001011-") then
430 report "PPC_divwu";
431 ppc_insn := PPC_DIVWU;
432 elsif std_match(f_in.insn, "011111---------------0100011100-") then
433 report "PPC_eqv";
434 ppc_insn := PPC_EQV;
435 elsif std_match(f_in.insn, "011111---------------1110111010-") then
436 report "PPC_extsb";
437 ppc_insn := PPC_EXTSB;
438 elsif std_match(f_in.insn, "011111---------------1110011010-") then
439 report "PPC_extsh";
440 ppc_insn := PPC_EXTSH;
441 elsif std_match(f_in.insn, "011111---------------1111011010-") then
442 report "PPC_extsw";
443 ppc_insn := PPC_EXTSW;
444 elsif std_match(f_in.insn, "011111---------------110111101--") then
445 report "PPC_extswsli";
446 ppc_insn := PPC_EXTSWSLI;
447 elsif std_match(f_in.insn, "011111---------------1111010110-") then
448 report "PPC_icbi";
449 ppc_insn := PPC_ICBI;
450 elsif std_match(f_in.insn, "011111---------------0000010110-") then
451 report "PPC_icbt";
452 ppc_insn := PPC_ICBT;
453 elsif std_match(f_in.insn, "011111--------------------01111-") then
454 report "PPC_isel";
455 ppc_insn := PPC_ISEL;
456 elsif std_match(f_in.insn, "010011---------------0010010110-") then
457 report "PPC_isync";
458 ppc_insn := PPC_ISYNC;
459 elsif std_match(f_in.insn, "011111---------------0000110100-") then
460 report "PPC_lbarx";
461 ppc_insn := PPC_LBARX;
462 elsif std_match(f_in.insn, "100010--------------------------") then
463 report "PPC_lbz";
464 ppc_insn := PPC_LBZ;
465 elsif std_match(f_in.insn, "100011--------------------------") then
466 report "PPC_lbzu";
467 ppc_insn := PPC_LBZU;
468 elsif std_match(f_in.insn, "011111---------------0001110111-") then
469 report "PPC_lbzux";
470 ppc_insn := PPC_LBZUX;
471 elsif std_match(f_in.insn, "011111---------------0001010111-") then
472 report "PPC_lbzx";
473 ppc_insn := PPC_LBZX;
474 elsif std_match(f_in.insn, "111010------------------------00") then
475 report "PPC_ld";
476 ppc_insn := PPC_LD;
477 elsif std_match(f_in.insn, "011111---------------0001010100-") then
478 report "PPC_ldarx";
479 ppc_insn := PPC_LDARX;
480 elsif std_match(f_in.insn, "011111---------------1000010100-") then
481 report "PPC_ldbrx";
482 ppc_insn := PPC_LDBRX;
483 elsif std_match(f_in.insn, "111010------------------------01") then
484 report "PPC_ldu";
485 ppc_insn := PPC_LDU;
486 elsif std_match(f_in.insn, "011111---------------0000110101-") then
487 report "PPC_ldux";
488 ppc_insn := PPC_LDUX;
489 elsif std_match(f_in.insn, "011111---------------0000010101-") then
490 report "PPC_ldx";
491 ppc_insn := PPC_LDX;
492 elsif std_match(f_in.insn, "101010--------------------------") then
493 report "PPC_lha";
494 ppc_insn := PPC_LHA;
495 elsif std_match(f_in.insn, "011111---------------0001110100-") then
496 report "PPC_lharx";
497 ppc_insn := PPC_LHARX;
498 elsif std_match(f_in.insn, "101011--------------------------") then
499 report "PPC_lhau";
500 ppc_insn := PPC_LHAU;
501 elsif std_match(f_in.insn, "011111---------------0101110111-") then
502 report "PPC_lhaux";
503 ppc_insn := PPC_LHAUX;
504 elsif std_match(f_in.insn, "011111---------------0101010111-") then
505 report "PPC_lhax";
506 ppc_insn := PPC_LHAX;
507 elsif std_match(f_in.insn, "011111---------------1100010110-") then
508 report "PPC_lhbrx";
509 ppc_insn := PPC_LHBRX;
510 elsif std_match(f_in.insn, "101000--------------------------") then
511 report "PPC_lhz";
512 ppc_insn := PPC_LHZ;
513 elsif std_match(f_in.insn, "101001--------------------------") then
514 report "PPC_lhzu";
515 ppc_insn := PPC_LHZU;
516 elsif std_match(f_in.insn, "011111---------------0100110111-") then
517 report "PPC_lhzux";
518 ppc_insn := PPC_LHZUX;
519 elsif std_match(f_in.insn, "011111---------------0100010111-") then
520 report "PPC_lhzx";
521 ppc_insn := PPC_LHZX;
522 elsif std_match(f_in.insn, "111010------------------------10") then
523 report "PPC_lwa";
524 ppc_insn := PPC_LWA;
525 elsif std_match(f_in.insn, "011111---------------0000010100-") then
526 report "PPC_lwarx";
527 ppc_insn := PPC_LWARX;
528 elsif std_match(f_in.insn, "011111---------------0101110101-") then
529 report "PPC_lwaux";
530 ppc_insn := PPC_LWAUX;
531 elsif std_match(f_in.insn, "011111---------------0101010101-") then
532 report "PPC_lwax";
533 ppc_insn := PPC_LWAX;
534 elsif std_match(f_in.insn, "011111---------------1000010110-") then
535 report "PPC_lwbrx";
536 ppc_insn := PPC_LWBRX;
537 elsif std_match(f_in.insn, "100000--------------------------") then
538 report "PPC_lwz";
539 ppc_insn := PPC_LWZ;
540 elsif std_match(f_in.insn, "100001--------------------------") then
541 report "PPC_lwzu";
542 ppc_insn := PPC_LWZU;
543 elsif std_match(f_in.insn, "011111---------------0000110111-") then
544 report "PPC_lwzux";
545 ppc_insn := PPC_LWZUX;
546 elsif std_match(f_in.insn, "011111---------------0000010111-") then
547 report "PPC_lwzx";
548 ppc_insn := PPC_LWZX;
549 elsif std_match(f_in.insn, "000100--------------------110000") then
550 report "PPC_maddhd";
551 ppc_insn := PPC_MADDHD;
552 elsif std_match(f_in.insn, "000100--------------------110001") then
553 report "PPC_maddhdu";
554 ppc_insn := PPC_MADDHDU;
555 elsif std_match(f_in.insn, "000100--------------------110011") then
556 report "PPC_maddld";
557 ppc_insn := PPC_MADDLD;
558 elsif std_match(f_in.insn, "010011---------------0000000000-") then
559 report "PPC_mcrf";
560 ppc_insn := PPC_MCRF;
561 elsif std_match(f_in.insn, "011111---------------1000000000-") then
562 report "PPC_mcrxr";
563 ppc_insn := PPC_MCRXR;
564 elsif std_match(f_in.insn, "011111---------------1001000000-") then
565 report "PPC_mcrxrx";
566 ppc_insn := PPC_MCRXRX;
567 elsif std_match(f_in.insn, "011111-----0---------0000010011-") then
568 report "PPC_mfcr";
569 ppc_insn := PPC_MFCR;
570 elsif std_match(f_in.insn, "011111-----1---------0000010011-") then
571 report "PPC_mfocrf";
572 ppc_insn := PPC_MFOCRF;
573 -- Specific MF/MT SPR encodings first
574 elsif std_match(f_in.insn, "011111-----01001000000101010011-") then
575 report "PPC_mfctr";
576 ppc_insn := PPC_MFCTR;
577 elsif std_match(f_in.insn, "011111-----01000000000101010011-") then
578 report "PPC_mflr";
579 ppc_insn := PPC_MFLR;
580 elsif std_match(f_in.insn, "011111-----01100010000101010011-") then
581 report "PPC_mftb";
582 ppc_insn := PPC_MFTB;
583 elsif std_match(f_in.insn, "011111-----01001000000111010011-") then
584 report "PPC_mtctr";
585 ppc_insn := PPC_MTCTR;
586 elsif std_match(f_in.insn, "011111-----01000000000111010011-") then
587 report "PPC_mtlr";
588 ppc_insn := PPC_MTLR;
589 elsif std_match(f_in.insn, "011111---------------0101010011-") then
590 report "PPC_mfspr";
591 ppc_insn := PPC_MFSPR;
592 elsif std_match(f_in.insn, "011111---------------1100001001-") then
593 report "PPC_modsd";
594 ppc_insn := PPC_MODSD;
595 elsif std_match(f_in.insn, "011111---------------1100001011-") then
596 report "PPC_modsw";
597 ppc_insn := PPC_MODSW;
598 elsif std_match(f_in.insn, "011111---------------0100001001-") then
599 report "PPC_modud";
600 ppc_insn := PPC_MODUD;
601 elsif std_match(f_in.insn, "011111---------------0100001011-") then
602 report "PPC_moduw";
603 ppc_insn := PPC_MODUW;
604 elsif std_match(f_in.insn, "011111-----0---------0010010000-") then
605 report "PPC_mtcrf";
606 ppc_insn := PPC_MTCRF;
607 elsif std_match(f_in.insn, "011111-----1---------0010010000-") then
608 report "PPC_mtocrf";
609 ppc_insn := PPC_MTOCRF;
610 elsif std_match(f_in.insn, "011111---------------0111010011-") then
611 report "PPC_mtspr";
612 ppc_insn := PPC_MTSPR;
613 elsif std_match(f_in.insn, "011111----------------001001001-") then
614 report "PPC_mulhd";
615 ppc_insn := PPC_MULHD;
616 elsif std_match(f_in.insn, "011111----------------000001001-") then
617 report "PPC_mulhdu";
618 ppc_insn := PPC_MULHDU;
619 elsif std_match(f_in.insn, "011111----------------001001011-") then
620 report "PPC_mulhw";
621 ppc_insn := PPC_MULHW;
622 elsif std_match(f_in.insn, "011111----------------000001011-") then
623 report "PPC_mulhwu";
624 ppc_insn := PPC_MULHWU;
625 elsif std_match(f_in.insn, "011111---------------0011101001-") then
626 report "PPC_mulld";
627 ppc_insn := PPC_MULLD;
628 elsif std_match(f_in.insn, "000111--------------------------") then
629 report "PPC_mulli";
630 ppc_insn := PPC_MULLI;
631 elsif std_match(f_in.insn, "011111---------------0011101011-") then
632 report "PPC_mullw";
633 ppc_insn := PPC_MULLW;
634 elsif std_match(f_in.insn, "011111---------------0111011100-") then
635 report "PPC_nand";
636 ppc_insn := PPC_NAND;
637 elsif std_match(f_in.insn, "011111---------------0001101000-") then
638 report "PPC_neg";
639 ppc_insn := PPC_NEG;
640 elsif std_match(f_in.insn, "011111---------------0001111100-") then
641 report "PPC_nor";
642 ppc_insn := PPC_NOR;
643 elsif std_match(f_in.insn, "011111---------------0110111100-") then
644 report "PPC_or";
645 ppc_insn := PPC_OR;
646 elsif std_match(f_in.insn, "011111---------------0110011100-") then
647 report "PPC_orc";
648 ppc_insn := PPC_ORC;
649 -- Has to be before ori
650 elsif std_match(f_in.insn, "01100000000000000000000000000000") then
651 report "PPC_nop";
652 ppc_insn := PPC_NOP;
653 elsif std_match(f_in.insn, "011000--------------------------") then
654 report "PPC_ori";
655 ppc_insn := PPC_ORI;
656 elsif std_match(f_in.insn, "011001--------------------------") then
657 report "PPC_oris";
658 ppc_insn := PPC_ORIS;
659 elsif std_match(f_in.insn, "011111---------------0001111010-") then
660 report "PPC_popcntb";
661 ppc_insn := PPC_POPCNTB;
662 elsif std_match(f_in.insn, "011111---------------0111111010-") then
663 report "PPC_popcntd";
664 ppc_insn := PPC_POPCNTD;
665 elsif std_match(f_in.insn, "011111---------------0101111010-") then
666 report "PPC_popcntw";
667 ppc_insn := PPC_POPCNTW;
668 elsif std_match(f_in.insn, "011111---------------0010111010-") then
669 report "PPC_prtyd";
670 ppc_insn := PPC_PRTYD;
671 elsif std_match(f_in.insn, "011111---------------0010011010-") then
672 report "PPC_prtyw";
673 ppc_insn := PPC_PRTYW;
674 elsif std_match(f_in.insn, "011110---------------------1000-") then
675 report "PPC_rldcl";
676 ppc_insn := PPC_RLDCL;
677 elsif std_match(f_in.insn, "011110---------------------1001-") then
678 report "PPC_rldcr";
679 ppc_insn := PPC_RLDCR;
680 elsif std_match(f_in.insn, "011110---------------------010--") then
681 report "PPC_rldic";
682 ppc_insn := PPC_RLDIC;
683 elsif std_match(f_in.insn, "011110---------------------000--") then
684 report "PPC_rldicl";
685 ppc_insn := PPC_RLDICL;
686 elsif std_match(f_in.insn, "011110---------------------001--") then
687 report "PPC_rldicr";
688 ppc_insn := PPC_RLDICR;
689 elsif std_match(f_in.insn, "011110---------------------011--") then
690 report "PPC_rldimi";
691 ppc_insn := PPC_RLDIMI;
692 elsif std_match(f_in.insn, "010100--------------------------") then
693 report "PPC_rlwimi";
694 ppc_insn := PPC_RLWIMI;
695 elsif std_match(f_in.insn, "010101--------------------------") then
696 report "PPC_rlwinm";
697 ppc_insn := PPC_RLWINM;
698 elsif std_match(f_in.insn, "010111--------------------------") then
699 report "PPC_rlwnm";
700 ppc_insn := PPC_RLWNM;
701 elsif std_match(f_in.insn, "011111---------------0010000000-") then
702 report "PPC_setb";
703 ppc_insn := PPC_SETB;
704 elsif std_match(f_in.insn, "011111---------------0000011011-") then
705 report "PPC_sld";
706 ppc_insn := PPC_SLD;
707 elsif std_match(f_in.insn, "011111---------------0000011000-") then
708 report "PPC_slw";
709 ppc_insn := PPC_SLW;
710 elsif std_match(f_in.insn, "011111---------------1100011010-") then
711 report "PPC_srad";
712 ppc_insn := PPC_SRAD;
713 elsif std_match(f_in.insn, "011111---------------110011101--") then
714 report "PPC_sradi";
715 ppc_insn := PPC_SRADI;
716 elsif std_match(f_in.insn, "011111---------------1100011000-") then
717 report "PPC_sraw";
718 ppc_insn := PPC_SRAW;
719 elsif std_match(f_in.insn, "011111---------------1100111000-") then
720 report "PPC_srawi";
721 ppc_insn := PPC_SRAWI;
722 elsif std_match(f_in.insn, "011111---------------1000011011-") then
723 report "PPC_srd";
724 ppc_insn := PPC_SRD;
725 elsif std_match(f_in.insn, "011111---------------1000011000-") then
726 report "PPC_srw";
727 ppc_insn := PPC_SRW;
728 elsif std_match(f_in.insn, "100110--------------------------") then
729 report "PPC_stb";
730 ppc_insn := PPC_STB;
731 elsif std_match(f_in.insn, "011111---------------1010110110-") then
732 report "PPC_stbcx";
733 ppc_insn := PPC_STBCX;
734 elsif std_match(f_in.insn, "100111--------------------------") then
735 report "PPC_stbu";
736 ppc_insn := PPC_STBU;
737 elsif std_match(f_in.insn, "011111---------------0011110111-") then
738 report "PPC_stbux";
739 ppc_insn := PPC_STBUX;
740 elsif std_match(f_in.insn, "011111---------------0011010111-") then
741 report "PPC_stbx";
742 ppc_insn := PPC_STBX;
743 elsif std_match(f_in.insn, "111110------------------------00") then
744 report "PPC_std";
745 ppc_insn := PPC_STD;
746 elsif std_match(f_in.insn, "011111---------------1010010100-") then
747 report "PPC_stdbrx";
748 ppc_insn := PPC_STDBRX;
749 elsif std_match(f_in.insn, "011111---------------0011010110-") then
750 report "PPC_stdcx";
751 ppc_insn := PPC_STDCX;
752 elsif std_match(f_in.insn, "111110------------------------01") then
753 report "PPC_stdu";
754 ppc_insn := PPC_STDU;
755 elsif std_match(f_in.insn, "011111---------------0010110101-") then
756 report "PPC_stdux";
757 ppc_insn := PPC_STDUX;
758 elsif std_match(f_in.insn, "011111---------------0010010101-") then
759 report "PPC_stdx";
760 ppc_insn := PPC_STDX;
761 elsif std_match(f_in.insn, "101100--------------------------") then
762 report "PPC_sth";
763 ppc_insn := PPC_STH;
764 elsif std_match(f_in.insn, "011111---------------1110010110-") then
765 report "PPC_sthbrx";
766 ppc_insn := PPC_STHBRX;
767 elsif std_match(f_in.insn, "011111---------------1011010110-") then
768 report "PPC_sthcx";
769 ppc_insn := PPC_STHCX;
770 elsif std_match(f_in.insn, "101101--------------------------") then
771 report "PPC_sthu";
772 ppc_insn := PPC_STHU;
773 elsif std_match(f_in.insn, "011111---------------0110110111-") then
774 report "PPC_sthux";
775 ppc_insn := PPC_STHUX;
776 elsif std_match(f_in.insn, "011111---------------0110010111-") then
777 report "PPC_sthx";
778 ppc_insn := PPC_STHX;
779 elsif std_match(f_in.insn, "100100--------------------------") then
780 report "PPC_stw";
781 ppc_insn := PPC_STW;
782 elsif std_match(f_in.insn, "011111---------------1010010110-") then
783 report "PPC_stwbrx";
784 ppc_insn := PPC_STWBRX;
785 elsif std_match(f_in.insn, "011111---------------0010010110-") then
786 report "PPC_stwcx";
787 ppc_insn := PPC_STWCX;
788 elsif std_match(f_in.insn, "100101--------------------------") then
789 report "PPC_stwu";
790 ppc_insn := PPC_STWU;
791 elsif std_match(f_in.insn, "011111---------------0010110111-") then
792 report "PPC_stwux";
793 ppc_insn := PPC_STWUX;
794 elsif std_match(f_in.insn, "011111---------------0010010111-") then
795 report "PPC_stwx";
796 ppc_insn := PPC_STWX;
797 elsif std_match(f_in.insn, "011111---------------0000101000-") then
798 report "PPC_subf";
799 ppc_insn := PPC_SUBF;
800 elsif std_match(f_in.insn, "011111---------------0000001000-") then
801 report "PPC_subfc";
802 ppc_insn := PPC_SUBFC;
803 elsif std_match(f_in.insn, "011111---------------0010001000-") then
804 report "PPC_subfe";
805 ppc_insn := PPC_SUBFE;
806 elsif std_match(f_in.insn, "001000--------------------------") then
807 report "PPC_subfic";
808 ppc_insn := PPC_SUBFIC;
809 elsif std_match(f_in.insn, "011111---------------0011101000-") then
810 report "PPC_subfme";
811 ppc_insn := PPC_SUBFME;
812 elsif std_match(f_in.insn, "011111---------------0011001000-") then
813 report "PPC_subfze";
814 ppc_insn := PPC_SUBFZE;
815 elsif std_match(f_in.insn, "011111---------------1001010110-") then
816 report "PPC_sync";
817 ppc_insn := PPC_SYNC;
818 elsif std_match(f_in.insn, "011111---------------0001000100-") then
819 report "PPC_td";
820 ppc_insn := PPC_TD;
821 elsif std_match(f_in.insn, "000010--------------------------") then
822 report "PPC_tdi";
823 ppc_insn := PPC_TDI;
824 elsif std_match(f_in.insn, "011111---------------0000000100-") then
825 report "PPC_tw";
826 ppc_insn := PPC_TW;
827 elsif std_match(f_in.insn, "000011--------------------------") then
828 report "PPC_twi";
829 ppc_insn := PPC_TWI;
830 elsif std_match(f_in.insn, "011111---------------0100111100-") then
831 report "PPC_xor";
832 ppc_insn := PPC_XOR;
833 elsif std_match(f_in.insn, "011010--------------------------") then
834 report "PPC_xori";
835 ppc_insn := PPC_XORI;
836 elsif std_match(f_in.insn, "011011--------------------------") then
837 report "PPC_xoris";
838 ppc_insn := PPC_XORIS;
839 elsif std_match(f_in.insn, "000001---------------0000000011-") then
840 report "PPC_SIM_CONFIG";
841 ppc_insn := PPC_SIM_CONFIG;
842 else
843 report "PPC_illegal";
844 ppc_insn := PPC_ILLEGAL;
845 end if;
846
847 v.decode := decode_rom_array(ppc_insn);
848 end if;
849
850 if flush_in = '1' then
851 v.valid := '0';
852 end if;
853
854 if rst = '1' then
855 v := Decode1ToDecode2Init;
856 end if;
857
858 -- Update registers
859 rin <= v;
860
861 -- Update outputs
862 d_out <= r;
863 end process;
864 end architecture behaviour;