The operand field specifies up to four operands. Each operand is obtained from the incoming packet data, from an internal register or as an immediate value specified in the instruction itself. In addition, there is a bit mask associated with each operand. The mask values are encoded in the instruction itself and the mask for each operand is applied before it is used by the Arithmetic and Logic Unit.
The operands are input to the two 32-bit Arithmetic and Logic units. For all calculations, a mask is used with each operand. The mask is a 32-bit number that is generated from a 5-bit code provided in the instruction or from an immediate value in the instruction. The 5-bit mask code specifies how many bits (from the LSB side) will be input to the ALU. An immediate mask must be used when the mask is not a continuous sequence of 1’s. Whenever an immediate mask value is specified, the mask value specified by the ‘Bits’ fields is ignored.
Each operand is at least 13-bits long and the encoding for each operand types is shown in Table 24-894 to Table 24-901.
Table 24-894 Packet Data OperandDescription | This type of operand is derived from the packet itself. The encoding specifies a number of bits (up to 32) to be extracted from a location in the packet indicated by the selected base register and offset. The format of 13-bit operand code is shown below. Internally, a 32-bit number is obtained from the packet. Then, a mask is created from the bits[4:0] field and bitwise ANDed with the 32- bits extracted from the packet. |
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Base[2:0] | Offset[4:0] | Bits[4:0] |
Bits | Field Name | Description |
---|
12:10 | Base[2:0] | The Base field selects one of the Base registers B0, B1, B2, B3 or B4. The operand comprises of (Bits+1) bits extracted from the packet. The offset from where the operand octets are extracted is determined by the sum of the value of specified base register (Base 0 to Base 4) and the specified offset. Base 0 is start of packet. |
9:5 | Offset[4:0] | The value of the selected base register plus the specified offset is the octet location in the packet from where the specified number of bits will be picked. |
4:0 | Bits[4:0] | The number of bits to be used as operand is specified by Bits+1. When Bits[4:0] is zero, only one bit is used as operand. When Bits[4:0] is 31, then 32 bits are used as operand. |
Table 24-895 Constant OperandDescription | One of the eight constants programmed by the host software can be used as operand. The bits field specifies the mask to be applied to the selected 32-bit constant. |
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 0 | 1 | 0 | 0 | C[2:0] | Bits[4:0] |
Bits | Field Name | Description |
---|
7:5 | C[2:0] | This field selects one of the constants (C0-C7). |
4:0 | Bits[4:0] | The number of bits to be used as operand is specified by Bits+1. When Bits[4:0] is zero, the least significant bit is used as operand. When Bits[4:0] is 2, then two LSBs are used as operand and so on. |
Table 24-896 32-bit Register OperandDescription | One of eight 32-bit registers is used as operand and bits[4:0] field specifies the bitmask to be applied to that register. |
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 0 | 1 | 0 | 1 | R[2:0] | Bits[4:0] |
Bits | Field Name | Description |
---|
7:5 | R[2:0] | This field selects one of the 32-bits registers (R0-R7). |
4:0 | Bits[4:0] | The number of bits to be used as operand is specified by Bits+1. When Bits[4:0] is zero, the least significant bit is used as operand. When Bits[4:0] is 2, then two LSBs are used as operand and so on. |
Table 24-897 1-bit Register OperandDescription | One of the four 1-bit registers is used as operand. |
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 0 | 1 | 1 | 0 | 0 | T[1:0] | 0 | 0 | 0 | 0 | 0 |
Bits | Field Name | Description |
---|
6:5 | T[1:0] | This field selects one of the four 1-bits registers (T0-T3). |
Table 24-898 Base Register OperandDescription | One of the base registers is used. The 2-bit codes are 00, 01, 10 and 11 for B1 to B4 respectively. |
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 0 | 1 | 1 | 1 | 1 | B[1:0] | 0 | 0 | Bits[2:0] |
Bits | Field Name | Description |
---|
6:5 | B[1:0] | This field selects one of the four base registers (B1-B4). Note that B0 is a virtual register which is always zero and specifies the start of packet. |
2:0 | Bits[2:0] | The number of bits to be used as operand is specified by Bits+1. When Bits[4:0] is zero, the least significant bit is used as operand. When Bits[4:0] is 2, then two LSBs are used as operand and so on. |
Table 24-899 End of Packet OperandDescription | The End-of-Packet (EOP) operand can be used to detect the end of current packet. Use of this operand will stall the CPU until the end of packet is reached. The end of packet operand will always be equal to one when the CPU detects end of packet. It will be zero until packet data is being received and will also stall the CPU. The recommended use of this operand is in the last instruction where a check may be made for size of current packet. Note that this operand only tracks the end of a complete successfully received packet by the RFIFO. The EOP operand does not detect abort of a packet. |
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | Bits[4:0] |
Bits | Field Name | Description |
---|
4:0 | Bits[4:0] | The number of bits specifies the mask. However, these bits are inconsequential for EOP operand. Irrespective of the mask specified by bits[4:0], the EOP operand is always equal to 0x1 in the execution cycle of the instruction it is used. |
Table 24-900 Octet Count OperandDescription | The Octet count operand is used to determine the number of bytes that have been received by rule engine. |
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | Bits[4:0] |
Bits | Field Name | Description |
---|
4:0 | Bits[4:0] | The number of bits specifies the mask that is applied to octet counter value. The recommend value for this field is 0x1F. |
Table 24-901 Immediate Data OperandsDescription | The immediate data operands can be bigger than 13 bits as shown in the codes below. Each of such operands is directly sent to the ALU without applying any addition bit mask. The immediate data operands can be 8, 16 or 32 bits wide. |
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 1 | 1 | 0 | 0 | Data[7:0] |
20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 1 | 1 | 0 | 1 | Data[15:0] |
36 | 35 | 34 | 33 | 32 | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 1 | 1 | 1 | 0 | Data[31:0] |
Table 24-902 Immediate Operand MasksDescription | The operand fields can also be used to specify bit masks. These are used when only specific bits from an operand are to be extracted. There is provision for 8-bit and 16-bit masks that can be encoded into an instruction’s operand field. |
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 1 | 0 | 0 | 0 | Mask[7:0] |
20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 1 | 0 | 0 | 1 | Mask[15:0] |
When the operand field is all-ones it does not specify any operand and is considered zero.
The tables below list the combinations in which operands may be programmed in an instruction. In this list, Pkt/Reg operand is an operand consisting of octets from the packet or the contents of one of the internal registers; mask specifies the value that is used as a mask instead of the mask generated from the Bits field in the instruction; immediate operand (immediate[7:0], immediate[15:0] and immediate[31:0]) is an 8/16/32 bit number that is used as an operand. The format of Pkt/Reg operand is as shown previously. The decoding of operands for each ALU is dependent upon the type of operation specified in the ALU and the format of the operand field. When there are four operands in the operand field, the first and second operands are used in ALU0 and the rest by ALU1. When ALU0 needs only one operand, then the remaining operands are fed to ALU1. The order of decoding operands is designed to first provide operands to ALU0 from the more significant side of operand field and then to ALU1. If the number of operands specified in instruction does not match with the number of operands required by the ALUs, unspecified behavior can occur. For an instruction to execute, both ALUs must have valid data. If any of the ALUs uses a packet data operand which is not yet available then the rule engine stalls until data is available. During the stall phase, the instruction is decoded every cycle and all required operands must be available simultaneously for the instruction to be executed In addition, if an instruction refers to packet octets that are no longer available, the rule engine stalls until the end of packet.
Table 24-903 Operand Field With Four OperandsPkt / Reg / Imm[7:0] Operand[12:0] | Pkt / Reg / Imm [7:0] Operand[12:0] | Pkt / Reg / Imm [7:0] Operand[12:0] | Pkt / Reg / Imm [7:0] Operand[12:0] |
Table 24-904 Operand Field With Three OperandsPkt / Reg / Imm[7:0] Operand[12:0] | Pkt / Reg / Imm [7:0] Operand[12:0] | Pkt / Reg / Imm [7:0] Operand[12:0] | Reserved |
Pkt/Reg Operand[12:0] | 11000 Mask[7:0] | Pkt / Reg / Imm [7:0] Operand[12:0] | Pkt / Reg / Imm [7:0] Operand[12:0] |
Pkt / Reg / Imm[7:0] Operand[12:0] | Pkt/Reg Operand[12:0] | 11000 Mask[7:0] | Pkt / Reg / Imm [7:0] Operand[12:0] |
Pkt / Reg / Imm[7:0] Operand[12:0] | Pkt / Reg / Imm [7:0] Operand[12:0] | Pkt/Reg Operand[12:0] | 11000 Mask[7:0] |
11101 Immediate[15:0] 11111 | Pkt / Reg / Imm[7:0] Operand[12:0] | Pkt / Reg / Imm[7:0] Operand[12:0] |
Pkt / Reg / Imm[7:0] Operand[12:0] | 11101 Immediate[15:0] 11111 | Pkt / Reg / Imm[7:0] Operand[12:0] |
Table 24-905 Operand Field With Two OperandsPkt / Reg / Imm[7:0] Operand[12:0] | Pkt / Reg / Imm [7:0] Operand[12:0] | Reserved | Reserved |
Pkt / Reg / Imm[7:0] Operand[12:0] | Pkt/Reg Operand[12:0] | 11000 Mask[7:0] | Reserved |
Pkt/Reg Operand[12:0] | 11000 Mask[7:0] | Pkt / Reg / Imm[7:0] Operand[12:0] | Reserved |
Pkt/Reg Operand[12:0] | 11000 Mask[7:0] | Pkt/Reg Operand[12:0] | 11000 Mask[7:0] |
11101 Immediate[15:0] 11111 | Pkt/Reg Operand[12:0] | 11000 Mask[7:0] |
Pkt / Reg / Imm[7:0] Operand[12:0] | 11101 Immediate[15:0] 11111 | Reserved |
Pkt/Reg Operand[12:0] | 11000 Mask[7:0] | 11101 Immediate[15:0] 11111 |
11101 Immediate[15:0] 11111 | 11101 Immediate[15:0] 11111 |
11101 Immediate[15:0] 11111 | Pkt / Reg / Imm[7:0] Operand[12:0] | Reserved |
Pkt/Reg Operand[12:0] | 11001 Mask[15:0] 11111 | Pkt / Reg / Imm[7:0] Operand[12:0] |
Pkt / Reg / Imm[7:0] Operand[12:0] | Pkt/Reg Operand[12:0] | 11001 Mask[15:0] 11111 |
Pkt/Reg Operand[12:0] | 1101 Mask[15:0] 01 Immediate[15:0] |
Pkt / Reg / Imm[7:0] Operand[12:0] | 11110 Immediate[31:0] 11 |
11110 Immediate[31:0] 11 | Pkt / Reg / Imm[7:0] Operand[12:0] |
Table 24-906 Operand Field With One OperandPkt / Reg / Imm[7:0] Operand[12:0] | Reserved | Reserved | Reserved |
Pkt/Reg Operand[12:0] | 11000 Mask[7:0] | Reserved | Reserved |
Pkt/Reg Operand[12:0] | 11001 Mask[15:0] 11111 | Reserved |
11101 Immediate[15:0] 11111 | Reserved | Reserved |
11110 Immediate[31:0] 11 | Reserved |
The formats in which operands are specified in the operand field have certain restrictions:
- a mask cannot follow an immediate value
- a mask cannot follow a previous mask
- a reserved field should have all following fields reserved as well
- the first field cannot be a mask