Three more, all from class on Friday, September 13

## To do

Create a circuit that performs 1-bit incrementation of its argument. There are two inputs,

*A*and*cin*, representing the input and a carry-in value. There are two outputs,*S*and*cout*, where*S = A + cin*(in one bit), and*cout*is the carry-out value of the sum.Create a 4-bit incrementation circuit. This circuit has four input wires,

*A0 ... A3*, representing the four bits of input. The output should have five outputs,*S0 ... S3*and*cout*, representing the four-bit value of*A+1*and the carry-out value.Implement addition and subtraction in a single circuit, with the ability to choose the mode. There are 9 inputs,

*A0 ... A3*,*B0 ... B3*, and*D*. The first 8 represent the 4-bit inputs for*A*and*B*, while*D*represents the "mode".There are four outputs,

*S0 ... S3*. If the input*D*is 1, the circuit will output the 4-bit value*A+B*on*S0 ... S3*. If it is 0, then the output should be*A-B*.In all cases, the least significant bit should be at

*x0*, the most significant at*x3*. Assume a 2's complement representation of negative numbers.You can and should reuse subcircuits as you need them.

### Turn in:

Save these three problems in a file called `hw2-5.circ`

To hand in your files:

Copy this file into your

`hw2`turn-in directory. Be sure to copy the directory and its files, not just the files.`cp -r ~/cpsc220/hw2/hw2-5.circ ~lasseter/classes/cpsc220/username/hw2/`