0 votes
in VHDL by (200 points)

How to use unsigned in VHDL?

2 Answers

0 votes
by (500 points)

In VHDL an "unsigned" is a type of vector element that's intended for arithmetic operations ( such as comparing to numeric values , adding , subtracting , multiplying , etc... ) Although arithmetic operations can sometimes be performed on the std_logic_vector type - this is strongly discouraged.

Example 1 :

signal kelvin_temperature : unsigned ( 15 downto 0 ) ;
signal below_room_temperature_alarm : std_logic ;

below_room_temperature_alarm <= '1' kelvin_temperature < 298 else '0' ;
Example 2 :
signal apples_in_basket : unsigned ( 7 downto 0 ) ;
signal rotten_apples_in_basket : unsigned ( 7 downto 0 ) ;
signal good_apples_in_basket : unsigned ( 7 downto 0 ) ;

good_apples_in_basket <= apples_in_basket - rotten_apples_in_basket ;
0 votes
by (500 points)

This is an array type that represents the behavior of unsigned numbers. I use it in counters for clock division, address controls, unsigned computations, and so on.

Hardware Coder Community

© 2022 by Hardware Coder. User contributions are licensed under cc by-sa 4.0 with attribution required. Attribution means a link to the question, answer, user, etc on this site.

This site is owned and operated by Hardware Coder in McKinney, Texas.

Send Us A Message
About Us

By using this site, you agree to the following:

Privacy Policy
Terms and Conditions
DMCA Policy
Earnings Disclaimer
Legal Disclaimer

...