• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. Type conversion from hex String to uint (32 bits) in Specman...

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 66
  • Views 15664
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Type conversion from hex String to uint (32 bits) in Specman e

bharathwajan
bharathwajan over 13 years ago

Hi All,

 

I am trying to read a file which has address and data in hex separated by space as shown below :

0001FF 0x47295784

I am having problem with converting the hex string 0001FFF to uint 32 bits and send this to my driver for further action. I have tried the following syntax from the cadence docs:

int = %{string};

int = pack(packing.low,string)

 Neither of them helped. In the both cases, the string is converted to a signed int. The doc doesnt help me convert string to uint (32 bits).

Could you pelase help me? 

Could anyone please help me do this type conversion?  

 Thank you !!! 

 Best Regards,

Bharath. 

  • Cancel
  • danielpoe2
    danielpoe2 over 13 years ago

     Hi,

     what you want is specman to interpret the string as a number. You can do this easily with "<string>".as_a(uint). However you need to consider how specman wants a hex to look like, namely it should be prefixed with "0x". So if you do "append("0x", string).as_a(uint)" you should get what you want. You can try it out on the specman console as well 'print "0xcafecafe".as_a(uint)'.

     

    Hope this helps,

    Daniel

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • bharathwajan
    bharathwajan over 13 years ago

    Hi Daniel,

     

    Thank a lot. It worked. I had tried this way but i didnot append "ox" to the string. Now it works.

     

    Thanks again !!!

     

    Best Regards,

    Bharath. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information