ISA cont. #
Stack architecture #
Example stack style assembly to compute A = B * (C + D)
PUSH (C) ; stack <- M[C]
PUSH (D) ; stack <- M[D]
ADD ; stack <- (C) + (D)
; values popped, added, result pushed
PUSH (B) ; stack <- M[B]
MUL ; stack <- ((C) + (D)) * (B)
; values popped, multiplied, result pushed
POP (A) ; M[A] <- (((C) + (D)) * (B))
; value popped and stored in memory
Accumulator architecture #
LD = load
Example accumulator style assembly to compute A = B * (C + D)
LD (C) ; ACC <- M[C]
ADD (D) ; ACC <- ACC + M[D]
MUL (B) ; ACC <- ACC * M[B]
ST (A) ; M[A] <- ACC
CISC – complex instruction set computer #
Example CISC style assembly to compute A = B * (C + D)
LD R1, (C) ; R1 <- M[C]
ADD R1, (D) ; R1 <- R1 + M[D]
MUL R1, (B) ; R1 <- R1 * M[B]
ST (A), R1 ; M[A] <- R1