7. Write the code to implement the expression ‘A = B + C-(DE), on three ISA Basi
ID: 3745352 • Letter: 7
Question
7. Write the code to implement the expression ‘A = B + C-(DE), on three ISA Basic classes: Stack architecture, Memory-to-Memory (3 address) architecture and Accumulator architecture. The instruction sets are: 1) Stack -push, pop, add, sub, mul, and div; 2) Memory-to-Memory (3 address) - add, sub, mul, and div; and 3) Accumulator - lda, sta, mul, add, sub, and div Assuming that operand addresses are 2 bytes, data values are 4 bytes, and opcode is 1 byte, compute the memory traffic the program would generate when it executes. For multiplication, it is assumed that 'n-byte x n-byte' produces 'n-byte.' When you compute the amount of memory traffic generated by the program, compute separately the amount of traffic due to fetch (fetch instruction) and execute (fetch data and store) using the following table as an example. Ex) Memory Traffic form for Stack, Memory-to-Memory, and Accumulator Architecture Execute Stack, Memory-to- Memory, or Accumulator Architecture Fetch Instruction Fetch Operands Store (ST) (Fetch) (FO) TotalExplanation / Answer
Stack Arcitecture :
Code Sequence
Push B
Push C
Add
Push D
Push E
Mul
sub
Instruction set: Memory to Memory
add R1, B Sub R1, B Add R1, C
load R1, B store R1, B
Example: B+C - (D*E)
load R1, B
Add R1, C /* B+C */
store R1, A
load R2, D
mul R2, E /* D*E */
sub R2, D /* B+C- (D*E) */
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.