// half adder component used in the multiplier module half_adder(a, b, s, cout); input a, b; output s, cout; assign s = a^b; assign cout = a&b; endmodule // full adder component used in the multiplier module full_adder(a, b, cin, s, cout); input a, b, cin; output s, cout; assign s = a^b^cin; assign cout = (a&b) | (b&cin) | (a&cin); endmodule // 5-bit by 4-bit unsigned multiplier module mult5by4(x, y, p); input [4:0] x; input [3:0] y; output [8:0] p; // internal nodes within the multiplier circuit wire t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22; // structural description of the multiplier circuit assign p[0] = x[0]&y[0]; half_adder ha1(x[1]&y[0], x[0]&y[1], p[1], t1); half_adder ha2(x[2]&y[0], x[1]&y[1], t2, t3); half_adder ha3(x[3]&y[0], x[2]&y[1], t4, t5); full_adder fa1(t2, t1, x[0]&y[2], p[2], t6); full_adder fa2(t4, t3, x[1]&y[2], t7, t8); full_adder fa3(x[4]&y[0], t5, x[3]&y[1], t9, t10); full_adder fa4(t7, t6, x[0]&y[3], p[3], t11); full_adder fa5(t9, t8, x[2]&y[2], t12, t13); full_adder fa6(x[4]&y[1], t10, x[3]&y[2], t14, t15); full_adder fa7(t12, t11, x[1]&y[3], p[4], t16); full_adder fa8(t14, t13, x[2]&y[3], t17, t18); full_adder fa9(x[4]&y[2], t15, x[3]&y[3], t19, t20); half_adder ha4(t17, t16, p[5], t21); full_adder fa10(t19, t18, t21, p[6], t22); full_adder fa11(x[4]&y[3], t20, t22, p[7], p[8]); endmodule