FPGARelated.com
Forums

Environmental variables to point at libraries with Modelsim?

Started by Nial Stewart May 7, 2009
Hi all,


In all my FPGA projects I try to keep everything uniform including
directory structures for projects etc, this allowing the same Modelsim VCOM
command to be used throughout (ie compiling designs and testbanches to
../Modelsim/work).

To stop having to compile the (usually) Altera libraries (altera_mf) into every
project directory I usually have a 'central' library.

Unfortunately the location of this varies depending on the machine
I'm working on (main, client's, laptop).

It would be really convenient to be able to declare an $Altera_Libraries
environmental variable and use this in Modelsim.ini, the way the $Model_Tech
one is. This could be set once for the machine then the same directories
copied/revision controlled machine independantly.

I've played about with this but haven't had any sucess.

Has anyone got anything similar to work?


Thanks for any pointers,


Nial


Nial Stewart wrote:
> It would be really convenient to be able to declare an $Altera_Libraries > environmental variable and use this in Modelsim.ini, the way the $Model_Tech > one is. This could be set once for the machine then the same directories > copied/revision controlled machine independantly. > > I've played about with this but haven't had any sucess. > > Has anyone got anything similar to work?
Yes, I haven't had any problems with that. In my case it's Xilinx libraries, and I put them in the directory defined by the $XILINX environment variable, wich I can use in the modelsim.ini, so this should work for you as well. I suspect there's a problem with the environment variable itself. I know that in Linux/UNIX it matters in what startup script you define the variable in. It might be that you put it in ~/.bash_profile, and that isn't executed for non-login shells or something (I could never wrap my head around this sort of stuff...). In Windows this should not be an issue. I'd first check if the variable is in fact available in ModelSim. Start ModelSim like you usually do, and check the variable ("set env(altera_libraries)" or something). If that doesn't give you the right value, then you need to define the variable somewhere else. In some Linux distros you have /etc/profile.local for that kind of stuff (variables that should be set for all users and all shells) or a /etc/bash.bashrc that is executed for every Bash started (bur not for ZSH or whatever else is there). HTH, Sean -- Replace "MONTH" with the three-letter abbreviation of the current month (simple, eh?).
Nial Stewart avait �nonc� :
> Has anyone got anything similar to work?
Did you try this in ModelSim's cmmand windows : puts $env(QUARTUS_ROOTDIR) Bert
> Yes, I haven't had any problems with that.
Thanks for the feedback Sean, I've tried it again and it's working now! Now I can (at last) have a unified project template! Nial.
On 7 Maj, 15:23, Sean Durkin <news_MO...@tuxroot.de> wrote:
> Nial Stewart wrote: > > It would be really convenient to be able to declare an $Altera_Libraries > > environmental variable and use this in Modelsim.ini, the way the $Model_Tech > > one is. This could be set once for the machine then the same directories > > copied/revision controlled machine independantly. > > > I've played about with this but haven't had any sucess. > > > Has anyone got anything similar to work? > > Yes, I haven't had any problems with that. > > In my case it's Xilinx libraries, and I put them in the directory > defined by the $XILINX environment variable, wich I can use in the > modelsim.ini, so this should work for you as well. > > I suspect there's a problem with the environment variable itself. I know > that in Linux/UNIX it matters in what startup script you define the > variable in. It might be that you put it in ~/.bash_profile, and that > isn't executed for non-login shells or something (I could never wrap my > head around this sort of stuff...). In Windows this should not be an issue. > > I'd first check if the variable is in fact available in ModelSim. Start > ModelSim like you usually do, and check the variable ("set > env(altera_libraries)" or something). If that doesn't give you the right > value, then you need to define the variable somewhere else. > > In some Linux distros you have /etc/profile.local for that kind of stuff > (variables that should be set for all users and all shells) or a > /etc/bash.bashrc that is executed for every Bash started (bur not for > ZSH or whatever else is there). > > HTH, > Sean > > -- > Replace "MONTH" with the three-letter abbreviation of the current month > (simple, eh?).
_ Instead of getting lost in your (personal account or computer)'s .bashrc .bash_profile .login etc. try using a script - that goes with the design (i.e. checked in with source code) - that sets up the necessary environment for the design. This script should point out paths to tool and tool-version binaries, library mappings to precompiled combinations of xilinx/altera with modelsim/actel with synplify/leonardo etc... In a unix-like environment you can "source" this file to setup environment variables to do just that. Cygwin will give you this on a NT/XP computer, maybe .bat files can to?? Regards -- Pontus