VHDL: Adder/Subtractor

author-image

By

This example describes a two input parameterized adder/subtractor design in VHDL. The design unit multiplexes add and subtract operations with an addnsub input. Synthesis tools detect add and subtract units in HDL code that share inputs and whose outputs are multiplexed by a common signal. Software infers lpm_addsub megafunction for such add/subtract designs.

Figure 1. Adder/subtractor top-level diagram.

Download the files used in this example: