Homework Assignment 10 Advanced Computer Architecture CS 350c Unique Number: 51160 Spring, 2016 Given: March 29, 2016 Due: April 7, 2016 This homework, like Homeworks 8 and 9, concerns improving your knowledge of combinational logic. 1. Using the C-language, write a barrel shifter "implementation". A barrel shifter provides the ability to shift left or right any amount (up to the width of the input data). A barrel shifter provides a bit-vector "rotate" functionality; that is, no bits are lost, bits shifted off one end are attached at the other end in the same order as they originally appeared. Below are four barrel-shift examples. Shift: Right 5 Right 2 Left 1 Left 3 Input: 00011111 00011111 00011111 00011111 Output: 11111000 11000111 00111110 11111000 In the first example, the least-significant five bits ("11111") are shifted out to the right and they return on the left. Note, that this is equivalent to left shifting three places. Your implementation function(s) may only use one-bit selectors and nothing else! But you may define C-language subroutines. If you do define a subroutine, then you also must define two C-language structures that describes your input and output data (like we have done below for the top-level interface). For instance, it may be helpful to define a 16-bit selector that takes one control input, 16 "a" input bits, and 16 "b" input bits, and that produces 16 "o" output bits. Below is the interface definition for our 16-bit barrel shifter; it takes 16-bit "i" input bits, one "dir" direction bit, and four "s" shift-amount bits. Our barrel-shifter implementation produces a 16-bit "f" result. struct barrel_shifter_16_in { int i00; // 16-bit, barrel-shifter input int i01; int i02; int i03; int i04; int i05; int i06; int i07; int i08; int i09; int i10; int i11; int i12; int i13; int i14; int i15; int dir; // left (1) or right (0) shift int s0; // shift amount (0-15) int s1; int s2; int s3; }; struct barrel_shifter_16_out { int f00; // 16-bit, output vector int f01; int f02; int f03; int f04; int f05; int f06; int f07; int f08; int f09; int f10; int f11; int f12; int f13; int f14; int f15; }; Hint: this barrel-shifter functionality can be implemented with four selectors and a modest amount of control logic. 2. Run an exhaustive set of tests on your 16-bit barrel-shifter. Report your results, and provide your C-language implementations.