Homework 1 Solution

$29.99 $18.99

This is a warm-up project whose objective is for you to set up the infrastructure you need for subsequent assignments. Help is available through piazza on our course t-square site, during TA office hours (http://www.ece.gatech.edu/academic/courses/ece2035/help/index.html), and by sending email to ece2035-help@ece.gatech.edu. There are also helpful links to tutorials and primers here: http://www.ece.gatech.edu/academic/courses/ece2035/assignments/index.html. HW1-1: The goal…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

Rate this product

This is a warm-up project whose objective is for you to set up the infrastructure you need for subsequent assignments. Help is available through piazza on our course t-square site, during TA office hours (http://www.ece.gatech.edu/academic/courses/ece2035/help/index.html), and by sending email to ece2035-help@ece.gatech.edu. There are also helpful links to tutorials and primers here: http://www.ece.gatech.edu/academic/courses/ece2035/assignments/index.html.

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

  • Linux Bash shell on Windows 10 (Anniversary Update): installation guide

  • VMware on Windows 8 or 10: installation guide

  • Virtual Box on Windows 8.1

  • Dual booting Ubuntu 12.04 and Windows 7

  • Red Hat on Linux machines in Klaus room 1448

  • 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).

  2. Find a suitable application to capture a screenshot which shows your text file open in an editor, running under Linux/Unix.

  1. 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.

  1. The file must be less than 200K bytes.

  2. Your solution must be properly uploaded to the T-square site before the scheduled due date, 5:00pm on Friday, 9 September 2016.

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 the following.

The shell program has a global variable x which is initialized with a hexadecimal number. Modify the program to determine whether x is a Harshad number in base 16 and if so, whether the factors involved are mirrors of each other (in base 16). Recall that a 16-Harshad number is a positive integer that is divisible by the sum of its digits when written in base 16. In other words, your program should determine if x = p*q, where p is the sum of hexadecimal digits of x, and

  • has the same digits as p in reverse order. An example of such a number is 0x6A5. In base 16, 6+A+5 = 15 which evenly divides 0x6A5. So 0x6A5 is a 16-Harshad number and its factors (0x6A5 = 15 * 51) are mirrors of each other.

Example

Result (1 of 3 cases):

0x6A3: 6+A+3 = 13; 0x643/13 has a remainder

not a 16-Harshad number (case 1)

0x6A4 = 14

*

55

16-Harshad w/out mirror factors (case 2)

0x6A5 = 15

*

51

16-Harshad w mirror factors (case 3)

ECE 2035 Homework 1

Your program should indicate which case is true for any given x, using one of the 3 possible print statements provided in the shell code. Be sure to try multiple test cases, but please return x to the original test value when submitting your code. Here are some other numbers to try: 0x1AAF, 0x1A5F, 0xE29, 0x1B00, 0x1D2F, 0x1A90, 0xE30.

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” (see this article or this one 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://users.ece.gatech.edu/~linda/2035/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. 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.

4. Your solution must include proper documentation and appropriate indentation.

5. Your solution must be properly uploaded to T-square before the scheduled due date,

5:00pm on Friday, 9 September 2016.

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 www.ece.gatech.edu/~scotty/misasim/. Copy or rename the shell program to HW1-3.asm and modify it to determine whether or not the value at location XLoc is a 16-Harshad number and if so, put a 1 in the memory location labeled Result, otherwise put a 0 in that location. For this exercise, it might be helpful to open the “Options” menu (the wrench on the toolbar) and select “hexadecimal” as the display base.

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

ECE 2035 Homework 1

  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…”

  1. Your program must store its result at the memory location labeled Result when it re-turns. This answer is used to check the correctness of your code.

  1. Your program must return to the operating system via the jr instruction. 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 T-square before the scheduled due date,

5:00pm on Friday, 9 September 2016.

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 as a

starting point for your programs

(http://www.ece.gatech.edu/academic/courses/ece2035/examples/index.html).

3