|
Lines 442-449
or v3.1B specification*). However with some care and consideration
Link Here
|
| 442 |
the exact same mapping used for INT and FP regfiles may be applied, |
442 |
the exact same mapping used for INT and FP regfiles may be applied, |
| 443 |
just to the upper bits, as explained below. |
443 |
just to the upper bits, as explained below. |
| 444 |
|
444 |
|
| 445 |
In OpenPOWER v3.0/1, BF/BT/BA/BB are all 5 bits. The top 3 bits (2:4) |
445 |
In OpenPOWER v3.0/1, BF/BT/BA/BB are all 5 bits. The top 3 bits (0:2) |
| 446 |
select one of the 8 CRs; the bottom 2 bits (0:1) select one of 4 bits |
446 |
select one of the 8 CRs; the bottom 2 bits (3:4) select one of 4 bits |
| 447 |
*in* that CR. The numbering was determined (after 4 months of |
447 |
*in* that CR. The numbering was determined (after 4 months of |
| 448 |
analysis and research) to be as follows: |
448 |
analysis and research) to be as follows: |
| 449 |
|
449 |
|
|
Lines 454-484
analysis and research) to be as follows:
Link Here
|
| 454 |
CR_bit = (CR_reg & (1<<bit_index)) != 0 |
454 |
CR_bit = (CR_reg & (1<<bit_index)) != 0 |
| 455 |
|
455 |
|
| 456 |
When it comes to applying SV, it is the CR\_reg number to which SV EXTRA2/3 |
456 |
When it comes to applying SV, it is the CR\_reg number to which SV EXTRA2/3 |
| 457 |
applies, **not** the CR\_bit portion (bits 0:1): |
457 |
applies, **not** the CR\_bit portion (bits 3:4): |
| 458 |
|
458 |
|
| 459 |
if extra3_mode: |
459 |
if extra3_mode: |
| 460 |
spec = EXTRA3 |
460 |
spec = EXTRA3 |
| 461 |
else: |
461 |
else: |
| 462 |
spec = EXTRA2<<1 | 0b0 |
462 |
spec = EXTRA2<<1 | 0b0 |
| 463 |
if spec[2]: |
463 |
if spec[0]: |
| 464 |
# vector constructs "BA[2:4] spec[0:1] 00 BA[0:1]" |
464 |
# vector constructs "BA[0:2] spec[1:2] 00 BA[3:4]" |
| 465 |
return ((BA >> 2)<<6) | # hi 3 bits shifted up |
465 |
return ((BA >> 2)<<6) | # hi 3 bits shifted up |
| 466 |
(spec[0:1]<<4) | # to make room for these |
466 |
(spec[1:2]<<4) | # to make room for these |
| 467 |
(BA & 0b11) # CR_bit on the end |
467 |
(BA & 0b11) # CR_bit on the end |
| 468 |
else: |
468 |
else: |
| 469 |
# scalar constructs "00 spec[0:1] BA[0:4]" |
469 |
# scalar constructs "00 spec[1:2] BA[0:4]" |
| 470 |
return (spec[0:1] << 5) | BA |
470 |
return (spec[1:2] << 5) | BA |
| 471 |
|
471 |
|
| 472 |
Thus, for example, to access a given bit for a CR in SV mode, the v3.0B |
472 |
Thus, for example, to access a given bit for a CR in SV mode, the v3.0B |
| 473 |
algorithm to determin CR\_reg is modified to as follows: |
473 |
algorithm to determin CR\_reg is modified to as follows: |
| 474 |
|
474 |
|
| 475 |
CR_index = 7-(BA>>2) # top 3 bits but BE |
475 |
CR_index = 7-(BA>>2) # top 3 bits but BE |
| 476 |
if spec[2]: |
476 |
if spec[0]: |
| 477 |
# vector mode, 0-124 increments of 4 |
477 |
# vector mode, 0-124 increments of 4 |
| 478 |
CR_index = (CR_index<<4) | (spec[0:1] << 2) |
478 |
CR_index = (CR_index<<4) | (spec[1:2] << 2) |
| 479 |
else: |
479 |
else: |
| 480 |
# scalar mode, 0-32 increments of 1 |
480 |
# scalar mode, 0-32 increments of 1 |
| 481 |
CR_index = (spec[0:1]<<3) | CR_index |
481 |
CR_index = (spec[1:2]<<3) | CR_index |
| 482 |
# same as for v3.0/v3.1 from this point onwards |
482 |
# same as for v3.0/v3.1 from this point onwards |
| 483 |
bit_index = 3-(BA & 0b11) # low 2 bits but BE |
483 |
bit_index = 3-(BA & 0b11) # low 2 bits but BE |
| 484 |
CR_reg = CR{CR_index} # get the CR |
484 |
CR_reg = CR{CR_index} # get the CR |
| 485 |
- |
|
|