Reformat execute2
[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_ADDC, 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_ADDC, 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_ADDC, 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_ADDC, 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_ADDC, 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_SUBFC, 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_SUBFC, 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_SUBFC, 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_SUBFC, 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
252 ppc_insn := PPC_ILLEGAL;
253
254 if f_in.valid = '1' then
255 report "Decode insn " & to_hstring(f_in.insn) & " at " & to_hstring(f_in.nia);
256
257 if std_match(f_in.insn, "011111---------------0100001010-") then
258 report "PPC_add";
259 ppc_insn := PPC_ADD;
260 elsif std_match(f_in.insn, "011111---------------0000001010-") then
261 report "PPC_addc";
262 ppc_insn := PPC_ADDC;
263 elsif std_match(f_in.insn, "011111---------------0010001010-") then
264 report "PPC_adde";
265 ppc_insn := PPC_ADDE;
266 elsif std_match(f_in.insn, "011111---------------0010101010-") then
267 report "PPC_addex";
268 ppc_insn := PPC_ADDEX;
269 elsif std_match(f_in.insn, "001110--------------------------") then
270 report "PPC_addi";
271 ppc_insn := PPC_ADDI;
272 elsif std_match(f_in.insn, "001100--------------------------") then
273 report "PPC_addic";
274 ppc_insn := PPC_ADDIC;
275 elsif std_match(f_in.insn, "001101--------------------------") then
276 report "PPC_addic.";
277 ppc_insn := PPC_ADDIC_RC;
278 elsif std_match(f_in.insn, "001111--------------------------") then
279 report "PPC_addis";
280 ppc_insn := PPC_ADDIS;
281 elsif std_match(f_in.insn, "011111---------------0011101010-") then
282 report "PPC_addme";
283 ppc_insn := PPC_ADDME;
284 elsif std_match(f_in.insn, "010011--------------------00010-") then
285 report "PPC_addpcis";
286 ppc_insn := PPC_ADDPCIS;
287 elsif std_match(f_in.insn, "011111---------------0011001010-") then
288 report "PPC_addze";
289 ppc_insn := PPC_ADDZE;
290 elsif std_match(f_in.insn, "011111---------------0000011100-") then
291 report "PPC_and";
292 ppc_insn := PPC_AND;
293 elsif std_match(f_in.insn, "011111---------------0000111100-") then
294 report "PPC_andc";
295 ppc_insn := PPC_ANDC;
296 elsif std_match(f_in.insn, "011100--------------------------") then
297 report "PPC_andi.";
298 ppc_insn := PPC_ANDI_RC;
299 elsif std_match(f_in.insn, "011101--------------------------") then
300 report "PPC_andis.";
301 ppc_insn := PPC_ANDIS_RC;
302 elsif std_match(f_in.insn, "000000---------------0100000000-") then
303 report "PPC_attn";
304 ppc_insn := PPC_ATTN;
305 elsif std_match(f_in.insn, "010010------------------------0-") then
306 report "PPC_b";
307 ppc_insn := PPC_B;
308 elsif std_match(f_in.insn, "010010------------------------1-") then
309 report "PPC_ba";
310 ppc_insn := PPC_BA;
311 elsif std_match(f_in.insn, "010000------------------------0-") then
312 report "PPC_bc";
313 ppc_insn := PPC_BC;
314 elsif std_match(f_in.insn, "010000------------------------10") then
315 report "PPC_bca";
316 ppc_insn := PPC_BCA;
317 elsif std_match(f_in.insn, "010011---------------1000010000-") then
318 report "PPC_bcctr";
319 ppc_insn := PPC_BCCTR;
320 elsif std_match(f_in.insn, "010000------------------------11") then
321 report "PPC_bcla";
322 ppc_insn := PPC_BCLA;
323 elsif std_match(f_in.insn, "010011---------------0000010000-") then
324 report "PPC_bclr";
325 ppc_insn := PPC_BCLR;
326 elsif std_match(f_in.insn, "010011---------------1000110000-") then
327 report "PPC_bctar";
328 ppc_insn := PPC_BCTAR;
329 elsif std_match(f_in.insn, "011111---------------0011111100-") then
330 report "PPC_bperm";
331 ppc_insn := PPC_BPERM;
332 elsif std_match(f_in.insn, "011111---------------0000000000-") then
333 report "PPC_cmp";
334 ppc_insn := PPC_CMP;
335 elsif std_match(f_in.insn, "011111---------------0111111100-") then
336 report "PPC_cmpb";
337 ppc_insn := PPC_CMPB;
338 elsif std_match(f_in.insn, "011111---------------0011100000-") then
339 report "PPC_cmpeqb";
340 ppc_insn := PPC_CMPEQB;
341 elsif std_match(f_in.insn, "001011--------------------------") then
342 report "PPC_cmpi";
343 ppc_insn := PPC_CMPI;
344 elsif std_match(f_in.insn, "011111---------------0000100000-") then
345 report "PPC_cmpl";
346 ppc_insn := PPC_CMPL;
347 elsif std_match(f_in.insn, "001010--------------------------") then
348 report "PPC_cmpli";
349 ppc_insn := PPC_CMPLI;
350 elsif std_match(f_in.insn, "011111---------------0011000000-") then
351 report "PPC_cmprb";
352 ppc_insn := PPC_CMPRB;
353 elsif std_match(f_in.insn, "011111---------------0000111010-") then
354 report "PPC_cntlzd";
355 ppc_insn := PPC_CNTLZD;
356 elsif std_match(f_in.insn, "011111---------------0000011010-") then
357 report "PPC_cntlzw";
358 ppc_insn := PPC_CNTLZW;
359 elsif std_match(f_in.insn, "011111---------------1000111010-") then
360 report "PPC_cnttzd";
361 ppc_insn := PPC_CNTTZD;
362 elsif std_match(f_in.insn, "011111---------------1000011010-") then
363 report "PPC_cnttzw";
364 ppc_insn := PPC_CNTTZW;
365 elsif std_match(f_in.insn, "010011---------------0100000001-") then
366 report "PPC_crand";
367 ppc_insn := PPC_CRAND;
368 elsif std_match(f_in.insn, "010011---------------0010000001-") then
369 report "PPC_crandc";
370 ppc_insn := PPC_CRANDC;
371 elsif std_match(f_in.insn, "010011---------------0100100001-") then
372 report "PPC_creqv";
373 ppc_insn := PPC_CREQV;
374 elsif std_match(f_in.insn, "010011---------------0011100001-") then
375 report "PPC_crnand";
376 ppc_insn := PPC_CRNAND;
377 elsif std_match(f_in.insn, "010011---------------0000100001-") then
378 report "PPC_crnor";
379 ppc_insn := PPC_CRNOR;
380 elsif std_match(f_in.insn, "010011---------------0111000001-") then
381 report "PPC_cror";
382 ppc_insn := PPC_CROR;
383 elsif std_match(f_in.insn, "010011---------------0110100001-") then
384 report "PPC_crorc";
385 ppc_insn := PPC_CRORC;
386 elsif std_match(f_in.insn, "010011---------------0011000001-") then
387 report "PPC_crxor";
388 ppc_insn := PPC_CRXOR;
389 elsif std_match(f_in.insn, "011111---------------1011110011-") then
390 report "PPC_darn";
391 ppc_insn := PPC_DARN;
392 elsif std_match(f_in.insn, "011111---------------0001010110-") then
393 report "PPC_dcbf";
394 ppc_insn := PPC_DCBF;
395 elsif std_match(f_in.insn, "011111---------------0000110110-") then
396 report "PPC_dcbst";
397 ppc_insn := PPC_DCBST;
398 elsif std_match(f_in.insn, "011111---------------0100010110-") then
399 report "PPC_dcbt";
400 ppc_insn := PPC_DCBT;
401 elsif std_match(f_in.insn, "011111---------------0011110110-") then
402 report "PPC_dcbtst";
403 ppc_insn := PPC_DCBTST;
404 elsif std_match(f_in.insn, "011111---------------1111110110-") then
405 report "PPC_dcbz";
406 ppc_insn := PPC_DCBZ;
407 elsif std_match(f_in.insn, "011111---------------0111101001-") then
408 report "PPC_divd";
409 ppc_insn := PPC_DIVD;
410 elsif std_match(f_in.insn, "011111---------------0110101001-") then
411 report "PPC_divde";
412 ppc_insn := PPC_DIVDE;
413 elsif std_match(f_in.insn, "011111---------------0110001001-") then
414 report "PPC_divdeu";
415 ppc_insn := PPC_DIVDEU;
416 elsif std_match(f_in.insn, "011111---------------0111001001-") then
417 report "PPC_divdu";
418 ppc_insn := PPC_DIVDU;
419 elsif std_match(f_in.insn, "011111---------------0111101011-") then
420 report "PPC_divw";
421 ppc_insn := PPC_DIVW;
422 elsif std_match(f_in.insn, "011111---------------0110101011-") then
423 report "PPC_divwe";
424 ppc_insn := PPC_DIVWE;
425 elsif std_match(f_in.insn, "011111---------------0110001011-") then
426 report "PPC_divweu";
427 ppc_insn := PPC_DIVWEU;
428 elsif std_match(f_in.insn, "011111---------------0111001011-") then
429 report "PPC_divwu";
430 ppc_insn := PPC_DIVWU;
431 elsif std_match(f_in.insn, "011111---------------0100011100-") then
432 report "PPC_eqv";
433 ppc_insn := PPC_EQV;
434 elsif std_match(f_in.insn, "011111---------------1110111010-") then
435 report "PPC_extsb";
436 ppc_insn := PPC_EXTSB;
437 elsif std_match(f_in.insn, "011111---------------1110011010-") then
438 report "PPC_extsh";
439 ppc_insn := PPC_EXTSH;
440 elsif std_match(f_in.insn, "011111---------------1111011010-") then
441 report "PPC_extsw";
442 ppc_insn := PPC_EXTSW;
443 elsif std_match(f_in.insn, "011111---------------110111101--") then
444 report "PPC_extswsli";
445 ppc_insn := PPC_EXTSWSLI;
446 elsif std_match(f_in.insn, "011111---------------1111010110-") then
447 report "PPC_icbi";
448 ppc_insn := PPC_ICBI;
449 elsif std_match(f_in.insn, "011111---------------0000010110-") then
450 report "PPC_icbt";
451 ppc_insn := PPC_ICBT;
452 elsif std_match(f_in.insn, "011111--------------------01111-") then
453 report "PPC_isel";
454 ppc_insn := PPC_ISEL;
455 elsif std_match(f_in.insn, "010011---------------0010010110-") then
456 report "PPC_isync";
457 ppc_insn := PPC_ISYNC;
458 elsif std_match(f_in.insn, "011111---------------0000110100-") then
459 report "PPC_lbarx";
460 ppc_insn := PPC_LBARX;
461 elsif std_match(f_in.insn, "100010--------------------------") then
462 report "PPC_lbz";
463 ppc_insn := PPC_LBZ;
464 elsif std_match(f_in.insn, "100011--------------------------") then
465 report "PPC_lbzu";
466 ppc_insn := PPC_LBZU;
467 elsif std_match(f_in.insn, "011111---------------0001110111-") then
468 report "PPC_lbzux";
469 ppc_insn := PPC_LBZUX;
470 elsif std_match(f_in.insn, "011111---------------0001010111-") then
471 report "PPC_lbzx";
472 ppc_insn := PPC_LBZX;
473 elsif std_match(f_in.insn, "111010------------------------00") then
474 report "PPC_ld";
475 ppc_insn := PPC_LD;
476 elsif std_match(f_in.insn, "011111---------------0001010100-") then
477 report "PPC_ldarx";
478 ppc_insn := PPC_LDARX;
479 elsif std_match(f_in.insn, "011111---------------1000010100-") then
480 report "PPC_ldbrx";
481 ppc_insn := PPC_LDBRX;
482 elsif std_match(f_in.insn, "111010------------------------01") then
483 report "PPC_ldu";
484 ppc_insn := PPC_LDU;
485 elsif std_match(f_in.insn, "011111---------------0000110101-") then
486 report "PPC_ldux";
487 ppc_insn := PPC_LDUX;
488 elsif std_match(f_in.insn, "011111---------------0000010101-") then
489 report "PPC_ldx";
490 ppc_insn := PPC_LDX;
491 elsif std_match(f_in.insn, "101010--------------------------") then
492 report "PPC_lha";
493 ppc_insn := PPC_LHA;
494 elsif std_match(f_in.insn, "011111---------------0001110100-") then
495 report "PPC_lharx";
496 ppc_insn := PPC_LHARX;
497 elsif std_match(f_in.insn, "101011--------------------------") then
498 report "PPC_lhau";
499 ppc_insn := PPC_LHAU;
500 elsif std_match(f_in.insn, "011111---------------0101110111-") then
501 report "PPC_lhaux";
502 ppc_insn := PPC_LHAUX;
503 elsif std_match(f_in.insn, "011111---------------0101010111-") then
504 report "PPC_lhax";
505 ppc_insn := PPC_LHAX;
506 elsif std_match(f_in.insn, "011111---------------1100010110-") then
507 report "PPC_lhbrx";
508 ppc_insn := PPC_LHBRX;
509 elsif std_match(f_in.insn, "101000--------------------------") then
510 report "PPC_lhz";
511 ppc_insn := PPC_LHZ;
512 elsif std_match(f_in.insn, "101001--------------------------") then
513 report "PPC_lhzu";
514 ppc_insn := PPC_LHZU;
515 elsif std_match(f_in.insn, "011111---------------0100110111-") then
516 report "PPC_lhzux";
517 ppc_insn := PPC_LHZUX;
518 elsif std_match(f_in.insn, "011111---------------0100010111-") then
519 report "PPC_lhzx";
520 ppc_insn := PPC_LHZX;
521 elsif std_match(f_in.insn, "111010------------------------10") then
522 report "PPC_lwa";
523 ppc_insn := PPC_LWA;
524 elsif std_match(f_in.insn, "011111---------------0000010100-") then
525 report "PPC_lwarx";
526 ppc_insn := PPC_LWARX;
527 elsif std_match(f_in.insn, "011111---------------0101110101-") then
528 report "PPC_lwaux";
529 ppc_insn := PPC_LWAUX;
530 elsif std_match(f_in.insn, "011111---------------0101010101-") then
531 report "PPC_lwax";
532 ppc_insn := PPC_LWAX;
533 elsif std_match(f_in.insn, "011111---------------1000010110-") then
534 report "PPC_lwbrx";
535 ppc_insn := PPC_LWBRX;
536 elsif std_match(f_in.insn, "100000--------------------------") then
537 report "PPC_lwz";
538 ppc_insn := PPC_LWZ;
539 elsif std_match(f_in.insn, "100001--------------------------") then
540 report "PPC_lwzu";
541 ppc_insn := PPC_LWZU;
542 elsif std_match(f_in.insn, "011111---------------0000110111-") then
543 report "PPC_lwzux";
544 ppc_insn := PPC_LWZUX;
545 elsif std_match(f_in.insn, "011111---------------0000010111-") then
546 report "PPC_lwzx";
547 ppc_insn := PPC_LWZX;
548 elsif std_match(f_in.insn, "000100--------------------110000") then
549 report "PPC_maddhd";
550 ppc_insn := PPC_MADDHD;
551 elsif std_match(f_in.insn, "000100--------------------110001") then
552 report "PPC_maddhdu";
553 ppc_insn := PPC_MADDHDU;
554 elsif std_match(f_in.insn, "000100--------------------110011") then
555 report "PPC_maddld";
556 ppc_insn := PPC_MADDLD;
557 elsif std_match(f_in.insn, "010011---------------0000000000-") then
558 report "PPC_mcrf";
559 ppc_insn := PPC_MCRF;
560 elsif std_match(f_in.insn, "011111---------------1000000000-") then
561 report "PPC_mcrxr";
562 ppc_insn := PPC_MCRXR;
563 elsif std_match(f_in.insn, "011111---------------1001000000-") then
564 report "PPC_mcrxrx";
565 ppc_insn := PPC_MCRXRX;
566 elsif std_match(f_in.insn, "011111-----0---------0000010011-") then
567 report "PPC_mfcr";
568 ppc_insn := PPC_MFCR;
569 elsif std_match(f_in.insn, "011111-----1---------0000010011-") then
570 report "PPC_mfocrf";
571 ppc_insn := PPC_MFOCRF;
572 -- Specific MF/MT SPR encodings first
573 elsif std_match(f_in.insn, "011111-----01001000000101010011-") then
574 report "PPC_mfctr";
575 ppc_insn := PPC_MFCTR;
576 elsif std_match(f_in.insn, "011111-----01000000000101010011-") then
577 report "PPC_mflr";
578 ppc_insn := PPC_MFLR;
579 elsif std_match(f_in.insn, "011111-----01100010000101010011-") then
580 report "PPC_mftb";
581 ppc_insn := PPC_MFTB;
582 elsif std_match(f_in.insn, "011111-----01001000000111010011-") then
583 report "PPC_mtctr";
584 ppc_insn := PPC_MTCTR;
585 elsif std_match(f_in.insn, "011111-----01000000000111010011-") then
586 report "PPC_mtlr";
587 ppc_insn := PPC_MTLR;
588 elsif std_match(f_in.insn, "011111---------------0101010011-") then
589 report "PPC_mfspr";
590 ppc_insn := PPC_MFSPR;
591 elsif std_match(f_in.insn, "011111---------------1100001001-") then
592 report "PPC_modsd";
593 ppc_insn := PPC_MODSD;
594 elsif std_match(f_in.insn, "011111---------------1100001011-") then
595 report "PPC_modsw";
596 ppc_insn := PPC_MODSW;
597 elsif std_match(f_in.insn, "011111---------------0100001001-") then
598 report "PPC_modud";
599 ppc_insn := PPC_MODUD;
600 elsif std_match(f_in.insn, "011111---------------0100001011-") then
601 report "PPC_moduw";
602 ppc_insn := PPC_MODUW;
603 elsif std_match(f_in.insn, "011111-----0---------0010010000-") then
604 report "PPC_mtcrf";
605 ppc_insn := PPC_MTCRF;
606 elsif std_match(f_in.insn, "011111-----1---------0010010000-") then
607 report "PPC_mtocrf";
608 ppc_insn := PPC_MTOCRF;
609 elsif std_match(f_in.insn, "011111---------------0111010011-") then
610 report "PPC_mtspr";
611 ppc_insn := PPC_MTSPR;
612 elsif std_match(f_in.insn, "011111----------------001001001-") then
613 report "PPC_mulhd";
614 ppc_insn := PPC_MULHD;
615 elsif std_match(f_in.insn, "011111----------------000001001-") then
616 report "PPC_mulhdu";
617 ppc_insn := PPC_MULHDU;
618 elsif std_match(f_in.insn, "011111----------------001001011-") then
619 report "PPC_mulhw";
620 ppc_insn := PPC_MULHW;
621 elsif std_match(f_in.insn, "011111----------------000001011-") then
622 report "PPC_mulhwu";
623 ppc_insn := PPC_MULHWU;
624 elsif std_match(f_in.insn, "011111---------------0011101001-") then
625 report "PPC_mulld";
626 ppc_insn := PPC_MULLD;
627 elsif std_match(f_in.insn, "000111--------------------------") then
628 report "PPC_mulli";
629 ppc_insn := PPC_MULLI;
630 elsif std_match(f_in.insn, "011111---------------0011101011-") then
631 report "PPC_mullw";
632 ppc_insn := PPC_MULLW;
633 elsif std_match(f_in.insn, "011111---------------0111011100-") then
634 report "PPC_nand";
635 ppc_insn := PPC_NAND;
636 elsif std_match(f_in.insn, "011111---------------0001101000-") then
637 report "PPC_neg";
638 ppc_insn := PPC_NEG;
639 elsif std_match(f_in.insn, "011111---------------0001111100-") then
640 report "PPC_nor";
641 ppc_insn := PPC_NOR;
642 elsif std_match(f_in.insn, "011111---------------0110111100-") then
643 report "PPC_or";
644 ppc_insn := PPC_OR;
645 elsif std_match(f_in.insn, "011111---------------0110011100-") then
646 report "PPC_orc";
647 ppc_insn := PPC_ORC;
648 -- Has to be before ori
649 elsif std_match(f_in.insn, "01100000000000000000000000000000") then
650 report "PPC_nop";
651 ppc_insn := PPC_NOP;
652 elsif std_match(f_in.insn, "011000--------------------------") then
653 report "PPC_ori";
654 ppc_insn := PPC_ORI;
655 elsif std_match(f_in.insn, "011001--------------------------") then
656 report "PPC_oris";
657 ppc_insn := PPC_ORIS;
658 elsif std_match(f_in.insn, "011111---------------0001111010-") then
659 report "PPC_popcntb";
660 ppc_insn := PPC_POPCNTB;
661 elsif std_match(f_in.insn, "011111---------------0111111010-") then
662 report "PPC_popcntd";
663 ppc_insn := PPC_POPCNTD;
664 elsif std_match(f_in.insn, "011111---------------0101111010-") then
665 report "PPC_popcntw";
666 ppc_insn := PPC_POPCNTW;
667 elsif std_match(f_in.insn, "011111---------------0010111010-") then
668 report "PPC_prtyd";
669 ppc_insn := PPC_PRTYD;
670 elsif std_match(f_in.insn, "011111---------------0010011010-") then
671 report "PPC_prtyw";
672 ppc_insn := PPC_PRTYW;
673 elsif std_match(f_in.insn, "011110---------------------1000-") then
674 report "PPC_rldcl";
675 ppc_insn := PPC_RLDCL;
676 elsif std_match(f_in.insn, "011110---------------------1001-") then
677 report "PPC_rldcr";
678 ppc_insn := PPC_RLDCR;
679 elsif std_match(f_in.insn, "011110---------------------010--") then
680 report "PPC_rldic";
681 ppc_insn := PPC_RLDIC;
682 elsif std_match(f_in.insn, "011110---------------------000--") then
683 report "PPC_rldicl";
684 ppc_insn := PPC_RLDICL;
685 elsif std_match(f_in.insn, "011110---------------------001--") then
686 report "PPC_rldicr";
687 ppc_insn := PPC_RLDICR;
688 elsif std_match(f_in.insn, "011110---------------------011--") then
689 report "PPC_rldimi";
690 ppc_insn := PPC_RLDIMI;
691 elsif std_match(f_in.insn, "010100--------------------------") then
692 report "PPC_rlwimi";
693 ppc_insn := PPC_RLWIMI;
694 elsif std_match(f_in.insn, "010101--------------------------") then
695 report "PPC_rlwinm";
696 ppc_insn := PPC_RLWINM;
697 elsif std_match(f_in.insn, "010111--------------------------") then
698 report "PPC_rlwnm";
699 ppc_insn := PPC_RLWNM;
700 elsif std_match(f_in.insn, "011111---------------0010000000-") then
701 report "PPC_setb";
702 ppc_insn := PPC_SETB;
703 elsif std_match(f_in.insn, "011111---------------0000011011-") then
704 report "PPC_sld";
705 ppc_insn := PPC_SLD;
706 elsif std_match(f_in.insn, "011111---------------0000011000-") then
707 report "PPC_slw";
708 ppc_insn := PPC_SLW;
709 elsif std_match(f_in.insn, "011111---------------1100011010-") then
710 report "PPC_srad";
711 ppc_insn := PPC_SRAD;
712 elsif std_match(f_in.insn, "011111---------------110011101--") then
713 report "PPC_sradi";
714 ppc_insn := PPC_SRADI;
715 elsif std_match(f_in.insn, "011111---------------1100011000-") then
716 report "PPC_sraw";
717 ppc_insn := PPC_SRAW;
718 elsif std_match(f_in.insn, "011111---------------1100111000-") then
719 report "PPC_srawi";
720 ppc_insn := PPC_SRAWI;
721 elsif std_match(f_in.insn, "011111---------------1000011011-") then
722 report "PPC_srd";
723 ppc_insn := PPC_SRD;
724 elsif std_match(f_in.insn, "011111---------------1000011000-") then
725 report "PPC_srw";
726 ppc_insn := PPC_SRW;
727 elsif std_match(f_in.insn, "100110--------------------------") then
728 report "PPC_stb";
729 ppc_insn := PPC_STB;
730 elsif std_match(f_in.insn, "011111---------------1010110110-") then
731 report "PPC_stbcx";
732 ppc_insn := PPC_STBCX;
733 elsif std_match(f_in.insn, "100111--------------------------") then
734 report "PPC_stbu";
735 ppc_insn := PPC_STBU;
736 elsif std_match(f_in.insn, "011111---------------0011110111-") then
737 report "PPC_stbux";
738 ppc_insn := PPC_STBUX;
739 elsif std_match(f_in.insn, "011111---------------0011010111-") then
740 report "PPC_stbx";
741 ppc_insn := PPC_STBX;
742 elsif std_match(f_in.insn, "111110------------------------00") then
743 report "PPC_std";
744 ppc_insn := PPC_STD;
745 elsif std_match(f_in.insn, "011111---------------1010010100-") then
746 report "PPC_stdbrx";
747 ppc_insn := PPC_STDBRX;
748 elsif std_match(f_in.insn, "011111---------------0011010110-") then
749 report "PPC_stdcx";
750 ppc_insn := PPC_STDCX;
751 elsif std_match(f_in.insn, "111110------------------------01") then
752 report "PPC_stdu";
753 ppc_insn := PPC_STDU;
754 elsif std_match(f_in.insn, "011111---------------0010110101-") then
755 report "PPC_stdux";
756 ppc_insn := PPC_STDUX;
757 elsif std_match(f_in.insn, "011111---------------0010010101-") then
758 report "PPC_stdx";
759 ppc_insn := PPC_STDX;
760 elsif std_match(f_in.insn, "101100--------------------------") then
761 report "PPC_sth";
762 ppc_insn := PPC_STH;
763 elsif std_match(f_in.insn, "011111---------------1110010110-") then
764 report "PPC_sthbrx";
765 ppc_insn := PPC_STHBRX;
766 elsif std_match(f_in.insn, "011111---------------1011010110-") then
767 report "PPC_sthcx";
768 ppc_insn := PPC_STHCX;
769 elsif std_match(f_in.insn, "101101--------------------------") then
770 report "PPC_sthu";
771 ppc_insn := PPC_STHU;
772 elsif std_match(f_in.insn, "011111---------------0110110111-") then
773 report "PPC_sthux";
774 ppc_insn := PPC_STHUX;
775 elsif std_match(f_in.insn, "011111---------------0110010111-") then
776 report "PPC_sthx";
777 ppc_insn := PPC_STHX;
778 elsif std_match(f_in.insn, "100100--------------------------") then
779 report "PPC_stw";
780 ppc_insn := PPC_STW;
781 elsif std_match(f_in.insn, "011111---------------1010010110-") then
782 report "PPC_stwbrx";
783 ppc_insn := PPC_STWBRX;
784 elsif std_match(f_in.insn, "011111---------------0010010110-") then
785 report "PPC_stwcx";
786 ppc_insn := PPC_STWCX;
787 elsif std_match(f_in.insn, "100101--------------------------") then
788 report "PPC_stwu";
789 ppc_insn := PPC_STWU;
790 elsif std_match(f_in.insn, "011111---------------0010110111-") then
791 report "PPC_stwux";
792 ppc_insn := PPC_STWUX;
793 elsif std_match(f_in.insn, "011111---------------0010010111-") then
794 report "PPC_stwx";
795 ppc_insn := PPC_STWX;
796 elsif std_match(f_in.insn, "011111---------------0000101000-") then
797 report "PPC_subf";
798 ppc_insn := PPC_SUBF;
799 elsif std_match(f_in.insn, "011111---------------0000001000-") then
800 report "PPC_subfc";
801 ppc_insn := PPC_SUBFC;
802 elsif std_match(f_in.insn, "011111---------------0010001000-") then
803 report "PPC_subfe";
804 ppc_insn := PPC_SUBFE;
805 elsif std_match(f_in.insn, "001000--------------------------") then
806 report "PPC_subfic";
807 ppc_insn := PPC_SUBFIC;
808 elsif std_match(f_in.insn, "011111---------------0011101000-") then
809 report "PPC_subfme";
810 ppc_insn := PPC_SUBFME;
811 elsif std_match(f_in.insn, "011111---------------0011001000-") then
812 report "PPC_subfze";
813 ppc_insn := PPC_SUBFZE;
814 elsif std_match(f_in.insn, "011111---------------1001010110-") then
815 report "PPC_sync";
816 ppc_insn := PPC_SYNC;
817 elsif std_match(f_in.insn, "011111---------------0001000100-") then
818 report "PPC_td";
819 ppc_insn := PPC_TD;
820 elsif std_match(f_in.insn, "000010--------------------------") then
821 report "PPC_tdi";
822 ppc_insn := PPC_TDI;
823 elsif std_match(f_in.insn, "011111---------------0000000100-") then
824 report "PPC_tw";
825 ppc_insn := PPC_TW;
826 elsif std_match(f_in.insn, "000011--------------------------") then
827 report "PPC_twi";
828 ppc_insn := PPC_TWI;
829 elsif std_match(f_in.insn, "011111---------------0100111100-") then
830 report "PPC_xor";
831 ppc_insn := PPC_XOR;
832 elsif std_match(f_in.insn, "011010--------------------------") then
833 report "PPC_xori";
834 ppc_insn := PPC_XORI;
835 elsif std_match(f_in.insn, "011011--------------------------") then
836 report "PPC_xoris";
837 ppc_insn := PPC_XORIS;
838 elsif std_match(f_in.insn, "000001---------------0000000011-") then
839 report "PPC_SIM_CONFIG";
840 ppc_insn := PPC_SIM_CONFIG;
841 else
842 report "PPC_illegal";
843 ppc_insn := PPC_ILLEGAL;
844 end if;
845
846 v.decode := decode_rom_array(ppc_insn);
847 end if;
848
849 if flush_in = '1' then
850 v.valid := '0';
851 end if;
852
853 if rst = '1' then
854 v := Decode1ToDecode2Init;
855 end if;
856
857 -- Update registers
858 rin <= v;
859
860 -- Update outputs
861 d_out <= r;
862 end process;
863 end architecture behaviour;