MARIE Programming Assignment - University Name - Fall Semester

Verified

Added on  2021/05/27

|12
|574
|96
Homework Assignment
AI Summary
This document presents a solution to a MARIE programming assignment. The solution includes the implementation of the Fibonacci series in assembly language, addressing the specific requirements of the MARIE architecture. The solution demonstrates the correct implementation and output of the program, including handling of potential overflow conditions. It also covers the analysis of instruction sets and addressing modes, providing examples for 1, 2, and 3-addressing code. The assignment also provides a detailed explanation of the number of instructions possible based on the addressing field size. The solution further analyzes a given expression to create equivalent code in 0, 1, 2, and 3 address formats. Finally, the solution includes a bibliography of relevant academic sources.
Document Page
Running head: MARIE PROGRAMMING
Assembly Language:
Marie Programming
Name of the Student:
Name of the University:
Author Note
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1
MARIE PROGRAMMING
Answer to question number 1
a. The following code provides the algorithm of the Fibonacci series:
ORG 100
Input // the user has to Input the number
Store N // The user inputs the number of terms to be printed
Store Ctr // It stores the counter variable in the accumulator
Loop1, Clear
Load Ctr // The counter is loaded into the processor form the accumulator
Subt C1 // The counter is subtracted by c1
Store Ctr
Load F2 // F2 is loaded into the accumulator
Add F1 // F1 is added
Store F3 // F3 is stored into the accumulator
Load F1 // F1 is loaded into the accumulator
Add F1 // F1 is added
Store F3 // F3 is stored into the accumulator
Load F1 // F1 is loaded into the accumulator
Store F2 // F2 is stored into the accumulator
Load F3
Store F1
Load Ctr
Skipcond 400 // Check condition is skipped here
Jump Loop1 // Jump condition to the location 400
Document Page
2
MARIE PROGRAMMING
Load Ctr
Output
Load N // Output is N
Output
Load F1 // the Final output is placed
Output
Halt // control halts
N, DEC 0
Ctr, DEC 0
C1, DEC 1
F1, DEC 0
F2, DEC 1
F3, DEC 0
Input: 1
Document Page
3
MARIE PROGRAMMING
Output:
Input: 10
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4
MARIE PROGRAMMING
Output:
Input: 21
Document Page
5
MARIE PROGRAMMING
Output: 10946
b.
Input: 22
Document Page
6
MARIE PROGRAMMING
Output:
Input: 23
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7
MARIE PROGRAMMING
Output:
Input: 24
Document Page
8
MARIE PROGRAMMING
Output: -19168
The machine displays a negative value at 24 as the memory of the machine goes out of
bounds. Hence the maximum value is 23 which provides a correct result for the machine and the
program.
Answer to question number 2
Number of possible instructions is 2^11=2048
Given that the size of the address field is 4.
Number of 1-addressing instruction = 30×2^4 =480
Number of 2-addressing instruction = 6×2^4 ×2^4 =1536
Hence, 2048 – 2016 = 32 number of accommodation are available.
Document Page
9
MARIE PROGRAMMING
Answer to question number 3
Given expression, A = (B+C)*(D-E)
3 addressing code for the expression is
ADD R1, B, C
SUB R2, D, E
MUL A, R1, R2
2 addressing code for the expression is
LOAD R1, B
ADD R1, C
LOAD R2, D
SUB R2, E
MUL R2, R1
STORE A, R2
1 addressing code for the expression is
LOAD B
ADD C
STORE T
Load D
SUB E
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
10
MARIE PROGRAMMING
MUL T
STORE A
0 addressing code for the expression is
PUSH B
PUSH C
ADD
PUSH D
PUSH E
SUB
MUL
Store A
Document Page
11
MARIE PROGRAMMING
Bibliography
Baldwin, J., Teh, A., Baniassad, E., Van Rooy, D. and Coady, Y., 2016. Requirements for tools
for comprehending highly specialized assembly language code and how to elicit these
requirements. Requirements Engineering, 21(1), pp.131-159.
Kawash, J., Kuipers, A., Manzara, L. and Collier, R., 2016, February. Undergraduate assembly
language instruction sweetened with the raspberry Pi. In Proceedings of the 47th ACM Technical
Symposium on Computing Science Education(pp. 498-503). ACM.
chevron_up_icon
1 out of 12
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]