Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

what's the wrong with this vhdl program

Status
Not open for further replies.

samar_mohammed

Newbie level 6
Joined
Jul 26, 2012
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,406
-- 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:

Re: what's the wrong with this vhdl programm

you didnt say what the error is. But I suspect its the fact there is no "/" function in the std_logic_unsigned package.

I suggest you use the numeric_std package instead, or use integers.
 

Re: what's the wrong with this vhdl programm

when i use this library it appears this error
ERROR :LIBRARY ERROR :pRIMARY UNIT "NUMRIC_STD"denoted by prefix "ieee"must exixt in the library
 

Re: what's the wrong with this vhdl programm

If that error message was cut & paste, then ... NUMRIC_STD != NUMERIC_STD As in, try adding an E. ;)
 

Re: what's the wrong with this vhdl programm

no the message wasn't copy & paste i just rewrite it, so i just missed 'e' when i wrote it again ^_^
i wrote it numeric_std and i had this error
 

Re: what's the wrong with this vhdl programm

bummer. :p So much for an easy fix. ;)
 

Re: what's the wrong with this vhdl programm

What I meant was that is was a pity that you didn't make a typo (forgot the E). A typo would have been easy for you to fix.
 

Re: what's the wrong with this vhdl programm

any way thanks for help my problem seems no solution :(
 

So what is the full code you actually use and what is the full error?

Case in point: there's no numeric_std mentioned anywhere in your code in the first post.

And while I'm being pedantic ... you probably mean "weight". A wight is a mythical creature. :p
 

If your formula for bmi (in the text before your code) is BMI = W / (L*L), then what is the /10000 in line 19 for? Also, if L is in meters you aren't going to have much resolution in your results. The integer results are also going to make things worse.
 

yes L is in meter and i use 10000 to convert it to cm this program doesn't work with me when i ask they say that this program can't deal with it like software programming i have tto define divided operation as hardware implementation.
 

I suggest you post the full code but my first suggestion is that you better use real in stead of std_logic_vector. And I assume you're not going to implement this in real logic?
 

this part of my project i have to calculate the value of fat in human body. i use before that integer instead of std_logic_vector it has the same problem is at end i delete that from my project to make it work :(
 

this seems like a very strange project to do in VHDL. something like this would usually be a software task. Are you trying to put this on a real FPGA?

And can you please post somne more code with the errors you are getting.
 
^_^
at end i did that i suppose that this is must be software task so i just did that i revive the value of bmi from external source and i did my whole program on that suppose.
yes i do. i fix all error that i was getting ^_^
 

we can't help you further if you don't post some code, but as tricky suggested, body mass index is a task that is better to implement in software. The same is true for fat percentage calculation.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top