Circuit Design with VHDL

In the preceding chapters, we saw a series of complete design examples utilizing VHDL code. Each design included:
Top-level diagram of the circuit, with description;
Review of basic concepts whenever necessary;
Complete VHDL code;
Simulation results; and
Additional comments when needed.
This chapter concludes Part I of the book. In it, a series of additional design examples are presented. These examples, like all the other designs shown so far, are also at the circuit level (that is, self-contained in the main code). In Part II, we will do the same; that is, we will conclude Part II with a chapter containing additional system design examples.
The diagram of a barrel shifter is shown in figure 9.1. The input is an 8-bit vector. The output is a shifted version of the input, with the amount of shift defined by the "shift" input (from 0 to 7). The circuit consists of three individual barrel shifters, each similar to that seen in example 6.9. Notice that the first barrel has only one 0 connected to one of the multiplexers (bottom left corner), while the second has two, and the third has four. For larger vectors, we would just keep doubling the number of 0 inputs. If shift = "001", for example, then only the first barrel should cause a shift; on the other hand, if shift = "111", then all barrels should cause a shift.
A VHDL code for the circuit of figure 9.1 is...