Lab 2 - FL13 - ECE 198 JL - University of Illinois - Engineering Wiki

Lab 2 - FL13 - ECE 198 JL - University of Illinois - Engineering Wiki

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab 2 - FL13 Lab 2 assignment is due on Wednesday, September 4 Thursday, September 5, by 7pm in your svn repository. Binary computations On June 4, 1996 an unmanned Ariane 5 rocket launched by the European Space Agency exploded just forty seconds after lift-off. The rocket was on its first voyage, after a decade of development costing $7 billion. The destroyed rocket and its cargo were valued at $500 million. On February 25, 1991, during the Gulf War, an American Patriot Missile battery in Dharan, Saudi Arabia, failed to intercept an incoming Iraqi Scud missile. The Scud struck an American Army barracks and killed 28 soliders. Source: http://www.ima.umn.edu/~arnold/455.f96/disasters.html What do both events have in common? As it turns out, some basic errors in binary computation caused both of these tragedies. In this Lab, we'll explore the limitations of binary computation and see what went wrong in both of these cases. More command line tricks For this assignment, we'll be using a program written for it called bincalc to perform binary computations. Before we can start using it, we need to learn a few more command line tricks. Program paths Recall from Lab 1 that Unix terminal commands have the following syntax: Recall that many programs take files and directories as arguments, which are written as paths . Relative paths describe how to get to the file from the current working directory, while absolute paths describe how to find the file from the root directory . What you may not be aware of is that program can also be a path. In fact, all programs are files that exist on the filesystem just like documents. You can see where a program is located with the “which” program: Try it with the “echo” program. When I run it, I get “/bin/echo”. “bin” is short for “binary”, since, as you'll soon discover in this class, programs are encoded in binary machine code. On Unix systems, a directory that contains executable (runnable) binaries is called “bin” by convention. Remember that I said program can be a path? You can prove it: Tilde expansion The shell replaces paths starting with a "~" references your home directory. For example, to go to your ece198jl directory, you can just use: A “~” followed by another user's name represents their home directory. We can use the tilde to access the ece198jl class account's home directory: program [arg1 . ..] which program1 . .. /bin/echo 'Programs are paths too!' cd ~/ece198jl
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Introducing bincalc You might notice that there's a “bin” directory inside ~ece199jl. You might further speculate that the “bincalc” program is inside ~ece198jl/bin. You'd be right. Let's run the program with no arguments: This is actually incorrect usage of the program, so it will print out some usage information. Read this information carefully. You'll see that adding a “-v” flag will make the program verbose, and that you must always give it a mode to indicate what binary format to use (like s8 for signed 8-bit).
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 12

Lab 2 - FL13 - ECE 198 JL - University of Illinois - Engineering Wiki

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online