homework9

.docx

School

University of Illinois, Chicago *

*We aren’t endorsed by this school

Course

266

Subject

Computer Science

Date

Apr 3, 2024

Type

docx

Pages

3

Uploaded by MinisterMusicAnt88

Report
ECE 266 – Introduction to Embedded Systems Spring 2024 Homework #9 Due: Wednesday, Mar. 27 Notes: a) Complete the assignment electronically and submit a PDF file on BlackBoard. You also need to submit an assembly program file. b) The submission will be graded by evaluating your effort level, not correctness. You are expected to show your best effort, and you may get the credit even if your answers are not all correct. Specially, for each problem, you should 1) show that you have a correct understanding of the problem; 2) use a reasonable approach to solve the problem; and 3) if required, show a complete procedure of solving in addition to the answer. c) It is suggested that you complete this week’s readings before you start on the homework. d) If you discuss this homework assignment with any of your classmates, claim so and state the name(s) of discussion participant(s). The discussion should be about the knowledge and skills related to the questions, not the solutions. Solution sharing is strictly prohibited . e) Late homework is NOT accepted. You may request an extension or exemption for a valid excuse (emergency, travel, etc.). Send the request by email to the instructor. f) The number in brackets for each exercise is an indication of the time (in minutes) needed to complete the exercise. Discussed with (if any): __________________ Readings: Textbook, Chapter 6, “Branch and Conditional Execution” Problems 1-4: For full credit, you must test your solution code in the CCS/LaunchPad platform . 1) Download the attached file homework8 _ main.c , homework8.h , and homework8_asm.asm into a folder named “Homework8”. 2) In CCS, create a CCS project named “Homework8” with external reference to folder “Homework8”. Double check that the above files have been added automatically to the project. Then, add the #include search paths and library file search paths for Util.lib and TivaWare, as you did in Lab 1. 3) Put your solution codes in homework8_asm.asm, which is a template. 4) Connect your Tiva C LaunchPad to your PC (through the debug port). Turn on the power. Start the CCS built-in terminal. 5) Build the project and run the program. The test output will be shown on the terminal window. Debug until your solution code works. Note: Even if the test output looks all correct, your codes may still contain bugs.
Submit homework8_asmfunc.asm containing your solution code in this assignment. You don’t have to put the codes in this file. That is the only file you need to submit for this assignment. Reminder: You can debug assembly code in CCS by step-by-step tracing, setting breakpoints, observing register values, and so on. You may explore the menu of CCS to find all the debugging features. Write assembly functions equivalent to the following C functions. 1. [15] Copy an array of short integer of certain length. void copy1(short X[], short Y[], int N) { int i; for (i = 0; i < N; i++) { Y[i] = X[i]; } } 2. [15] Write an assembly function equivalent to the following C function. The function saturates all short integers of array X[] to 12 bits. Use a SSAT instruction inside the loop. void Ssat12Array(short X[], int N) { int i; for (int i = 0; i < N; i++) { if (X[i] < -2048) X[i] = -2048; else if (X[i] > 2047) X[i] = 2047; } } 3. [15] Write an assembly function equivalent to the following C function. The function calculates the dot product of two vectors (arrays). Note that the array elements are “short int”, and the result is “int”. int DotProduct(short X[], short Y[], int N) { int i; int result = 0; for (i = 0; i < N; i++) { result += X[i] * Y[i]; } return result; }
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help