Mac OSX data types
|Assignee:||Wilson Snyder||% Done:|
I routinely use verilator on my macbook pro. So thank you for making it available, and it is great to be able to say that :)
I just upgraded to verilator-3.833 and realized that there were/are two issues that can happen with regard to uint64_t on mac osx. Fundamentally, it is because mac uses "unsigned long long" to mean uint64_t (i.e. as opposed to "unsigned long").Here are the edits that I had to do to make it work:
2012-07-26 [.../verilator-3.833/include] $> diff verilatedos.h /usr/local/share/verilator/include/verilatedos.h 167c167 < typedef unsigned long vluint64_t; ///< 64-bit unsigned type --- > typedef unsigned long long vluint64_t; ///< 64-bit unsigned typeand
2012-07-26 [.../verilator-3.833/include] $> diff vltstd/svdpi.h /usr/local/share/verilator/include/vltstd/svdpi.h 19c19 < --- > #include <stdint.h>
obviously this is a hack, but, if you would be willing to fix this, I can clone the repo and re-test the re-build :)
#1 Updated by Wilson Snyder over 1 year ago
- Category set to Configure/Make/Compiling
- Status changed from New to Assigned
- Assignee set to Wilson Snyder
There were some Mac issues fixed in the git version, though I'm not sure about that one. Please give it a try.
While I'm sure "long long" fixes your machine, obviously others need to work too. I've had to apply several patches from other folks in this area, so if you could find a definitive source of how to properly do it that would be appreciated. The logic now looks for __WORDSIZE == 64, which I thought was correct. BTW it can't use configure nor uint64_t as that is not always defined.
#2 Updated by Joe Eiler over 1 year ago
I suggested the __WORDSIZE a couple years ago, before I did I checked on a mac and __WORDSIZE was getting defined in stdint.h IIRC. I don't have access to a mac right now but you might want to check the stdint include file to see what they are keying off. You might also want to look at limits.h (FYI, linux does it in an included bits/wordsize.h)
Odd, the way your diff looks it appears your system must have WORDSIZE defined to 64 (or you would have fallen to the #else and gotten the 32bit wordsize you wanted). I would say it could maybe try to look at __LP64 but that is really compiler dependent and verilator has things broken up nicely by OS.