Question Details

[answered] Below is also my previous lab if that helps understand. #in


Please need help with my lab assignment. Below is also my previous lab if that helps understand.

#include "stdio.h"

int main(void) {

/*
Unless otherwise indicated, all statments in the code REQUIRE
incrementation of the opTime variable.

The amount of time that an internal unit uses during operation is given in the pdf.

There are five internal units, and different instructions require particular units to operate.
opTime += 0;// IF (Instruction Fetch) unit
opTime += 0;// ID (Instruction Decode) unit
opTime += 0;// OF (Operand Fetch) unit
opTime += 0;// OE (Operation Execution) unit
opTime += 0;// OS (Operant Store) unit
*/

// To keep track of runtime
// DO NOT include in opTime calculation!
float opTime = 0.0;

//An arbitrary number for use as a condition in second 'for' loop
int n = 1000;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

//some float variables that represent registers and memory locations
float x = 1;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit
float y = 1;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit
float z = 1;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit
float t = 0;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit
float k = 1;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit



// Iterator declaration; In C, declaring 'i' must be done before initializing a 'for' loop
// DO NOT include in opTime calculation!
int i;

// Assume 'for' loop instruction is read only one time, but it checks and incremants i 100 times!
// Each command requires incrementing opTime variable relative to what it does.

//'for' instruction

opTime+= 800;//IF unit
opTime+= 100;//ID unit
opTime += 0; // OF unit
opTime+= 200;//OE unit
opTime += 0; // OS unit

for(i = 0 ; i{
//i opTime+= 800;//IF unit
opTime+= 100;//ID unit
opTime += 0; // OF unit
opTime+= 200;//OE unit
opTime += 0; // OS unit


//i++ / i = i + 1
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 800; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

x = y + z;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 800; // OF unit
opTime += 0; // OE unit
opTime += 0; // OS unit

y = x;
opTime += 1600; // IF unit
opTime += 100; // ID unit
opTime += 800; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

z = y + i;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 1600; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

}

opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 4800; // OF unit
opTime += 200; // OE unit
opTime += 0; // OS unit

printf("n x = %fn y = %fn z = %fn t = %fn k = %fn Operating time 01 = %f ns nnn", x,y,z,t,k, opTime);


//re-initializing registers and memory locations
x = 1;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

y = 0;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

z = 0;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

t = 0;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

k = 0;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

// Assume for instruction is read only onetime, but it checks and incremants i for 1000 times! n is initialized before.

//'for' instruction
opTime+= 800;//IF unit
opTime+= 100;//ID unit
opTime += 0; // OF unit
opTime+= 200;//OE unit
opTime += 0; // OS unit

for( i = 0; i {
//i opTime += 0; // IF unit
opTime += 0; // ID unit
opTime += 0; // OF unit
opTime += 200; // OE unit
opTime += 0; // OS unit

//i++ / i = i + 1
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 800; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

y = t + 1;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 800; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

k = k + 5;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 800; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit
z++;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 800; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

t = t + i;
opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 1600; // OF unit
opTime += 200; // OE unit
opTime += 800; // OS unit

}

opTime += 800; // IF unit
opTime += 100; // ID unit
opTime += 4800; // OF unit
opTime += 200; // OE unit
opTime += 0; // OS unit

printf("n x = %fn y = %fn z = %fn t = %fn k = %fn Total operating time = %f nsnnn", x,y,z,t,k, opTime);



// Do not include in opTime calculation!
return 0;
}

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Sep 18, 2020

PRICE: $15

Solution~0001005610.zip (25.37 KB)

Buy this answer for only: $15

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free copy from our tutoring website www.aceyourhomework.com (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Sep 18, 2020

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN YOUR SET DEADLINE.

Order Now