Tricking your Mac in to Believing it can run ModelSim
Many of our users love Mac computers. Too bad that the mainstream EDA sector does not. There are hardly any EDA tools available for Mac, so most people use scripts to run their simulations on a remote (or a virtualized) Linux machine. In this blog post, I will explain how you can trick your Mac (or rather: your Sigasi tool) in to believing that it can run ModelSim, just like I showed you in this screencast.
Disclaimer 1: This is in no way a crack; we're not messing with ModelSim! You'll need a legal copy and a valid license, which you can get from your Mentor Graphics sales rep, or (a limited version, free of charge) from the Altera website
Disclaimer 2: Consider this semi-advanced stuff. I'm sharing this idea because I think it will be useful to other people, it is not a supported Sigasi feature.
Disclaimer 3: I hate discaimers!
We will need a computer with SSH acces that has a working version of ModelSim installed. I suggest you use a Linux computer because Mac OSX and Linux are both Unix-like systems. If you use a Windows compile server, you may run in to troubles with the path format (backslashes on Windows!). You can either use a remote computer, or set up a virtual machine (using something like Parallels or VirtualBox) on your Mac.
You will need the following info:
- the host name (or IP address) of your build server
- your user name on that server
- the install path of ModelSim on the server
You also need to set up an SSH key so that you can log on to the server without typing your password.
Next, we will create a fake ModelSim installation dir on the Mac. This directory will contain one script, remote_modelsim.sh and several symlinks to this script.
mkdir ~/fakeModelSim
cd ~/fakeModelSim
touch remote_modelsim.sh
ln -s remote_modelsim.sh vsim
ln -s remote_modelsim.sh vcom
ln -s remote_modelsim.sh vlib
The fakeModelSim script copies the files to the build server and executes the specified ModelSim command.
#!/bin/sh#configuration REMOTE_USER=john.doe REMOTE_HOST=122.22.22.221 REMOTE_HOME='/home/john.doe' REMOTE_MODELSIM_DIR='/opt/altera/10.0/modelsim_ase/bin'COMMAND=`basename $0` # calculate the arguments, with proper quotes around each argument for ARG in "$@" do ARGS="$ARGS \"$ARG\"" done# Calculate a directory on the remote build server, where we can put our data HASH=$(echo ${PWD} ${HOSTNAME} ${USER} | shasum | cut -c1-32) REMOTE_DIR=${REMOTE_HOME}/remote_compilation/${HASH}# sync the project directory. You don't need this if you are using a network shared folder. function try_rsync(){ rsync -r ${PWD}/* ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_DIR} } function createRemoteDir(){ echo "rsync failed, probably because the remote directory $REMOTE_DIR did not exits. Retrying." >&2 ssh ${REMOTE_USER}@${REMOTE_HOST} "mkdir -p ${REMOTE_DIR}" } try_rsync || ( createRemoteDir && try_rsync ) || exit -1 # end syncREMOTE_SCRIPT=\ "cd ${REMOTE_DIR}; "\ "MODELSIM_DIR=/opt/altera/10.0/modelsim_ase/bin ; "\ "/opt/altera/10.0/modelsim_ase/bin/$COMMAND $ARGS"# echo "# Running remote command $REMOTE_SCRIPT" ssh ${REMOTE_USER}@${REMOTE_HOST} $REMOTE_SCRIPT
Now all you need to do, is tell Sigasi (or whatever tool you are using) to use ~/fakeModelSim as path for the ModelSim executables.
Other tools and Feedback
Al of this will work just as well with Xilinx ISim, or with the Altera Quartus II, or for a million other EDA and non-EDA tools. You can extend the script to copy the compiled files back to your local computer, or you can use a shared folder instead of rsync. Feel free to improve and share.
Do you like this script? Do you like you Mac? Do you have a better way of designing hardware with your Mac? Talk to me in the comments section, below!
Comments
modelsim on macos
I was hoping you'd found a way of tricking the modelsim install to use whatever glibc is installed on MacOS-X. There's probably no technical reason why it can't run native – though I'm not sure if flexlm has a MacOS version or not. Running remote on a linux machine but displaying on the Mac is not really running modelsim on the Mac at all – just displaying it there. I admit it's a clever hack to use ssh to execute on the remote host though.
VirtualBox
In fact, I am running it on my Mac hardware: it runs on a VirtualBox alongside my other Mac stuff. Having a whole new virtual machine does create a big overhead, though!
FlexLM does run on Mac, if your EDA tool vendor pays Flexera to offer you this service, which they probably don't.
Let's hope that EDAC (or Mentor) adds Mac OSX to their list of supported platforms, so that we won't have to jump though hoops to run stuff on a Mac.
One can always access a
One can always access a license from a machine that is running FlexLM though, even it it's not native on the Mac. I'm running parallels and it doesn't seem to have much overhead (except for consuming memory). Would be nice to have a native version of EDA tools running MacOSX – even it they require X11. There's really no technical reason why it couldn't be supported – probably as easy as linux support and most tools run on way more distros than the official vendor-supported one or two.
Paul
where is the simulation part?
Hi, I came through this webpage while googling and I think it would be useful for my situation. I am using a Mac and there is a ModelSim installed on a remote linux machine which I also have an ssh access. However, I don't find the compile/simulation command for ModelSim in your script? I have installed Sigasi plugin in Eclipse. Can you please elaborate more on how to "tell Sigasi to use ~/fakeModelSim as path for the ModelSim executables"?
Great Thanks..
Only for HDT 1.0 (for now)
Hi! This blog post works with Sigasi 1.0 The simulator integration has not been ported to Sigasi 2.x yet.
More information on how to set up ModelSim from Sigasi HDT 1.0 is in the user manual. Instead of using a real ModelSim directory, you should select the
~/fakeModelSimdirectory.