![]() |
|
|
|||||||
![]() |
VHDL - If statement with String condition |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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. ROOZ |
|
|
|
|
|
|
#2 |
|
Junior Member
Join Date: Apr 2008
Posts: 12
|
use strcmp(), can be found in library std_developerskit.std_iopak.all
eko |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jun 2008
Posts: 3
|
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. ROOZ |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jun 2008
Posts: 2
|
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 "==" mmarco76 |
|
|
|
|
|
#5 | |
|
Junior Member
Join Date: Jun 2008
Posts: 3
|
Quote:
thanks for the response but i realize the problem. i made my own strcmp function which is easier to use. ROOZ |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Give you enough string functions in Java web reporting tool | freezea | Software | 0 | 10-08-2009 09:03 AM |
| urgent help....need urgent help on say string task.. | pooja | Software | 0 | 03-03-2009 06:16 AM |
| Java String Problems | rbnbenjamin | General Help Related Topics | 0 | 02-03-2009 11:02 PM |
| ASP.NET: Asign Users in Roles(Array.IndexOf(Of String) method) | msandlana | Software | 0 | 04-25-2008 06:37 AM |
| Hidden linebreaks in string? VB.NET | Jiggy | Software | 0 | 04-23-2008 02:18 PM |