Computer Systems Homework 12: Multi-precision Arithmetic Exercise, Assignments of Electrical and Electronics Engineering

Instructions for a computer systems homework assignment focused on multi-precision arithmetic. Students are required to write a program to compute the sum and difference of two 32-bit binary numbers, ignoring overflow conditions. Examples and notes on using add-with-carry and subtract-with-carry, as well as loop structures for the operations.

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-mke
koofers-user-mke 🇺🇸

9 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ELEC 2220 Computer Systems
Homework #12
Due: Friday, 9-26-08
1. Rewrite the program for Problem 8 of the midterm quiz, and test it in CodeWarrior.
For convenience, make the array 20 bytes, rather than 200.
2. Design a program to compute A1 = B1 + C1 - D1, where all variables are 32-bit
binary numbers. You may ignore overflow conditions for this exercise. Define the
values of A1, B1, C1, and D1 as 32-bit (4-byte) numbers, stored in “big-endian
format”, using “dc.b” directives. (Recall that the proper storage convention for multi-
precision numbers is for the most significant byte to be stored at the lowest address.)
Example: A1 db $01,$27,$3f,$44 ;A1 = $01273f44
Run the program two times, using the following values.
FIRST RUN: SECOND RUN:
A1 = undefined initially
B1 = $12345678 $fabcdef1
C1 = $4567bcde $ffffffff
D1 = $2345ef01 $eeeeeeee
Print one copy of your program and the two Code Warrior debug windows, circling or
highlighting the values of the four variables after each run.
Notes:
1. Multi-precision arithmetic requires the use of add-with-carry and subtract-with-
carry.
2. If adding, an entire multi-precision result must be computed before moving on to
another operation.
3. Consider using loop structures to do the operations needed for the 32-bit add and
the 32-bit subtract.

Partial preview of the text

Download Computer Systems Homework 12: Multi-precision Arithmetic Exercise and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

ELEC 2220 Computer Systems Homework # Due: Friday, 9-26-

  1. Rewrite the program for Problem 8 of the midterm quiz, and test it in CodeWarrior. For convenience, make the array 20 bytes, rather than 200.
  2. Design a program to compute A1 = B1 + C1 - D1, where all variables are 32-bit binary numbers. You may ignore overflow conditions for this exercise. Define the values of A1, B1, C1, and D1 as 32-bit (4-byte) numbers, stored in “big-endian format”, using “dc.b” directives. (Recall that the proper storage convention for multi- precision numbers is for the most significant byte to be stored at the lowest address.)

Example: A1 db $01,$27,$3f,$44 ;A1 = $01273f

Run the program two times, using the following values.

FIRST RUN: SECOND RUN: A1 = undefined initially B1 = $12345678 $fabcdef C1 = $4567bcde $ffffffff D1 = $2345ef01 $eeeeeeee

Print one copy of your program and the two Code Warrior debug windows, circling or highlighting the values of the four variables after each run.

Notes:

  1. Multi-precision arithmetic requires the use of add-with-carry and subtract-with- carry.
  2. If adding, an entire multi-precision result must be computed before moving on to another operation.
  3. Consider using loop structures to do the operations needed for the 32-bit add and the 32-bit subtract.