Einchipmikrorechner und Signalprozessoren/Zusammenfassung

Aus II-Wiki
Zur Navigation springen Zur Suche springen

Zusammenspiel von Vergleichen und Bedingten Sprüngen

Eigenschaften EµR DSP
Vergleichsarten:

eine

 CMP A, B
  • Ein Vergleich reicht, da er mehrere Flags setzt
  • Wahl des Condition Codes wird erst in der Bedingung festgelegt

mehrere

 CMPEQ A, B, Ziel
 CMPLT A, B, Ziel
 CMPGT A, B, Ziel
  • Da nur ein "Flag" (bit im Zielregister) beim Vergleichen gesetzt wird müssen mehrere Befehle unterschidliche Vergleiche realisieren
  • Wahl des "Condition Codes" wird schon beim Vergleichen festgelegt
Vergleichsresultate:

sind im PSW kodiert:

  • Z Zero
  • V Overflow
  • C Carry
  • N Negativ

sind im Zielregister gespeichert

  • 0 wenn false
  • 1 wenn true
Sprungarten:

mehrere (durch Condtion Codes)

 JMP cc_EQ, Label
 JMP cc_SLT, Label
 JMP cc_SGT, Label
  • Erst hier muss sich für eine Bedingung entschieden werden

eine

 [A] B Label
Bedingungen:

Durch Condition Codes:

  • Wahrheitswert der Bedingung wird aus Kombination des Z-, V-, C- und N-Flags gebildet
  • Wahrheitswert der Bedingung ist der Inhalt des Bedingungsregister
  • true falls Bedingungsregister <> 0
  • false falls Bedingungsregister = 0
Beispiele:
 CMP R0, R1
 JMP cc_EQ, m0
 CMP R0, R1
 JMP cc_SLT, m0
 CMP R0, R1
 JMP cc_SGT, m0
      CMPEQ A1, A2, B0
 [B0] B m0
      CMPLT A1, A2, B0
 [B0] B m0
      CMPGT A1, A2, B0
 [B0] B m0

Zusammenspiel von Vergleichen und Bedingten Sprüngen beim EµR

<graphviz> digraph G {

 node [fontsize = 11];
 edge [fontsize = 11];
 CMP [label = "CMP R0, R1"];
 PSW [shape = record; label = " ... | <Z> Z | <V> V | <C> C | <N> N"];
 cc [shape = record; label = "<EQ> cc_EQ | <SLT> cc_SLT | <SGT> cc_SGT | ..."];
 EQ [label = "JMP cc_EQ, m0", color = red, fontcolor = red];
 SLT [label = "JMP cc_SLT, m0", color = green, fontcolor = green];
 SGT [label = "JMP cc_SGT, m0", color = blue, fontcolor = blue];
 {node [shape = box; style = filled];
   Hint1 [label = "PSW"; color = gray];
   Hint2 [label = "Condition Codes"; color = gray];
 };
 {rank = same; Hint1; PSW}
 {rank = same; Hint2; cc}
 {edge [color = gray; arrowhead = none];
   Hint1 -> PSW;
   Hint2 -> cc;
 }
 CMP -> PSW:Z;
 CMP -> PSW:V;
 CMP -> PSW:C;
 CMP -> PSW:N [label = "ändert Flags im PSW"];
 PSW:Z -> cc:EQ [color = red];
 PSW:Z -> cc:SLT [color = green];
 PSW:V -> cc:SLT [color = green];
 PSW:C -> cc:SLT [color = green];
 PSW:N -> cc:SLT [color = green];
 PSW:Z -> cc:SGT [color = blue];
 PSW:V -> cc:SGT [color = blue];
 PSW:C -> cc:SGT [color = blue];
 PSW:N -> cc:SGT [color = blue, label = "Condition Codes bilden sich\naus den Flags des PSW"];
 cc:EQ -> EQ [color = red];
 cc:SLT -> SLT [color = green];
 cc:SGT -> SGT [color = blue];

} </graphviz>

Zusammenspiel von Vergleichen und Bedingten Sprüngen beim DSP

<graphviz> digraph G {

 node [fontsize = 11];
 edge [fontsize = 11];
 B [shape = record; label = " A0 | ... | A15 | <0> B0 | <1> B1 | ... | B15"];
 EQ [label = "CMPEQ A1, A2, B0", color = red, fontcolor = red];
 LT [label = "CMPLT A1, A2, B0", color = green, fontcolor = green];
 GT [label = "CMPGT A1, A2, B0", color = blue, fontcolor = blue];


 {node [shape = box; style = filled];
   Hint1 [label = "Register"; color = gray];
 };
 {rank = same; Hint1; B}
 {edge [color = gray; arrowhead = none];
   Hint1 -> B;
 }
 EQ -> B:0 -> "[B0] B m0" [color = red];
 LT -> B:0 -> "[B0] B m0" [color = green];
 GT -> B:0 -> "[B0] B m0" [color = blue];

} </graphviz>