# Exercises

### Exercises

1:

Describe the architecture of a bicycle. What parts of the bicycle are not parts of the architecture? What are some implementation differences among different bicycles?

2:

Consider the car rental industry. What aspects of automobile architecture are essential to the ability of any driver to operate a randomly allocated rental car? What are some implementation differences among different automobiles that are not especially relevant to either the driver or the rental agency?

3:

Explain why harpsichords, organs, and accordions are not exemplars of "piano architecture."

4:

Why do you think that one computer manufacturer builds computers with a different architecture from those of another manufacturer? What does this imply about the importance of well-standardized high-level languages?

5:

What effect do you think the standardization of operating systems or command languages might have on the future development of computer architectures?

6:

Compute how much larger 1 EiB is than 1 EB, according to the IEC conventions for binary multiples .

7:

PA-RISC Architecture 1.1 defines extension registers that permit virtual addresses to be 16, 24, or 32 bits wider than the base level 32 bits. Express the three resulting maximum virtual address sizes using appropriate binary prefixes from Table 1-2.

8:

Adapt the program SQUARES in a high-level language to compute the cubes of the first five integers without using any explicit multiplication. Hint: An algorithm for N 3 can be discovered by writing down the series 1, 8, 27, 64, … and then inspecting the pattern of first, second, and third tabular differences. This is only a pencil-and-paper exercise, but save your work for future adaptation.

9:

Digital's first highly successful minicomputer, the PDP-8, was a 12-bit machine. What range of integers can be represented in a 12-bit unsigned binary number? In a 12-bit two's complement signed number?

10:

Convert 101010101 2 into hexadecimal and octal. Convert 10A34 16 into octal and decimal. Negate both values using 32-bit two's-complement hexadecimal form.

11:

Complete the following table by converting the given number in each row into the other bases.

Decimal

Binary

Octal

a.

100

b.

100

c.

100

d.

100

12:

1. 205 - 6

2. AF9 + 9

3. 1A x B2 (use "long" multiplication, and think carefully about the "carries")

4. 1CFF + F2FF

13:

Write a high-level language program that inputs a decimal number and a radix and reformats that decimal number in the specified radix. For example, if the inputs are 10 and 16, the output should be A. Limit yourself to bases less than or equal to 16.

## Chapter 2. Computer Structures and Data Representations

When you develop applications in a high-level language, such as C or FORTRAN, you have to understand the features, capabilities, and limitations of the programming language more thoroughly than you need to know the nature of the computer architecture for which that language has been implemented. The computer appears to you to be a machine that executes C or FORTRAN statements and manipulates high-level data elements. For example, while standard FORTRAN provides for the storage and use of Boolean variables, the computer itself may not; the FORTRAN compiler implements Boolean variables using some other intrinsic data type that the computer architecture does support.

The actual structure of the underlying hardware is thus virtually invisible to the high-level language programmer. Not so for the assembly language programmer, who gets a much closer feel for the actual machine and thus needs to understand the structure of a computer system, the nature of memory addressing, and the process of program execution. Once you have attained this foundation, you can begin to focus on learning instructions and elementary assembly language programming for a particular architecture.

Compiler writers need architectural information, as well as specific details about new processor implementations , so that compilers can create application programs that achieve optimal performance. Not every program written to perform well on, say, a Pentium III is guaranteed to perform as well on a Pentium 4 system running at the same, or a faster, clock rate. Different implementations may put different machine instructions at a relative disadvantage .