Docsity

Cosc 2150 Assignment 6: Writing ARC Assembly Language Code - Prof. James S. Ward, Assignments of Computer Architecture and Organization

Toggle sidebar
bg1
Cosc 2150 Assignment 6
Due: March 11, 2009
Write the assembly language code in ARC (simplified SPARC code). Test it with the
simulator. You must have comments or lose half the points for each problem. 10 points
per question, for a total of 20 points
1. Do not modify the loop it must go from 5 to 0.
main () {
int c[5], a;
for (a=4; a>=0; a--) {
if (a==0) {
c[a] = 5;
} else if (a > 3) {
c[a] = a / 2;
} else {
c[a] = a * 4;
}
}
2. You must have the subroutine.
int c, a=-1, b=4; //Yes, these are global variables
main () {
if ( ((a <= 0) && ( b >= 4) )) || ( (a + b)*4 >50) {
c = 10;
} else {
sub1();
}
}
sub1 () {
c = (a + b) * 2;
}
Turn in:
A printed report, which includes the following
1. title page:
Cosc 2150
Homework #6
y o u r N a m e
in large font at the top of the page. At the bottom of the page, include a non-empty statement of help
delivered and help received. It is OK to state that no help was given or received. It is NOT ok to omit the
statement of help.
1.Turn in a printed copy of the code and compiled code found in the .lst file for both questions.
2. put a copy of the code in your course directory
\\lamont.cs.uwyo.edu\courses\cosc2150\students\<lastname>\homework6\

Partial preview of the text

Download Cosc 2150 Assignment 6: Writing ARC Assembly Language Code - Prof. James S. Ward and more Assignments Computer Architecture and Organization in PDF only on Docsity!

Cosc 2150 Assignment 6 Due: March 11, 2009 Write the assembly language code in ARC (simplified SPARC code). Test it with the simulator. You must have comments or lose half the points for each problem. 10 points per question, for a total of 20 points

  1. Do not modify the loop it must go from 5 to 0. main () { int c[5], a; for (a=4; a>=0; a--) { if (a==0) { c[a] = 5; } else if (a > 3) { c[a] = a / 2; } else { c[a] = a * 4; } }
  2. You must have the subroutine. int c, a=-1, b=4; //Yes, these are global variables main () { if ( ((a <= 0) && ( b >= 4) )) || ( (a + b)*4 >50) { c = 10; } else { sub1(); } } sub1 () { c = (a + b) * 2; } Turn in: A printed report, which includes the following
  3. title page: Cosc 2150 Homework # your Name in large font at the top of the page. At the bottom of the page, include a non-empty statement of help delivered and help received. It is OK to state that no help was given or received. It is NOT ok to omit the statement of help. 1.Turn in a printed copy of the code and compiled code found in the .lst file for both questions.
  4. put a copy of the code in your course directory \lamont.cs.uwyo.edu\courses\cosc21 50 \students<lastname>\homework6\