Method and apparatus for comparing source data in a processor
By using Single Instruction Multiple Data (SIMD) instructions in the DSP to compare source data, the instruction overhead problem of the DSP in identifying the maximum or minimum value of an array and its position is solved, thus improving the performance of the sorting function.
Patent Information
- Application Number
- CN202010424516.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-05-24
- Filing Date
- 2020-05-19
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2040-05-19
AI Technical Summary
Modern digital signal processors (DSPs) require multiple instructions to identify the minimum or maximum value and its position in an array when performing sorting functions, which increases instruction overhead and affects performance.
Using Single Instruction Multiple Data (SIMD) instructions, the channel data of the first and second source registers are compared in the processor through a single indexed vector maximum or minimum value instruction. The maximum or minimum value is identified and stored in the destination register, while the channel of the assertion register is identified or de-identified to identify the position.
This reduces the instruction overhead required for the sorting function and improves the performance of the DSP when performing the sorting function.
Smart Images

Figure CN111984316B_ABST
Abstract
Description
Technical Field
[0001] This application relates to comparing source data in a processor, and more particularly to a method and apparatus for comparing source data in a processor in response to an instruction for a vector maximum or minimum value with an index. Background Technology
[0002] Modern digital signal processors (DSPs) face multiple challenges. DSPs may frequently execute software that requires sorting functions. Sorting functions may need to identify the minimum or maximum value in an array of values, and in some cases, the position or index of that minimum or maximum value. Multiple instructions may be required to identify the minimum or maximum value and its position, increasing instruction overhead due to the frequent and repetitive nature of sorting functions performed by DSPs. Summary of the Invention
[0003] According to at least one embodiment of this disclosure, a method for comparing first and second source data in a processor in response to an indexed vector maximum or minimum value instruction includes designating first and second source registers containing the first and second source data, a destination register storing the comparison data, and an assertion register. Each of the registers includes multiple channels. The method includes executing instructions by: comparing, for each channel in the first and second source registers, a value in the channel of the first source register with a value in the corresponding channel of the second source register to identify a maximum or minimum value; storing the maximum or minimum value in the corresponding channel of the destination register; confirming the corresponding channel of the assertion register if the maximum or minimum value originates from the first source register; and deconfirming the corresponding channel of the assertion register if the maximum or minimum value originates from the second source register.
[0004] According to another embodiment of this disclosure, a data processor includes a first source register configured to contain first source data, a second source register configured to contain second source data, a destination register, and an assertion register. Each of the first and second source registers, the destination register, and the assertion register includes multiple channels. In response to executing a single indexed vector maximum or minimum value instruction, the data processor is configured to compare a value in a channel of the first source register with a corresponding value in a corresponding channel of the second source register to identify a maximum or minimum value; store the maximum or minimum value in a corresponding channel of the destination register; identify a corresponding channel of the assertion register because the maximum or minimum value originates from the first source register; and de-identify a corresponding channel of the assertion register because the maximum or minimum value originates from the second source register. Attached Figure Description
[0005] For a detailed description of each example, reference will now be made to the accompanying drawings, in which:
[0006] Figure 1 A dual scalar / vector datapath processor is shown in accordance with various examples;
[0007] Figure 2 A dual scalar / vector datapath processor is shown in accordance with various examples; Figure 1 A register and functional unit in a dual scalar / vector datapath processor is shown in accordance with various examples;
[0008] Figure 3 An exemplary global scalar register file is shown;
[0009] Figure 4 An exemplary local scalar register file shared by arithmetic functional units is shown;
[0010] Figure 5 An exemplary local scalar register file shared by multiply functional units is shown;
[0011] Figure 6 An exemplary local scalar register file shared by load / store units is shown;
[0012] Figure 7 An exemplary global vector register file is shown;
[0013] Figure 8 An exemplary predicate register file is shown;
[0014] Figure 9 An exemplary local vector register file shared by arithmetic functional units is shown;
[0015] Figure 10 An exemplary local vector register file shared by multiply and related functional units is shown;
[0016] Figure 11 A pipeline stage of a central processing unit is shown in accordance with various examples;
[0017] Figure 12 Sixteen instructions of a single fetch packet are shown in accordance with various examples;
[0018] Figure 13 A set of exemplary registers related to instruction execution is shown in accordance with various examples, including first and second source registers, a destination register, and a predicate register;
[0019] Figures 14A-14D Numerical examples of instruction execution are shown in accordance with various examples;
[0020] Figure 15 Instruction encodings of instructions are shown in accordance with various examples; and
[0021] Figure 16 A flowchart illustrating a method of executing instructions according to various examples is shown. DETAILED DESCRIPTION
[0022] As explained above, DSPs typically execute software that requires sorting functions to be performed. Although sorting functions are generally well understood, implementing sorting functions at the processor level (e.g., using assembly or compiler level instructions) can require multiple instructions. For example, a sorting function can require identifying a minimum or maximum value in an array of values, as well as identifying the position or index of the identified minimum or maximum value in the array. Since sorting functions performed by DSPs are typically frequent and repetitive, it is undesirable to increase instruction overhead.
[0023] To improve the performance of a DSP performing sorting functions by at least reducing the instruction overhead required to perform those sorting functions, examples of the present disclosure are directed to a vector max / min with index instruction that compares first source data in a first source register to second source data in a second source register. The vector max / min with index instruction is a single instruction multiple data (SIMD) instruction that operates on data in corresponding lanes of the first and second source registers. For example, the first and second source registers are 512-bit vector registers, and each lane is an 8-bit lane, such that 64 comparisons are performed in response to executing a single vector max / min with index instruction.
[0024] Referring to the vector max with index instruction, executing the vector max with index instruction compares data in corresponding lanes of the first and second source registers, identifies a maximum value for each pair of compared data (i.e., data from the first and second source registers in a single lane), and stores the maximum values in a destination register. In at least one example, the destination register is the second source register. The vector max with index instruction also asserts or de-asserts a corresponding lane of a predicate register for each lane based on the comparison results of the corresponding lanes of the first and second source registers. For example, if the identified maximum value is from the first source register, the corresponding lane in the predicate register is asserted; if the identified maximum value is from the second source register, the corresponding lane in the predicate register is de-asserted. The predicate register values are used, for example, in the next sorting iteration to zero out “lost” items (e.g., those where the identified maximum value is from the second source register and thus the corresponding lane in the predicate register is de-asserted), such that the corresponding values in the first source register are no longer in the sorting pool.
[0025] The operation of the indexed vector min instruction is similar, except that instead of identifying the maximum value of each pair of compared data, the indexed vector min instruction identifies the minimum value and stores the minimum value in the destination register. The indexed vector min instruction also asserts or de-asserts the corresponding lane of the predicate register for each lane based on the comparison result of the corresponding lanes of the first and second source registers. For example, if the identified minimum value is from the first source register, the corresponding lane in the predicate register is asserted; if the identified minimum value is from the second source register, the corresponding lane in the predicate register is de-asserted. Similar to above, the predicate register value is used, for example, in the next sort iteration to zero out the "lost" entries (e.g., those where the identified minimum value is from the second source register and thus the corresponding lane in the predicate register is de-asserted), so that the corresponding value in the first source register is no longer in the sort pool.
[0026] By implementing a single indexed vector max / min instruction that both identifies the maximum / min value of each pair of compared data (i.e., the data from the first and second source registers in a single lane) and identifies the location or index of the identified maximum / min value by asserting or de-asserting the corresponding lane in the predicate register, the instruction overhead for performing the sort function is reduced, which improves the performance of the DSP in executing software that requires the sort function to be performed.
[0027] Figure 1 A dual scalar / vector datapath processor according to various examples of the present disclosure is shown. The processor 100 includes a separate level one instruction cache (L1 I) 121 and a level one data cache (L1 D) 123. The processor 100 includes a level two combined instruction / data cache (L2) 130 that holds both instructions and data. Figure 1 The connection (bus 142) between the level one instruction cache 121 and the level two combined instruction / data cache 130 is shown. Figure 1 The connection (bus 145) between the level one data cache 123 and the level two combined instruction / data cache 130 is shown. In one example, the processor 100 level two combined instruction / data cache 130 stores instructions to back up the level one instruction cache 121 and data to back up the level one data cache 123. In this example, the level two combined instruction / data cache 130 is further connected to higher level caches and / or main memory in a manner known in the art and not shown in the Figure 1 In this example, the central processing unit core 110, the level one instruction cache 121, the level one data cache 123, and the level two combined instruction / data cache 130 are formed on a single integrated circuit. The signal integrated circuit optionally includes other circuitry.
[0028] The central processing unit core 110 fetches instructions from the level one instruction cache 121 under the control of the instruction fetch unit 111. The instruction fetch unit 111 determines the next few instructions to be executed and invokes a set of fetch packet sizes for these instructions. The nature and size of the fetch packet is further detailed below. As is known in the art, on a cache hit, the instructions are fetched directly from the level one instruction cache 121 if these instructions are stored in the level one instruction cache 121. On a cache miss (the specified instruction fetch packet is not stored in the level one instruction cache 121), the instructions are looked up in the level two combined cache 130. In the present example, the size of a cache line in the level one instruction cache 121 is equal to the size of a fetch packet. The memory location of these instructions is either a hit or a miss in the level two combined cache 130. A hit is serviced from the level two combined cache 130. A miss is serviced from a higher level cache (not shown) or from main memory (not shown). As is known in the art, the requested instructions can be provided to both the level one instruction cache 121 and the central processing unit core 110 simultaneously to speed up usage.
[0029] In one example, the central processing unit core 110 contains a plurality of functional units to perform the data processing tasks specified by the instructions. The instruction dispatch unit 112 determines the target functional unit for each fetched instruction. In the present example, the central processing unit 110 functions as a very long instruction word (VLIW) processor capable of operating on multiple instructions in the corresponding functional units simultaneously. Preferably, a compiler organizes the instructions in an execution packet that are executed together. The instruction dispatch unit 112 directs each instruction to its target functional unit. The functional unit assigned to an instruction is completely specified by the compiler generated instruction. The hardware of the central processing unit core 110 has no role in this functional unit assignment. In the present example, the instruction dispatch unit 112 can operate on multiple instructions in parallel. The number of these parallel instructions is set by the size of the execution packet. This is further detailed below.
[0030] One role of the dispatch task of the instruction dispatch unit 112 is to determine whether the instruction is executed on a functional unit of the scalar data path side A 115 or the vector data path side B 116. An instruction bit in each instruction, referred to as the s bit, determines which data path the instruction controls. This is further detailed below.
[0031] The instruction decode unit 113 decodes each instruction in the current execution packet. The decoding involves identifying the functional unit to perform the instruction, identifying the registers from the possible register files to use for providing data for the corresponding data processing operation, and identifying the register destination for the result of the corresponding data processing operation. As explained further below, an instruction can involve a constant field instead of a register number operand field. The result of this decoding is signals for controlling the target functional unit to perform the data processing operation on the indicated data as specified by the corresponding instruction.
[0032] The central processing unit core 110 includes control registers 114. The control registers 114 store information for controlling the functional units in the scalar data path side A 115 and the vector data path side B 116. This information can be mode information or the like.
[0033] The decoded instructions from the instruction decode 113 and the information stored in the control registers 114 are provided to the scalar data path side A 115 and the vector data path side B 116. The functional units within the scalar data path side A 115 and the vector data path side B 116 thus perform the instruction specified data processing operation on the instruction specified data and store the result in one or more instruction specified data registers. Each of the scalar data path side A 115 and the vector data path side B 116 includes a plurality of functional units that preferably operate in parallel. These will be explained below in more detail in connection with Figure 2 Further details. There is a data path 117 between the scalar data path side A 115 and the vector data path side B 116 that allows data exchange.
[0034] The central processing unit core 110 includes additional non-instruction based modules. The simulation unit 118 allows the machine state of the central processing unit core 110 to be determined in response to instructions. This capability is typically used for algorithm development. The interrupt / exception unit 119 enables the central processing unit core 110 to respond to external asynchronous events (interrupts) and to attempts to perform improper operations (exceptions).
[0035] The central processing unit core 110 includes a stream engine 125. The stream engine 125 of the presently illustrated embodiment provides two data streams from predetermined addresses that are typically cached in the level two combined cache 130 to the files of the vector data path B side 116. This provides controlled data movement from memory (as cached in the level two combined cache 130) directly to functional unit operand input. This is explained in further detail below.
[0036] Figure 1Exemplary data widths for the buses between the various parts are shown. The level one instruction cache 121 provides instructions to the instruction fetch unit 111 via bus 141. Bus 141 is preferably a 512-bit bus. Bus 141 is unidirectional from the level one instruction cache 121 to the central processing unit 110. The level two combined cache 130 provides instructions to the level one instruction cache 121 via bus 142. Bus 142 is preferably a 512-bit bus. Bus 142 is unidirectional from the level two combined cache 130 to the level one instruction cache 121.
[0037] The level one data cache 123 exchanges data with the register file in the scalar data path side A 115 via bus 143. Bus 143 is preferably a 64-bit bus. The level one data cache 123 exchanges data with the register file in the vector data path side B 116 via bus 144. Bus 144 is preferably a 512-bit bus. Buses 143 and 144 are shown as bidirectional to support central processing unit 110 data reads and data writes. The level one data cache 123 exchanges data with the level two combined cache 130 via bus 145. Bus 145 is preferably a 512-bit bus. Bus 145 is shown as a bidirectional to support cache servicing for central processing unit 110 data reads and data writes.
[0038] As is known in the art, CPU data requests are fetched directly from the level one data cache 123 on a cache hit (if the requested data is stored in the level one data cache 123). On a cache miss (the specified data is not stored in the level one data cache 123), the data is looked up in the level two combined cache 130. The memory location of the requested data is either a hit or a miss in the level two combined cache 130. Hits are serviced from the level two combined cache 130. Misses are serviced from another level of cache (not shown) or from main memory (not shown). As is known in the art, the requested instruction can be provided to the level one data cache 123 and the central processing unit core 110 simultaneously to speed up usage.
[0039] The second level combined cache 130 provides data for a first data stream to the stream engine 125 via a bus 146. The bus 146 is preferably a 512-bit bus. The stream engine 125 provides data for this first data stream to the functional units of the vector data path side B 116 via a bus 147. The bus 147 is preferably a 512-bit bus. The second level combined cache 130 provides data for a second data stream to the stream engine 125 via a bus 148. The bus 148 is preferably a 512-bit bus. The stream engine 125 provides data for this second data stream to the functional units of the vector data path side B 116 via a bus 149. The bus 149 is preferably a 512-bit bus. According to various examples of the present disclosure, the buses 146, 147, 148, and 149 are shown as being unidirectional from the second level combined cache 130 to the stream engine 125 and to the vector data path side B 116.
[0040] Upon a cache hit (if the requested data is stored in the second level combined cache 130), the stream engine 125 data request is fetched directly from the second level combined cache 130. Upon a cache miss (the specified data is not stored in the second level combined cache 130), the data is looked up from another level of cache (not shown) or from main memory (not shown). In some examples, it is technically feasible for the level one data cache 123 to cache data that is not stored in the second level combined cache 130. If this operation is supported, upon a stream engine 125 data request that is a miss in the second level combined cache 130, the second level combined cache 130 should snoop the level one data cache 123 for the stream engine 125 request data. If the level one data cache 123 stores the data, its snoop response will contain the data, which is then provided to service the stream engine 125 request. If the level one data cache 123 does not store the data, its snoop response will indicate this, and the second level combined cache 130 must service the stream engine 125 request from another level of cache (not shown) or from main memory (not shown).
[0041] In one example, both the level one data cache 123 and the second level combined cache 130 can be configured as selected amounts of cache or directly addressable memory according to U.S. Patent No. 6,606,686, entitled "UNIFIED MEMORY SYSTEM ARCHITECTURE INCLUDING CACHE AND DIRECTLY ADDRESSABLE STATIC RANDOM ACCESS MEMORY."
[0042] Figure 2Further details of the functional units and register files within the scalar datapath side A 115 and the vector datapath side B 116 are shown. The scalar datapath side A 115 contains a global scalar register file 211, an LI / S1 local register file 212, an M1 / N1 local register file 213, and a D1 / D2 local register file 214. The scalar datapath side A 115 contains an LI unit 221, an S1 unit 222, an M1 unit 223, an N1 unit 224, a D1 unit 225, and a D2 unit 226. The vector datapath side B 116 contains a global vector register file 231, an L2 / S2 local register file 232, an M2 / N2 / C local register file 233, and a predicate register file 234. The vector datapath side B 116 contains an L2 unit 241, an S2 unit 242, an M2 unit 243, an N2 unit 244, a C unit 245, and a P unit 246. There are restrictions on which functional units can read or which register files can write. These are detailed below.
[0043] The scalar datapath side A 115 contains an LI unit 221. The LI unit 221 typically accepts two 64-bit operands and produces a 64-bit result. The two operands are each called from an instruction specified register in the global scalar register file 211 or the LI / S1 local register file 212. The LI unit 221 preferably performs the following instruction selection operations: 64-bit addition / subtraction operations; 32-bit min / max operations; 8-bit single instruction multiple data (SIMD) instructions such as absolute value, sum of minima, and sum of maxima determination; loop min / max operations; and various move operations between register files. The result can be written into an instruction specified register in the global scalar register file 211, the LI / S1 local register file 212, the M1 / N1 local register file 213, or the D1 / D2 local register file 214.
[0044] The scalar datapath side A 115 contains an S1 unit 222. The S1 unit 222 typically accepts two 64-bit operands and produces a 64-bit result. The two operands are each called from an instruction specified register in the global scalar register file 211 or the LI / S1 local register file 212. The S1 unit 222 preferably performs the same types of operations as the LI unit 221. There can optionally be slight differences between the data processing operations supported by the LI unit 221 and the S1 unit 222. The result can be written into an instruction specified register in the global scalar register file 211, the LI / S1 local register file 212, the M1 / N1 local register file 213, or the D1 / D2 local register file 214.
[0045] Scalar datapath side A 115 includes Ml units 223. Ml units 223 generally accept two 64-bit operands and produce a 64-bit result. Both operands are each called from an instruction specified register in global scalar register file 211 or Ml / Nl local register file 213. Ml units 223 preferably perform the following instruction selection operations: 8-bit multiply operations; complex dot product operations; 32-bit bit count operations; complex conjugate multiply operations; and bitwise logical operations, shifts, additions, and subtractions. The result can be written into an instruction specified register in global scalar register file 211, Ll / Sl local register file 212, Ml / Nl local register file 213, or Dl / D2 local register file 214.
[0046] Scalar datapath side A 115 includes Nl units 224. Nl units 224 generally accept two 64-bit operands and produce a 64-bit result. Both operands are each called from an instruction specified register in global scalar register file 211 or Ml / Nl local register file 213. Nl units 224 preferably perform the same types of operations as Ml units 223. There can be certain double operations that employ both Ml units 223 and Nl units 224 (referred to as double issue instructions). The result can be written into an instruction specified register in global scalar register file 211, Ll / Sl local register file 212, Ml / Nl local register file 213, or Dl / D2 local register file 214.
[0047] Scalar datapath side A 115 includes Dl units 225 and D2 units 226. Dl units 225 and D2 units 226 generally each accept two 64-bit operands and each produce a 64-bit result. Dl units 225 and D2 units 226 generally perform address calculations and corresponding load and store operations. Dl units 225 are used for 64-bit scalar loads and stores. D2 units 226 are used for 512-bit vector loads and stores. Dl units 225 and D2 units 226 preferably also perform: swapping, packing, and unpacking of load and store data; 64-bit SIMD arithmetic operations; and 64-bit bitwise logical operations. Dl / D2 local register file 214 generally stores base and offset addresses used in corresponding load and store address calculations. Both operands are each called from an instruction specified register in global scalar register file 211 or Dl / D2 local register file 214. The result can be written into an instruction specified register in global scalar register file 211, Ll / Sl local register file 212, Ml / Nl local register file 213, or Dl / D2 local register file 214.
[0048] Vector datapath side B 116 contains L2 unit 241. L2 unit 241 typically takes two 512-bit operands and produces a 512-bit result. The two operands are each called from an instruction specified register in global vector register file 231, L2 / S2 local register file 232, or predicate register file 234. L2 unit 241 preferably performs similar instructions as Ll unit 221, only on the wider 512-bit data. The result can be written to an instruction specified register in global vector register file 231, L2 / S2 local register file 232, M2 / N2 / C local register file 233, or predicate register file 234.
[0049] Vector datapath side B 116 contains S2 unit 242. S2 unit 242 typically takes two 512-bit operands and produces a 512-bit result. The two operands are each called from an instruction specified register in global vector register file 231, L2 / S2 local register file 232, or predicate register file 234. S2 unit 242 preferably performs similar instructions as S 1 unit 222. The result can be written to an instruction specified register in global vector register file 231, L2 / S2 local register file 232, M2 / N2 / C local register file 233, or predicate register file 234.
[0050] Vector datapath side B 116 contains M2 unit 243. M2 unit 243 typically takes two 512-bit operands and produces a 512-bit result. The two operands are each called from an instruction specified register in global vector register file 231 or M2 / N2 / C local register file 233. M2 unit 243 preferably performs similar instructions as Ml unit 223, only on the wider 512-bit data. The result can be written to an instruction specified register in global vector register file 231, L2 / S2 local register file 232, or M2 / N2 / C local register file 233.
[0051] Vector datapath side B 116 contains N2 unit 244. N2 unit 244 typically takes two 512-bit operands and produces a 512-bit result. The two operands are each called from an instruction specified register in global vector register file 231 or M2 / N2 / C local register file 233. N2 unit 244 preferably performs the same type of operations as M2 unit 243. There can be certain double operations that employ both M2 unit 243 and N2 unit 244 (referred to as double issue instructions). The result can be written to an instruction specified register in global vector register file 231, L2 / S2 local register file 232, or M2 / N2 / C local register file 233.
[0052] Vector datapath side B 116 includes C unit 245. C unit 245 typically accepts two 512-bit operands and produces a 512-bit result. Both operands are each called from instruction specified registers in either global vector register file 231 or M2 / N2 / C local register file 233. C unit 245 preferably performs: "rake" and "search" instructions; up to 512 2-bit PN * 8-bit multiply I / Q complex multiplications per clock cycle; 8-bit and 16-bit sum of absolute difference (SAD) computations up to 512 SADs per clock cycle; horizontal addition and horizontal min / max instructions; and vector permute instructions. C unit 245 also contains 4 vector control registers (CUCR0 through CUCR3) used to control certain operations of C unit 245 instructions. In certain C unit 245 operations, control registers CUCR0 through CUCR3 are used as operands. Control registers CUCR0 through CUCR3 are preferably used to control the general permute instruction (VPERM); and as masks for the SIMD multiple DOT product operation (DOTPM) and the SIMD multiple sum of absolute difference (SAD) operation. Control register CUCR0 is preferably used to store the polynomial for the Galois Field multiply operation (GFMPY). Control register CUCR1 is preferably used to store the Galois Field polynomial generator function.
[0053] Vector datapath side B 116 contains P units 246. P units 246 perform basic logical operations on registers of local predicate register file 234. P units 246 can read and write predicate register file 234 directly. These operations include single register unary operations. For example: NEG (negate), which inverts each bit of a single register; BITCNT (bit count), which returns a count of the number of bits in a single register having a predetermined numeric state (1 or 0); RMBD (rightmost bit detect), which returns the number of bit positions from the least significant bit position (rightmost) to the first bit position having a predetermined numeric state (1 or 0); DECIMATE, which selects every Nth (1, 2, 4, etc.) bit for output; and EXPAND, which duplicates each bit N times (2, 4, etc.) as directed by the instruction. These operations include two register binary operations, for example: AND, a bitwise AND of the data of two registers; NAND, a bitwise AND of the data of two registers followed by a NOT; OR, a bitwise OR of the data of two registers; NOR, a bitwise OR operation of the data of two registers followed by a NOT; and XOR, an exclusive OR of the data of two registers. These operations include moving data from a predicate register of predicate register file 234 to another specified predicate register or to a specified data register in global vector register file 231. Typical intended uses of P units 246 include manipulating SIMD vector comparison results for controlling further SIMD vector operations. BITCNT instructions can be used to count the number of 1s in a predicate register to determine the number of valid data elements from a predicate register.
[0054] Figure 3 Global scalar register file 211 is shown. There are 16 independent 64-bit wide scalar registers, named A0 through A15. Each register of global scalar register file 211 can be read or written as 64-bit scalar data. All scalar datapath side A 115 functional units (LI unit 221, SI unit 222, Ml unit 223, Nl unit 224, Dl unit 225, and D2 unit 226) can read or write global scalar register file 211. Global scalar register file 211 can be read as 32-bit or 64-bit, and can only be written as 64-bit. Instruction execution determines the read data size. Vector datapath side B 116 functional units (L2 unit 241, S2 unit 242, M2 unit 243, N2 unit 244, C unit 245, and P unit 246) can read from global scalar register file 211 via crossbar 117 under the restrictions detailed below.
[0055] Figure 4The D1 / D2 local register file 214 is shown. There are 16 independent 64-bit wide scalar registers, named D0 through D16. Each register of the D1 / D2 local register file 214 can be read or written as 64-bit scalar data. All of the scalar data path side A 115 functional units (L1 unit 221, S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226) can write to the global scalar register file 211. Only the D1 unit 225 and D2 unit 226 can read from the D1 / D2 local scalar register file 214. The data expected to be stored in the D1 / D2 local scalar register file 214 will contain the base address and offset address used in address calculations.
[0056] Figure 5 The L1 / S1 local register file 212 is shown. Figure 5 The example shown in FIG. 2 has 8 independent 64-bit wide scalar registers, named AL0 through AL7. The preferred instruction encoding (see Figure 15 ) allows the L1 / S1 local register file 212 to contain up to 16 registers. Figure 5 The example of FIG. 2 only implements 8 registers to reduce circuit size and complexity. Each register of the L1 / S1 local register file 212 can be read or written as 64-bit scalar data. All of the scalar data path side A 115 functional units (L1 unit 221, S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226) can write to the L1 / S1 local scalar register file 212. Only the L1 unit 221 and S1 unit 222 can read from the L1 / S1 local scalar register file 212.
[0057] Figure 6 The M1 / N1 local register file 213 is shown. Figure 6 The example shown in FIG. 2 has 8 independent 64-bit wide scalar registers, named AL0 through AL7. The preferred instruction encoding (see Figure 15 ) allows the M1 / N1 local register file 213 to contain up to 16 registers. Figure 6 The example of FIG. 2 only implements 8 registers to reduce circuit size and complexity. Each register of the M1 / N1 local register file 213 can be read or written as 64-bit scalar data. All of the scalar data path side A 115 functional units (L1 unit 221, S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226) can write to the M1 / N1 local scalar register file 213. Only the M1 unit 223 and N1 unit 224 can read from the M1 / N1 local scalar register file 213.
[0058] Figure 7 A global vector register file 231 is shown. There are 16 independent 512-bit wide vector registers. Each register of the global vector register file 231 can be read or written as 64-bit scalar data, named B0 through B15. Each register of the global vector register file 231 can be read or written as 512-bit vector data, named VB0 through VB15. The instruction type determines the data size. All vector data path side B 116 functional units (L2 unit 241, S2 unit 242, M2 unit 243, N2 unit 244, C unit 245, and P unit 246) can read or write the global scalar register file 231. Scalar data path side A 115 functional units (L1 unit 221, S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226) can read from the global vector register file 231 via the cross path 117 under the restrictions that will be detailed below.
[0059] Figure 8 A P local register file 234 is shown. There are 8 independent 64-bit wide registers, named P0 through P7. Each register of the P local register file 234 can be read or written as 64-bit scalar data. Vector data path side B 116 functional units (L2 unit 241, S2 unit 242, C unit 244, and P unit 246) can write to the P local register file 234. Only L2 unit 241, S2 unit 242, and P unit 246 can read from the P local scalar register file 234. The usual intended use of the P local register file 234 includes: writing a one-bit SIMD vector comparison result from L2 unit 241, S2 unit 242, or C unit 244; manipulating the SIMD vector comparison result by P unit 246; and using the manipulated result to control a further SIMD vector operation.
[0060] Figure 9 An L2 / S2 local register file 232 is shown. Figure 9 The example shown in the middle has 8 independent 512-bit wide vector registers. The preferred instruction encoding (see Figure 15 ) allows the L2 / S2 local register file 232 to contain up to 16 registers. Figure 9The example shown in FIG. 2A has 8 independent 512-bit wide vector registers. The preferred instruction encoding (see FIG. 3) allows the L2 / S2 local vector register file 232 to contain up to 16 registers.
[0061] Figure 10 The M2 / N2 / C local register file 233 is shown in FIG. 2B. Figure 10 The example shown in FIG. 2B has 8 independent 512-bit wide vector registers. The preferred instruction encoding (see FIG. 3) allows the M2 / N2 / C local vector register file 233 to contain up to 16 registers. Figure 15 Figure 10 The example shown in FIG. 2A has 8 independent 512-bit wide vector registers. The preferred instruction encoding (see FIG. 3) allows the L2 / S2 local vector register file 232 to contain up to 16 registers.
[0062] One design choice is to provide a global register file accessible by all functional units on one side and a local register file accessible by only some functional units on one side. Some examples of the present disclosure only employ one type of register file corresponding to the disclosed global register file.
[0063] Referring back to FIG. 2A Figure 2 The cross path 117 allows limited data exchange between the scalar data path side A 115 and the vector data path side B 116. During each operation cycle, one 64-bit data word can be fetched from the global scalar register file A 211 to be used as an operand by one or more functional units of the vector data path side B 116, and one 64-bit data word can be fetched from the global vector register file 231 to be used as an operand by one or more functional units of the scalar data path side A 115. Any scalar data path side 115 functional unit (LI unit 221, SI unit 222, Ml unit 223, Nl unit 224, Dl unit 225, and D2 unit 226) can read a 64-bit operand from the global vector register file 231. This 64-bit operand is the least significant bits of 512 bits of data in the register of the global vector register file 231 that is accessed. Multiple scalar data path side A 115 functional units can take the same 64-bit cross path data as an operand during the same operation cycle. However, only one 64-bit operand is transferred from the vector data path side B 116 to the scalar data path side A 115 in any single operation cycle. Any vector data path side B 116 functional unit (L2 unit 241, S2 unit 242, M2 unit 243, N2 unit 244, C unit 245, and P unit 246) can read a 64-bit operand from the global scalar register file 211. If the corresponding instruction is a scalar instruction, the cross path operand data is treated as any other 64-bit operand. If the corresponding instruction is a vector instruction, the upper 448 bits of the operand are filled with zeros. Multiple vector data path side B 116 functional units can take the same 64-bit cross path data as an operand during the same operation cycle. Only one 64-bit operand is transferred from the scalar data path side A 115 to the vector data path side B 116 in any single operation cycle.
[0064] In certain restricted cases, the stream engine 125 transfers data. The stream engine 125 controls two data streams. A stream consists of a sequence of elements of a particular type. A program that operates on a stream reads the data sequentially, operating on each element in turn. Each stream has the following basic properties. Stream data has a well-defined start and end time. Stream data has a fixed element size and type throughout the stream. Stream data has a fixed sequence of elements. Thus, a program cannot randomly seek within a stream. Stream data is read-only in the active state. A program cannot write to a stream while it is being read. Once a stream is opened, the stream engine 125: computes the address; fetches the defined data type from the level two unified cache (this can require cache servicing from higher levels of memory); performs data type manipulations, such as zero extension, sign extension, data element reordering / swapping (e.g., matrix transpose); and passes the data directly to the program data register file within the CPU 110. Thus, the stream engine 125 is useful for real-time digital filtering operations on well-behaved data. The stream engine 125 frees these memory fetch tasks from the corresponding CPU, enabling other processing functions.
[0065] The stream engine 125 provides the following benefits. The stream engine 125 allows multi-dimensional memory access. The stream engine 125 increases the available bandwidth of the functional units. Since the stream buffer bypasses the level one data cache 123, the stream engine 125 minimizes the number of cache miss stalls. The stream engine 125 reduces the number of scalar operations required to maintain a loop. The stream engine 125 manages address pointers. The stream engine 125 handles address generation, freeing the address generation instruction slot and the Dl unit 225 and D2 unit 226 for other computations.
[0066] The CPU 110 operates on an instruction pipeline. Instructions are fetched in fixed-length instruction packets, described further below. All instructions require the same number of pipeline stages for fetch and decode, but different numbers of execution stages.
[0067] Figure 11 The following pipeline stages are shown: program fetch stage 1110, dispatch and decode stage 1120, and execution stage 1130. The program fetch stage 1110 contains three stages for all instructions. The dispatch and decode stage 1120 contains three stages for all instructions. The execution stage 1130 contains one to four stages, depending on the instruction.
[0068] The fetch stage 1110 comprises a program address generation stage 1111 (PG), a program access stage 1112 (PA) and a program receive stage 1113 (PR). During the program address generation stage 1111 (PG), a program address is generated in the CPU and a read request is sent to the memory controller of the level one instruction cache LlI. During the program access stage 1112 (PA), the level one instruction cache LlI processes the request, accesses the data in its memory and sends a fetch packet to the CPU boundary. During the program receive stage 1113 (PR), the CPU receives the fetch packet.
[0069] The instructions are always fetched in groups of sixteen 32-bit wide slots, constituting a fetch packet. Figure 12 Sixteen instructions 1201 to 1216 of a single fetch packet are shown. The fetch packet is aligned on a 512-bit (16-word) boundary. One example employs a fixed 32-bit instruction length. Fixed length instructions have advantages for a number of reasons. Fixed length instructions enable easy decoder alignment. Correctly aligned instruction fetches enable multiple instructions to be loaded into parallel instruction decoders. This correctly aligned instruction fetch can be achieved by a predetermined instruction alignment when stored in a memory coupled to the fixed instruction packet fetch (the fetch packet is aligned on a 512-bit boundary). Aligned instruction fetches allow the parallel decoders to operate on the fetch bits of the instruction size. Variable length instructions require an initial step of locating each instruction boundary before they can be decoded. Fixed length instruction sets typically allow more regular placement of instruction fields. This simplifies the construction of each decoder, which is an advantage for a wide issue VLIW central processor.
[0070] The execution of each instruction is partially controlled by the p-bit in each instruction. This p-bit is preferably bit 0 of a 32-bit wide slot. The p-bit determines whether the instruction is executed in parallel with the next instruction. The instructions are scanned from the lower address to the higher address. If the p-bit of an instruction is 1, then the next subsequent instruction (of higher memory address) is executed in parallel (in the same cycle) with the instruction. If the p-bit of an instruction is 0, then the next subsequent instruction is executed in the cycle after the instruction.
[0071] The CPU 110 and the level one instruction cache LlI 121 pipelines are separate from each other. The fetch packet return from the level one instruction cache LlI can take a different number of clock cycles, depending on the external environment, for example whether there is a hit in the level one instruction cache 121 or a hit in the level two combined cache 130. Therefore, the program access stage 1112 (PA) can take several clock cycles, rather than 1 clock cycle as in the other stages.
[0072] The instructions executed in parallel constitute an execution packet. In one example, an execution packet can contain up to sixteen instructions. No two instructions in an execution packet can use the same functional unit. A slot is one of the following five types: 1) a self-contained instruction executed on one of the functional units (LI unit 221, SI unit 222, Ml unit 223, Nl unit 224, DI unit 225, D2 unit 226, L2 unit 241, S2 unit 242, M2 unit 243, N2 unit 244, C unit 245, and P unit 246) of CPU 110; 2) a no-unit instruction, such as a NOP (no operation) instruction or a multi-NOP instruction; 3) a branch instruction; 4) a constant field extension; and 5) a condition code extension. Some of these slot types are explained further below.
[0073] Dispatch and decode stage 1120 includes instruction dispatch to appropriate execution unit stage 1121 (DS), instruction pre-decode stage 1122 (DC1), and instruction decode, operand read stage 1123 (DC2). During instruction dispatch to appropriate execution unit stage 1121 (DS), the fetch packet is divided into execution packets and assigned to the appropriate functional units. During instruction pre-decode stage 1122 (DC1), the source registers, destination registers, and related paths are decoded to execute the instructions in the functional units. During instruction decode, operand read stage 1123 (DC2), more detailed unit decoding is completed and operands are read from the register file.
[0074] Execution stage 1130 includes execution stages 1131-1135 (El-E5). Different types of instructions require different numbers of these stages to complete their execution. These stages of the pipeline play an important role in understanding the state of the device at the boundaries of CPU cycles.
[0075] During execution 1 stage 1131 (El), the condition of the instruction is evaluated and the operands are operated on. As shown in FIG. 11, execution 1 stage 1131 can receive operands from one of stream buffer 1141 and a register file, shown schematically as 1142. For load and store instructions, address generation is performed and address modification is written to the register file. For branch instructions, the branch fetch packet of the PG stage is affected. As shown in FIG. 11, load and store instructions access memory, shown schematically here as memory 1151. For single-cycle instructions, the result is written to the destination register file. This assumes that any condition of the instruction is evaluated to true. If the condition is evaluated to false, then the instruction does not write any result or have any pipelined operations after execution 1 stage 1131. Figure 11 Figure 11
[0076] During execution phase 2 1132 (E2), the load instruction sends the address to memory. The store instruction sends the address and data to memory. If saturation occurs, the single-cycle instruction whose result is saturated sets the SAT bit in the control status register (CSR). For the 2-cycle instruction, the result is written to the destination register file.
[0077] During execution phase 3 1133 (E3), the data memory access is made. If saturation occurs, any multiply instruction whose result is saturated sets the SAT bit in the control status register (CSR). For the 3-cycle instruction, the result is written to the destination register file.
[0078] During execution phase 4 1134 (E4), the load instruction brings the data into the CPU boundary. For the 4-cycle instruction, the result is written to the destination register file.
[0079] During execution phase 5 1135 (E5), the load instruction writes the data to the register. This is shown schematically in Figure 11 with the input from memory 1151 to execution phase 5 1135.
[0080] In some cases, a processor 100 (e.g., a DSP) can be called upon to execute software that requires a sorting function to be performed. As explained above, implementing a sorting function at the processor level (e.g., using assembly or compiler-level instructions) requires multiple instructions to identify the maximum / minimum value and its index or position in the array of values. Since sorting functions performed by a DSP are often frequent and repetitive, it is undesirable to add instruction overhead.
[0081] Figure 13 One example of a register 1300 used in executing a vector maximum / minimum instruction with index is shown. The register 1300 includes a first source register 1302, a second source register 1304, and a destination register 1306. As will be explained further below, in some examples, the second source register 1304 is used as the destination register 1306. The register 1300 also includes a predicate register 1308. In this example, the first and second source registers 1302, 1304 and the destination register 1306 are 512-bit vector registers, such as those contained in the global vector register file 231 explained above. In this example, the predicate register 1308 is a 64-bit predicate register contained in the predicate register file 234, also explained above. In other examples, the first and second source registers 1302, 1304, the destination register 1306, and the predicate register 1308 can have different sizes; the scope of the present disclosure is not limited to one particular register size or one particular set of register sizes.
[0082] In this example, each of the first source register 1302, the second source register 1304, the destination register 1306, and the predicate register 1308 are divided into 64 equal-sized lanes, labeled lanes 0 through 63. Thus, the first and second source registers 1302, 1304 and the destination register 1306 are 8-bit lanes (labeled bytes 0 through 63, respectively), while the lanes of the predicate register 1308 are single-bit lanes (labeled P0 through P63, respectively). Data in similarly-numbered lanes in different registers are said to be in "corresponding" lanes. For example, byte 0 of the first source register 1302, byte 0 of the second source register 1304, byte 0 of the destination register 1306, and bit P0 of the predicate register 1308 are all in corresponding lanes, i.e., in lane 0.
[0083] The indexed vector max instruction contains fields specifying the first source register 1302, the second source register 1304, and the destination register 1306 (e.g., in the global vector register file 231). The indexed vector max instruction also contains a field specifying the predicate register 1308 (e.g., in the predicate register file 234). In response to executing the indexed vector max instruction, the DSP 100 compares each pair of values in the respective lanes of the first and second source registers 1302, 1304. For example, byte 0 of the first source register 1302 is compared with byte 0 of the second source register 1304, byte 1 of the first source register 1302 is compared with byte 1 of the second source register 1304, and so on. As a result of the comparisons of the values in the corresponding lanes of the first and second source registers 1302, 1304, the DSP 100 identifies the maximum value of each pair of compared values and stores the maximum value in the corresponding lane of the destination register 1306. For example, the maximum value of the lane 0 values in the first and second source registers 1302, 1304 is stored in lane 0 of the destination register 1306. In the example in which the second source register 1304 is used as the destination register 1306, the data in lane 0 of the second source register 1304 can be overwritten with the maximum value identified in the comparison.
[0084] Additionally, in response to executing the indexed vector maximum instruction, the DSP 100 asserts or de-asserts the corresponding lane of the predicate register 1308. For purposes of the following discussion, "assert" means setting the predicate register 1308 bit value to'1'and "de-assert" means setting the predicate register 1308 bit value to '0'. However, it should be understood that the scope of the present disclosure is not limited to certain values associated with the assertion or de-assertion of a field in the predicate register 1308. In one example, because the comparison indicates that the maximum value is from or contained in the first source register 1302, the DSP 100 asserts the corresponding lane of the predicate register 1308. In this example, because the comparison indicates that the maximum value is from or contained in the second source register 1302, the DSP 100 de-asserts the corresponding lane of the predicate register 1308. In the case where the values in the corresponding lanes of the first and second source registers 1302, 1304 are equal, whether to assert or de-assert the corresponding lane of the predicate register 1308 can be considered a design choice. That is, in some examples, an equal value in the lanes of the first and second source registers 1302, 1304 can result in asserting the corresponding lane of the predicate register 1308; in other examples, an equal value in the lanes of the first and second source registers 1302, 1304 can result in de-asserting the corresponding lane of the predicate register 1308.
[0085] The indexed vector minimum instruction also contains fields specifying the first source register 1302, the second source register 1304, and the destination register 1306 (e.g., in the global vector register file 231). The indexed vector minimum instruction also contains a field specifying the predicate register 1308 (e.g., in the predicate register file 234). In response to executing the indexed vector minimum instruction, the DSP 100 compares each pair of values in the lanes of the first and second source registers 1302, 1304. For example, byte 0 of the first source register 1302 is compared with byte 0 of the second source register 1304, byte 1 of the first source register 1302 is compared with byte 1 of the second source register 1304, and so on. As a result of the comparison of the values in the corresponding lanes of the first and second source registers 1302, 1304, the DSP 100 identifies the minimum value for each pair of compared values and stores the minimum value in the corresponding lane of the destination register 1306. For example, the minimum value of the lane 0 values in the first and second source registers 1302, 1304 is stored in lane 0 of the destination register 1306. In the example where the second source register 1304 is used as the destination register 1306, the data in lane 0 of the second source register 1304 can be overwritten with the minimum value identified in the comparison.
[0086] Additionally, in response to executing the indexed vector minimum instruction, the DSP 100 asserts or de-asserts the corresponding lane of the predicate register 1308. In one example, because the comparison indicates that the minimum value is from or contained in the first source register 1302, the DSP 100 asserts the corresponding lane of the predicate register 1308. In this example, because the comparison indicates that the minimum value is from or contained in the second source register 1302, the DSP 100 de-asserts the corresponding lane of the predicate register 1308. As above, in the case where the values in the corresponding lanes of the first and second source registers 1302, 1304 are equal, whether to assert or de-assert the corresponding lane of the predicate register 1308 can be considered a design choice. That is, in some examples, equal values in the lanes of the first and second source registers 1302, 1304 can result in asserting the corresponding lane of the predicate register 1308; in other examples, equal values in the lanes of the first and second source registers 1302, 1304 can result in de-asserting the corresponding lane of the predicate register 1308.
[0087] Figures 14A-14D Various examples of the functionality of the indexed vector maximum / minimum instruction are shown. In particular, Figures 14A-14D The values contained in the first four lanes of the first and second source registers 1402, 1404 are shown. Figures 14A-14D The values stored in the corresponding first four lanes of the destination register 1406 and the predicate register 1408, resulting from execution of the indexed vector maximum / minimum instruction, are also shown, as explained further below. Although only four lanes are shown for each of the first and second source registers 1402, 1404, the destination register 1406, and the predicate register 1408, it should be understood that this is for ease of discussion, and that Figures 14A-14D Examples of the indexed vector maximum / minimum instruction can extend to the register sizes discussed above with respect to Figure 13 As explained above with respect to Figure 13 In some examples, the second source register 1404 is used as the destination register 1406, and thus, the previous values of the second source register 1404 are overwritten with the minimum or maximum value identified for each lane.
[0088] Figure 14AOne example of a vector max with index instruction is shown in which the data in the lanes of the first and second source registers 1402a, 1404a are treated as unsigned values. Thus, as explained above, the destination register 1406a contains the maximum of each pair of comparison values from the corresponding lanes of the first and second source registers 1402a, 1404a. In this example, the corresponding lane of the predicate register 1408a is asserted if the identified maximum came from the first source register 1402a, and is de-asserted if the identified maximum came from the second source register 1404a.
[0089] The exemplary first source register 1402a data are x01, x04, x80, x7F in lanes 3 through 0, respectively. The exemplary second source register 1404a data are x02, x03, x6F, x7F in lanes 3 through 0, respectively. Since the vector max with index instruction is executed, in this example where the data values are unsigned values, the destination register 1406a contains the maximum values, x02 in lane 3, x04 in lane 2, x80 in lane 1, and x7F in lane 0.
[0090] Since the identified maximum value x02 in lane 3 came from the second source register 1404a, the corresponding lane of the predicate register 1408a is de-asserted. Since the identified maximum value x04 in lane 2 came from the first source register 1402a, the corresponding lane of the predicate register 1408a is asserted. Since the identified maximum value x80 in lane 1 came from the first source register 1402a, the corresponding lane of the predicate register 1408a is asserted. Finally, since the values in lane 0 are equal, in this example the corresponding lane of the predicate register 1408a is de-asserted.
[0091] Figure 14B One example of a vector max with index instruction is shown in which the data in the lanes of the first and second source registers 1402b, 1404b are treated as signed values. Thus, as explained above, the destination register 1406b contains the maximum of each pair of comparison values from the corresponding lanes of the first and second source registers 1402b, 1404b. In this example, the corresponding lane of the predicate register 1408b is asserted if the identified maximum came from the first source register 1402b, and is de-asserted if the identified maximum came from the second source register 1404b.
[0092] Exemplary first source register 1402b data are x01, x04, x80, x7F in lanes 3-0, respectively. Exemplary second source register 1404b data are x02, x03, x6F, x7F in lanes 3-0, respectively. As a vector max with index instruction is executed, in this instance where data values are signed values, destination register 1406b contains the maximum values, x02 in lane 3, x04 in lane 2, x6F in lane 1, and x7F in lane 0.
[0093] As the identified maximum value x02 in lane 3 comes from the second source register 1404b, the corresponding lane of predicate register 1408b is de-asserted. As the identified maximum value x04 in lane 2 comes from the first source register 1402b, the corresponding lane of predicate register 1408b is asserted. As the identified maximum value x6F in lane 1 comes from the second source register 1404b, the corresponding lane of predicate register 1408b is de-asserted. Finally, as the values in lane 0 are equal, in this instance, the corresponding lane of predicate register 1408b is de-asserted.
[0094] Figure 14C An example of a vector min with index instruction is shown, where data in lanes of first and second source registers 1402c, 1404c are treated as unsigned values. Thus, as explained above, destination register 1406c contains the minimum value from each pair of compared values from corresponding lanes of first and second source registers 1402c, 1404c. In this instance, if the identified minimum value comes from the first source register 1402c, the corresponding lane of predicate register 1408c is asserted, and if the identified minimum value comes from the second source register 1404c, it is de-asserted.
[0095] Exemplary first source register 1402c data are x01, x04, x80, x7F in lanes 3-0, respectively. Exemplary second source register 1404c data are x02, x03, x6F, x7F in lanes 3-0, respectively. As a vector min with index instruction is executed, in this instance where data values are unsigned values, destination register 1406c contains the minimum values, x01 in lane 3, x03 in lane 2, x6F in lane 1, and x7F in lane 0.
[0096] Since the identified minimum value x01 in lane 3 comes from the first source register 1402c, the corresponding lane of the predicate register 1408c is asserted. Since the identified minimum value x03 in lane 2 comes from the second source register 1404c, the corresponding lane of the predicate register 1408c is de-asserted. Since the identified minimum value x6F in lane 1 comes from the second source register 1404c, the corresponding lane of the predicate register 1408c is de-asserted. Finally, since the values in lane 0 are equal, the corresponding lane of the predicate register 1408b is de-asserted in this example.
[0097] Finally, Figure 14D An example of a vector minimum with index instruction is shown in which the data in the lanes of the first and second source registers 1402d, 1404d are treated as signed values. Thus, as explained above, the destination register 1406d contains the minimum value from each pair of compared values from the corresponding lanes of the first and second source registers 1402d, 1404d. In this example, the corresponding lane of the predicate register 1408d is asserted if the identified minimum value comes from the first source register 1402d, and de-asserted if the identified minimum value comes from the second source register 1404d.
[0098] The exemplary first source register 1402d data are x01, x04, x80, x7F in lanes 3 through 0, respectively. The exemplary second source register 1404d data are x02, x03, x6F, x7F in lanes 3 through 0, respectively. Since the vector minimum with index instruction is executed, in this example in which the data values are signed values, the destination register 1406d contains the minimum values, x01 in lane 3, x03 in lane 2, x80 in lane 1, and x7F in lane 0.
[0099] Since the identified minimum value x01 in lane 3 comes from the first source register 1402d, the corresponding lane of the predicate register 1408d is asserted. Since the identified minimum value x03 in lane 2 comes from the second source register 1404d, the corresponding lane of the predicate register 1408d is de-asserted. Since the identified minimum value x80 in lane 1 comes from the first source register 1402d, the corresponding lane of the predicate register 1408d is asserted. Finally, since the values in lane 0 are equal, the corresponding lane of the predicate register 1408b is de-asserted in this example.
[0100] Figure 15One example of an instruction encoding 1500 for a functional unit instruction used by examples of the present disclosure is shown. Other instruction encodings are possible and within the scope of the present disclosure. Each instruction consists of 32 bits and controls the operation of one of the individually controllable functional units (L1 unit 221, S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225, D2 unit 226, L2 unit 241, S2 unit 242, M2 unit 243, N2 unit 244, C unit 245, and P unit 246). The bit fields are defined as follows.
[0101] The pdst field 1502 (bits 26-31) specifies the predicate register in the corresponding predicate register file 234 as the destination for the indexed or predicate portion of the instruction result.
[0102] The src2 / dst field 1504 (bits 20-25) specifies a second source register (e.g., second source register 1304) from the global vector register file 231 and, in this example, also specifies a destination register (e.g., destination register 1306) that will hold the comparison result or identified maximum / minimum value.
[0103] The src1 field 1506 (bits 14-19) specifies a first source register (e.g., first source register 1302) from the global vector register file 231.
[0104] The opcode field 1508 (bits 5-13) specifies the type of instruction (e.g., maximum or minimum) and indicates the appropriate instruction options (e.g., treat the data in the lanes of the source registers as signed or unsigned values). The unit field 1510 (bits 2-4) provides a specific indication of the functional unit used and the operation performed. The detailed explanation of the opcode is generally outside the scope of the present disclosure except for the instruction options detailed below.
[0105] The s bit 1512 (bit 1) indicates whether the scalar data path side A 115 or the vector data path side B 116. If s = 0, the scalar data path side A 115 is selected. This restricts the functional unit to the L1 unit 221, S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226 shown in FIG. 1A and the corresponding register files. Similarly, s = 1 selects the vector data path side B 116, restricting the functional unit to the L2 unit 241, S2 unit 242, M2 unit 243, N2 unit 244, P unit 246, and the corresponding register files shown in FIG. 1B. Figure 2 The s bit 1512 (bit 1) indicates whether the scalar data path side A 115 or the vector data path side B 116. If s = 0, the scalar data path side A 115 is selected. This restricts the functional unit to the L1 unit 221, S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226 shown in FIG. 1A and the corresponding register files. Similarly, s = 1 selects the vector data path side B 116, restricting the functional unit to the L2 unit 241, S2 unit 242, M2 unit 243, N2 unit 244, P unit 246, and the corresponding register files shown in FIG. 1B. Figure 2 The s bit 1512 (bit 1) indicates whether the scalar data path side A 115 or the vector data path side B 116. If s = 0, the scalar data path side A 115 is selected. This restricts the functional unit to the L1 unit 221, S1 unit 222, M1 unit 223, N1 unit 224, D1 unit 225, and D2 unit 226 shown in FIG. 1A and the corresponding register files. Similarly, s = 1 selects the vector data path side B 116, restricting the functional unit to the L2 unit 241, S2 unit 242, M2 unit 243, N2 unit 244, P unit 246, and the corresponding register files shown in FIG. 1B.
[0106] The p-bit 1514 (bit 0) flags an execution packet. The p-bit determines if the instruction is executed in parallel with a subsequent instruction. The p-bit is scanned from the low address to the high address. If the p of the current instruction = 1, then the next instruction is executed in parallel with the current instruction. If the p of the current instruction = 0, then the next instruction is executed in the cycle after the current instruction. All instructions executed in parallel form an execution packet. An execution packet can contain up to twelve instructions. Each instruction in an execution packet must use a different functional unit.
[0107] Figure 16 A flowchart of a method 1600 according to an example of the present disclosure is shown. The method 1600 begins in block 1602 by specifying a first source register containing first source data, a second source register containing second source data, a destination register for storing comparison data, and a predicate register. The first and second source registers, the destination register, and the predicate register are specified in fields of an indexed vector max / min instruction, such as the src1 field 1506, the src2 field 1504, the dst field 1504, and the pdst field 1502, respectively, with respect to Figure 15 the above description). In some cases, the predicate register is a 64-bit predicate register contained in the predicate register file 234, as explained above. In other cases, the first and second source registers, the destination register, and the predicate register can have different sizes; the scope of the present disclosure is not limited to one particular register size or one particular set of register sizes.
[0108] The method 1600 continues in block 1604 by executing the indexed vector max / min instruction, in particular by comparing values in lanes of the first source register with values in corresponding lanes of the second source register to identify a maximum / minimum value. In one example, the source registers are 512-bit vector registers, and the lanes are 8-bit lanes, such that 64 comparisons are made when executing a single indexed vector max / min instruction, as explained above with respect to Figure 13 The 8-bit lanes can be interpreted as signed or unsigned values.
[0109] The method 1600 further continues in block 1606 by storing the maximum / minimum identified value in a corresponding lane of the destination register. In one example, the destination register can be the second source register, such that the second source register is overwritten with the identified maximum / minimum value.
[0110] The method 1600 continues in block 1608 with asserting the corresponding lane of the predicate register due to the maximum / minimum value being from the first source register. However, if the maximum / minimum value is from the second source register, the method 1600 continues in block 1610 with de-asserting the corresponding lane of the predicate register. In this example, "asserting" refers to setting the predicate register value to '1', while "de-asserting" refers to setting the predicate register bit value to '0'. However, it should be understood that the scope of the present disclosure is not limited to certain values related to the assertion or de-assertion of a field in a predicate register. In one example, the DSP 100 asserts the corresponding lane of the predicate register due to the comparison indicating that the maximum / minimum value is from or contained in the first source register. In this example, the DSP 100 de-asserts the corresponding lane of the predicate register due to the comparison indicating that the maximum / minimum value is from or contained in the second source register. In the case where the values in the corresponding lanes of the first and second source registers are equal, it can be considered a design choice whether to assert or de-assert the corresponding lane of the predicate register. That is, in some examples, an equal value in the lanes of the first and second source registers will result in asserting the corresponding lane of the predicate register; in other examples, an equal value in the lanes of the first and second source registers will result in de-asserting the corresponding lane of the predicate register.
[0111] In the foregoing discussion and in the claims, the terms "including" and "comprising" are used in an open-ended fashion, and thus should be interpreted to mean "including, but not limited to...." Also, the term "couple" or "couples" is intended to mean either an indirect or direct connection. Thus, if a first device couples to a second device, that connection can be through a direct connection or through an indirect connection via other devices and connections. Similarly, a device that is coupled between a first component or location and a second component or location can be an indirect connection, through one or more other devices and connections, or a direct connection, without interposition of another device. An element or feature that is "configured to" perform a task or function can be configured (e.g., programmed or designed) at a time of manufacture to perform the function and / or can be reconfigurable (or configurable) by a user after manufacture to
[0112] The above discussion is meant to illustrate and provide a general understanding of the principles of the present disclosure along with the various examples. Once a complete understanding of the disclosure is achieved, many changes in the details, materials, and arrangements of parts can be made by those skilled in the art without departing from the scope of the present disclosure. The following claims are intended to cover all such changes and modifications.
Claims
1. A method for comparing first and second source data in a processor in response to a vector max with index instruction, the method comprising: specifying, in respective fields of the vector max with index instruction, a first source register containing the first source data, a second source register containing the second source data, a destination register for storing comparison data, and a predicate register, wherein each of the first and second source registers, the destination register, and the predicate register comprises a plurality of lanes; and executing the vector max with index instruction, wherein executing the vector max with index instruction further comprises, for each lane in the first source register and a corresponding lane in the second source register: comparing a value in the lane of the first source register with a value in the corresponding lane of the second source register to identify a maximum value; storing the maximum value in a corresponding lane of the destination register; asserting a corresponding lane of the predicate register due to the maximum value being from the first source register; and deasserting the corresponding lane of the predicate register due to the maximum value being from the second source register.
2. The method of claim 1, wherein the destination register comprises the second source register.
3. The method of claim 1, wherein the first and second source data each comprise a 512-bit vector.
4. The method of claim 3, wherein the lanes of the first and second source registers comprise 8-bit lanes.
5. The method of claim 4, wherein the value in each 8-bit lane is a signed value.
6. The method of claim 4, wherein the corresponding lane of the predicate register comprises a single bit.
7. A data processor comprising: a first source register configured to contain first source data; a second source register configured to contain second source data; a destination register; and a predicate register; wherein each of the first and second source registers, the destination register, and the predicate register comprises a plurality of lanes; wherein, in response to execution of a single vector max with index instruction, the data processor is configured to: compare a value in a lane of the first source register with a value in a corresponding lane of the second source register to identify a maximum value; store the maximum value in a corresponding lane of the destination register; assert a corresponding lane of the predicate register due to the maximum value being from the first source register; and deassert the corresponding lane of the predicate register due to the maximum value being from the second source register.
8. The data processor of claim 7, wherein the destination register comprises the second source register.
9. The data processor of claim 7, wherein the first and second source data each comprise a 512-bit vector.
10. The data processor of claim 9, wherein the lanes of the first and second source registers comprise 8-bit lanes. 11. The data processor of claim 10, wherein the values in each 8-bit lane are signed values.
12. The data processor of claim 10, wherein the corresponding lane of the predicate register comprises a single bit.
13. A method for comparing first and second source data in a processor in response to an indexed vector minima instruction, the method comprising: specifying, in respective fields of the indexed vector minima instruction, a first source register containing the first source data, a second source register containing the second source data, a destination register for storing comparison data, and a predicate register, wherein each of the first and second source registers, the destination register, and the predicate register comprises a plurality of lanes; and executing the indexed vector minima instruction, wherein executing the indexed vector minima instruction further comprises, for each lane in the first source register and a corresponding lane in the second source register: comparing a value in the lane of the first source register with a value in the corresponding lane of the second source register to identify a minimum value; storing the minimum value in a corresponding lane of the destination register; asserting a corresponding lane of the predicate register due to the minimum value being from the first source register; and deasserting the corresponding lane of the predicate register due to the minimum value being from the second source register.
14. The method of claim 13, wherein the destination register comprises the second source register.
15. The method of claim 13, wherein the first and second source data each comprise a 512-bit vector.
16. The method of claim 15, wherein the lanes of the first and second source registers comprise 8-bit lanes.
17. The method of claim 16, wherein the values in each 8-bit lane are signed values.
18. The method of claim 16, wherein the corresponding lane of the predicate register comprises a single bit.
19. A data processor comprising: a first source register configured to contain first source data; a second source register configured to contain second source data; a destination register; and a predicate register; wherein each of the first and second source registers, the destination register, and the predicate register comprises a plurality of corresponding lanes; wherein, in response to execution of a single indexed vector minima instruction, the data processor is configured to: compare a value in a lane of the first source register with a value in a corresponding lane of the second source register to identify a minimum value; store the minimum value in a corresponding lane of the destination register; assert a corresponding lane of the predicate register due to the minimum value being from the first source register; and deassert the corresponding lane of the predicate register due to the minimum value being from the second source register. 20. The data processor of claim 19, wherein the destination register comprises the second source register.
21. The data processor of claim 19, wherein the first and second source data each comprise 512-bit vectors.
22. The data processor of claim 21, wherein the lanes of the first and second source registers comprise 8-bit lanes.
23. The data processor of claim 22, wherein the values in each 8-bit lane are signed values.
24. The data processor of claim 22, wherein the corresponding lanes of the predicate register comprise single bits.
Citation Information
Patent Citations
Unified memory system architecture including cache and directly addressable static random access memory
US6606686B1
Minimum processor instruction for implementing weighted fair queuing and other priority queuing
US20040148320A1
Handling of Conditional Instructions in a Data Processing Apparatus
US20070208924A1
Running-min and running-max instructions for processing vectors
US20100325398A1
Power saving branch modes in hardware
US20180341489A1