Lehrstuhl für Informatik 3 - D. Fey Vorlesung GRa - SS , Folie 1 Beispiel Stack-Architektur
Lehrstuhl für Informatik 3 - D. Fey Vorlesung GRa - SS , Folie 2 + ÷× 14ab3 14 a × b 3 ÷ + Traversierter Baum (post-order)
Lehrstuhl für Informatik 3 - D. Fey Vorlesung GRa - SS , Folie 3 14 a × b 3 ÷ + Ausgangslage für Abarbeitung in stack-basierter Architektur Erzeugte Textbeschreibung Keine explizite Adressierung über load, store Instruktionen Sondern Verwenden von push, pop Instruktionen 14 a × b 3 ÷ + push 14 // Konstante 14 auf Stack legen a × b 3 ÷ + a b 14 ToS: Top of stack Zeigt auf ersten freien Platz ToS Push 14 → Stack(ToS) ToS = ToS+1 MemoryStack 12 -3
Lehrstuhl für Informatik 3 - D. Fey Vorlesung GRa - SS , Folie 4 a × b 3 ÷ + push a // Inhalt im Speicher unter Adresse a auf Stack legen × b 3 ÷ + a b ToS Push Mem(a) → Stack(ToS) ToS = ToS+1 MemoryStack × b 3 ÷ + x // Multiplizieren b 3 ÷ + a b ToS Stack(ToS-2) x Stack(ToS-1) → Stack(ToS-2) ToS = ToS-1 MemoryStack
Lehrstuhl für Informatik 3 - D. Fey Vorlesung GRa - SS , Folie 5 b 3 ÷ + push b // Inhalt im Speicher unter Adresse b auf Stack legen 3 ÷ + a b ToS Push Mem(b) → Stack(ToS) ToS = ToS+1 MemoryStack ÷ + push 3 ÷ + a b ToS Push 3 → Stack(ToS-1) ToS = ToS+1 MemoryStack
Lehrstuhl für Informatik 3 - D. Fey Vorlesung GRa - SS , Folie 6 ÷ + divide + a b ToS Stack(ToS-2) ÷ Stack(ToS-1) → Stack(ToS-2) ToS = ToS-1 MemoryStack add a b ToS MemoryStack Stack(ToS-2) + Stack(ToS-1) → Stack(ToS-2) ToS = ToS-1