Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For problems 1 – 4, give the exact number of bits for the answer. For answers co

ID: 3761643 • Letter: F

Question

For problems 1 – 4, give the exact number of bits for the answer. For answers consisting of 32 bits, provide the hex representation of those 32 bits (double check you conversions). For answers consisting of less than 32 bits, provide the exact number of bits.

1. (5 x 2 pts 10 pts)The instruction: or $se, $t1, $t2 is executed in a single-cycle data path (Figure 4.24). Assume that presently the address in the Program Counter is 0x00400000. What is the value of the encoded instruction word? What would the output be of Sign-extend for this instruction word? What are the values of ALU control inputs to the ALU for this instruction? What is the new PC address after this instruction is executed? What is the value of ALUSrc Mux control bit? a. b. c. d. e.

Explanation / Answer

Solution:

=======

Number Systems:

Human beings use decimal (base 10) and duodecimal (base 12) number systems for counting and measurements (probably because we have 10 fingers and two big toes). Computers use binary (base 2) number system, as they are made from binary digital components (known as transistors) operating in two states - on and off. In computing, we also use hexadecimal (base 16) or octal (base 8) number systems, as a compact form for represent binary numbers.

1.1  Decimal (Base 10) Number System

Decimal number system has ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9, called digits. It uses positional notation. That is, the least-significant digit (right-most digit) is of the order of 10^0 (units or ones), the second right-most digit is of the order of 10^1 (tens), the third right-most digit is of the order of 10^2 (hundreds), and so on. For example,

We shall denote a decimal number with an optional suffix D if ambiguity arises.

1.2  Binary (Base 2) Number System

Binary number system has two symbols: 0 and 1, called bits. It is also a positional notation, for example,

We shall denote a binary number with a suffix B. Some programming languages denote binary numbers with prefix 0b (e.g., 0b1001000), or prefix b with the bits quoted (e.g., b'10001111').

A binary digit is called a bit. Eight bits is called a byte (why 8-bit unit? Probably because 8=23).

1.3  Hexadecimal (Base 16) Number System

Hexadecimal number system uses 16 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F, called hex digits. It is a positional notation, for example,

We shall denote a hexadecimal number (in short, hex) with a suffix H. Some programming languages denote hex numbers with prefix 0x (e.g., 0x1A3C5F), or prefix x with hex digit quoted (e.g., x'C3A4D98B').

Each hexadecimal digit is also called a hex digit. Most programming languages accept lowercase 'a' to 'f' as well as uppercase 'A' to 'F'.

Computers uses binary system in their internal operations, as they are built from binary digital electronic components. However, writing or reading a long sequence of binary bits is cumbersome and error-prone. Hexadecimal system is used as a compact form or shorthand for binary bits. Each hex digit is equivalent to 4 binary bits, i.e., shorthand for 4 bits, as follows:

1.4  Conversion from Hexadecimal to Binary

Replace each hex digit by the 4 equivalent bits, for examples,

1.5  Conversion from Binary to Hexadecimal

Starting from the right-most bit (least-significant bit), replace each group of 4 bits by the equivalent hex digit (pad the left-most bits with zero if necessary), for examples,

It is important to note that hexadecimal number provides a compact form or shorthand for representing binary bits.

1.6  Conversion from Base r to Decimal (Base 10)

Given a n-digit base r number: dn-1 dn-2 dn-3 ... d3 d2 d1 d0 (base r), the decimal equivalent is given by:

For examples,

1.7  Conversion from Decimal (Base 10) to Base r

Use repeated division/remainder. For example,

The above procedure is actually applicable to conversion between any 2 base systems. For example,

1.8  General Conversion between 2 Base Systems with Fractional Part

Example 1:

Example 2:

0H (0000B) (0D) 1H (0001B) (1D) 2H (0010B) (2D) 3H (0011B) (3D) 4H (0100B) (4D) 5H (0101B) (5D) 6H (0110B) (6D) 7H (0111B) (7D) 8H (1000B) (8D) 9H (1001B) (9D) AH (1010B) (10D) BH (1011B) (11D) CH (1100B) (12D) DH (1101B) (13D) EH (1110B) (14D) FH (1111B) (15D)