assignment2(2)
3 Pages

assignment2(2)

Course Number: EEE 230, Fall 2012

College/University: ASU

Word Count: 787

Rating:

Document Preview

CSE/EEE 230: Computer Organization and Assembly Programming Assignment 2 Date assigned: September 24th, 2012 Due date: 4.30 pm, October 3rd, 2012 (at the start of the lecture) 1. [40 points] The following problems deal with translating from C to MIPS. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the array A and B...

Unformatted Document Excerpt
Coursehero >> Arizona >> ASU >> EEE 230

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

230: CSE/EEE Computer Organization and Assembly Programming Assignment 2 Date assigned: September 24th, 2012 Due date: 4.30 pm, October 3rd, 2012 (at the start of the lecture) 1. [40 points] The following problems deal with translating from C to MIPS. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the array A and B are in registers $s6 and $s7, respectively. a f = -g - A[4]; b B[8] = A[i-j]; i. [10 points] For the C statements above, what is the corresponding MIPS assembly code? ii. [5 points] For the C statements above, how many MIPS assembly instructions are needed to perform the C statement? iii. [5 points] For the C statements above, how many different registers are needed to carry out the C statement? The following problems deal with translating from MIPS to C. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively. a sll $s2, $s4, 1 add $s0, $s2, $s3 add $s0, $s0, $s1 b add $t0, $s6, $s0 add $t1, $s7, $s1 lw $s0, 0($t0) addi $t2, $t0, 4 lw $t0, 0($t2) add $t0, $t0, $s0 sw $t0, 0($t1) iv. [10 points] For the MIPS assembly instructions above, what is the corresponding C statement? v. [5 points] For the MIPS assembly instructions above, rewrite the assembly code to minimize the number if MIPS instructions (if possible) needed to carry out the same function. vi. [5 points] How many registers are needed to carry out the MIPS assembly as written above? If you could rewrite the code, what is the minimal number of registers needed? 2. [35 points] In the following problems, we will be investigating memory operations in the context of an MIPS processer. The table below shows the values of an array stored in memory. Assume the base address of the array is stored in register $s6 and offset it with respect to the base address of the array. a Address Data 20 4 24 5 28 3 32 2 36 1 b Address Data 24 2 28 4 32 3 36 6 40 1 i. [10 points] For the memory locations in the table above, write C code to sort the data from lowest to highest, the placing lowest value in the smallest memory location shown in the figure. Assume that the data shown represents the C variable called Array, which is an array of type int, and that the first number in the array shown is the first element in the array. Assume that this particular machine is a byte-addressable machine and a word consists of four bytes. ii. [10 points] For the memory locations in the table above, write MIPS code to sort the data from lowest to highest, placing the lowest value in the smallest memory location. Use a minimum number of MIPS instructions. Assume the base address of Array is stored in register $s6. iii. [5 points] To sort the array above, how many instructions are required for the MIPS code? If you are not allowed to use the immediate field in lw and sw instructions, how many MIPS instructions do you need? The following problems explore the translation of hexadecimal numbers to other number of formats. a 0xabcdef12 b 0x10203040 iv. [5 points] Translate the hexadecimal numbers above into decimal. v. [5 points] Show how the data in the table would be arranged in memory of a little-endian and a big-endian machine. Assume the data is stored starting at address 0. 2. [30 points] The following problems explore number conversions from signed and unsigned binary numbers to decimal numbers. a 0010 0100 1001 0010 0100 1001 0010 0100 two b 0101 1111 1011 1110 0100 0000 0000 0000 two i. [5 points] For the patterns above, what base 10 numbers does the binary number represent, assuming that it is a twos complement integer? ii. [5 points] For the patterns above, what base 10 number does the binary number represent, assuming that it is an unsigned integer? iii. [5 points] For the patterns above, what hexadecimal number does it represent? The following problems explore number conversions from decimal to signed and unsigned binary numbers. a -1 ten b 1024 ten iv. [5 points] For the base ten numbers above, convert to 2s complement binary. v. [5 points] For the base ten numbers above, convert to 2s complement hexadecimal. vi. [5 points] For the base ten numbers above, convert the negated values from the table to 2s complement hexadecimal.

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

ASU - EEE - 230
CSE/EEE 230: Computer Organization and Assembly ProgrammingAssignment 3Date assigned: October 4th, 2012Due date: 4.30 pm, October 17th, 2012 (at the start of the lecture)1. [40 points] This exercise deals with recursive procedure calls. For the follow
ASU - EEE - 230
CSE/EEE 230: Computer Organization and Assembly ProgrammingAssignment 4Date assigned: October 26th, 2012Due date: 4.30 pm, November 5th, 2012 (at the start of the lecture)1. [40 points] The table below contains the link-level details of two different
ASU - EEE - 230
1a)P121.00 E 93.5GHz 6s1point11pointP230.00 E 92GHz 15s1point11pointP390.00 E 95GHz 9s1point21pointif all are wrong, 0 point; else base points are 2.b)15s6s4points2GHz 5GHz2pointsc)9s15s4points30.00 E 9 18.00 E 92points
ASU - EEE - 230
CSE/EEE 230: Computer Organization and Assembly ProgrammingProject 1Date assigned: September 24th, 2012Due date: 4.30 pm, October 8th, 2012 (at the start of the lecture)1. [20 points] Modify demo program and run it.i.Follow the demo instruction to r
ASU - EEE - 230
CSE/EEE 230: Computer Organization and Assembly ProgrammingProject 2Date assigned: October 10th, 2012Due date: 4.30 pm, October 24th, 2012 (at the start of the lecture)1. [100 points] Translate C code to MIPS assembly.Task 1 Translate the following C
ASU - EEE - 230
CSE/EEE 230: Computer Organization and Assembly ProgrammingProject 3Date assigned: October 26th, 2012Due date: 4.30 pm, November 7th, 2012 (at the start of the lecture)Task 1 [20 points] Define function DOT_PRODUCT, and use this function to calculate
ASU - EEE - 230
1.i.The five classic components of a computer are input, output, memory, datapath, and control, with thelast two sometimes combined and called the processor.ii.The datapath performs the arithmetic operations, and control tells the datapath, memory, a
ASU - EEE - 230
CSE/EEE 230: Computer Organization and Assembly ProgrammingSolution 2Date assigned: September 24th, 2012Due date: 4.30 pm, October 3rd, 2012 (at the start of the lecture)1. [40 points] The following problems deal with translating from C to MIPS. Assum
ASU - EEE - 230
CSE/EEE 230: Computer Organization and Assembly ProgrammingSolution 3Date assigned: October 4th, 2012Due date: 4.30 pm, October 17th, 2012 (at the start of the lecture)1. [40 points] This exercise deals with recursive procedure calls. For the followin
ASU - ENG - 102
Due: Tuesday, August 24 (by class time)Worth: Ungraded but requiredIntroductory ExerciseThis exercise helps students familiarize themselves with uploading assignments to Blackboardand introduces each students background and educational goals to the in
ASU - ENG - 102
Due: Tuesday, August 30 (by class time)Worth: Ungraded but requiredIntroductory EssayPlease write a short essay (1-2 pages) in which you evaluate the quality of Edward Kochsargument Death and Justice (posted in the Content area of Blackboard under Rea
ASU - ENG - 102
JournalsDue: Thursday, December 2 (In class)Worth: 10%For this assignment students will keep a journal throughout the semester in which theyrespond to prompts from the instructor and classmates Current Events presentations. Each entrywill be a freewr
ASU - ENG - 102
Due:Thursday,September23,2010Worth:15%LettertheEditorThisassignmentasksyoutowritealettertotheeditorofanewspaperormagazine.Wewillbe completingthisassignmentoverseveraldays.PartOneDueinclassThursday,September16,2010(InformalPeerReviewnoteform)Selectan
ASU - ENG - 102
Optional FinalDue:Thursday, December 9 in LL 545BBetween 8:45 and 10:30 AM (NO LATE PAPERS)(you may make arrangements to turn the final in early, but they must be turned inin-person)Worth: The full points for the original assignmentIn a two-pocket
ASU - ENG - 102
The Research PaperTopic Selection: Thursday October 28, 2010Research Plan and Annotated Bibliography: November 4 or 9, 2010Peer Review:Claims and Reasons: Tuesday, November 16 2010Full Drafts: Thursday, November 18Final Drafts: Tuesday, November 23,
ASU - ENG - 102
Due: Tuesday, September 7, 2010(peer review Thursday, September 2)Worth: 10%Length: 2-3 pages (double-spaced)Writing Assignment 1Often no progress in the argumentative process can occur because the sides differ onwhat is at issue, share no common gr
ASU - ENG - 102
Due: October 21, 2010Peer Editing: October 19, 2010Worth: 20%Writing Assignment 3Eng 102This writing assignment asks students to evaluate a claim made by Al Gore in AnInconvenient Truth. Students may pick any cause and effect claim except the one di
ASU - PHY - 121
Calculus 101As I write this I am looking at my copy Calculus, by Michael Spivak. It is a Spanishtranslation that I purchased more than 30 years ago for my Calculus class in college. Iwas so fascinated by the topic and by Spivak's presentation that I re
ASU - PHY - 121
Chapter 11Dynamics of many-particle systems11.1 Many-particle systemsIn Chapter 1 we introduced the particle model. By assuming that an object can berepresented by a geometrical point, with the entire object's mass concentrated at thispoint, we were
ASU - PHY - 121
Question 1"Projectile Motion" implies that air resistance can be ignored. See page 79.Question 2If the acceleration is constant but not zero, the trajectory is either a straight line or aparabola. The first case occurs when the initial velocity is par
ASU - PHY - 121
Question 1The graph of velocity versus time is a straight, non-horizontal line as in Fig. 2.17.Question 2For constant non-zero acceleration the graph of x versus t is a parabola. See page 49.Question 3Free fall is motion in vacuum ( the effects of ai
ASU - PHY - 121
Question 1This is the Test of Understanding of Section 2.6 Question. Then answer is "concave up".If the acceleration is increasing with time, the velocity is increasing at an increasing rate,and this means that the curve bends upward.Question 2The ve
ASU - PHY - 121
Question 1In uniform circular motion the speed and the magnitude of the acceleration are constant.See CAUTION statement on page 89.Question 2The period T in circular motion is the time needed for one revolution. See page 89.Question 3In non-uniform
ASU - PHY - 121
Question 11,000,000 N is close to the weight of a blue whale. See Table 4.1Question 2If the net force disappears the acceleration also disappears because of Newton's SecondLaw. This means that velocity cannot change any more. In other words, the objec
ASU - PHY - 121
Question 1A body is in equilibrium when it is moving at constant velocity or at rest. See page 136.In other words, the acceleration must be zero, and if the acceleration is zero the net forcemust be zero too.Question 2The normal force can be equal, l
ASU - PHY - 121
Question 1The force that pushes the car up the hill is the friction force excerted by the road on thewheels.Question 2The only activity that does not require friction is jumping into the air.Question 3The coefficient of friction between rubber and c
ASU - PHY - 121
Question 1The normal force acquires a component in the direction of the centripetal acceleration.See Example 5.23Question 2The centrifugal force does not exist. See CAUTION section on page 159.Question 3The force needed is proportional to the accele
ASU - PHY - 121
Question 1Since the object is starting from rest, Eq. 6.6 implies.12W = 2Now if the work is W = 2W, the new speed v must satisfy12W = mv212W = mv22Now if we divide Eq. (2) by Eq. (1) we get22 2= 2 = and this impliesv = 2 vQuestion 2T
ASU - PHY - 121
Question 1If power is constant, we haveFv = ,where P is a constant. This means that a = F/m = P/mv. Since the velocity is changing,the acceleration is also changing. If you integrate the equations of motion (solutions arein Problem 6.92), youll find
ASU - PHY - 121
Question 1Both students assign the same value to the change in gravitational potential energybetween roof and ground. Read the CAUTION statement on page 216.Question 2Both rocks reach the ground with the same speed (This you know from Chapter 2, buty
ASU - PHY - 121
Question 1If the balls have the same momentum, the same force is needed to stop them. But if theyhave the same kinetic energy, the bowling ball's momentum is a factor (mbowling/mbaseball)1/2larger than the baseball's momentum. Thus a force larger by th
ASU - PHY - 121
Question 1This is a perfectly inelastic collision. Only momentum is conserved.Question 2The moving body A stops dead. You can see this from Eq. 8.24 for the special case mA =mB.Question 3In an elastic collision the relative velocity of the objects h
ASU - PHY - 121
Question 1The expression is only valid for constant angular acceleration. See Section 9.2Question 2The tangential component of acceleration is zero if the angular acceleration is zero. SeeEq. 9.14Question 3The centripetal component of acceleration i
ASU - PHY - 121
Question 1The gravitational potential energy of an extended object of mass M is the same as thepotential energy of a point mass M located at the position of the center of mass of theextended object. The derivation of this is on page 301.Question 2The
ASU - PHY - 122
Data Analysis1. IntroductionScientists need very precise and accurate measurements for many reasons. We may needto test (distinguish) rival theories which make almost the same prediction (e.g. for thetrack of an asteroid headed for earth, or the effec
ASU - PHY - 122
Data FitsIntroductionMost experiments involve several variables that are interdependent, such as force (F) anddisplacement (x) for a spring. A range of F will produce a range of x, withproportionality constant k, as described by Hookes law F(x) = kx.
ASU - PHY - 122
Friction: Determination of s and kIntroductionIn this lab, we will take measurements for which the random errors are relatively large(roughly 10 % of the measured values). We will use a statistical analysis to determine afinal measured value with prop
ASU - PHY - 122
Error Propagation: VolumesIntroductionIn this lab you will practice error analysis by measuring volumes of a few regular shapes.You need to understand the Data Analysis document to successfully complete thisexercise. The aim is to understand how error
ASU - PHY - 122
Vectors and StaticsIntroductionStatics is concerned with the application of Newtons laws to things which do notaccelerate. Examples include the design of bridges, elasticity (forces within deformedmaterials), and the forces which act at the junctions
ASU - PHY - 122
Springs and OscillatorsIntroductionIn this lab you will measure the static behavior (stretch vs. force) of simple springs,practice linear fits to find the static spring constant, then make an oscillator and test therelationship between frequency and m
ASU - PHY - 122
Density (Linearized Plots)IntroductionIn this lab you will determine the density of clay by weighing a set of hand-made spheres.You will fit a model function for mass vs. diameter using a linearized plot and a log-logplot. The aim is to understand how
ASU - PHY - 122
Newtons Second Law of MotionIntroduction and TheoryNewtons second law of motion can be summarized by the following equation: F = ma(1)where F represents the net external force acting on an object, m is the mass of the objectmoving under the influenc
ASU - PHY - 122
Energy ConservationIntroduction and TheoryThe energy that an object has due to its motion is called kinetic energy and is defined as1K = mv 2(1)2where m is the objects mass and v is its speed. An object will also have gravitationalpotential energy
ASU - PHY - 122
Projectile MotionIntroduction and TheoryConsider the projectile motion of a ball as shown in figure 1. At t = 0 the ball is released atthe position specified by coordinates (0, y0) with horizontal velocity vx.yvx(0, y0)xFigure 1. The system of coo
ASU - PHY - 122
Conservation of Linear Momentum and (Sometimes) EnergyIntroduction and TheoryCollisions are an important way of studying how objects interact. Conservation laws havebeen developed that allow one to say quite a bit about what is happening without knowin
ASU - PHY - 122
Collisions in Two DimensionsIntroduction and TheoryThis experiment will build from the collisions in one-dimension activity that has alreadybeen done. In two dimensions, as in one, the total linear momentum of the system ofcolliding bodies will be con
ASU - PHY - 122
Rotational MotionIntroductionIn this lab a constant torque will create a constant angular acceleration for a rigid body rotatingabout its center of mass. You will see that the moment of inertia depends on the rotation axis fora given object and finall
ASU - PHY - 122
Damped OscillationsIntroductionIn an earlier lab you looked at a mass and linear spring system as an oscillator, whichproduced simple harmonic motion (SHM). A pendulum is also an oscillator, where themotion takes place along a curved path. In this lab
ASU - PHY - 122
Lab 3: Vectors and StaticsSupplementWhat is below extends the discussion on pages 7 and 8 of the Data Analysis (DA) packet.In the Vectors and Statics exercise you will need to understand how errors in measuredangles propagate thorough the sine and cos
ASU - PHY - 131
PHY 131ShumwayEXAM 1 (5 pages + equation sheet)9:0010:15 am, Feb. 17, 20111. (60 points) Consider a uniform line of charge extending from x = a to x = 0 with total charge Q, anda charge q located at point x = d, a distance D from the end of the line.
ASU - PHY - 131
ASU - PHY - 131
PHY 131ShumwayExam 2 (5 pages + eq. sheet)Mar. 24, 20111. (60 points) An innitely long insulating cylinder of radius R has non-uniform charge density,(r) = 0r2R2In this problem you will have to use calculus on cylindrical shells and cylindrical Gau
ASU - PHY - 131
ASU - PHY - 131
ASU - PHY - 131
PHY 131ShumwayFINAL EXAM (7 pages + eq. sheet)7:30-9:20am, May 6, 20101. (90 points) A capacitor is made from two concentric spherical shells with inner radius a and outerradius b, with an insulating dielectric medium with dielectric constant K betwee
ASU - PHY - 131
ASU - PHY - 131
PHY 131ShumwaySAMPLE FINAL EXAM (7 pages + eq. sheet + notes) 7:30-9:20am, May 6, 20101. (90 points) To save space, someone designs a capacitor with three parallel plates, each with an area A,and separated by distances d. The middle plate holds a charg
ASU - PHY - 131
ASU - PHY - 131
PHY 131ShumwaySAMPLE EXAM 1 (5 pages + eq. sheet)for the Feb. 25, 2010 exam1. (60 points) Consider a disk of radius a with total charge Q uniformly distributed over its area, and acharge q located a perpendicular distance x from the center of the disk
ASU - PHY - 131
PHY 131ShumwaySAMPLE EXAM 1 (5 pages + eq. sheet)for the Feb. 25, 2010 examEquation Sheet for Exam 1Chapter 21F=1 |q1 q2 |4 0 r 2F = qEThe torque and energy for a dipole p = q d in an electric eld are =pEU = p EChapter 22E =E dAE =Qenc0P
ASU - PHY - 131
PHY 131ShumwaySAMPLE EXAM 2 (5 pages + eq. sheet + notes)for the Apr. 1, 2010 exam1. (60 points) A cylindrical metal wire with length L and radius r carries current according to Drudeslaw.(a) Express the current I in terms of the density of electrons