1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.h $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* COPYRIGHT International Business Machines Corp. 2012,2014 */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
/* You may obtain a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
/* implied. See the License for the specific language governing */
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
// $Id: pore_inline_decode.h,v 1.4 2013/11/27 15:52:18 thi Exp $
#ifndef __PORE_INLINE_DECODE_H__
#define __PORE_INLINE_DECODE_H__
#include <stdint.h>
#include "pore_inline_decode.h"
#ifdef __cplusplus
extern "C" {
#endif
/* latest definitions can be found in pgas.h */
#define PORE_OPCODE_NOP 0x0f
#define PORE_OPCODE_WAIT 0x01
#define PORE_OPCODE_TRAP 0x02
#define PORE_OPCODE_HOOK 0x4f
#define PORE_OPCODE_BRA 0x10
#define PORE_OPCODE_BRAZ 0x12
#define PORE_OPCODE_BRANZ 0x13
#define PORE_OPCODE_BRAI 0x51
#define PORE_OPCODE_BSR 0x14
#define PORE_OPCODE_BRAD 0x1c
#define PORE_OPCODE_BSRD 0x1d
#define PORE_OPCODE_RET 0x15
#define PORE_OPCODE_CMPBRA 0x56
#define PORE_OPCODE_CMPNBRA 0x57
#define PORE_OPCODE_CMPBSR 0x58
#define PORE_OPCODE_LOOP 0x1f
#define PORE_OPCODE_ANDI 0x60
#define PORE_OPCODE_ORI 0x61
#define PORE_OPCODE_XORI 0x62
#define PORE_OPCODE_AND 0x25
#define PORE_OPCODE_OR 0x26
#define PORE_OPCODE_XOR 0x27
#define PORE_OPCODE_ADD 0x23
#define PORE_OPCODE_ADDI 0x24
#define PORE_OPCODE_SUB 0x29
#define PORE_OPCODE_SUBI 0x28
#define PORE_OPCODE_NEG 0x2a
#define PORE_OPCODE_COPY 0x2c
#define PORE_OPCODE_ROL 0x2e
#define PORE_OPCODE_LOAD20 0x30
#define PORE_OPCODE_LOAD64 0x71
#define PORE_OPCODE_SCR1RD 0x32
#define PORE_OPCODE_SCR1RDA 0x73
#define PORE_OPCODE_SCR2RD 0x36
#define PORE_OPCODE_SCR2RDA 0x77
#define PORE_OPCODE_WRI 0x78
#define PORE_OPCODE_BS 0x74
#define PORE_OPCODE_BC 0x75
#define PORE_OPCODE_SCR1WR 0x39
#define PORE_OPCODE_SCR2WR 0x3a
#define PORE_OPCODE_SCAND 0x7c
#ifndef __ASSEMBLER__
/* Internal register encodings for the execution engine */
typedef enum {
PORE_PRV_BASE_ADDR0_ENC = 0x00,
PORE_PRV_BASE_ADDR1_ENC = 0x01,
PORE_OCI_MEMORY_BASE_ADDR0_ENC = 0x02,
PORE_OCI_MEMORY_BASE_ADDR1_ENC = 0x03,
PORE_SCRATCH0_ENC = 0x04,
PORE_SCRATCH1_ENC = 0x05,
PORE_SCRATCH2_ENC = 0x06,
PORE_ERROR_MASK_ENC = 0x07,
/* PORE_MEM_RELOC_ENC = 0x07, */
PORE_TABLE_BASE_ADDR_ENC = 0x08,
PORE_EXE_TRIGGER_ENC = 0x09,
PORE_DATA0_ENC = 0x0a,
/* PORE_I2C_E0_PARAM_ENC = 0x0b, */
/* PORE_I2C_E1_PARAM_ENC = 0x0c, */
/* PORE_I2C_E2_PARAM_ENC = 0x0d, */
PORE_PC_ENC = 0x0e,
PORE_ALU_IBUF_ID_ENC = 0x0f
} pore_internal_reg_t;
typedef struct {
/// The first 32 bits of every instruction
uint32_t instruction;
/// The opcode; bits 0..6 of the instruction
int opcode;
// Is this instruction 4 or 12 bytes long; bit 0 of the instruction
int long_instruction;
// bit 8 of the instruction which is within the ima24 address
int memory_space;
/// The parity bit; bit 7 of the instruction
int parity;
/// The register specifier at bits 8..11 of the instruction
///
/// This register is sometimes called the source, sometimes the target,
/// depending on the opcode.
int tR;
int r0;
/// The register specifier at bits 12..15 of the instruction
///
/// This register is always called the 'source' but is named generically
/// here since sometimes the specifier at bits 8..11 is also called a
/// 'source'.
int sR;
int r1;
/// 'ImD16' is the signed 16-bit immediate for short immediate adds and
/// subtracts. For the rotate instruction this field also contains the
/// rotate count which is either 1, 4, 8, 16 or 32.
int16_t imd16;
/// 'ImD20' is the 20-bit unsigned immediate for the LOAD20 instruction
int32_t imd20;
/// 'ImD24' is the 24-bit unsigned immediate for the WAIT instruction
uint32_t imd24;
/// 'ImA24' is the 24-bit unsigned immediate representing an address
uint32_t ima24;
/// 'ImD64' is the 64-bit immediate for data immediates and BRAI. This
/// field is only set for 3-word instructions.
uint64_t imd64;
/// 'ImPCO20' is a signed, 20-bit word offset for branch instructions
int32_t impco20;
/// 'ImPCO24' is a signed, 24-bit word offset for branch instructions
int32_t impco24;
/// 'ImPC48' is a signed, 48-bit word offset for branch instructions
int64_t impc48;
/// This is the base register specifier - either a memory (OCI) base
/// register or a pervasive base register - for Read/Write operations.
int base_register;
/// This is the 22-bit signed offset for memory (OCI) addressing
int32_t memory_offset;
/// This field contains the port number and local address portions of the
/// PIB/PCB address for load/store operations that target the PIB/PCB.
/// Note that bits 0..11 will always be 0 in this address. Bits 1..7 (the
/// multicast bit and chiplet id) are sourced from the associated
/// pervasive base register when the instruction executes.
uint32_t pib_offset;
/// The update bit of the SCAND instruction
int update;
/// The capture bit of the SCAND instruction
int capture;
/// The scan length from a SCAND instruction
int scan_length;
/// The scan select from a SCAND instruction
uint32_t scan_select;
/// The address offset from a SCAND instruction
uint32_t scan_offset;
} PoreInlineDecode;
void
vpore_inline_decode_instruction(PoreInlineDecode *dis, uint32_t instruction);
void
vpore_inline_decode_imd64(PoreInlineDecode *dis, uint64_t imd64);
#ifdef __cplusplus
} /* closing brace for extern "C" */
#endif
#endif /* __ASSEMBLER__ */
#endif /* __PORE_INLINE_DECODE_H__ */
|