**Full Subtractor RTL Design & Verification:** Give the truth table, Bool…
**Full Subtractor RTL Design & Verification:** Give the truth table, Boolean expressions, and gate-level implementation of a **Full Subtractor** with borrow-in ($B_{in}$). Write structural/gate-level Verilog RTL code and its testbench.
Model answer
### 1. Working Principle & Truth Table A **Full Subtractor** subtracts bit $B$ and incoming borrow $B_{in}$ from minuend $A$, yielding Difference ($D$) and Borrow-out ($B_{out}$): {ccc|cc} A & B & B_{in} & Diff (D) & B_{out} \\ \hline 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 1 \\ 0 & 1 & 0 & 1 & 1 \\ 0 & 1 & 1 & 0 & 1 \\ 1 & 0 & 0 & 1 & 0 \\ 1 & 0 & 1 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0 \\ 1 & 1 & 1 & 1 & 1 ### 2. Boolean Expressions - $Difference = A \oplus B \oplus B_{in}$ - $B_{out} = \overline{A} B + \overline{A} B_{in} + B B_{in} = \overline{A} B + \overline{(A \oplus B)} B_{in}$ ### 3. Verilog RTL Implementation ### 4. Verilog Testbench