If statement with String condition

Joined
Jun 9, 2008
Messages
3
Reaction score
0
Hi everyone,
I would like to know how to do string comparison as a condition for if statement
for instance, i have a block with a string input (S) and it is being fed by either "sdfr23rdf34x23fsfdr" or "wedq23asd44x344dfd" and i would like to do the following
if (S == "sdfr23rdf34x23fsfdr")
.....
elsif (S=="wedq23asd44x344dfd")
..
end if;

could someone please help me about how to do such a comparison.
 

eko

Joined
Apr 16, 2008
Messages
12
Reaction score
0
use strcmp(), can be found in library std_developerskit.std_iopak.all
 
Joined
Jun 9, 2008
Messages
3
Reaction score
0
thanks eko for your response but I am having problem applying it.
i did the following

process

begin

if (strcmp(memory_model,"two_port_64x16")) then

inst_foundry_two_port_64x16b : TS6N65ULPA64X16M4F
................

end if ;
end process;

the problem is that i get the following error
No feasible entries for subprogram "strcmp".

and if i do the following,
process

begin

if ((strcmp(memory_model,"two_port_64x16"))==0) then

inst_foundry_two_port_64x16b : TS6N65ULPA64X16M4F
................

end if ;
end process;

i get another error
near "=": syntax error

could someone please help me with this.
 
Joined
Jun 10, 2008
Messages
2
Reaction score
0
1- problem 1: be sure to have included the library.
In the beginning of the vhdl file you've to write:
use std_developerskit.std_iopak.all;

2- problem 2: in VHDL the comparison is only 1 "=" not "=="
 
Joined
Jun 9, 2008
Messages
3
Reaction score
0
mmarco76 said:
1- problem 1: be sure to have included the library.
In the beginning of the vhdl file you've to write:
use std_developerskit.std_iopak.all;

2- problem 2: in VHDL the comparison is only 1 "=" not "=="


thanks for the response but i realize the problem. i made my own strcmp function which is easier to use.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top