The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> Variable string handling https://designers-guide.org/forum/YaBB.pl?num=1285841040 Message started by Peter R. Kroon on Sep 30th, 2010, 3:03am |
Title: Variable string handling Post by Peter R. Kroon on 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 |
Title: Re: Variable string handling Post by Geoffrey_Coram on 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 (==). |
Title: Re: Variable string handling Post by Peter R. Kroon on 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. |
Title: Re: Variable string handling Post by Geoffrey_Coram on 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. |
Title: Re: Variable string handling Post by Marq Kole on 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 |
Title: Re: Variable string handling Post by Peter_R_Kroon on 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 :) |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |