Modelsim on cygwin?

R

Ric Thompson

Guest
I've had this problem on a couple of projects now, but I'm not sure
what the best fix is.

I have an environment which is set up for Unix, with scripts and
makefiles containing mainly relative paths, but with some paths rooted
at '/'. I also need to get these projects working on Windows/cygwin.

On cygwin, the bash scripts and makefiles run Ok, and cygwin makes
sure that paths rooted at '/' actually appear at 'c:\cygwin\' in the
file system. However, if I have a script which includes the command
'vcom /myfile' then vcom/vsim attempt to open 'c:/myfile', and not
'c:/cygwin/myfile'. They presumably bypass the cygwin API in some way.

Any ideas on the best way to handle this? Ideally, I want to use
exactly the same scripts and makefiles on Unix and Windows.

Cheers

Ric
 
Hi Ric,

What about using "uname -o" in your script and modify the pathname based on
the answer (i.e. Cygwin/<linux>)?

Hans
www.ht-lab.com


"Ric Thompson" <nospam@nospam.com> wrote in message
news:ubapn1dv13lgpafab9bi7r10fr5nrsspo3@4ax.com...
I've had this problem on a couple of projects now, but I'm not sure
what the best fix is.

I have an environment which is set up for Unix, with scripts and
makefiles containing mainly relative paths, but with some paths rooted
at '/'. I also need to get these projects working on Windows/cygwin.

On cygwin, the bash scripts and makefiles run Ok, and cygwin makes
sure that paths rooted at '/' actually appear at 'c:\cygwin\' in the
file system. However, if I have a script which includes the command
'vcom /myfile' then vcom/vsim attempt to open 'c:/myfile', and not
'c:/cygwin/myfile'. They presumably bypass the cygwin API in some way.

Any ideas on the best way to handle this? Ideally, I want to use
exactly the same scripts and makefiles on Unix and Windows.

Cheers

Ric
 
Ric Thompson wrote:
I've had this problem on a couple of projects now, but I'm not sure
what the best fix is.

I have an environment which is set up for Unix, with scripts and
makefiles containing mainly relative paths, but with some paths rooted
at '/'. I also need to get these projects working on Windows/cygwin.

On cygwin, the bash scripts and makefiles run Ok, and cygwin makes
sure that paths rooted at '/' actually appear at 'c:\cygwin\' in the
file system. However, if I have a script which includes the command
'vcom /myfile' then vcom/vsim attempt to open 'c:/myfile', and not
'c:/cygwin/myfile'. They presumably bypass the cygwin API in some way.

vcom is a windows application. It doesn't even know that cygwin is
there.


Any ideas on the best way to handle this? Ideally, I want to use
exactly the same scripts and makefiles on Unix and Windows.
You could reinstall cygwin with its root set to c:\ rather than
c:\cygwin
That's a bit ugly though.

Regards,
Allan
 
Ric Thompson wrote:
I've had this problem on a couple of projects now, but I'm not sure
what the best fix is.

I have an environment which is set up for Unix, with scripts and
makefiles containing mainly relative paths, but with some paths rooted
at '/'. I also need to get these projects working on Windows/cygwin.

On cygwin, the bash scripts and makefiles run Ok, and cygwin makes
sure that paths rooted at '/' actually appear at 'c:\cygwin\' in the
file system. However, if I have a script which includes the command
'vcom /myfile' then vcom/vsim attempt to open 'c:/myfile', and not
'c:/cygwin/myfile'. They presumably bypass the cygwin API in some way.

Any ideas on the best way to handle this? Ideally, I want to use
exactly the same scripts and makefiles on Unix and Windows.
We've been using modelsim under cygwin for months now without issues.

Cygwin has built-in commands to help with these type things:
cygpath.

So, try the following:
vcom `cygpath -a -w /myfile`

cygpath translates the pathname of "/myfile" to a windows
pathname (the -a means absolute pathname, -w means windows pathname).

--Mark
 
Ric Thompson wrote:

I have an environment which is set up for Unix, with scripts and
makefiles containing mainly relative paths, but with some paths rooted
at '/'. I also need to get these projects working on Windows/cygwin.
I have not yet found a satisfactory environment
for cygwin and emacs vhdl-mode and vsim.
However, Makefiles created by emacs vhdl-mode
work across platforms.

At work, I use native linux emacs vhdl-mode and vsim,
and always leave an up-to-date Makefile.
If I have to work at a windows machine for any reason,
I do this:

1. Control Panel, System, Advanced, Environment to get
vcom.exe, vsim.exe and make.exe in my windows path.
2. Start, run, cmd.exe
3. cd \
mkdir vhdl\my_project
cd vhdl\my_project
4. cvs checkout (or copy) my source files *.vhd and Makefile
5. make library
6. make test_foo
vsim test_foo

And I'm up and running at a modelsim prompt
with test_foo elaborated and ready to go.


-- Mike Treseler
 
On Thu, 17 Nov 2005 16:13:09 +0000, Ric Thompson <nospam@nospam.com>
wrote:

I've had this problem on a couple of projects now, but I'm not sure
what the best fix is.

I have an environment which is set up for Unix, with scripts and
makefiles containing mainly relative paths, but with some paths rooted
at '/'. I also need to get these projects working on Windows/cygwin.

On cygwin, the bash scripts and makefiles run Ok, and cygwin makes
sure that paths rooted at '/' actually appear at 'c:\cygwin\' in the
file system. However, if I have a script which includes the command
'vcom /myfile' then vcom/vsim attempt to open 'c:/myfile', and not
'c:/cygwin/myfile'. They presumably bypass the cygwin API in some way.

Any ideas on the best way to handle this? Ideally, I want to use
exactly the same scripts and makefiles on Unix and Windows.
To expand on the other replies a bit:

The Cygwin API isn't transparent; you have to recompile your app to
use it. It also has an unfriendly licence, so vendors of commercial
tools are unlikely to use it, which is your problem.

This means, in short, that your scripts and makefiles have to use full
pathnames which start at your drive letter (unless you can make
everything relative). If you're using full pathnames you can then put
your project in either the Cygwin tree (based at c:\cygwin, or
whatever) or in your normal Windows location; it doesn't matter. Some
things are easier in the Cygwin tree (filename completion, for
example), but I personally prefer a location outside Cygwin.

The makefile below works on both Cygwin and *nix without modification.
Caveats: you may have to export OSTYPE in your environment, and Cygwin
only sets OSTYPE for bash (it doesn't set it when starting tcsh, for
example). You may prefer to use $shell to run uname, rather than
checking OSTYPE.

HTH

Evan

---------------
ifeq ($(OSTYPE),cygwin)
ROOT = $(shell cygpath -w /)
else
ROOT =
endif
PREFIX = $(ROOT)/build/users/evan
FILE = wibble

$(PREFIX)/$(FILE) :
@echo "OSTYPE is $(OSTYPE); ROOT is $(ROOT)"
touch $(PREFIX)/$(FILE)
vcom $(PREFIX)/$(FILE)

clean :
rm $(PREFIX)/$(FILE)
---------------
 
Ric Thompson wrote:
I've had this problem on a couple of projects now, but I'm not sure
what the best fix is.

I have an environment which is set up for Unix, with scripts and
makefiles containing mainly relative paths, but with some paths rooted
at '/'. I also need to get these projects working on Windows/cygwin.

On cygwin, the bash scripts and makefiles run Ok, and cygwin makes
sure that paths rooted at '/' actually appear at 'c:\cygwin\' in the
file system. However, if I have a script which includes the command
'vcom /myfile' then vcom/vsim attempt to open 'c:/myfile', and not
'c:/cygwin/myfile'. They presumably bypass the cygwin API in some way.

Any ideas on the best way to handle this? Ideally, I want to use
exactly the same scripts and makefiles on Unix and Windows.
I realize that what I'm about to say probably won't help, but I've been
in your shoes, and the best solution was to make all paths relative.
There are other reasons for doing this; for example, if you use
source-code control (and you DO, right?), everything is much easier if
you can check out your design into any arbitrary directory and have it
build properly.

I find myself always checking and possibly editing tool-generated
project and other files to make sure that there are no absolute paths.
Everything is a lot easier.

-a
 
On Thu, 17 Nov 2005 16:13:09 +0000, Ric Thompson <nospam@nospam.com>
wrote:

I've had this problem on a couple of projects now, but I'm not sure
what the best fix is.

I have an environment which is set up for Unix, with scripts and
makefiles containing mainly relative paths, but with some paths rooted
at '/'. I also need to get these projects working on Windows/cygwin.

On cygwin, the bash scripts and makefiles run Ok, and cygwin makes
sure that paths rooted at '/' actually appear at 'c:\cygwin\' in the
file system. However, if I have a script which includes the command
'vcom /myfile' then vcom/vsim attempt to open 'c:/myfile', and not
'c:/cygwin/myfile'. They presumably bypass the cygwin API in some way.

Any ideas on the best way to handle this? Ideally, I want to use
exactly the same scripts and makefiles on Unix and Windows.
Check out cygpath.exe under cygwin.
It translates "cygwin" paths to/from DOS paths.

Regards
Anton Erasmus
 

Welcome to EDABoard.com

Sponsor

Back
Top