The thermometer code (also named as unary code) is useful to extract a vector number and use it to drive several switches. The thermometer code converts a n-bit number into a series of ones followed by zeroes of size 2^n.
In this example a 8-bit vector is going to be transformed into 256 signals to drive 256 switches. The binary-to-thermometer decoder is used, instead of the binary-code, to perform smoother transition during most significant bit changing.
Get FREE Credit for your next AirBnb Reservation by opening a new account (even if you already have one!)
The thermometer coder block is written in VHDL and tested on the next Figure.
entity thermometer is
vector_in : in std_logic_vector(7 downto 0);
vector_out : out std_logic_vector(255 downto 0)
architecture vhdlams of thermometer is
signal salida : std_logic_vector(255 downto 0) := (others => '0');
variable intermediate: integer range 0 to 255;
intermediate := CONV_INTEGER((vector_in));
salida <= (others => '0');
for i in 0 to intermediate loop
salida(i) <= '1';
vector_out <= salida;
For the test a 8 bit counter signal is given to the block under test.
ramp used as stimuli