samar_mohammed
Newbie level 6
-- this program is to calculate the value of bmi which equal to =(wight/length^2) where length in meter i don't know the error could u help me ^_^
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 library ieee; use ieee.std_logic_1164.all; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ------------------------------------------- entity BMI_mesure is port (length :in STD_LOGIC_VECTOR(7 DOWNTO 0); wight :in STD_LOGIC_VECTOR (7 DOWNTO 0); BMI :out STD_LOGIC_VECTOR (6 DOWNTO 0)); end entity BMI_mesure; -------------------------------------------- architecture BMI_behav of BMI_mesure is begin process(length,wight) variable BMI_value :STD_LOGIC_VECTOR(6 DOWNTO 0); variable LENGTH_value :STD_LOGIC_VECTOR(7 DOWNTO 0) :=LENGTH; variable WIGHT_value :STD_LOGIC_VECTOR(7 DOWNTO 0) :=WIGHT; begin BMI_VALUE(6 DOWNTO 0) :=(WIGHT_value(7 DOWNTO 0)/((LENGTH_value(7 DOWNTO 0)*LENGTH_value(7 DOWNTO 0))/10000)); BMI <= BMI_value(6 DOWNTO 0) ; end process; end architecture BMI_behav;
Last edited by a moderator: