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.

VHDL functions mistakes?

Status
Not open for further replies.

clros

Member level 2
Joined
May 26, 2018
Messages
45
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
387
Hi to all,

Ok, I have discovered that a my function work when I do:

Code:
function myConvert (A : in STD_LOGIC_VECTOR( 7 DOWNTO 0 ) ) return integer is
variable output : integer := 0;
begin
output := 5;
return output;
end function;

But, it do not work when I do:
Code:
function myConvert (A : in STD_LOGIC_VECTOR( 7 DOWNTO 0 ) ) return integer is
variable output : integer := 0;
begin
if a(7 downto 6) = "00" then
Output := 1;
elsif a(7 downto 6) = "01" then
Output := 2 ;
end if;
return output;
end function;

I do not understand... what is wrong?
 

I dont understand what counts as "work" and "do not work". The two functions are different, and syntactically fine. So whats the problem?
 

I dont understand what counts as "work" and "do not work". The two functions are different, and syntactically fine. So whats the problem?

The second function return always zero.
 

Then clearly that the A input bits (7 downto 6) are not "00" or "01"
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top