Jim
Jim

Reputation: 135

Create questasim/modelsim project from the command line

I'm trying to write a makefile for compiling and simulating some vhdl code.

Is there a way to create a project from linux/windows command line ?

It is straightforward if you open the tool and run "project new" but there's no documentation for doing it from the command line.

Upvotes: 0

Views: 1988

Answers (3)

Andrew White
Andrew White

Reputation: 1

As user maximus already mentioned, one can just write a simple tcl script in a .do file, which contains the project commands smth like:

if { [file exists project_name.mpf] } {
    puts "Project 'project_name' already exists, opening..."
    project open project_name
} else {
    puts "Creating new project 'project_name'"
    # Create a new project

    project new . project_name rtl_work
    project addfile rtl/uart_rx.v
    project addfile rtl/uart_tx.v
    project addfile rtl/uart_tb.v
    project compile all
}

or one can invoke the code directly from cmdline:

$(MODELSIM_DIR)/vsim -c \
-do "project new . project_name rtl_work; project addfile rtl/uart_tb.v; project compile all; run -all; exit;"

Upvotes: 0

HTLab
HTLab

Reputation: 74

My recommendation would be not to use projects, they will get in the way.

As Rakend already mentioned just use .do files which are simple and you have a full Tcl interpreter to your disposal if you want to do some extra stuff.

If you want to use makefiles then compile your code manually and then run vmake to create the Makefile for you. However, vcom/vlog are quick so .do is all you need.

Good luck,

Hans.

Upvotes: 0

maximus
maximus

Reputation: 174

I don't know how to use the project command directly from command line. But I've another method to do it. If you are into command line, you might know it already.

Anyway, you can write a .do file which contains the project commands then use vsim -c -do filename.do to execute it.

for example, my filename.do contains "project new . pro_name"

Upvotes: 0

Related Questions