Altera_Forum
Honored Contributor
15 years ago2's complement consideration
Hello everyone!
I have some considerations about the implementation of twos complement in a filter/decimation design. The ADC used in the design is AD7401, which had also been discussed earlier about. We have talked about it in general in two topics at AlteraForum and I also found a related topic at edaboard.com in which FvM had given some answers. Links are provided below. http://www.alteraforum.com/forum/showthread.php?t=21560 (http://www.alteraforum.com/forum/showthread.php?t=21560) http://www.alteraforum.com/forum/showthread.php?t=22104 (http://www.alteraforum.com/forum/showthread.php?t=22104) http://www.edaboard.com/ftopic353078.html (http://www.edaboard.com/ftopic353078.html) My question is simple: after implementig the filter normally, how can I get it to 2's complement? FvM refers to shifting the decimator's output. Wouldn't it be the same if we substracted a value of 32768 (unsigned decimal) from the original output? What about the libraries (packages) and TYPES used? Should we use the IEEE numeric_std.all package? Should we define our vectors as signed instead of std_logic_vectors? I found a good reference about VHDL types (link below), but it rather confused me. http://www.synthworks.com/papers/vhdl_math_tricks_mapld_2003.pdf (http://www.synthworks.com/papers/vhdl_math_tricks_mapld_2003.pdf) I am in knowledge about the theoretical approach of how ones/twos complement works. Thanks to everybody in advance!