|
| 1 | +# File Name: OsvvmScriptsFileCreate.tcl |
| 2 | +# Purpose: Scripts for running simulations |
| 3 | +# Revision: OSVVM MODELS STANDARD VERSION |
| 4 | +# |
| 5 | +# Maintainer: Jim Lewis email: jim@synthworks.com |
| 6 | +# Contributor(s): |
| 7 | +# Jim Lewis email: jim@synthworks.com |
| 8 | +# Markus Ferringer Patterns for error handling and callbacks, ... |
| 9 | +# |
| 10 | +# Description |
| 11 | +# Tcl procedures to Autogenerate Files |
| 12 | +# |
| 13 | +# Developed by: |
| 14 | +# SynthWorks Design Inc. |
| 15 | +# VHDL Training Classes |
| 16 | +# OSVVM Methodology and Model Library |
| 17 | +# 11898 SW 128th Ave. Tigard, Or 97223 |
| 18 | +# http://www.SynthWorks.com |
| 19 | +# |
| 20 | +# Revision History: |
| 21 | +# Date Version Description |
| 22 | +# 1/2025 2025.01 Initial |
| 23 | +# |
| 24 | +# |
| 25 | +# This file is part of OSVVM. |
| 26 | +# |
| 27 | +# Copyright (c) 2025 by SynthWorks Design Inc. |
| 28 | +# |
| 29 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 30 | +# you may not use this file except in compliance with the License. |
| 31 | +# You may obtain a copy of the License at |
| 32 | +# |
| 33 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 34 | +# |
| 35 | +# Unless required by applicable law or agreed to in writing, software |
| 36 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 37 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 38 | +# See the License for the specific language governing permissions and |
| 39 | +# limitations under the License. |
| 40 | +# |
| 41 | + |
| 42 | +package require fileutil |
| 43 | + |
| 44 | +namespace eval ::osvvm { |
| 45 | + # Declare existance as a global, but do not initialize as it will clear it |
| 46 | + variable AnalyzeDict |
| 47 | + variable AnalyzeOrderList |
| 48 | + variable SimulateDict |
| 49 | + |
| 50 | +# ------------------------------------------------- |
| 51 | +# CreateDryRunDict |
| 52 | +# |
| 53 | +proc CreateDryRunDict {ProFileToBuild} { |
| 54 | + # CreateDryRunDict runs a build script in DryRunMode and |
| 55 | + # creates dictionaries of Analyze and Simulate information. |
| 56 | + # The Analyze dictionary, ::osvvm::AnalyzeDict, has a dictionary |
| 57 | + # for each library used. For each library there is an array of |
| 58 | + # dictionaries that contain the file analyzed as well as language version used. |
| 59 | + # The Simulation dictionary, ::osvvm::SimulateDict, has a dictionary |
| 60 | + # for each library used. For each library there is an array of |
| 61 | + # dictionaries that contain information passed to simulate. |
| 62 | + # |
| 63 | + # ProFileToBuild - Path to the pro file that build the entire design. |
| 64 | + # WhereToCreate - Directory into which to create vhdl_ls.toml. Default = . |
| 65 | + # |
| 66 | + |
| 67 | + variable GenerateOsvvmReports |
| 68 | + set SavedGenerateOsvvmReports $GenerateOsvvmReports |
| 69 | + set GenerateOsvvmReports "false" ;# turn off reports |
| 70 | + |
| 71 | + # initialize dictionaries to empty |
| 72 | + variable AnalyzeDict [dict create] ;# empty dictionary |
| 73 | + variable AnalyzeOrderList "" ;# empty list |
| 74 | + variable SimulateDict [dict create] ;# empty dictionary |
| 75 | + |
| 76 | + # Create AnalyzeDict and SimulateDict as a recording of |
| 77 | + source $::OsvvmLibraries/Scripts/VendorScripts_DryRunDict.tcl |
| 78 | + |
| 79 | + build $ProFileToBuild [BuildName CreateDryRunDict] |
| 80 | +# if {$ScriptToRun ne ""} { $ScriptToRun } |
| 81 | + |
| 82 | + # restore settings and tool API actions |
| 83 | + # StartUp ;# replace source below with StartUp if features beyond VendorScripts_xxx.tcl are changed |
| 84 | + source $::OsvvmLibraries/Scripts/VendorScripts_${::osvvm::ScriptBaseName}.tcl |
| 85 | + set GenerateOsvvmReports $SavedGenerateOsvvmReports ;# restore reports |
| 86 | +} |
| 87 | + |
| 88 | +# ------------------------------------------------- |
| 89 | +# CreateVhdlLsToml for VHDL LS |
| 90 | +# |
| 91 | +proc CreateVhdlLsToml {ProFileToBuild {WhereToCreate .}} { |
| 92 | + # CreateVhdlLsToml runs a build script in DryRunMode and |
| 93 | + # creates a vhdl_ls.toml file. |
| 94 | + # |
| 95 | + # ProFileToBuild - Path to the pro file that build the entire design. |
| 96 | + # WhereToCreate - Directory into which to create vhdl_ls.toml. Default = . |
| 97 | + # |
| 98 | + variable AnalyzeDict |
| 99 | + |
| 100 | + # Create AnalyzeDict for the ProFileToBuild script |
| 101 | + CreateDryRunDict $ProFileToBuild |
| 102 | + |
| 103 | + set TomlHomeDir [file normalize $WhereToCreate] |
| 104 | + set TomlFile [open [file join $TomlHomeDir vhdl_ls.toml] w] |
| 105 | + |
| 106 | + puts $TomlFile "# Generated by OSVVM's CreateToml" |
| 107 | + puts $TomlFile "\[Libraries\]" |
| 108 | + |
| 109 | + foreach key [dict keys $AnalyzeDict] { |
| 110 | + # Print library name |
| 111 | + set FileList [dict get $AnalyzeDict $key] |
| 112 | + puts $TomlFile "${key}.files = \[" |
| 113 | + foreach FileDict $FileList { |
| 114 | + puts $TomlFile " '[dict get $FileDict FileName]'," |
| 115 | + } |
| 116 | + puts $TomlFile "\]" |
| 117 | + # mark things from OSVVM libraries as thrid party |
| 118 | + } |
| 119 | + close $TomlFile |
| 120 | +} |
| 121 | + |
| 122 | + |
| 123 | +# Don't export the following due to conflicts with Tcl built-ins |
| 124 | +# map |
| 125 | + |
| 126 | +namespace export CreateDryRunDict |
| 127 | +namespace export CreateVhdlLsToml |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | +# end namespace ::osvvm |
| 132 | +} |
0 commit comments