Changeset fdaef80 in rtems-docs


Ignore:
Timestamp:
Nov 20, 2018, 4:36:10 PM (5 months ago)
Author:
zehata <zenon.hans.taneka@…>
Branches:
master
Children:
92745a4
Parents:
80a2b75
git-author:
zehata <zenon.hans.taneka@…> (11/20/18 16:36:10)
git-committer:
Joel Sherrill <joel@…> (11/20/18 16:36:10)
Message:

cpu-supplement/sparc.rst: Merge Annul Slot Explanation (GCI 2018)

This content originated as an email response from Jiri Gaisler
to Joel Sherrill in response to a question.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpu-supplement/sparc.rst

    r80a2b75 rfdaef80  
    437437drivers, and MPCI routines, must also adhere to these calling conventions.
    438438
     439----------------
     440
     441.. sidebar:: *Origin*
     442
     443  This SPARC Annul Slot section was originally an email from Jiri Gaisler
     444  to Joel Sherrill that explained why sometimes, a single instruction
     445  will not be executed, due to the Annul Slot feature.
     446
     447In SPARC, the default behaviour is to execute instructions after a branch.
     448As with the behaviour of most RISC (Reduced Instruction Set Computer)
     449machines, SPARC uses a branch delay slot. This is because completing
     450an instruction every clock cycle introduces the problem that a branch
     451may not be resolved until the instruction has passed through the
     452pipeline. By inserting stalls, this is prevented. In each cycle, if a
     453stall is inserted, it is considered one branch delay slot.
     454
     455For example, a regular branch instruction might look like so:
     456
     457.. code-block:: assembly
     458
     459        cmp %o4, %g4    /* if %o4 is equals to %g4 */
     460        be 200fd06      /* then branch */
     461        mov [%g4], %o4  /* instructions after the branch, this is a */
     462                        /* branch delay slot it is executed regardless */
     463                        /* of whether %o4 is equals to %g4 */
     464
     465However, if marked with "``,a``", the instructions after the branch will
     466only be executed if the branch is taken.  In other words, only if the
     467condition before is true, then it would be executed. Otherwise if would be
     468"annulled".
     469
     470.. code-block:: assembly
     471
     472        cmp %o4, %g4    /* if %o4 is equals to %g4 */
     473        be,a 200fd06    /* then branch */
     474        mov [%g4], %o4  /* instruction after the branch */
     475
     476
     477The ``mov`` instruction is in a branch delay slot and is only executed
     478if the branch is taken (e.g. if %o4 is equals to %g4).
     479
     480This shows up in analysis of coverage reports when a single instruction
     481is marked unexecuted when the instruction above and below it are executed.
     482
     483
    439484Memory Model
    440485============
Note: See TracChangeset for help on using the changeset viewer.