21.01.2013 Views

Lecture Notes in Computer Science 4917

Lecture Notes in Computer Science 4917

Lecture Notes in Computer Science 4917

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

152 T.T. Hahn et al.<br />

for 16-bit <strong>in</strong>structions. For a 32-bit <strong>in</strong>struction, the correspond<strong>in</strong>g two p-bits <strong>in</strong><br />

the header are not used (set to zero). The rema<strong>in</strong><strong>in</strong>g seven expansion bits (bits<br />

14-20) are used to specify different variations of the 16-bit <strong>in</strong>struction set.<br />

The expansion bits and p-bits are effectively extra opcode bits that are attached<br />

to each <strong>in</strong>struction <strong>in</strong> the fetch packet. The compressor software (discussed<br />

<strong>in</strong> section 4) encodes the expansion bits to maximize the number of<br />

<strong>in</strong>structions <strong>in</strong> a fetch packet.<br />

The protected load <strong>in</strong>struction bit (bit 20) <strong>in</strong>dicates if all load <strong>in</strong>structions<br />

<strong>in</strong> the fetch packet are protected. This elim<strong>in</strong>ates the NOP that occurs after a<br />

load <strong>in</strong>struction <strong>in</strong> code with limited ILP, which is common <strong>in</strong> control oriented<br />

code. The register set bit (bit 19) <strong>in</strong>dicates which set of eight registers is used<br />

for three operand 16-bit <strong>in</strong>structions. The data size field (bits 16-18) encodes<br />

the access size (byte, half-word, word, double-word) of all 16-bit load and store<br />

<strong>in</strong>structions. The branch bit (bit 15) controls if branch <strong>in</strong>structions or certa<strong>in</strong><br />

S-unit arithmetic and shift <strong>in</strong>structions are available. F<strong>in</strong>ally, the saturation bit<br />

(bit 14) <strong>in</strong>dicates if many of the basic arithmetic operations saturate on overflow.<br />

3.3 Branch and Call Instructions<br />

Certa<strong>in</strong> branch <strong>in</strong>structions appear<strong>in</strong>g <strong>in</strong> header-based fetch packets can reach<br />

half-word program addresses. Ensur<strong>in</strong>g that branch <strong>in</strong>structions can reach <strong>in</strong>tended<br />

dest<strong>in</strong>ation addresses is handled by the compressor software.<br />

A new 32-bit <strong>in</strong>struction, CALLP, can be used to take the place of a B (branch)<br />

<strong>in</strong>struction and an ADDKPC (set up return address) <strong>in</strong>struction. However, unlike<br />

branch <strong>in</strong>structions, where the five delay slots must be filled with other<br />

<strong>in</strong>structions or NOPs, the CALLP <strong>in</strong>struction is “protected,” mean<strong>in</strong>g other<br />

<strong>in</strong>structions cannot start <strong>in</strong> the delay slots of the CALLP. The use of this <strong>in</strong>struction<br />

can reduce code size up to six percent on some applications with a<br />

small degradation <strong>in</strong> performance.<br />

4 The Compressor<br />

When compil<strong>in</strong>g code for C64+, an <strong>in</strong>struction’s size is determ<strong>in</strong>ed at assemblytime.<br />

(This is possible because each 16-bit <strong>in</strong>struction has a 32-bit counterpart.)<br />

The compressor runs after the assembly phase and is responsible for convert<strong>in</strong>g<br />

as many 32-bit <strong>in</strong>structions as possible to equivalent 16-bit <strong>in</strong>structions. The<br />

compressor takes a specially <strong>in</strong>strumented object file (where all <strong>in</strong>structions are<br />

32-bit), and produces an object file where some <strong>in</strong>structions have been converted<br />

to 16-bit <strong>in</strong>structions. Figure 5 depicts this arrangement. Code compression could<br />

also be performed <strong>in</strong> the l<strong>in</strong>ker s<strong>in</strong>ce the f<strong>in</strong>al addresses and immediate fields<br />

of <strong>in</strong>structions with relocation entries are known and may allow more 16-bit<br />

<strong>in</strong>structions to be used.<br />

The compressor also has the responsibility of handl<strong>in</strong>g certa<strong>in</strong> tasks that cannot<br />

be performed <strong>in</strong> the assembler because the addresses of <strong>in</strong>structions will<br />

change dur<strong>in</strong>g compression. In addition, the compressor must fulfill certa<strong>in</strong> architecture<br />

requirements that cannot be easily handled by the compiler. These

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!