This example describes a two-input, 8 bit adder/subtractor design in Verilog HDL. The design unit dynamically switches between add and subtract operations with an add_sub input port.
Download the files used in this example:
Table 1. Adder/Subtractor Port Listing
Port Name | Type | Description |
---|---|---|
dataa[7:0], datab[7:0] | Input | 8 bit data inputs |
add_sub | Input | Input port to enable dynamic switching between add and subtract operations |
clk | Input | Clock input |
result[8:0] | Output | 8 bit data output and a carry/borrow most significant bit (MSB) |