Docsity

Program Assignment for Logical Functions on a Range of Numbers in CSC 3210, Assignments of Computer Architecture and Organization

Toggle sidebar
bg1
Program Assignment #3
Summer 2008
CSC 3210
Due Thursday, July 10th at 10:00 am
Write a program to perform various logical functions on a range of numbers. At the start of your
program define a constant xval to have a certain value. The TA will change this to test your program, so
make sure not to code based upon any particular value. Your program should do the following for the
range of numbers from xval to (xval + 4). The value of xval can be between 0 and 4096.
Note: For the step of determining if the value is divisible by 4, you should only use logical instructions
and not arithmetic instructions to accomplish this.
Suppose xval is given an initial value of 22. You should display the following:
xval = 22 decimal
xval = 0x16 hexidecimal
swapping bytes 0 and 1 results in 0x1600
Is xval divisible by 4? No
Complementing the first two bytes of xval results in 0xffe9
xval = 23 decimal
xval = 0x17 hexidecimal
swapping bytes 0 and 1 results in 0x1700
Is xval divisible by 4? No
Complementing the first two bytes of xval results in 0xffe8
xval = 24 decimal
xval = 0x18 hexidecimal
swapping bytes 0 and 1 results in 0x1800
Is xval divisible by 4? Yes
Complementing the first two bytes of xval results in 0xffe7
xval = 25 decimal
xval = 0x19 hexidecimal
swapping bytes 0 and 1 results in 0x1900
Is xval divisible by 4? No
Complementing the first two bytes of xval results in 0xffe6

Partial preview of the text

Download Program Assignment for Logical Functions on a Range of Numbers in CSC 3210 and more Assignments Computer Architecture and Organization in PDF only on Docsity!

Program Assignment # Summer 2008 CSC 3210 Due Thursday, July 10th^ at 10:00 am Write a program to perform various logical functions on a range of numbers. At the start of your program define a constant xval to have a certain value. The TA will change this to test your program, so make sure not to code based upon any particular value. Your program should do the following for the range of numbers from xval to (xval + 4). The value of xval can be between 0 and 4096. Note: For the step of determining if the value is divisible by 4, you should only use logical instructions and not arithmetic instructions to accomplish this. Suppose xval is given an initial value of 22. You should display the following: xval = 22 decimal xval = 0x16 hexidecimal swapping bytes 0 and 1 results in 0x Is xval divisible by 4? No Complementing the first two bytes of xval results in 0xffe xval = 23 decimal xval = 0x17 hexidecimal swapping bytes 0 and 1 results in 0x Is xval divisible by 4? No Complementing the first two bytes of xval results in 0xffe xval = 24 decimal xval = 0x18 hexidecimal swapping bytes 0 and 1 results in 0x Is xval divisible by 4? Yes Complementing the first two bytes of xval results in 0xffe xval = 25 decimal xval = 0x19 hexidecimal swapping bytes 0 and 1 results in 0x Is xval divisible by 4? No Complementing the first two bytes of xval results in 0xffe