Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hena

macrumors newbie
Original poster
Jun 26, 2008
1
0
hello can you helo i am hena please if you can help me to solve this project
project :
1. Consider the C-like code below. What values do the last three lines print out? If it’s printing an address, tell me what variable’s address it is printing. Assume that the “print” statement “does what you’d expect” - it prints out the value of the address or variable after it.


int p[20];
for (i=0; i<20; i++)
{p = i;}
int *mypointer = &p[0];
print *mypointer;
print p;
print p[3];


2. Processor P1 has a 1GHz clock, and processor P2 has a 2GHz clock. They have completely different instruction sets, but they both execute exactly 1 instruction per cycle. Which processor has better performance and why? You must explain your answer to get credit.




3. Write a MIPS assembly program that reads a string of integers and computes whether it (the number represented by the entire string) is prime or not. Assume the string of integers has no more than 5 digits.


4. Write a MIPS assembly program that sorts, in ascending order, all of the characters that are provided as inputs (sorting is done by ASCII code). Assume you won’t get more than 100 characters. Some inputs may repeat. The pseudo-code for your program is below.
 

Attachments

  • Arch Project.doc
    33.5 KB · Views: 67

Mac Player

macrumors regular
Jan 19, 2006
225
0
1) Firsts prints prints 0, second the address of p, third prints 3.

2) With different instruction sets it's impossible to compare.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Do your own homework/course work. Seriously: if we answer this what will you have learnt? Nothing that's what. I'm reporting this in the hope that the thread gets closed.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
This doesn't break any forum rules and it's probably best to just ignore it.

Fair enough. It just makes me very angry that people who cheat and lie their way through life like this may end up getting qualified and giving my industry a bad name when they are found to know nothing :mad:
 

mcgomer

macrumors newbie
Feb 3, 2008
16
0
Fair enough. It just makes me very angry that people who cheat and lie their way through life like this may end up getting qualified and giving my industry a bad name when they are found to know nothing :mad:

Its worse than that, they go into management and end up being decision makers on how to implement projects. :D
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Computer Architecture was one of the best courses I took in my undergrad CS program. I would never imagine trying to get around the work. If you don't like CS, there's always MIS or other such degrees that aren't as technically rigorous. If you really have no idea, and you have read the book (Sounds like Patterson and Hennessy) thoroughly, you should speak with the professor or a TA to get help with this. Asking us to do your homework is no better than just copying it from someone else.

Download spim here:
http://pages.cs.wisc.edu/~larus/spim.html

And build it for your OS X machine (I assume you have a mac since you're posting here). Then get to work writing the MIPS ASM.

As for the first two questions, I don't believe you even made an attempt.

-Lee
 

foidulus

macrumors 6502a
Jan 15, 2007
904
1
Fair enough. It just makes me very angry that people who cheat and lie their way through life like this may end up getting qualified and giving my industry a bad name when they are found to know nothing :mad:

Just give bad advice :p

To the op, your program prints "Do your own homework!" in an infinite loop :p
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
Do your own homework/course work. Seriously: if we answer this what will you have learnt? Nothing that's what. I'm reporting this in the hope that the thread gets closed.

While I agree with you completely and respect your presence in this forum, you seemed to have no real issues doing someone else's job for them. I commend you on insisting that the OP learn Cocoa 101, but you still provided a lot of code fixes...I don't really see the difference and try to avoid both situations.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
you seemed to have no real issues doing someone else's job for them

Whilst I see your point entirely, I think that is a very different set of circumstances. In that case the individual has clearly made some effort, was asking for help with a specific part of their existing code, not for the whole thing to be done for them and has gone on to prove that I was right: they have solved further problems on their own and have put the effort in. In that case it appears that something has been dumped on them unasked and they are trying their hardest. In this case it appears that someone has signed up for this and is not trying at all.
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
Whilst I see your point entirely, I think that is a very different set of circumstances. In that case the individual has clearly made some effort, was asking for help with a specific part of their existing code, not for the whole thing to be done for them and has gone on to prove that I was right: they have solved further problems on their own and have put the effort in. In that case it appears that something has been dumped on them unasked and they are trying their hardest. In this case it appears that someone has signed up for this and is not trying at all.

I guess I looked at as students don't get paid $$$ as a result from our help, programmers do.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.