DOC PREVIEW
UIUC ECE 190 - Programming Studio

This preview shows page 1-2-3-4-5 out of 16 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Programming Studio #1 ECE 190Programming Studio #1 • Announcements • In Studio Assignment – Introduction to Linux Command-Line Operations • Recitation – Floating Point Representation – Binary & Hexadecimal – 2’s ComplementAnnouncements • Homework 1 – Available online now. Due Wednesday at 5pm in the drop box in the basement of Everitt lab. – No late homework accepted. If it’s not in the drop box by 5pm on due date, it receives a zero, no excuses. • Course information – Use the web board through http://my.ece.illinois.edu to ask questions on homework, mps, etc. – View the syllabus on the website for deadlines, rules, etc. and check website and web board frequently (once per day) for announcements.Programming Studio Assignment: Introduction to LinuxLogging In • Log into your machine – Use your netid and AD password – If you cannot log in because you are not an engineering student ask your TA to create an account for you • If you are using a Windows workstation you must connect to an EWS Linux machine using SSH – Open PuTTY • In the Host Name box type “remlnx” • Make sure the Port is set to “22” • Click Open • When prompted to log in, use your netid and AD password • It is possible to connect to an EWS workstation from home. Look on the EWS website for instructionsWorking in Command Line • Instead of pointing and clicking we tell the computer what to do by typing a command – Most of the ECE tools are only command line based • In Linux, open the “Terminal” application to enter command line mode • To see which directory you are in type “pwd” – Initially you should be in “/home/engr/your_net_id” • To see the contents of the current directory type “ls” – To see more details about the contents type “ls –l” • To obtain help for most Linux commands/programs type “man <command_name>” – Let’s see the help information for the “ls” command • Type: “man ls”Creating/changing directories • We use the “mkdir dir_name” command to make a directory called “dir_name” • Create directories “ps01” – Type “mkdir ps01” • Confirm that a directory was created by typing “ls” and seeing that the “ps01” directory shows up in the list • To change to a directory we use the “cd” command – Type “cd ps01” to change to the “ps01” directory – To exit to the parent directory of “ps01” type “cd ../”Moving Files/Directories • Make sure you are out of the ps01 directory – (Don’t remember how? Check the previous slides…) • Create a directory called “dir2” • Move dir2 using the “mv source dest” command – Type “mv dir2 ps01” – “Moving” a file/folder to a new destination is also used to “rename” • Make sure you moved it to “ps01” – Type “ls ps01” to see the contents inside “ps01” • Many times you will want to make copies of files/directories by using the “cp” command – Make a backup copy of “ps01” called “ps01_01212011” by executing: “cp –r ps01 ps01_01212011 – The “-r” tells the “copy” command to also make a copy of all the contents inside folder ps01. If you are copying files you don’t need it. • Type “ls” to confirm that you made a backup copyDeleting Files/Folders • We use the “rm” (remove) command to delete things • WARNING! This is an irreversible operation. There is no way to undo it. Make sure you use this command with caution and double check before your press ENTER. If you accidentally delete a project file it will be lost for ever. • To delete a file called “filename” type “rm filename” • Try to delete ps01 by typing “rm ps01” – To delete a directory you must add a “-r” after rm: “rm –r ps01” – You will be prompted to confirm that you want to delete it as well as the contents inside of itAll done! • Type “exit” to close the terminal and/or close the SSH connection. • Make sure to log out of your machineBinary Representation • 1 and 0 are the only digits. This is a “base 2” counting system • Left hand bit is the “MSB (Most Significant Bit), right hand bit is the “LSB” (Least Significant Bit) • Binary -> decimal conversion: – Multiply each digit by 2n where “n” is the number of places away from the right-most bit – Sum all the products together – Ex: 11102 = 1*23 + 1*22 + 1*21 + 0*20 = 1410 • Decimal -> binary conversion – Divide the number by two. If the remainder is 0 then the bit is 0, otherwise it is 1 – Subtract the remainder from the decimal value – Repeat the above two steps until the decimal value is 0 – Read the binary number right-to-left from the bottom-up – Ex: 610=> 6/2 = 3.0 => bit: 0 3/2 = 1.5 => bit: 1 => 1102 1/2 = 0.5 => bit: 1Hexadecimal Representation • Concept is the same as binary, except it’s base 16 instead of 2 – Digits range from 0 to F – To indicate the number is a hexadecimal place an “x” in front • Hexadecimal -> Decimal Conversion – Exactly as in binary, but multiply each digit by 16n – Ex: x15F = 1*162 + 5*161 + F * 160 = 256 + 80 + 15 = 35110 • Decimal -> Hexadecimal – The same as in binary, but divide by 16, remainder values 10 to 15 are represented by letters A to F – Ex: 2710 => 27/16 = 1 r 11 => xB 1/16 = 0 r 1 => x1 => x1B • Decimal -> Binary (Shortcut) – First convert the decimal to hexadecimal, then convert each hex digit to a 4-bit binary2’s Complement • A way to represent negative numbers in binary • If the MSB is “1” the bit pattern represents a negative number. But you can’t just multiply each bit by a power of 2 to find its value – To find its magnitude: perform 1’s complement (change all the 1’s to 0’s and vice versa) – Add 1 – Use the standard binary->decimal method to obtain the magnitude • Ex: 1011 => 0100 => 0100 + 1 => 0101 => 510. So 10112 is -510 • What about 1002? • To convert from decimal to 2’s complement convert the absolute value of the decimal number to binary as before. If the original decimal value is negative, perform 1’s complement on that binary representation and add 1 to it • What is the decimal range of an n-bit 2’s complement representation?Floating Point • Need a way to represent non integers in binary • The common representation follows a standard set by IEEE (IEEE-754) • 32 bits needed for


View Full Document
Download Programming Studio
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Programming Studio and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Programming Studio 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?