|
Last change
on this file was
81,
checked in by rosiere, 18 years ago
|
- Finish Environment (and test)
- Continue predictor_unit
- Add external tools
- svn keyword "Id" set
|
-
Property svn:keywords set to
Id
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | /******************************************** |
|---|
| 2 | * files : asm_002_addc.s |
|---|
| 3 | * authors : Rosiere Mathieu |
|---|
| 4 | * date : 2006/06/20 |
|---|
| 5 | ******************************************** |
|---|
| 6 | * input : - |
|---|
| 7 | * output : 1 test OK |
|---|
| 8 | * 0 test KO |
|---|
| 9 | ******************************************** |
|---|
| 10 | * test : Test the carry |
|---|
| 11 | * warning : instructions used |
|---|
| 12 | * l.add |
|---|
| 13 | * l.addi |
|---|
| 14 | * l.and |
|---|
| 15 | * l.bf |
|---|
| 16 | * l.jal |
|---|
| 17 | * l.jr |
|---|
| 18 | * l.sfne |
|---|
| 19 | ******************************************** |
|---|
| 20 | */ |
|---|
| 21 | .file "asm_002_addc.s" |
|---|
| 22 | .section .text |
|---|
| 23 | .align 4 |
|---|
| 24 | |
|---|
| 25 | .global _asm_002_addc |
|---|
| 26 | _asm_002_addc : |
|---|
| 27 | /* save context */ |
|---|
| 28 | l.addi r1,r1,-12 |
|---|
| 29 | l.sw 0(r1),r20 |
|---|
| 30 | l.sw 4(r1),r21 |
|---|
| 31 | l.sw 8(r1),r22 |
|---|
| 32 | /* Return is KO (default) */ |
|---|
| 33 | l.and r11,r0,r0 |
|---|
| 34 | |
|---|
| 35 | /* |
|---|
| 36 | * R20 = 0x00000001 |
|---|
| 37 | * R21 = 0xFFFFFFFF |
|---|
| 38 | * R22 = 0x00000000 and carry is set |
|---|
| 39 | */ |
|---|
| 40 | l.addi r20,r0, 1 |
|---|
| 41 | l.addi r21,r0,-1 |
|---|
| 42 | l.add r22,r20,r21 |
|---|
| 43 | |
|---|
| 44 | /* Add the carry */ |
|---|
| 45 | l.addc r22,r0,r0 |
|---|
| 46 | |
|---|
| 47 | l.sfne r22,r20 |
|---|
| 48 | l.bf _asm_002_addc_ko |
|---|
| 49 | l.nop 0 |
|---|
| 50 | |
|---|
| 51 | _asm_002_addc_ok : |
|---|
| 52 | l.addi r11,r0,1 |
|---|
| 53 | |
|---|
| 54 | _asm_002_addc_ko : |
|---|
| 55 | /* load context */ |
|---|
| 56 | l.lwz r22,8(r1) |
|---|
| 57 | l.lwz r21,4(r1) |
|---|
| 58 | l.lwz r20,0(r1) |
|---|
| 59 | l.jr r9 |
|---|
| 60 | l.addi r1,r1,12 |
|---|
Note: See
TracBrowser
for help on using the repository browser.