Assignment 7, due Mar. 9
Part of
the homework for 22C:60 (CS:2630), Spring 2012
|
On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (usually Friday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!
void upcase( char * src; char * dst ) { char ch; do { ch = *src; if ((ch >= 'a') && (ch <='z')) { ch = ch + ('A' - 'a'); } *dst = ch; src = src + 1; dst = dst + 1; } while (ch != NULL); }
A Problem: Write an equivalent SMAL Hawk subroutine that takes R3 as the source address and R4 as the destination address, and conforms to the standard Hawk calling sequence. (1.0 points)
a) ... it uses explicit inverters instead of bubbles on inputs to gates. (0.4 points)
b) ... so that, as a result of applying De Morgan's laws, it only uses nand gates and does not use any and or or gates. (0.4 points)
Note: Neatness counts. Graph paper, rulers and other tools can all help.
A problem: Give the truth table for a one-bit stage of a subtractor. (0.8 points)
Note: You may find that the discussion of an adder-subtractor in the section of Chapter 8 on arithmetic logic units provides useful insight.
Consider the following sequence of figures:
[] [][][] [][][][][][][][][] [] [] [] [][] [][] [] [][][] [][][][][][][][][] [][][] [][][] [] [] [] [] [][][] [][][] [][][][][][][][][] [] [][] [][] [] [][][][][][][][][] [][][][][][][][][][][][][][][][][][][][][][][][][][][] [] [][] [][] [][] [][] [][] [][] [][] [][] [] [][][][][][][][][][][][][][][][][][][][][][][][][][][] [][][] [][][][][][] [][][][][][] [][][] [] [] [] [][] [] [] [][] [] [] [] [][][] [][][][][][] [][][][][][] [][][] [][][][][][][][][][][][][][][][][][][][][][][][][][][] [] [][] [][] [][] [][] [][] [][] [][] [][] [] [][][][][][][][][][][][][][][][][][][][][][][][][][][] [][][][][][][][][] [][][][][][][][][] [] [][] [][] [] [] [][] [][] [] [][][][][][][][][] [][][][][][][][][] [][][] [][][] [][][] [][][] [] [] [] [] [] [] [] [] [][][] [][][] [][][] [][][] [][][][][][][][][] [][][][][][][][][] [] [][] [][] [] [] [][] [][] [] [][][][][][][][][] [][][][][][][][][] [][][][][][][][][][][][][][][][][][][][][][][][][][][] [] [][] [][] [][] [][] [][] [][] [][] [][] [] [][][][][][][][][][][][][][][][][][][][][][][][][][][] [][][] [][][][][][] [][][][][][] [][][] [] [] [] [][] [] [] [][] [] [] [] [][][] [][][][][][] [][][][][][] [][][] [][][][][][][][][][][][][][][][][][][][][][][][][][][] [] [][] [][] [][] [][] [][] [][] [][] [][] [] [][][][][][][][][][][][][][][][][][][][][][][][][][][]
These are the first 4 Serpinski gaskets. Each successive gasket is formed of 8 of its predecessors arranged in a square, leaving a hollow where the 9th would go. The Serpinski gasket is an example of a fractal figure, since as you zoom in on any part of the gasket, all you see is more gaskets.
Write a program to fill the screen with the largest Serpinski gasket that fits on the screen, centered. This program will, by its nature, be recursive. You will need to compute, in advance, the size of the largest gasket that will fit on the screen, and then follow through with the actual recursive code.
Your source file must be named mp4.a all lower case. This file must exist on the departmental linux cluster. Use the division of math-sciences coursework submission tools to submit this file. For instructions, see:
-- http://www.divms.uiowa.edu/help/msstart/submit.html
The grader will assemble and run your code, and will comment, on your assembly listing, about any deficiencies in your work. You will be penalized for any of the following errors:
A suggestion: Work incrementally and note that problem 2 on the homework above is closely related to this assignment. First, get your program to prompt repeatedly for y or n and quit when n is typed. Then make it output a value. Then start working on making it translate heptavigintimal to binary. Steal code from the notes.