CMU 15-190 Spring 2017: Topics in Intermediate Programming
Homework 1 (Due Wednesday 25-Jan, at 11:59pm)
- This hw is optional. It is for students who want to get a bit more out of the optional/advanced talk last week, and in particular for those who may wish to get 3 units of pass/fail credit for 15-190 (for whom it is required). We hope that's quite a few of you!
- Work Solo or in Groups of 2-5 (and groups are strongly recommended) Have fun!
- We will grade the hw, but loosely, and chiefly based on effort. You should expect to invest 1-2 hours on it and you'll be fine. This is not about the grade, of course, but about the learning. So take your time, discuss issues with your groupmates, have fun, and enjoy.
- Please track when you start and stop working on this, and with whom you collaborate. You'll need that for your submission. And again, have fun.
- Install TMCM_Labs (The Most Complex Machine)
We will use these labs several times in this mini-course, so you should install them. Note that you will also need Java, which you may have installed on your machine. If not, first install Java as explained here. Then, download TMCM_Labs.zip from here. Unzip that, and then run TMCM_Labs.jar in that folder (the first time you do this on a Mac, you'll have to ctrl-click it and click “Open”, thereafter you can just click it). From there, run “xLogicCircuits Lab 1” and you're in business. If you get stuck, go to OH and a TA can help you. - Make a simple XOR circuit from scratch
To demonstrate that you can use the logic circuit editor, try to make a simple XOR circuit from scratch. Take a screenshot of your circuit to submit. Call it xorCircuit.jpg (or .png or whatever). - Make an XOR circuit using only NOR gates
First, make a simple NOR gate (by adding a NOT gate to the output of an OR gate). Shrink it and name it “NOR”, so now you can use that NOR gate in other circuits. Then, remake your XOR circuit from the previous step, only now using only NOR gates (the point of this being to demonstrate that we can, in fact, do this -- and not just for XOR circuits, but any circuits at all -- just with NOR gates -- wow!). The way to do this is to follow the pathway that we covered in class. First, construct the Disjunctive Normal Form (DNF) of XOR (which is pretty much the only way you'll represent it anyhow). Next, use DeMorgan's Law to replace (X AND Y) with (NOT ((NOT X) OR (NOT Y))). Then, replace (X OR Y) with (NOT (X NOR Y)). And finally replace (NOT X) with (X NOR X). Whew! Take a screenshot and name it xorCircuitWithNors.jpg (or .png or whatever). - Make a SELECT circuit
Do Exercise 9 from here. Take a screenshot and name it selectCircuit.jpg (or .png or whatever). - Make a Mini-ALU circuit
Do Exercise 10 from here. This activity in particular is a fine precursor to the next part of the “Tetris with a Bucket of Sand” talks, where we discuss how to build a simple CPU. Take a screenshot and name it miniAluCircuit.jpg (or .png or whatever). - Additional Reading and Exercises
If you have time and interest, read the well-written text of xLogicCircuits Lab1 and Lab2, and do some of those exercises. - What to Submit
Each member of the group should submit their own PDF file, 15-190-hw1.pdf, containing this information:- Your name and andrew id
- The names and andrew id's of your groupmates
- The start/stop times you worked, and the total time you worked.
- Your thoughts about this exercise -- useful, interesting, etc? This will help us improve the 15-190 experience as we go.
- The screenshots from above -- xorCircuit, xorCircuitWithNors, selectCircuit, and miniAluCircuit. Note: one way to create a PDF is to first make a Word file, then export that to PDF.
Have fun!