Homework 1 Solution

$35.00 $24.00

The objective of this assignment is for you to set up the infrastructure you need for subsequent assignments and to write and execute basic MIPS and C programs. Help is available through piazza, during TA office hours (posted on Canvas syllabus page) and by sending email to ece2035-help@ece.gatech.edu. There are also links to tutorials, primers,…

You’ll get a: . zip file solution

 

 
Categorys:

Description

5/5 – (2 votes)

The objective of this assignment is for you to set up the infrastructure you need for subsequent assignments and to write and execute basic MIPS and C programs. Help is available through piazza, during TA office hours (posted on Canvas syllabus page) and by sending email to ece2035-help@ece.gatech.edu. There are also links to tutorials, primers, and installation guides on our course web site: http://www.ece.gatech.edu/academic/courses/ece2035/assignments/ and on Canvas (Files>Additional Resources).

 

HW1-1: The goal of this part is to use a Linux/Unix environment and become familiar with its facilities. Toward this end, you must either acquire/access and run an appropriate Linux/Unix distribution that fits your computing environment or connect to a machine in the Klaus 1448 Linux cluster. The following are some the options available:

 

  • Unix underlying Mac OS X

 

 

 

  • Virtual Box on Windows 8.1

 

  • Red Hat on Linux machines in Klaus room 1448

 

  • Dual booting (e.g., Ubuntu 12.04 and Windows 7)

 

  • Running native Ubuntu (e.g., 14.04.3 LTS)

 

Once you do this, then perform the following exercises.

 

  1. Create and edit a text file that contains the following:
    • Tell one interesting fact about yourself.

 

  • Which Linux/Unix distribution are you using (e.g., Ubuntu 14.04.03)?

 

  • The method you are using to run Linux/Unix (e.g., one of the options above).

 

  1. Find a suitable application to capture a screenshot which shows your text file open in an editor, running under Linux/Unix.
  2. Submit your screenshot in jpeg format in a file of size no greater than 200K.

 

In order for your solution to be properly received and graded, there are a few requirements.

 

  1. The file must be named HW1-1.jpg.
  2. The file must be less than 200K bytes.
  3. Your solution must be properly uploaded to the Canvas site (under Assignments) before the scheduled due date.

 

Please note that for all solutions uploaded to Canvas, all filenames must be exactly as specified, including proper capitalization and file extension (e.g., HW1-1.jpg, HW1-2.c, etc.).

 

HW1-2: The goal of this part of the project is to modify a short C program, compile it using the GNU C Compiler gcc, and run it. A program shell HW1-2-shell.c is provided. You must copy/rename it to HW1-2.c and modify it to compute a measure of overlap between two rectangles R1 and R2, called intersection over union. It is defined as:

 

IoU= Area (R 1∩R 2)∗100
Area(R 1)+Area (R 2)− Area(R 1∩R 2)

 

For example, if the rectangles do not overlap, IoU = 0%. If they are at the same location and are the same height and width, IoU = 100%. If they are the same area 30 and their area of overlap is 10, IoU = 20%.

 

ECE 2035 Homework 1

 

 

This is frequently used in computer vision to measure how closely aligned two bounding boxes are to each other. For example, comparing the location of a detected object of interest with that of known correct “ground truth” location can be used to evaluate the accuracy of an object detection algorithm. If the IoU is greater than some threshold, the detected object would be counted as a true positive. See Fig. 1.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Fig 1: Example image annotated with bounding boxes for ground truth (blue) and detected object (red).
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Fig 2: Intersection over Union

 

 

Each bounding box is specified by the coordinates of their top left corner (Tx, Ty) and bottom right corner (Bx, By), given as the four elements of an array in this order: {Tx, Ty, Bx, By}. For example,

int R1[] = {64, 51, 205, 410};

specifies the bounding box with top left corner (64, 51) and bottom right corner (205, 410).

 

Important details and hints:

 

  • In images, the origin (0,0) is located at the upper leftmost pixel, x increases to the right and y increases downward. So in our bounding box representation, it will always be true that: Tx < Bx and Ty < By.

 

  • Assume images are 640×480 and bounding boxes fit within these bounds and are always of size at least 1×1.

 

  • IoU should be specified as an integer percent (only the whole part of the division), i.e., round down to the nearest whole number between 0 and 100 inclusive.

 

  • Be sure to multiply the area of intersection by 100 before dividing it by the area of union. You are doing integer arithmetic, not floating point operations. You’ll lose significant digits (precision) if you multiply by 100 after the division.

 

  • A common way to compute the width (or height) of the intersection of two rectangles is to find the difference between the “min of maxes” and the “max of mins.” For example,

 

ECE 2035 Homework 1

 

 

the intersection’s width is min(Bx1, Bx2) – max(Tx1, Tx2), where Bx1 and Bx2 are the maximum x for rectangle R1 and R2, respectively, and Tx1 and Tx2 are the minimum x.

 

  • Be sure to try multiple test cases, but do not change the declaration of the global variables (you should change only their initial values, such as the elements in the arrays to create new test cases).

 

  • Do not forget to handle the case in which the rectangles do not overlap. Hint: what is true of the intersection width or height calculation in this case?

 

Compiling and running your code:

 

You should open a “terminal window” to run gcc under Linux/Unix (type man gcc for compiler usage or look up GCC online documentation on the internet). If you do not have gcc installed, you can use “sudo apt-get install gcc” to install it. See these links for quick tutorials on apt-get and installing packages:

 

 

 

Note that in the terminal window, you can enter any of the Linux commands (such as ls, cd, cp; for reference see http://ece2035.ece.gatech.edu/assignments/Linux_Cmd_Cheatsheet.pdf).

 

Use the Linux command cd to change your current working directory to the directory in which you placed the shell program. For example,

> cd ~/Documents/2035/hw1

or

 

> cd /mnt/c/Users/Linda/2035/hw1

 

You can list the files in that directory using

 

> ls ­la

 

You can copy a file using cp or rename a file using mv (move a file to a new file). For example:

 

> cp HW1­2­shell.c HW1­2.c

You can use any of the available text editors normally found on Linux, including vi, vim, and emacs. Using the text editor of your choice modify the HW1-2.c program to compute the span as described above.

 

Once you write your program, you can compile and run it using the Linux command line:

 

  • gcc HW1­2.c –g –Wall –o HW1­2

 

  • ./HW1­2

You should become familiar with the compiler options specified by these flags.

 

In order for your solution to be properly received and graded, there are a few requirements.

 

  1. The file must be named HW1-2.c.
  2. Your name and the date should be included in the header comment.
  3. Do not #include any additional libraries.
  4. In the starting shell program, it is especially important not to remove or modify any print statements since they will be used in the grading process.
  5. Your solution must include proper documentation and appropriate indentation.
  6. Your solution must be properly uploaded to Canvas before the scheduled due date.

 

HW1-3: The goal of this part is for you to install MiSaSiM, modify a short assembly program HW1-3-shell.asm, simulate, test and debug it in MiSaSiM. The MiSaSiM simulator can be installed according to the instructions at http://lindawills.ece.gatech.edu/misasim/. Copy or

 

ECE 2035 Homework 1

 

 

rename the shell program to HW1-3.asm and modify it to compute the intersection over union of two rectangles which are allocated and initialized in the .data section of the program.

 

These use the same bounding box format as in part HW1-2. Store the result (an integer between 0 and 100, inclusive) in the memory location labeled IoU.

 

The same details and hints given in HW1-2 apply in HW1-3. Two additional constraints for this assignment only.

 

  • Do not write values to registers $0, $29, $30, or $31.

 

  • Do not use helper functions or function calls (JAL instruction).

 

In order for your solution to be properly received and graded, there are a few requirements.

 

  1. The file must be named HW1-3.asm.

 

  1. Your name and the date should be included in the beginning of the file.

 

  1. The starting shell program should not be modified except for the replacement of the com-ment “# write your code here…”
  2. Your program must store its result at the memory location labeled IoU when it returns. This answer is used to check the correctness of your code.
  3. Your program must return to the operating system via the jr Programs that include infinite loops or produce simulator warnings or errors will receive zero credit.

 

  1. Your solution must include proper documentation.

 

  1. Your solution must be properly uploaded to Canvas before the scheduled due date.

 

Honor Policy: In all programming assignments, you should design, implement, and test your own code. Any submitted assignment containing non-shell code that is not fully created and debugged by the student constitutes academic misconduct. The only exception to this is that you may use code provided in tutorial-0.zip or in the examples on the course website/Canvas as a starting point for your programs (http://ece2035.ece.gatech.edu/examples/index.html or Canvas>Files>Lecture Slides>Code Examples).