CAVA can perhaps be characterized as a "Post-RISC" instruction set. It is richer than the austere and spartan early RISC, but very restrained compared to the VAX, and much more regular than x86. It is philosophically much closer to the IBM 360 and the Semour Cray architectures, far away from the explicit parallelism paradigm of VLIW such as the IA64. CAVA orient towards modern but moderate implementations, aspiring to be a player in the highly competitive, rapidly evolving market segment sometimes called "High End Embedded." It is a general purpose 64-bit architecture with substantial DSP support.
Although not subscribing to the VLIW paradigm of explicitly supporting instruction level parallelism, the CAVA instruction set architecture nevertheless provide assistance to high performance implementations. The instruction formats are designed so hardware can easily detect dependent strings of instructions, which can be dispatch as a unit but must, of course, be executed sequentially. Several strings can be simulataneously in execution on implementations with multiple functional units. The average dependent string length is consistent close to two and a half instructions across many programs. An implementation with a maximum throughput of one string per cycle has many of the same characteristics as the traditional single-issue pipeline: simple, efficient, easy to clock at high frequency. Yet its performance can be comparable to conventional dual- or triple-issue implementations.
CAVA is a "two address" architecture: instructions specify two operands, one of which is a register that is both the output and one of the input operands. Architected registers can be renamed during execution, transforming instructions into dynamic instances with "three addresses." Two-address architectures can be encoded in fewer instruction bits than three-address, requiring less ROM space in embedded applications and generally less bandwidth throughout the processor. They can also convey valuable information from the compiler to the hardware of the last use of a register value.
CAVA benefits from the learning experiences of previous architectures. Observing across implementations of out-of-order processors, it is apparent that one of the most important characteristic of an ISA is the regularity of state update. Such things as separate integer and floating point registers, condition codes, and special-purpose registers like the MIPS HI/LO registers and the PowerPC MQ registers cause untold headachs during implementation. Similarily, the existance of auto-incrementing load instructions is a severe handicap, since those instructions, and usually only those instructions, produce two results. Some implementations actually decompose such instruction into separate "micro ops," which would seem to defeat the whole purpose of having auto-increment. Renaming registers is resource and power intensive; having the capability to rename two outputs registers per instruction, but only using it once in a while, is not efficient.
Another very important characteristic of an ISA is the maximum number of source registers in an instruction. That number can be unobvious: the Conditional Move instruction typically looks like it has two input and one output. However, in a renaming implementation, it becomes necessary to treat the conditional updating of the output by, in essense, inputing the old value of the output register and then selecting it or the other input to be written into a renamed (i.e. diferent physical) register. Many RISC architectures added the Conditional Move instruction, with the idea that it can emulate the VLIW concept of predication, prior to embarking on out-of-order implementations. The cost-performance consequencies of having Conditional Move instructions are rather ambiguous.
On the other hand, some characteristics that were thought to be extremely important in the early RISC days have turned out to be much less so. A case in point is having a single, fixed instruction size. All superscalar processors must be capable of dispatching varying numbers of instruction, so they must solve a problem similar to the "variable length instruction" problem. In retrospect, the essential qualities seem to be that all instruction lengths be multiples of the shortest, which Semour Cray calls an instruction Parcel, and that register specifiers appear in the same location within a parcel, preferably only in the first parcel of longer instructions.
Certain operations are known to be commonly performed in groups, and their broad utility has withstood the test of time. It seems wasteful to continuously detect their co-location and re-analyze their dependencies in order to accelerate them. There is a continuom between, on the one hand, the very simplified and, some would say overly primitive, ISA that is typical of the early RISC architectures, to, on the other hand, the very complex ISA of architectures like the VAX and IA64. ISA design being somewhat of an art, what is ideal for one architect is naturally not right for another. The CAVA philosophy is very implementation oriented: (i) if it is extremely valuable, do whatever is necessary, even if it causes irregularities (e.g. see the memcpy instruction), and (ii) complex instructions that modify little, and very specific, machine state are much easier to implement efficiently than those that potentially modify a lot of state. These ideas are based on any scientific principles, but merely pragmatic based on implementation experiences.
CAVA has a single file of 64 registers each of 64-bits. All types of values can be uniformly stored there, and all instructions uniformly address all 64 registers. By ABI convention register $0 is the stack pointer and register $63 contains the return address, but the hardware doesn't have to know anything about that. Register specifiers are plain and simple--there are no register windows or any facility for "rotation."
The philosophy for data type support is "everything that fits in 64-bits." Naturally, this includes the usual 32- and 64-bit integers, single- and double- precision floating point numbers. CAVA also supports a variety of short vectors: pairs of single-precision floating point numbers, pairs of 32-bit signed and unsigned integers, vectors of four 16-bit signed and unsigned integers, and vectors of eight 8-bit signed and unsigned integers. All of these scalar and vector types are stored uniformly in the same register file.
There is one special register that may be used often, the vector accumulator, explained in more details in the section titled "Vector Accumulator Instructions." The main reason for this irregularity is that this register is much wider than 64-bits. The program counter is also a special register. It is implicit and not directly accessible, and can only be updated by branch and jump instructions.
Memory is byte addressible. Loads and stores of any size have no alignment restrictions on the address. While merely convenient for scalars, this property becomes absolutely essential when loading and storing 64-bit data which are in fact packed vectors of small integers or single-precision floating point numbers. Comparing DSP kernels, the code for architectures with strict alignment requirements need many more overhead instructions relative to architectures that support "unaligned" access. SIMD support without unaligned loads has questionable utility.
CAVA is little endien. Supporting "bi-endien" is very cheap in hardware, but turns out to be extremely expensive during verification, and is an absolute nightmare for system software development and release. CAVA uses the same endien as the x86 PC.
CAVA instructions are 24 and 48 bits. The extra 24 bits of long instructions are used for such things as large address displacements, 32-bit immediate values and branch targets that are far away, obliviating the need for typical RISC instructions such as "Set High Half" or "Load Upper Immediate." The hardware needed to rotate and align instructions to byte boundaries is, in a system context, easily made up by the savings of ROM space and general bandwidth. Across many programs, the average CAVA instruction length is 3.5 bytes, but there are also fewer CAVA instructions compared to RISC, so that the total object code size is typically 30% smaller. Nevertheless, it is still perhaps 30% larger than the cooresponding x86 binary.
There are separate instructions for 32-bit and 64-bit integer operations. The reason is that many applications fit comfortably in 4GBytes of address space, and a 32 bit datapath definitely saves area and, perhaps more importantly, saves power. The intent is that a mostly 32-bit program should run close to full speed on implementations with 32-bit datapaths--only truely 64-bit operations should take more cycles to execute.
CAVA has a large number of conditional branch instructions. There are short branches that compare a register against zero, long branches that compare a register with another register or an immediate constant, and complex instructions that perform load-compare-branch. The reasons for having complex branch instructions are (i) it is well known that such combinations occur very frequently, but more importantly, (ii) integrating the load and branch gets rid of the intermediate register references, allowing even very simple, in-order pipelines to cheaply speculate beyond a cache miss involving the integrated load.
Many DSP architectures have a "two memory" organization: one is the normal data memory, the other is a much smaller memory used to store tables of coefficents. Typically, a single instruction loads from both memories and performs a multiply-accumulate, auto-increments both address pointers, and sometimes even decrement a counter and branch, all in one cycle. Although there may be a lot of other more ordinary looking instructions, this particular operation is digital signal processing, and its absence may be one of the reasons why general purpose architectures have had a tough time breaking into the DSP market.
CAVA supports DSP with a set of memory-to-accumulator instructions. The memory addressing mode is base register plus small displacement (up to 256 bytes) with no auto-increment. The multiply-accumulate and sum-of-absolute-value instructions specify a general-purpose register as the second operand. The intent is to asymtotically match the DSP architecture's throughput: Loop unrolling with the small address displacement amortizes address increment without incurring the implementation penalties of auto-increment. The 64 entry by 64 bit register file comfortably holds a block of 16x16 8-bit video data or several 8x8 matrices of 16-bit coefficients.
However, support at the instruction operation level is not enough to really make DSP algorithms run fast. By its very nature, DSP works on streaming data that is continuously being created by a sensor or consumed by some output device, in real time. Therefore, ordinary data caches do not help, and in fact usually severely degrade performance. Most DSP programs are organized around the double buffer idea: while the sensor is filling one buffer, the processor crunches on the other buffer, then the buffer usage is flipped. To operate at high frequencies, the buffers must be in some kind of local memory within the processor chip, and filled by Direct Memory Access that operates in the background.
CAVA has a cache instruction that can lock portions of virtual address space into cache, and a memcpy instruction which is an all-purpose "Data Transporter." The sequential program semantics of the Memory Copy instruction is always the same. However, depending on whether the source or destination memory range has been locked into cache, the instruction can selectively become nonblocking to perform the DMA functionality. The compiler or programmer has access to the Cache Directive and Memory Copy instructions through the Unix mmap() and memcpy() library functions, respectively. CAVA processors can support software controlled DMA in high level languages such as C++ and Java. More details are available in the section titled "Special Instructions."
One of the dangers of having load-and-whatever opcodes in an instruction set is that it is very easy to get carried away. There are, obviously, an infinite variety of combinations, all of which may be useful to some people. The philosphy used for CAVA limits complex instructions to only those combinations that (i) does not update general purpose registers, and (ii) cannot cause an exception besides the "Invalid Address Translation" trap from the integrated load. These restrictions yield subtle but very significant implementation simplicifications. However, their discussion is beyond the scope of this document.
This chapter details special registers and their fields, instruction formats and specific opcode bit patterns. Most of the information in this chapter is automatically derived from the "master/arch/syntax.in" file.