Complete the code to declare a 1-bit input named 'a'.
input [1];The input 'a' is declared as a 1-bit input to represent one bit of the number.
Complete the code to assign the difference output as the XOR of inputs 'a' and 'b'.
assign diff = a [1] b;The difference bit in a subtractor is calculated using XOR (^) of inputs 'a' and 'b'.
Fix the error in the borrow output assignment to correctly compute borrow in a 1-bit subtractor.
assign borrow = (~a) [1] b;The borrow output is true when 'a' is 0 and 'b' is 1, so use AND (&) between ~a and b.
Fill both blanks to complete the module header and port list for a 1-bit subtractor.
module subtractor([1], [2], diff, borrow);
The module header lists inputs first: 'input a' and 'input b' are the inputs for the subtractor.
Fill all three blanks to complete the always block that calculates difference and borrow using inputs 'a', 'b', and 'bin'.
always @(*) begin diff = a [1] b [2] bin; borrow = ([3] a & b) | (b & bin) | ([3] a & bin); end
The difference is XOR of a, b, and bin. Borrow is calculated using AND and OR with complemented 'a'.
