Question 2 [45 marks]
Everything stored on a computer is expressed as a sequence of bits (0s and 1s). However, different types of data (for example, characters and numbers) may be represented by the same sequence of bits. Hence, depending on requirements computers can be custom designed for specific roles. For example, a simple computer controller does not need the same precision as a super computer used for weather calculation. Hence, the number of bits used to store numbers can be significantly different. In this question, we will consider a 12-bit computer controller based on the following specifications.
Specifications of the 12-bit computer controller
Text characters (or symbols) are represented using 8-bits in our computer. the hexadecimal value representing the state of these 8-bitsTable 1 maps the “Control, Basic and Supplemental Latin 1 Character set” to68a. For example, this hexadecimal value to binary gives the state of the 8-bits (i.e. the 8-bits0100 0100 from Table 1 the character ‘h’ has the hexadecimal value . Converting
represents the character ‘h’).
In this computer, we will also assume that numbers (both signed/unsigned integers, and floating point numbers) are stored in 12-bits. Floating point (real) numbers are stored as per the algorithm in the Grossman (2009), with as the exponent bias (where ?? is the number of bits for the characteristic).2??-1 – 1
6-bits of these 12-bits reserved for the mantissa (or significand) and
For example, the string of 24-bits:0011 0110 0011 1001 0011 0101, in this computer might represent:× 3×
Table 1); or 2 • three ASCII/LATIN-1 characters ‘695’ (i.e. 8-bits encoded as per
• two numbers ( 12-bits). The interpretation of these 12-bits will be
different depending whether the numbers are stored as:– signed integers (e.g. 867 and -1739), or0.13672 -0.00040440.13672 ).
– as floating point (real) numbers (e.g.0.1406More precisely, any floating point number between-0.0004044 -0.0004119 and and
will have the same 12-bit pattern, in this not very accurate computer. Similarly, any floating point number between and will also have the same 12-bit pattern.
a This mapping is based on Unicode 10.0 Standard
Table 1: Hexadecimal map of the “Control, Basic and Supplemental Latin 1 Character set” to an 8-bit encoding scheme. See http://www.unicode.org/charts/PDF/U0000.pdf and http: //www.unicode.org/charts/PDF/U0080.pdf for control character definitions.
0 1 2 3 4 5 6 7 8 9 A B C D E F
0 NULL SOH STX ETX EOT ENQ ACK BELL BS HT LF VT FF CR SO SI
1 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US
2 SP ! – # $ % & ‘ ( ) * + , – . /
3 0 1 2 3 4 5 6 7 8 9 : ; = ?
4 @ A B C D E F G H I J K[ L M] N O
5 P Q R S T U V W X Y Z ^ _
6 ` a b c d e f g h i j k{ l m} n o
7 p q r s t u v w x y z | ~ DEL
8 XXX XXX BPH NBH IND NEL SSA ESA HTS HTJ VTS PLD PLU RI SS2 SS3
9 DCS PU1 PU2 STS CCH MW SPA EPA SOS XXX SCI CSI ST OSC PM APC
A NBSP ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ SH ® ¯
B ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿
C À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï
D Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß
E à á â ã ä å æ ç è é ê ë ì í î ï
F ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
a) What is the largest positive floating point (or real) number that is represent5 marks able using the 12-bits on this computer.
b) Find the value of the 12-bits required to represent the signed integer:-15
3 marks on this computer.
c) Find the value of the 12-bits required to represent the floating point number10.01
5 marks on this computer.
d) Is the number stored in Question 2(c) exact? If not, what is the actual number
1 mark stored?
e) Find the actual bit pattern required to store the word below.
Apple .
3 marks
The remaining parts of Question 2(0101 0011 1111 1101 0111 1101f—i) refer to the following 24-bits:
3 marks f) Represent these 24-bits as a hexadecimal number.
3 marks g) What characters according to Table 1 are represented by these 24-bits?
4 marks h) What pair of signed integers is represented by these 24-bits?
6 marks i) What pair of floating point numbers could be represented by these 24-bits?
j) This computer controller also supports 24-bit (i.e., double precision ) floating point (real) numbers using the method outlined in Grossman (2009), except in this case of double precision floats all 24-bits are used to store a single number, with 8-bits of these 24-bits being used to store the characteristic. Using this information answer the following:
i) What is the smallest positive floating point (real) number that can be10.01 6 marks represented using double precision on this computer?
ii) What will be the state of the 24-bits, if is stored as a double preci6 marks sion floating point number on this computer? Is it exact?
Question 3 [17 marks] ?? ??
A complex farm machine is controlled by two sensors and . Each sensor only has two states 0 and 1. The following logic rule controls if the machine runs:(?? ? ??) ? (¬?? ? ??) ? (¬?? ? ¬??) . 1
(1)
That is, the machine will run when the above logic rule (Equation 1) returns (i.e., True).
a) Construct a truth table for each of the following logic expressions.?? ? ??¬?? ? ??¬?? ? ¬??
4 marks i)
4 marks ii)
4 marks iii)
b) Combining the results from Question 3a create a truth table for the rule in
Equation 1 which controls the farm machine. Hence, determine the state of 5 marks the sensors when the farm machine is running.
Question 4 [18 marks]
In computers, colours are created by blending different combinations of red, green html, photoshop, gimp etc. These 6 digits represent the state of the 24-bits. For??62929 These colours are normally specified as three two-digit hexadecimal numbers in example, Brown is specified as to indicate the proportions of red, green and
and blue (RGB). The RGB combination required to represent a colour on a computeris stored in 24-bits. These 24-bits are divided inshade of red, green or blue. As 8-bits are used for each colour, colours can store 256shades of red, green or blue. Hence, some 16 million colours (represented on must modern computers in a single image.3 × 8-bits, which store a specific224 or 2563) can be
blue required. Hence, the bit pattern:1010 0110 0010 1001 0010 1001,
will be interpreted as “Brown”. For grey shades the three proportions will always000000 ????????????????????0000001111 1111 1111 1111 1111 11110000 0000 0000 0000 0000 00001111 1111 0000 0000 0000 00000000 0000 1111 1111 0000 00000000 0000 0000 0000 1111 1111.????000000???? ;;;, be equal. Moreover indicates that the colour is fully saturated. Hence, white corresponds to or the bit pattern: Black which is represented by the bits: fully saturated red is or the bit pattern: fully saturated green is which is represented by the 24-bits: and fully saturated blue is which has the bit pattern:
a) Convert the RGB values for the colours below to their equivalent 24-bit pat-
Colour name Colour Hexadecimal???? 8?? 8????2 22 22 terns.
Rosy Brown
4 marks Firebrick
b) Convert the 24-bits representing the colours below to their equivalent hexa-
Colour name Colour 24-1111 1111 0001 0100 1001 00110011 0010 1100 1101 0011 0010bit Pattern decimal values.
Deep Pink
4 marks Lime Green
each pixel is stored in 24-bits. These can be either stored in 2row or column× 3 c) On computers, images are broken up in several million pixels. The colour for
order. For example, consider the image below consisting of pixels, with the hexadecimal representation of each pixels 24-bit pattern shown.
FFA07A FFD700 FFA07A
FFA07A FFA07A FFA07A
The 144-bits required to store the image can be stored in bits as: FFA07A FFD700 FFA07A FFA07A FFA07A FFA07A (row order), or
FFA07A FFA07A FFD700 FFA07A FFA07A FFA07A (column order). Hence, to recreate an image you need to know the total number of pixels, the storage3 × 3 order and one other dimension of the image.
i) The following 216 bits, store a pixel image in column order.
00FF00 00FF00 00FF00 FFFFFF 00FF00 FFFFFF FFFFFF 00FF00 FFFFFF.
6 marks Sketch the image represented by this bit pattern. 7680 × 4320
ii) How many bits are required to store an 8k UHD image ( ) image in 24-bit RGB colours? How many whole 8k images can you store 4 marks in an 8GB (GigaByte) drive.
References
Grossman, P. (2009), Discrete Mathematics for Computing, 3rd edn, Palgrave MacMillan.
End Of Assignment Questions