Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dereje #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Dereje #19

wants to merge 3 commits into from

Conversation

Derejearega
Copy link

No description provided.

syscall
li $v0,5
syscall
move $s5,$v0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-5 Doesn't limit the user to 9 and therefore breaks on relatively small input. This is unsafe because your loop is accessing addresses that are out of the bounds set in fibs. (For my test, output is invalid for input > 21 where if you allocate more memory you will see that it works fine)

In fact if you try to run it with 25 numbers and pay attention to $a0 after it loads the "space" memory address, you may see the value 268501076, which is where the space character is stored, but for 25 fibonacci numbers, the sequence ends at 268501084, which means that the space character " " has been replaced with another character.

@JShrein
Copy link

JShrein commented Feb 19, 2015

SCORE: 80

PART 1:
Total: -5

-5 Doesn't limit the user to 9 and therefore breaks on relatively small input. This is unsafe because your loop is accessing addresses that are out of the bounds set in fibs. (For my test, output is invalid for input > 21 where if you allocate more memory you will see that it works fine)

In fact if you try to run it with 25 numbers and pay attention to $a0 after it loads the "space" memory address, you may see the value 268501076, which is where the space character is stored, but for 25 fibonacci numbers, the sequence ends at 268501084, which means that the space character " " has been replaced with another character.

PART 2:
Total: -8

prompt0 and prompt1 are good but
prompt2 - prompt5 is misleading because those strings aren't really prompting the user for anything.

-8 Part of the exercise is to store arithmetic results in memory (instead of just using registers), then to retrieve them from memory for printing.

If user enters 0 for N2, division by 0 occurs and the program breaks. Good idea to protect against that. No points lost since division was not required.

PART 3:
Total: -7

-5 Virtually NO comments (III)
-2 $k0 and $k1 are intended for OS use (k for kernel) and should NOT be used as general-purpose registers even though it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants