CS137-lecture-20210429

ISA cont. #

image_2021-04-29-19-02-28 image_2021-04-29-19-10-40

Stack architecture #

image_2021-04-29-19-13-15 image_2021-04-29-19-22-08

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 #

image_2021-04-29-19-31-33

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 #

image_2021-04-29-19-52-02

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