Download presentation
Presentation is loading. Please wait.
1
4-Bit Binary-to-BCD Converter: case Statement
Discussion D3.4 Example 14
2
Binary-to-BCD Converter
3
-- Example 14: 4-Bit Binary-to-BCD Converter
library IEEE; use IEEE.STD_LOGIC_1164.all; entity binbcd4 is port( b : in STD_LOGIC_VECTOR(3 downto 0); p : out STD_LOGIC_VECTOR(4 downto 0) ); end binbcd4;
4
architecture binbcd4 of binbcd4 is
signal ps: STD_LOGIC_VECTOR(7 downto 0); begin process(b) case b is when X"0" => ps <= X"00"; when X"1" => ps <= X"01"; when X"2" => ps <= X"02"; when X"3" => ps <= X"03"; when X"4" => ps <= X"04"; when X"5" => ps <= X"05"; when X"6" => ps <= X"06"; when X"7" => ps <= X"07"; when X"8" => ps <= X"08"; when X"9" => ps <= X"09"; when X"A" => ps <= X"10"; when X"B" => ps <= X"11"; when X"C" => ps <= X"12"; when X"D" => ps <= X"13"; when X"E" => ps <= X"14"; when X"F" => ps <= X"15"; when others => ps <= X"00"; end case; end process; p <= ps(4 downto 0); end binbcd4;
5
Aldec Active-HDL Simulation
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.