Types of Address Instructions

by 07:50 0 ความคิดเห็น
Three address instructions
- จะมี 2 ตัวถูกดำเนินการ และ 1 ตัวเป้าหมาย
- เราจะเรียกสิ่งนี้ว่า "General register organization"
Ex  X = (A+B) * (C+D)
add t0 ,A ,B # Temp t0 = A+B
add t1 ,C ,D # Temp t1 = C+D
mul X ,t0 , t1 # X = t0*t1

Two address instructions
- ตัวเป้าหมายจะเป็นตัวเดียวกับตัวดำเนินการตัวแรก
Ex  X = (A+B) * (C+D)
mov t0 ,A # Temp t0 = A
add t0 ,B # t0 = t0+B
mov t1 ,C # Temp t1 = C
add t1 ,D # t1 = t1+D
mul t0 ,t1 # t0 = t0*t1
mov X ,t0 # X = t0

One address instructions
- ใช้ AC ในการจัดการข้อมูลทุกๆข้อมูล
Ex  X = (A+B) * (C+D)
load A # AC = A
add B # AC = AC+B
store t0 # Temp t0 = AC
load C # AC = C
add D # AC = AC+D
mul t0 # AC = AC*t0
store X # X = AC




Zero address instructions
- นำ stack มาใช้ โดยมี 2 ตัวดำเนินการคือ pushและ pop
Ex  X = (A+B) * (C+D)
push A # TOS<=A
push B # TOS<=B
add  # TOS<=(A+B)
push C # TOS<=C
push D # TOS<=D
add  # TOS<=(C+D)
mul  # TOS<=(C+D)*(A+B)
pop X # X=TOS

เว็บอ้างอิง : http://www.slideshare.net/sanjeevpatel4x/instruction-format


Unknown

Developer

เด็กน้อยคนนึง เขาต้องเดินทางข้ามภูเขาเก้าลูกเพื่อไปโรงเรียน ในระหว่างการเดินทางนั่นเขา ได้เจอกับสิ่งต่างๆ มากมายทั้งสัตว์น้อยใหญ่ และ พืชนานาชนิดมากมาย ในภูเขาแต่ละลูกที่เขาเดินไปนั้น จะมีความแตกต่างกันอย่างสิ้นเชิง ภูเขาลูกที่นึงเป็นภูเขาที่เต็มไปด้วยผู้คนมากมาย ต่างเฉลิมฉลองกัน พอผ่านภูเขาลูกที่หนึ่งเขาก็พอกับภูเขาลูกที่สอง...

0 ความคิดเห็น:

แสดงความคิดเห็น