Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 5, Problem 5.16HW
Program Plan Intro
Given C Code:
void inner4(vec_ptr u, vec_ptr v, data_t *dest)
{
long i;
long length = vec_length(u);
data_t *udata = get_vec_start(u);
data_t *vdata = get_vec_start(v);
data_t sum = (data_t) 0;
for (i = 0; i < length; i++)
{
sum = sum + udata[i] * vdata[i];
}
*dest = sum;
}
Cycles per element (CPE):
- The CPE denotes performance of
program that helps in improving code. - It helps to understand detailed level loop performance for an iterative program.
- It is appropriate for programs that use a repetitive computation.
- The processor’s activity sequencing is controlled by a clock that provides regular signal of some frequency.
Loop unrolling:
- It denotes a program transformation that would reduce count of iterations for a loop.
- It increases count of elements computed in each iteration.
- It reduces number of operations that is not dependent to program directly.
- It reduces count of operations in critical paths of overall computations.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Q3: Consider the Boolean function
f(x1, x2, x3) Σ(1,2, 5)
a. Implement using PLA.
b. Implement using 3 input Look Up Table (LUT).
Implement the following error detection and error correction algorithms using C programming for Hamming code.
For Hamming codes, flip a bit in the data and implement the algorithm to correct the same on the receiver side.
As we learned in the lecture, computer software uses decimal degrees (DD), as they are much easier to handle in complex algorithms for various mapping applications. Your task is to convert Lat-Long from DMS to DD and vice versa. Remember: when using DD, the cardinal direction are replaced by positive and negative numbers . The "+" sign is omitted (it is implied) and only the minus sign "--" is mandatory . (See lecture)
Washington Monument in DC has the following coordinates, in DMS:
LAT: 38 deg 53 min 22 sec North ; LONG: 77 deg 02 min 19 sec West.
Use an online converter (such as https://www.latlong.net/degrees-minutes-seconds-to-decimal-degreesLinks to an external site.) and find the coordinates in decimal degrees.
Choose the correct coordinates in DD for the Washington Monument:
38.88944444 , 77.03861111
38.88944444 , --77.03861111
--38.88944444 , 77.03861111
--38.88944444 , --77.03861111
Chapter 5 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Knowledge Booster
Similar questions
- Simplify B (x, y, z) = X’Z+X’Y+YZarrow_forwardCreate and implement a function given using a multiplexer and decoder. f=ПM(1,3,4,7) ..arrow_forwardImplement the modular exponentiation (a.k.a. fast exponentiation) function mod_exp (b, n, m) to compute bn (mod m) more efficiently. (Hint: to read n bit-by-bit, use / and % operations repeatedly) a) Test your function for b = 3, n = 231 – 2, m = 231 – 1. b) Report the result and the time (in seconds) it takes to find the result. Q3. [30 pts] Modify your is_prime function to use the mod_exp (b, n, m) instead of the standard power operation (b**n % m). Rename it as is_prime2. Modify the mersenne (p) function to use is_prime2, and call it mersenne2. a) Use the modified function mersenne2 to print all the Mersenne primes Mp for p between 2 and 31 if possible, (with k = 3 in the is_prime function). Compare the results with the ones found in Q1. b) Gradually increase the range of p to find more Mersenne primes (say up to p = 101 if possible). What is the largest Mersenne prime you can achieve here? c) Extend the work in part (b) and find the maximum Mersenne prime you can get from this…arrow_forward
- Given f(a,b,c) = a(b+c') (a) Express f and f' as a minterm expansion (use m-notation.) (b) Express f and f' as a maxterm expansion (user m-notation.)arrow_forwarduse matlab Write an M-file to calculate the factorial function N!, Be sure to handle the special case of 0! Also, be sure to report an error if N is negative .run the program for the three statearrow_forwardprint this patternarrow_forward
- An L8 array was used to conduct the following experiments. Note that each experimental run is listed as a treatment condition (T.C. #). The quality characteristic is larger-the-better. Using the formula shown from lecture, what is the Signal to Noise ratio for TC 4? 27.37 26.74 27.87 26.23 (Don't hand writing solution)arrow_forward4- The function F(A,B,C)=AB + AC is equivalent to: a) [m(2,3,4,6) b) [m(2,3,6,7) c) [m(1,2,5) d) {m(1,5) 5- The function represented by the following 4X1 Multiplexer is a. F=xy+xyz + xz b. F=xy+yz+xz c. F = xy + xyz + xyz d. F=xy+yz+xz NÍN02 10 II 12 13 4X1 Mux 81 80 x y Farrow_forwardA c++ program that implements full subtractor using full adder for n bits.(Eg if n=4,the program should subtract two 4 bit numbers and show the output after subtraction as well as borrow)arrow_forward
- Write a function that returns the real part of the dominant eigenvector of M(a 11*11matrix), normalized to sum to 1. use pythonarrow_forwardComputer Science The question asks "Implement a two-bit equator (compare two-bit variables a [1:0] and b[1:0] using assign statement and primitive table and simulate it.", in Verilog HDL. Not sure if this is important to the individual reading this but this question is being asked in the context that the Modelsim program is being used. If more information is needed I'd be happy to oblige.arrow_forwardThe complement of the function F(A,B ,C, D) = E (2, 4, 7. 10, 12, 14) is F =7 (0,1.3.5,6,8,9,11,13.15) F =E (0,1,3,5,6,8,9.11.13.15) O Otherarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education