VHDL Cookbook 6
VHDL Cookbook 6
VHDL Cookbook 6
Advanced VHDL
6-1
6-2 The VHDL Cookbook
adder constructed out of full-adder cells, with the exception of the least
significant bit, which is consists of a half-adder. A generate statement to
achieve this is shown in Figure6-2.
The outer generate statement iterates with i taking on values from 0 to
width-1. For the least significant bit (i=0), an instance of a half adder
component is generated. The input bits are connected to the least
significant bits of a and b, the output bit is connected to the least significant
bit of sum, and the carry bit is connectected to the carry in of the next stage.
For intermediate bits, an instance of a full adder component is generated
with inputs and outputs connected similarly to the first stage. For the most
significant bit (i=width-1), an instance of the half adder is also generated, but
its carry output bit is connected to the signal carry.