From 601b265a764f545358290e60cd61e69ca2499770 Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Fri, 31 Oct 2014 15:24:21 +0000
Subject: [PATCH] Fixed 'mk all' for Modelsim version >= 10 by using the
 directory type for vlib.

---
 tools/modelsim/commands.do | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/modelsim/commands.do b/tools/modelsim/commands.do
index d9cae9cb12..01ce3567d4 100644
--- a/tools/modelsim/commands.do
+++ b/tools/modelsim/commands.do
@@ -150,6 +150,19 @@ proc parse_for_libs arg_list {
     return $libs
 }
 
+# Create work library
+proc do_vlib arg_work {
+    set modelsimId [vsimId]
+    set dot_index [string first . $modelsimId]
+    set modelsimId [string range $modelsimId 0 [expr $dot_index-1]]
+    if {$modelsimId < 10} {
+        vlib $arg_work
+    } else {
+        # The makefile that is created by vmake relies on using directories in vlib
+        vlib -type directory $arg_work
+    }
+}
+
 # Extract this lib or all libs that it depends on for arg_lib
 proc extract_all_libs arg_lib {
     if {$arg_lib=="all"} {
@@ -214,7 +227,7 @@ proc mk_execute {arg_lib} {
         lp $arg_lib
         # create work library if it does not already exist
         if {![file exists "$sim/work"]} then {
-            vlib work
+            do_vlib work
         }
         global env   ;# Make global env() variable known locally. This is necessary for $env(*) in compile IP tcl script, alternatively use $::env(*) in compile IP tcl scrip
         foreach ip $compile_ip {
@@ -236,7 +249,7 @@ proc mk_compile {arg_lib} {
     if {[file exists "$sim/work"]} then {
         vdel -lib $sim/work -all
     }
-    vlib work
+    do_vlib work
     # and then first execute any IP compile scripts
     mk_execute $arg_lib
     # and then compile the HDL
@@ -263,7 +276,7 @@ proc mk_vmake {arg_lib} {
     }
     # recreate work library
     vdel -lib $sim/work -all
-    vlib work
+    do_vlib work
     # and then first execute any IP compile scripts
     mk_execute $arg_lib
 }
-- 
GitLab