The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 12:29pm
Pages: 1
Send Topic Print
Variable string handling (Read 3472 times)
Peter_R_Kroon
New Member
*
Offline



Posts: 5
The Netherlands
Variable string handling
Sep 30th, 2010, 3:03am
 
Because I wrote a generic module which checks signal events on a pin I want the pin name reported in a message generated by this module if the pin changes value.
For this moment I used the following definition for an input pin containing the name of a pin:

input [8*15:1] pin

However I want to make it generic because it is not known at front how many characters a pin name will be (I do not want to count this manually!) so I am looking to a construction where the number of pin name characters can be count and the outcome can be put on the position of the 15 in the example above.

Or if there is another simple way to import strings of the format "string" (including "")via an input pin into a module.
Inside the module it must be possible to check if the received string has a certain contents!

Regards

Peter
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Variable string handling
Reply #1 - Sep 30th, 2010, 6:26am
 
How are you setting the value of that input pin -- do you have another module that sets it?

I also can't think of a way that you could possibly use that input to do anything useful.

I could imagine using a "string parameter" in VAMS:
 parameter string pin_to_check = "NONE";

 if (pin_to_check == "INA") begin
   // do something
 end else if (pin_to_check == "INB") begin
   // do something
 end else
   $strobe(" pin_to_check=%s is not a valid pin!", pin_to_check);

But in this case, you have to have a set of fixed strings to check against.  AMS allows only limited string operations, one of which is test-equal (==).
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Peter_R_Kroon
New Member
*
Offline



Posts: 5
The Netherlands
Re: Variable string handling
Reply #2 - Sep 30th, 2010, 11:31pm
 
Geoffrey,

Unfortunately I can not use the phrase "parameter string pin_to_check = "NONE"" in my code, I get then an error that a semicolon is expected on the position of the word "string".
I can try to define the parameter definition without the string word supplement and see if I can use the parameter in equations.
FYI: I am using the cadence toolsuite for compiling + simulation.
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: Variable string handling
Reply #3 - Oct 4th, 2010, 2:18pm
 
Search this forum for "string parameter" -- I'm pretty sure someone posted something about being able to use them, but there was a trick.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Marq Kole
Senior Member
****
Offline

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: Variable string handling
Reply #4 - Nov 17th, 2010, 7:54am
 
For support of string parameters you will need to use a recent version of Cadence MMSIM stream. In Spectre 7.2 it is supported.

Marq
Back to top
 
 
View Profile   IP Logged
Peter_R_Kroon
New Member
*
Offline



Posts: 5
The Netherlands
Re: Variable string handling
Reply #5 - Nov 18th, 2010, 12:35am
 
Marq,

I found sofar a satisfactory solution for my problem so my probem is solved for the moment. I used as a compromise a name parameter added to the generic module. The parameter name is used now only for messages and not anymore for comparison so in that way it is kept simple.
This thread can be closed now  :)
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.