risc-and-cisc-computes

Write a RISC & CISC-style program that computes the expression ANSWER = A × B + C × D

RISC-style program:

A RISC-style program that computes ANSWER = A × B + C × D

 MoveR2, #AGet the address of A
 LoadR3, (R2)Load the operand A
 MoveR2, #BGet the address operand of B
 LoadR4, (R2)Load the operand B
 MultiplyR5, R3, R4Generate A × B
 MoveR2, #CGet the address of the C
 LoadR3, (R2)Load the operand C
 MoveR2, #DGet the address of the D
 LoadR4, (R2)Load the operand D
 MultiplyR6, R3, R4Generate C × D
 AddR7, R5, R6Compute the final answer
 MoveR2, #ANSWERGet the address
 StoreR7, R2Store the answer
 Next instruction  
 ORIGIN0 × 500 
A:DATAWORD100Test data
B:DATAWORD50 
C:DATAWORD20 
D:DATAWORD400 
ANSWER:RESERVE4Space for the answer

 

CISC-style program:

A CISC-style program that computes ANSWER = A × B + C × D

 MoveR2, ALoad the operand A
 MultiplyR2, BGenerate A × B
 MoveR3, CLoad the operand C
 MultiplyR3, DGenerate C × D
 AddR3, R2Compute the final answer
 MoveANSWER, R3Store the answer
 Next instruction  
 ORIGIN0 × 500 
A:DATAWORD100Test data
B:DATAWORD50 
C:DATAWORD20 
D:DATAWORD400 
ANSWER:RESERVE4Space for the answer

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top