Homework Assignment 9 Advanced Computer Architecture CS 350c Unique Number: 51160 Spring, 2016 Given: March 22, 2016 Due: March 31, 2016 This homework, like Homework 8, concerns improving your knowledge of combinational logic. 1. Write a C function that exactly implements the functionality of the TI 74181 ALU using only the C-language operators "|", "&", and "~". All variables declared should be of type "int" and each "int" variable should contain only one bit in its least significant position. Your code should be straight-line C code with no branchs nor calls. For documentation on the 74181, see the class lecture notes. Your C function should take one argument (the structure below) and return one object (the second structure below). Variable names that end with the "_" (underline character) are considered models for active-low signals. For additional information about the 74181, see page 7-271 (page 523 in the PDF file referenced just below): http://www.cs.utexas.edu/~hunt/class/2016-spring/cs350c/lectures/1976-TTL_DATABOOK.pdf struct cl_181_in { int cin_; // carry input int a0; // a-vector input int a1; int a2; int a3; int b0; // b-vector input int b1; int b2; int b3; int m; // logical or arithmetic int s0; // function select int s1; int s2; int s3; }; struct cl_181_out { int f0; // function output int f1; int f2; int f3; int cout_; // carry output int a_equal_b; int p_; // propagate int g_; // generate }; 2. Write a C function that exactly implements the functionality of the TI 74182 look-ahead carry generator using only the C-language operators "|", "&", and "~". All variables declared should be of type "int" and each "int" variable should contain only one bit in its least significant position. Your C function should take one argument (the structure below) and return one object (the second structure below). Your code should be straight-line C code with no branchs nor calls. For information about the 74182, see page 7-282 (page 534 in the PDF file referenced above): struct cl_182_in { int cin_; // carry input int g0_; // generate input int g1_; int g2_; int g3_; int p0_; // propagate input int p1_; int p2_; int p3_; }; struct cl_182_out { int cn0_; // carry group 1 int cn1_; // carry group 2 int cn2_; // carry group 3 int g_; // generate int p_; // propagate }; 3. Write a C function that creates a 16-bit ALU using multiple calls (essentially copies) of the 74181 ALU and the 74182 look-ahead carry generator. You may also include additional C-language operators "|", "&", and "~" as needed to "glue" things together. The 16-bit ALU should provide all of the functions offered by a single, 4-bit 74181 ALU, but for 16 bits with the fast carry propagation provided by the 74182 carry look-ahead function. Your C function should take one argument (the structure below) and return one object (the second structure below). Note that some outputs (e.g., propagate, generate) are not returned by the 16-bit ALU. // 16-bit input/output structures struct alu_16_in { int cin; // carry input int a00; // 16-bit, a-vector input int a01; int a02; int a03; int a04; int a05; int a06; int a07; int a08; int a09; int a10; int a11; int a12; int a13; int a14; int a15; int b00; // 16-bit, b-vector input int b01; int b02; int b03; int b04; int b05; int b06; int b07; int b08; int b09; int b10; int b11; int b12; int b13; int b14; int b15; int m; // logical or arithmetic int s0; // function select int s1; int s2; int s3; }; struct alu_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; int cout; // output carry }; 4. Run an exhaustive set of tests on your 16-bit ALU for the XOR and ADD functions. Report your results, and provide your C-language implementations for the 74181, 74182, and your 16-bit ALU (which you did for the three problems above).