05.09.2015 Views

计 算 机 组 织 与 系 统 结 构

打印版 - 北京大学微处理器研究开发中心

打印版 - 北京大学微处理器研究开发中心

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

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

Using Index Registers<br />

C i ← A i + B i , 1 ≤ i ≤ n<br />

LOADi -n, IX<br />

LOOP JZi DONE, IX<br />

A<br />

LOAD<br />

LASTA, IX<br />

ADD LASTB, IX<br />

STORE LASTC, IX<br />

JUMP<br />

LOOP<br />

LASTA<br />

DONE HALT<br />

• Program does not modify itself<br />

• Efficiency i has improved dramatically (ops / iter)<br />

with index regs without index regs<br />

instruction fetch 5(2)<br />

17 (14)<br />

operand fetch 2<br />

10 (8)<br />

store 1<br />

5 (4)<br />

• Costs:<br />

Instructions are 1 to 2 bits longer<br />

Index registers with ALU-like circuitry<br />

Complex control<br />

北 京 大 学 <strong>计</strong> <strong>算</strong> <strong>机</strong> 科 学 技 术 <strong>系</strong><br />

北 京 大 学 微 处 理 器 研 究 开 发 中 心<br />

Operations on Index Registers<br />

To increment index register by k<br />

AC ← (IX)<br />

AC ← (AC) + k<br />

IX ← (AC)<br />

new instruction<br />

new instruction<br />

also the AC must be saved and restored.<br />

It may be better to increment IX directly<br />

INCi k, IX IX ← (IX) + k<br />

More instructions to manipulate index register<br />

STOREi x, IX M[x] ← (IX) (extended to fit a word)<br />

...<br />

IX begins to look like an accumulator<br />

⇒ several index registers<br />

several accumulators<br />

⇒ General Purpose Registers<br />

北 京 大 学 <strong>计</strong> <strong>算</strong> <strong>机</strong> 科 学 技 术 <strong>系</strong><br />

北 京 大 学 微 处 理 器 研 究 开 发 中 心<br />

Evolution of Addressing Modes<br />

1. Single accumulator, absolute address<br />

LOAD<br />

x<br />

2. Single accumulator, index registers<br />

LOAD x, IX<br />

3. Indirection<br />

LOAD (x)<br />

4. Multiple accumulators, index registers, indirection<br />

LOAD<br />

R, IX, x<br />

or LOAD R, IX, (x) the meaning?<br />

R ← M[M[x] + (IX)]<br />

or R ← M[M[x + (IX)]]<br />

5. Indirect through registers<br />

LOAD R I , (R J )<br />

6. The works<br />

LOAD R I , R J , (R K ) R J = index, R K = base addr<br />

Variety of Instruction Formats<br />

Two address formats: the destination is same as one of the operand<br />

sources<br />

(Reg × Reg) to Reg R I ← (R I ) + (R J )<br />

(Reg × Mem) to Reg R I ← (R I ) + M[x]<br />

x can be specified directly or via a register<br />

effective address calculation for x could include indexing,<br />

indirection, ...<br />

Three address formats: One destination and up to two operand<br />

sources per instruction<br />

(Reg x Reg) to Reg R I ← (R J ) + (R K )<br />

(Reg x Mem) to Reg<br />

R I ← (R J ) + M[x]<br />

北 京 大 学 <strong>计</strong> <strong>算</strong> <strong>机</strong> 科 学 技 术 <strong>系</strong><br />

北 京 大 学 微 处 理 器 研 究 开 发 中 心<br />

北 京 大 学 <strong>计</strong> <strong>算</strong> <strong>机</strong> 科 学 技 术 <strong>系</strong><br />

北 京 大 学 微 处 理 器 研 究 开 发 中 心

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

Saved successfully!

Ooh no, something went wrong!