Answers to Your Questions & Professor Patt's emails to class


This page will contain Prof. Patt's answers to your questions.



Professor Patt's email to the class (10/27/00)
I have received about a dozen email messages over the long weekend from 
students who are concerned that their score on the second exam puts them
in great jeopardy with respect to their grade in the course.  The bottom
line to each email I have received is usually: Do I have any chance of 
passing this course?

Some of you are misunderstanding your grade on the second exam.  If you got
above 40, you are probably not in danger of failing the course.  My exams,
I am told, tend to be challenging.  My objective is to test if you can 
combine what you have learned in the course with your ability to think 
to solve problems or answer questions.  That usually results in much lower 
grades than if I simply asked you to barf back what I earlier barfed on the 
blackboard.  I take this into account when assigning final grades.

To the question, "Can I pass the course?" I should make a few observations:

First, as I have said all term, I am interested in how much you understand
at the END of the semester, not how much you understand in the middle of the
semester.  So, if you do exceptionally well on the final, compared to how 
you did on the two mid-terms, I will weigh the final exam much more heavily.  

What you have to come to grips with is how much you understand or don't 
understand the material of this course.  People get a bad grade for all sorts
of reasons that have nothing to do with their understanding of the material.
You could have just had a bad day.  Or, you may have misinterpreted questions
that you should have interpreted correctly.  Or, you ran out of time.  If one of
these is the reason, you have every reason to expect to do better on the final.
You will have 3 hours to do the final, and I plan to make up an exam
that will not stress you for three hours.  Also, it is less likely you will
have another *bad day*.  So, if you really believe you are *getting it*, you 
should feel ecouraged that the final will pull you through in good form.  But, 
please do not lie to yourself.  You know whether you are really getting it or 
not.  

If you are not getting it, then you need to ask yourself why, since the 
reasons probably will shed a lot of light on what to do from here.  

It could be you have breezed through high school without ever developing 
good study habits, and you are facing for the first time a course where 
your sheer brilliance (and no studying) will not carry you through.  If 
this is the case, you have less than three weeks to get it together before
the final.

Or, it may be that you are bright and you are working hard, but things have 
not clicked yet for you.  That one is harder to respond to, since there are 
less than three weeks left.  However, I have seen a lot of students over the 
years where it all clicks in the last couple of weeks, and it is clear sailing 
from then on.  If this is you, you should talk to your TA, then combine
studying with using the TA office hours.  There is a good chance you can pull
it off.

Or, you could just not have any talent for this stuff, in which case, you
should rethink your career objectives.  If you are thinking of majoring in
engineering, the kinds of aptitudes you will need are the aptitudes that
you need for 379k.

Or, it could be that you are not able to learn from the way I teach. ...in
which case, if you get a D or an F, you should consider taking the course
next semester when Professor Ambler is teaching it.  It may be that your
learning style more nearly matches his teaching style.  One of the best
things a student can do is find professors who teach on the same wavelength
that he/she learns.

Most important, this is not the time to panic.  If you are concerned, you 
should at least talk to your TA and if you like, also come see me.

Finally, good luck.  I hope you are enjoying what you are learning, and 
I would like to see you complete the course successfully.

Yale Patt



Code for Binary to Decimal (ASCII) Conversion Program
Here's the code Professor Patt generated in Monday's class (October 30).

;; This program takes the value stored at the memory location referenced
;; by VALUE and outputs it to the console.
;; 
        .ORIG x3000
        
        ;; initialize block
        AND   R0, R0, #0        ; clear count
        LEA   R2, OUTBLK        ; R2 is the pointer to OUTBLK

        ;; output the sign and obtain the absolute value of the number
        LD    R3, PLUS          ; R3 contains the ASCII value for '+'
        STR   R3, R2, #0        ; store '+' into the first location of OUTBLK
        LD    R1, VALUE         ; R1 contains the number to be displayed
        BRzp  H                 ; branch if number is zero or positive
        NOT   R1, R1            ;
        ADD   R1, R1, #1        ;
        LD    R3, MINUS         ; R3 contains the ASCII value for '-'
        STR   R3, R2, #0        ; store '-' into the first location of OUTBLK

;; ======================================================================
;; process the hundreds digit
H       AND   R0, R0, #0        ; clear the digit count
        LD    R4, MINUSHUN        ; R4 = #-100
        ADD   R1, R1, R4        ; subtract 100 from R1
HAGAIN  BRn   HCORR             ; branch if negative to HCORR
        ADD   R0, R0, #1        ; increment the digit count
        ADD   R1, R1, R4        ; subtract 100 from R1
        BRnzp HAGAIN            ;

        ;; make correction to number
HCORR   LD    R4, HUN           ; R4 = #100
        ADD   R1, R1, R4        ; number now contains only tens and units digits

        ;; store the hundreds digit to output
        LD    R4, ASCII         ; load the ASCII template
        ADD   R0, R0, R4        ; add the ASCII template
        STR   R0, R2, #1        ; store the hundreds digit into OUTBLK

;; ======================================================================
;; process the tens digit
        AND   R0, R0, #0        ; clear the digit count
        LD    R4, MINUSTEN      ; R4 = #-10
        ADD   R1, R1, R4        ; subtract 10 from R1
TAGAIN  BRn   TCORR             ; branch if negative to TCORR
        ADD   R0, R0, #1        ; increment the digit count
        ADD   R1, R1, R4        ;  subtract 10 from R1
        BRnzp TAGAIN            ;

        ;; make correction to number
TCORR   LD    R4, TEN           ; R4 = #10
        ADD   R1, R1, R4        ; number now contains only the units digit

        ;; store the hundreds digit to output
        LD    R4, ASCII         ; load the ASCII template
        ADD   R0, R0, R4        ; add the ASCII template
        STR   R0, R2, #2        ; store the tens digit into OUTBLK

;; ======================================================================
;; process the units digit
        ;; store the units digit to output
        LD    R0, ASCII         ; load the ASCII template
        ADD   R0, R1, R0        ; add the ASCII template
        STR   R0, R2, #3        ; store the units digit into OUTBLK

;; ======================================================================
;; output
        LDR   R0, R2, #0        ; load the sign
        TRAP  x21               ; OUT
        LDR   R0, R2, #1        ; load the hundreds digit
        TRAP  x21               ; OUT
        LDR   R0, R2, #2        ; load the tens digit
        TRAP  x21               ; OUT
        LDR   R0, R2, #3        ; load the units digit
        TRAP  x21               ; OUT
        
        TRAP  x25               ; stop the LC-2
        
;; ======================================================================
;; data
OUTBLK  .blkw 4                 ; reserve a block of 4 words to store output
VALUE   .FILL #347              ; this is the value to output
PLUS    .FILL x2B               ; '+'
MINUS   .FILL x2D               ; '-'
MINUSHUN  .FILL #-100             ;
HUN     .FILL #100              ;
MINUSTEN  .FILL #-10              ;
TEN     .FILL #10               ;
ASCII   .FILL x30               ; ASCII template
        
        .END




Code for the character count example
Here's the code Professor Patt generated  in Wednesday's class (October 18).

Program:
x3000   0101 010 010 1 00000
x3001   0010 001 000010100
x3002   1111 0000 0010 0011
x3003   0110 011 001 000000
x3004   0001 101 011 1 11100
x3005   0000 010 000001110
x3006   1001 011 011 111111
x3007   0001 011 011 1 00001
x3008   0001 011 011 000 000
x3009   0000 101 000001011
x300A   0001 010 010 1 00001
x300B   0001 001 001 1 00001
x300C   0110 011 001 000000
x300D   0000 111 000000100
x300E   0010 000 000010011
x300F   0001 000 000 000 010
x3010   1111 0000 0010 0001
x3011   1111 0000 0010 0101
x3012   0000 000 00000 0000   (nop)
Data:
x3013   0000 0000 0011 0000   (the mask for converting to ASCII)    
x3014   address of first character


For example, if you want to count the occurence of a character in the
sentence "I love you!" and if you want to place this sentence starting
from memory location x4000, what you need to do is put the address x4000
into memory location x3014 and put the ASCII values corresponding to the
characters in "I love you!" starting from memory location x4000. Don't
forget to put the ASCII code of the eot (end of text) character at the
very end of all ASCII codes. As an example, your memory should contain:

x4000   0000 0000 0100 1001  ;ASCII code for I
x4001   0000 0000 0010 0000  ;ASCII code for space
x4002   0000 0000 0110 1100  ;ASCII code for l
x4003   0000 0000 0110 1111  ; o
x4004   0000 0000 0111 0110  ; v
x4005   0000 0000 0110 0101  ; e
x4006   0000 0000 0010 0000  ;  
x4007   0000 0000 0111 1001  ; y
x4008   0000 0000 0110 1111  ; o
x4009   0000 0000 0111 0101  ; u
x400A   0000 0000 0010 0001  ; !
x400B   0000 0000 0000 0100  ; ASCII code for eot character



How do you represent 0 in Floating Point Representation?

A student wrote:


        In floating point form, the fraction part is assigned 23 bits, and the
        digit 1 preceding the  point is omitted. In that case, how is the number
        zero represented in floating point form? Because 0 = 0.00 x 2^0  Here
        there is no digit 1 before the point. How will the number then be
        represented? Also if it is represented as
        0  01111111  00000000000000000000000  won't this be translated into
        decimal form as 1? I would like to clarify this doubt.
Professor Patt wrote:

Very good. This is spelled out in the book and perhaps I should have covered
it in class (maybe even instead of starting the material on transistors), 
You are absolutely correct, I did not show you how to represent 0.  Recall that
I did say that I was showing you what to do if the exponent was not 00000000
and not 11111111.  I did not tell you how to interpret the 32 bits if the 
exponent is 00000000 or 11111111.  It turns out that the smallest normalized
number is represented as

                0 00000001 00000000000000000000000

which is interpreted as 1.00000000.... x 2 ^(-126)

We did mention that exponent in class although we did not generate the smallest
normalized number.  

What if we want to represent something smaller than 2^(-126).  We can do
that using the exponent field 00000000.  If the exponent is 00000000, the
number is interpreted as 

                0.xxxxxxxxxxxxxxxxxxxxxxx X 2^(-126).

The xxxxxxxxxxxxxxxxxxxxxxx is the fraction part.

So, reading the text book: What is the smallest magnitude greater than 0 that
you can represent?  

Finally, to answer your question, 0 is represented as:

                0 00000000 00000000000000000000000

Got it?

Yale Patt