diff --git a/.github/scripts/generate_tag.py b/.github/scripts/generate_tag.py index bc0a44a4d..2329904b3 100644 --- a/.github/scripts/generate_tag.py +++ b/.github/scripts/generate_tag.py @@ -13,43 +13,25 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import datetime -import subprocess +import os +import re from gh import gh new_tag = "NO_NEW_TAG" -print("Getting latest release index…") +tags = [tag for _, tag in gh.openlane.tags] -print("Getting the latest tag…") +openlane_tm_rx = re.compile(r"openlane-(.+?)\.tm") -latest_tag = None -latest_tag_commit = None -commits_with_tags = gh.openlane.tags -tags = [tag for _, tag in commits_with_tags] -for tag in commits_with_tags: - commit, name = tag - latest_tag = name - latest_tag_commit = commit - -commit_count = int( - subprocess.check_output( - ["git", "rev-list", "--count", "%s..%s" % (latest_tag_commit, "HEAD")] - ) -) - -if commit_count == 0: - print("No new commits. A tag will not be created.") -else: - now = datetime.datetime.now() - - time = now.strftime("%Y.%m.%d") - new_tag = time - release_counter = 0 - while new_tag in tags: - release_counter += 1 - new_tag = f"{time}r{release_counter}" - - print("Naming new tag %s." % new_tag) +for file in os.listdir("scripts"): + match = openlane_tm_rx.match(file) + if match is not None: + tag = match[1] + if tag not in tags: + new_tag = tag + print("Naming new tag %s." % new_tag) + else: + print("No new tag found.") + break gh.export_env("NEW_TAG", new_tag) diff --git a/.github/scripts/variables_documentation.py b/.github/scripts/variables_documentation.py index befb03315..983495ac4 100644 --- a/.github/scripts/variables_documentation.py +++ b/.github/scripts/variables_documentation.py @@ -63,6 +63,7 @@ OPENLANE_MOUNTED_SCRIPTS_VERSION OPENLANE_ROOT OPENLANE_VERSION +OPENLANE_COMMIT OPENROAD_BIN PACKAGED_SCRIPT_0 PDKPATH diff --git a/.github/workflows/openlane_ci.yml b/.github/workflows/openlane_ci.yml index 263807a4d..d2c01c053 100644 --- a/.github/workflows/openlane_ci.yml +++ b/.github/workflows/openlane_ci.yml @@ -294,10 +294,6 @@ jobs: with: name: pdk-tarball - - name: Write Main Branch - run: | - echo "MAIN_BRANCH=${{ vars.MAIN_BRANCH }}" >> $GITHUB_ENV - - name: Write Hash run: | echo "GIT_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV @@ -310,7 +306,7 @@ jobs: done - name: Create Tag (If scheduled or dispatched) - if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.BRANCH_NAME == env.MAIN_BRANCH }} + if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && (env.BRANCH_NAME == vars.MAIN_BRANCH || env.BRANCH_NAME == 'superstable') }} run: cd ${GITHUB_WORKSPACE}/ && python3 ${GITHUB_WORKSPACE}/.github/scripts/generate_tag.py - name: Tag Commit (If scheduled or dispatched) diff --git a/docs/source/getting_started/quickstart.md b/docs/source/getting_started/quickstart.md index b45ff7e67..b363d9211 100644 --- a/docs/source/getting_started/quickstart.md +++ b/docs/source/getting_started/quickstart.md @@ -81,7 +81,7 @@ This is a typical structure for a design folder: │   ├── config.json │   ├── logs │   ├── openlane.log -│   ├── OPENLANE_VERSION +│   ├── OPENLANE_COMMIT │   ├── PDK_SOURCES │   ├── reports │   ├── results diff --git a/docs/source/reference/openlane_commands.md b/docs/source/reference/openlane_commands.md index 4b7610055..39e386a39 100644 --- a/docs/source/reference/openlane_commands.md +++ b/docs/source/reference/openlane_commands.md @@ -4,7 +4,7 @@ This page describes the list of commands available in OpenLane, their functional **NOTE:** You must run the `prep` command before running any of the other commands, in order to have the necessary files and configurations loaded. -The following commands are available in the interactive mode: `./flow.tcl -interactive`, or in Tclsh using `% package require openlane 0.9`. +The following commands are available in the interactive mode: `./flow.tcl -interactive`, or in Tclsh using `% package require openlane`. ## General Commands diff --git a/flow.tcl b/flow.tcl index 645b26607..4ece22086 100755 --- a/flow.tcl +++ b/flow.tcl @@ -17,7 +17,11 @@ set ::env(OPENLANE_ROOT) [file dirname [file normalize [info script]]] if { ! [info exists ::env(OPENROAD_BIN) ] } { set ::env(OPENROAD_BIN) openroad } -lappend ::auto_path "$::env(OPENLANE_ROOT)/scripts/" +if { [info exists ::env(TCL8_5_TM_PATH)] } { + set ::env(TCL8_5_TM_PATH) "$::env(OPENLANE_ROOT)/scripts:$::env(TCL8_5_TM_PATH)" +} else { + set ::env(TCL8_5_TM_PATH) "$::env(OPENLANE_ROOT)/scripts" +} package require openlane; # provides the utils as well proc run_placement_step {args} { @@ -371,25 +375,25 @@ set flags {-interactive -it -drc -lvs -synth_explore -run_hooks} parse_key_args "flow.tcl" argv arg_values $options flags_map $flags -no_consume -if {[catch {exec cat /git_version} ::env(OPENLANE_VERSION)]} { - if {[catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_VERSION)]} { - set ::env(OPENLANE_VERSION) "" +if {[catch {exec cat /git_version} ::env(OPENLANE_COMMIT)]} { + if {[catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_COMMIT)]} { + set ::env(OPENLANE_COMMIT) "" } } if { [file isdirectory $::env(OPENLANE_ROOT)/.git] } { if {![catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)]} { - if { $::env(OPENLANE_VERSION) == $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)} { + if { $::env(OPENLANE_COMMIT) == $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)} { unset ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION) } } } -puts "OpenLane $::env(OPENLANE_VERSION)" +puts "OpenLane v[package version openlane] ($::env(OPENLANE_COMMIT))" if { [info exists ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)] } { puts "(with mounted scripts from $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION))" } -puts "All rights reserved. (c) 2020-2023 Efabless Corporation and contributors." +puts "All rights reserved. (c) 2020-2024 Efabless Corporation and contributors." puts "Available under the Apache License, version 2.0. See the LICENSE file for more details." puts "" diff --git a/scripts/openlane-1.1.0.tm b/scripts/openlane-1.1.0.tm new file mode 100644 index 000000000..7cc3c8b5e --- /dev/null +++ b/scripts/openlane-1.1.0.tm @@ -0,0 +1,17 @@ +# Copyright 2024 Efabless Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set scripts_dir [ file dirname [ file normalize [ info script ] ] ] +foreach file [glob $scripts_dir/tcl_commands/*.tcl] { + source $file +} diff --git a/scripts/tcl_commands/refresh.tcl b/scripts/openlane_utils-1.1.0.tm old mode 100755 new mode 100644 similarity index 76% rename from scripts/tcl_commands/refresh.tcl rename to scripts/openlane_utils-1.1.0.tm index 20b7957c5..3187aefac --- a/scripts/tcl_commands/refresh.tcl +++ b/scripts/openlane_utils-1.1.0.tm @@ -1,4 +1,4 @@ -# Copyright 2020 Efabless Corporation +# Copyright 2024 Efabless Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,5 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -pkg_mkIndex . +set scripts_dir [ file dirname [ file normalize [ info script ] ] ] +foreach file [glob $scripts_dir/utils/*.tcl] { + source $file +} diff --git a/scripts/tcl_commands/all.tcl b/scripts/tcl_commands/all.tcl index bee91da25..e48da481b 100755 --- a/scripts/tcl_commands/all.tcl +++ b/scripts/tcl_commands/all.tcl @@ -868,8 +868,8 @@ proc prep {args} { file copy -force $::env(PDK_ROOT)/$::env(PDK)/SOURCES $::env(RUN_DIR)/PDK_SOURCES } - if { [info exists ::env(OPENLANE_VERSION) ] } { - try_exec echo "OpenLane $::env(OPENLANE_VERSION)" > $::env(RUN_DIR)/OPENLANE_VERSION + if { [info exists ::env(OPENLANE_COMMIT) ] } { + try_exec echo "OpenLane $::env(OPENLANE_COMMIT)" > $::env(RUN_DIR)/OPENLANE_COMMIT } if { [info exists ::env(EXTRA_GDS_FILES)] } { @@ -1322,5 +1322,3 @@ proc run_post_run_hooks {} { puts_verbose "No post-run hook found, skipping..." } } - -package provide openlane 0.9 diff --git a/scripts/tcl_commands/checkers.tcl b/scripts/tcl_commands/checkers.tcl index 697f53614..02d86ab0f 100755 --- a/scripts/tcl_commands/checkers.tcl +++ b/scripts/tcl_commands/checkers.tcl @@ -401,5 +401,3 @@ proc quit_on_klayout_drc {report_file} { puts_info "No KLayout DRC violations after GDS streaming out." } } - -package provide openlane 0.9 diff --git a/scripts/tcl_commands/cts.tcl b/scripts/tcl_commands/cts.tcl index a61126227..252ceeb6d 100755 --- a/scripts/tcl_commands/cts.tcl +++ b/scripts/tcl_commands/cts.tcl @@ -71,6 +71,3 @@ proc run_resizer_timing {args} { puts_info "Skipping Placement Resizer Timing Optimizations." } } - - -package provide openlane 0.9 diff --git a/scripts/tcl_commands/floorplan.tcl b/scripts/tcl_commands/floorplan.tcl index 802f0c902..260c4c74a 100755 --- a/scripts/tcl_commands/floorplan.tcl +++ b/scripts/tcl_commands/floorplan.tcl @@ -518,5 +518,3 @@ proc run_floorplan {args} { run_power_grid_generation } - -package provide openlane 0.9 diff --git a/scripts/tcl_commands/init_design.tcl b/scripts/tcl_commands/init_design.tcl index 5675a76dc..53d4c32f3 100755 --- a/scripts/tcl_commands/init_design.tcl +++ b/scripts/tcl_commands/init_design.tcl @@ -53,5 +53,3 @@ if { \[file exists \$filename\] == 1} { puts_info "Finished populating:\n$config_path \nPlease modify CLOCK_PORT, CLOCK_PERIOD and add your advanced settings to $config_path" } - -package provide openlane 0.9 diff --git a/scripts/tcl_commands/klayout.tcl b/scripts/tcl_commands/klayout.tcl index ffa256a92..1a6790e84 100755 --- a/scripts/tcl_commands/klayout.tcl +++ b/scripts/tcl_commands/klayout.tcl @@ -229,5 +229,3 @@ proc open_in_klayout {args} { --lym $::env(KLAYOUT_DEF_LAYER_MAP)\ $arg_values(-layout) } - -package provide openlane 0.9 diff --git a/scripts/tcl_commands/lvs.tcl b/scripts/tcl_commands/lvs.tcl index 0d45218b9..7e5851fc9 100755 --- a/scripts/tcl_commands/lvs.tcl +++ b/scripts/tcl_commands/lvs.tcl @@ -203,6 +203,3 @@ proc run_lvs {{layout "$::env(EXT_NETLIST)"}} { proc run_netgen {args} { handle_deprecated_command run_lvs } - -package provide openlane 0.9 - diff --git a/scripts/tcl_commands/magic.tcl b/scripts/tcl_commands/magic.tcl index 45a4ebc3b..79aa356fd 100755 --- a/scripts/tcl_commands/magic.tcl +++ b/scripts/tcl_commands/magic.tcl @@ -296,5 +296,3 @@ proc erase_box {args} { unset ::env(_tmp_mag_box_coordinates) unset ::env(SAVE_GDS) } - -package provide openlane 0.9 diff --git a/scripts/tcl_commands/pkgIndex.tcl b/scripts/tcl_commands/pkgIndex.tcl deleted file mode 100755 index 653065899..000000000 --- a/scripts/tcl_commands/pkgIndex.tcl +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2020 Efabless Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Tcl package index file, version 1.1 -# This file is generated by the "pkg_mkIndex" command -# and sourced either when an application starts up or -# by a "package unknown" script. It invokes the -# "package ifneeded" command to set up package-related -# information so that packages will be loaded automatically -# in response to "package require" commands. When this -# script is sourced, the variable $dir must contain the -# full path name of this file's directory. - -package ifneeded openlane 0.9 [list source [file join $dir all.tcl]]\n[list source [file join $dir checkers.tcl]]\n[list source [file join $dir cts.tcl]]\n[list source [file join $dir floorplan.tcl]]\n[list source [file join $dir init_design.tcl]]\n[list source [file join $dir lvs.tcl]]\n[list source [file join $dir magic.tcl]]\n[list source [file join $dir placement.tcl]]\n[list source [file join $dir routing.tcl]]\n[list source [file join $dir synthesis.tcl]]\n[list source [file join $dir klayout.tcl]]\n[list source [file join $dir sta.tcl]] diff --git a/scripts/tcl_commands/placement.tcl b/scripts/tcl_commands/placement.tcl index a93f53c11..a72b51482 100755 --- a/scripts/tcl_commands/placement.tcl +++ b/scripts/tcl_commands/placement.tcl @@ -220,5 +220,3 @@ proc run_resizer_design {args} { puts_info "Skipping Placement Resizer Design Optimizations." } } - -package provide openlane 0.9 diff --git a/scripts/tcl_commands/routing.tcl b/scripts/tcl_commands/routing.tcl index 04219428a..6035615dd 100755 --- a/scripts/tcl_commands/routing.tcl +++ b/scripts/tcl_commands/routing.tcl @@ -464,6 +464,3 @@ proc run_resizer_timing_routing {args} { puts_info "Skipping Global Routing Resizer Timing Optimizations." } } - - -package provide openlane 0.9 diff --git a/scripts/tcl_commands/sta.tcl b/scripts/tcl_commands/sta.tcl index c5d60f166..c939f173f 100644 --- a/scripts/tcl_commands/sta.tcl +++ b/scripts/tcl_commands/sta.tcl @@ -202,5 +202,3 @@ proc run_parasitics_sta {args} { } } } - -package provide openlane 0.9 diff --git a/scripts/tcl_commands/synthesis.tcl b/scripts/tcl_commands/synthesis.tcl index 44d42bf50..e84056382 100755 --- a/scripts/tcl_commands/synthesis.tcl +++ b/scripts/tcl_commands/synthesis.tcl @@ -338,5 +338,3 @@ proc run_verilator {} { puts_info "$warnings_count warnings found by linter" } } - -package provide openlane 0.9 diff --git a/scripts/utils/deflef_utils.tcl b/scripts/utils/deflef_utils.tcl index bd3f054cd..831afc2ca 100755 --- a/scripts/utils/deflef_utils.tcl +++ b/scripts/utils/deflef_utils.tcl @@ -222,6 +222,3 @@ proc insert_buffer {args} { incr ::env(INSERT_BUFFER_COUNTER) } - - -package provide openlane_utils 0.9 diff --git a/scripts/utils/fake_display_buffer.tcl b/scripts/utils/fake_display_buffer.tcl index 343c47749..08d17d7f8 100755 --- a/scripts/utils/fake_display_buffer.tcl +++ b/scripts/utils/fake_display_buffer.tcl @@ -21,6 +21,3 @@ proc fake_display_buffer {args} { proc kill_display_buffer {args} { exec killall Xvfb } - - -package provide openlane_utils 0.9 diff --git a/scripts/utils/pkgIndex.tcl b/scripts/utils/pkgIndex.tcl deleted file mode 100755 index f642dddca..000000000 --- a/scripts/utils/pkgIndex.tcl +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2020 Efabless Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Tcl package index file, version 1.1 -# This file is generated by the "pkg_mkIndex" command -# and sourced either when an application starts up or -# by a "package unknown" script. It invokes the -# "package ifneeded" command to set up package-related -# information so that packages will be loaded automatically -# in response to "package require" commands. When this -# script is sourced, the variable $dir must contain the -# full path name of this file's directory. - -package ifneeded openlane_utils 0.9 [list source [file join $dir deflef_utils.tcl]]\n[list source [file join $dir utils.tcl]]\n[list source [file join $dir fake_display_buffer.tcl]] diff --git a/scripts/utils/utils.tcl b/scripts/utils/utils.tcl index d66b0b973..4b03cb8b3 100755 --- a/scripts/utils/utils.tcl +++ b/scripts/utils/utils.tcl @@ -785,5 +785,3 @@ proc run_odbpy_script {args} { try_exec $::env(OPENROAD_BIN) -exit -no_init -python {*}$args unset ::env(PYTHONPATH) } - -package provide openlane_utils 0.9