Assignment 2, due Sep 2

Part of the homework for 22C:60 (CS:2630), Fall 2011
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

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!

  1. Background: Consider the following randomly selected bit patterns:
    100110 010011 000011 001001 011011

    a) Give the decimal value of each of these interpreted as an unsigned binary number. (0.5 points)

    b) Give the decimal value of each of these interpreted as 2's complement binary number. (0.5 points)

    c) Give the decimal value of each of these interpreted as 1's complement binary number. (0.5 points)

  2. Background: Consider the following SMAL code:
    .	=	0
    	W	0
    A	=	.
    	B	1,0,0,0
    .	=	12
    	H	B - 5, 0
    .	=	8
    B:	W	2
    .	=	. + 4
    	W	A
    

    a) Show the assembly listing for this code. You may do it by hand or use the Hawk assembler. You will learn different useful things either way. Do it by hand first if you opt to do it both ways. (1.0 points)

    b) Show the contents of memory this produces, show the result as 32-bit words, their addresses in ascending order and with both addresses and values expressed in hexadecimal. (0.5 points)