Add batch 2 (danielholanda_LeFlow, The-OpenROAD-Project_OpenSTA, omarelhedaby_CNN-FPGA, QShen3_CNN-FPGA, openrisc_mor1kx)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +17 -0
- QShen3_CNN-FPGA/LICENSE +21 -0
- QShen3_CNN-FPGA/README.md +188 -0
- QShen3_CNN-FPGA/src/Avg.v +49 -0
- QShen3_CNN-FPGA/src/Avg_pool.v +86 -0
- QShen3_CNN-FPGA/src/Conv2d.v +129 -0
- QShen3_CNN-FPGA/src/ConvKernel.v +56 -0
- QShen3_CNN-FPGA/src/FullConnect.v +80 -0
- QShen3_CNN-FPGA/src/Max.v +50 -0
- QShen3_CNN-FPGA/src/Max_pool.v +86 -0
- QShen3_CNN-FPGA/src/Mult.v +35 -0
- QShen3_CNN-FPGA/src/Relu.v +33 -0
- QShen3_CNN-FPGA/src/Relu_activation.v +56 -0
- The-OpenROAD-Project_OpenSTA/.clang-format +31 -0
- The-OpenROAD-Project_OpenSTA/.clang-tidy +82 -0
- The-OpenROAD-Project_OpenSTA/.cursor/rules/cpp-coding-standards.mdc +73 -0
- The-OpenROAD-Project_OpenSTA/.cursor/rules/cpp-indentation.mdc +43 -0
- The-OpenROAD-Project_OpenSTA/.cursor/rules/opensta-tests.mdc +13 -0
- The-OpenROAD-Project_OpenSTA/.dockerignore +4 -0
- The-OpenROAD-Project_OpenSTA/.github/ISSUE_TEMPLATE/bug_report.md +10 -0
- The-OpenROAD-Project_OpenSTA/.github/dependabot.yml +25 -0
- The-OpenROAD-Project_OpenSTA/.github/workflows/buildifier.yaml +44 -0
- The-OpenROAD-Project_OpenSTA/.github/workflows/ci.yml +108 -0
- The-OpenROAD-Project_OpenSTA/.github/workflows/github-actions-are-differences-found.yml +20 -0
- The-OpenROAD-Project_OpenSTA/.github/workflows/on-delete.yml +34 -0
- The-OpenROAD-Project_OpenSTA/.github/workflows/on-label.yml +90 -0
- The-OpenROAD-Project_OpenSTA/.github/workflows/on-push.yml +16 -0
- The-OpenROAD-Project_OpenSTA/.github/workflows/sync-from-upstream.yml +46 -0
- The-OpenROAD-Project_OpenSTA/.gitignore +35 -0
- The-OpenROAD-Project_OpenSTA/BUILD.bazel +419 -0
- The-OpenROAD-Project_OpenSTA/Brewfile +10 -0
- The-OpenROAD-Project_OpenSTA/CMakeLists.txt +731 -0
- The-OpenROAD-Project_OpenSTA/Dockerfile.ubuntu22.04 +47 -0
- The-OpenROAD-Project_OpenSTA/Dockerfile.ubuntu24.04 +46 -0
- The-OpenROAD-Project_OpenSTA/Jenkinsfile +5 -0
- The-OpenROAD-Project_OpenSTA/LICENSE +674 -0
- The-OpenROAD-Project_OpenSTA/README.md +317 -0
- The-OpenROAD-Project_OpenSTA/app/Main.cc +215 -0
- The-OpenROAD-Project_OpenSTA/app/StaApp.i +42 -0
- The-OpenROAD-Project_OpenSTA/app/StaMain.cc +151 -0
- The-OpenROAD-Project_OpenSTA/cmake/FindCUDD.cmake +25 -0
- The-OpenROAD-Project_OpenSTA/cmake/FindTCL.cmake +81 -0
- The-OpenROAD-Project_OpenSTA/cmake/GetGitRevisionDescription.cmake +168 -0
- The-OpenROAD-Project_OpenSTA/cmake/GetGitRevisionDescription.cmake.in +41 -0
- The-OpenROAD-Project_OpenSTA/dcalc/ArcDcalcWaveforms.cc +87 -0
- The-OpenROAD-Project_OpenSTA/dcalc/ArcDcalcWaveforms.hh +55 -0
- The-OpenROAD-Project_OpenSTA/dcalc/ArcDelayCalc.cc +305 -0
- The-OpenROAD-Project_OpenSTA/dcalc/Arnoldi.hh +88 -0
- The-OpenROAD-Project_OpenSTA/dcalc/Arnoldi.txt +57 -0
- The-OpenROAD-Project_OpenSTA/dcalc/ArnoldiDelayCalc.cc +1529 -0
.gitattributes
CHANGED
|
@@ -487,3 +487,20 @@ OpenTimer_OpenTimer/benchmark/wb_dma/wb_dma.ops filter=lfs diff=lfs merge=lfs -t
|
|
| 487 |
OpenTimer_OpenTimer/benchmark/wb_dma/wb_dma.ops.back filter=lfs diff=lfs merge=lfs -text
|
| 488 |
OpenTimer_OpenTimer/benchmark/wb_dma/wb_dma.output filter=lfs diff=lfs merge=lfs -text
|
| 489 |
OpenTimer_OpenTimer/wiki/reference/TAU[[:space:]]2018[[:space:]]Contest[[:space:]]Education.docx filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 487 |
OpenTimer_OpenTimer/benchmark/wb_dma/wb_dma.ops.back filter=lfs diff=lfs merge=lfs -text
|
| 488 |
OpenTimer_OpenTimer/benchmark/wb_dma/wb_dma.output filter=lfs diff=lfs merge=lfs -text
|
| 489 |
OpenTimer_OpenTimer/wiki/reference/TAU[[:space:]]2018[[:space:]]Contest[[:space:]]Education.docx filter=lfs diff=lfs merge=lfs -text
|
| 490 |
+
The-OpenROAD-Project_OpenSTA/test/sky130hd/sky130_fd_sc_hd__ff_n40C_1v95.lib filter=lfs diff=lfs merge=lfs -text
|
| 491 |
+
The-OpenROAD-Project_OpenSTA/test/sky130hd/sky130_fd_sc_hd__ss_n40C_1v40.lib filter=lfs diff=lfs merge=lfs -text
|
| 492 |
+
The-OpenROAD-Project_OpenSTA/test/sky130hd/sky130_fd_sc_hd__tt_025C_1v80.lib filter=lfs diff=lfs merge=lfs -text
|
| 493 |
+
The-OpenROAD-Project_OpenSTA/test/sky130hd/sky130hd_tt.lib filter=lfs diff=lfs merge=lfs -text
|
| 494 |
+
The-OpenROAD-Project_OpenSTA/test/sky130hs/sky130_fd_sc_hs__tt_025C_1v80.lib filter=lfs diff=lfs merge=lfs -text
|
| 495 |
+
The-OpenROAD-Project_OpenSTA/test/sky130hs/sky130hs_tt.lib filter=lfs diff=lfs merge=lfs -text
|
| 496 |
+
danielholanda_LeFlow/src/ip/stratixiv_pcie_hip_atoms.v filter=lfs diff=lfs merge=lfs -text
|
| 497 |
+
danielholanda_LeFlow/src/ip/stratixv_hssi_atoms_ncrypt.v filter=lfs diff=lfs merge=lfs -text
|
| 498 |
+
danielholanda_LeFlow/src/ip/stratixv_pcie_hip_atoms_ncrypt.v filter=lfs diff=lfs merge=lfs -text
|
| 499 |
+
danielholanda_LeFlow/src/tensorflow/tensorflow-1.6.0-cp27-cp27mu-linux_x86_64.whl filter=lfs diff=lfs merge=lfs -text
|
| 500 |
+
omarelhedaby_CNN-FPGA/CNN-FPGA-Vivado/CNN-FPGA-Vivado.sim/sim_1/behav/convLayerMulti_TB_behav.wdb filter=lfs diff=lfs merge=lfs -text
|
| 501 |
+
omarelhedaby_CNN-FPGA/CNN-FPGA-Vivado/CNN-FPGA-Vivado.sim/sim_1/behav/xsim.dir/convLayerMulti_TB_behav/xsim.xdbg filter=lfs diff=lfs merge=lfs -text
|
| 502 |
+
omarelhedaby_CNN-FPGA/Screenshots[[:space:]]and[[:space:]]Reports/Part[[:space:]]2-[[:space:]]TanH[[:space:]]activation/SimulationImages/PostSynthesisSimulationFullKernel.PNG filter=lfs diff=lfs merge=lfs -text
|
| 503 |
+
omarelhedaby_CNN-FPGA/Screenshots[[:space:]]and[[:space:]]Reports/Part[[:space:]]2-[[:space:]]TanH[[:space:]]activation/SimulationImages/SimulatingFullKernelSize.PNG filter=lfs diff=lfs merge=lfs -text
|
| 504 |
+
omarelhedaby_CNN-FPGA/Screenshots[[:space:]]and[[:space:]]Reports/Part[[:space:]]3-[[:space:]]SoftMax[[:space:]]activation/Synthesis[[:space:]]Reports[[:space:]]and[[:space:]]Screenshots/SoftMax[[:space:]]Comparison[[:space:]]Report.docx filter=lfs diff=lfs merge=lfs -text
|
| 505 |
+
omarelhedaby_CNN-FPGA/Screenshots[[:space:]]and[[:space:]]Reports/Part[[:space:]]5-[[:space:]]Integration/FC[[:space:]]layer[[:space:]]Waveform.PNG filter=lfs diff=lfs merge=lfs -text
|
| 506 |
+
omarelhedaby_CNN-FPGA/Test.xlsx filter=lfs diff=lfs merge=lfs -text
|
QShen3_CNN-FPGA/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2018 Shen
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
QShen3_CNN-FPGA/README.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CNN - FPGA
|
| 2 |
+
|
| 3 |
+
<!-- TOC -->
|
| 4 |
+
|
| 5 |
+
- [CNN - FPGA](#cnn---fpga)
|
| 6 |
+
- [项目由来](#项目由来)
|
| 7 |
+
- [使用](#使用)
|
| 8 |
+
- [Conv2d](#conv2d)
|
| 9 |
+
- [Max_pool](#max_pool)
|
| 10 |
+
- [Avg_pool](#avg_pool)
|
| 11 |
+
- [Relu_activation](#relu_activation)
|
| 12 |
+
- [FullConnect](#fullconnect)
|
| 13 |
+
- [使用示例](#使用示例)
|
| 14 |
+
|
| 15 |
+
<!-- /TOC -->
|
| 16 |
+
|
| 17 |
+
## 项目由来
|
| 18 |
+
|
| 19 |
+
  毕业设计,为了蹭热点,选了几个和人工智能相关的课题,本意是希望通过毕业设计让自己了解一下机器学习,比如CNN一类的。很不幸,被体系结构实验室的老师抢走了。于是就面临了这个偏硬件的课题,用FPGA加速人工智能算法。</Br>
|
| 20 |
+
  毕竟只是本科毕业设计,这个课题在我手里就变成了用FPGA加速CNN,本来的目的还是要完成,在大致了解了CNN之后,还是在极不情愿中做完了这个项目。</Br>
|
| 21 |
+
  项目本质很简单,使用Verilog实现了一些CNN的模块。~~几乎没有多少实用价值。~~ 另外,和大多数FPGA加速CNN的项目一样,本项目只能运行推断,不能学习,所以没有后向传播~~这不怪我,Xilinx自己都已经放弃治疗了。~~
|
| 22 |
+
|
| 23 |
+
## 使用
|
| 24 |
+
|
| 25 |
+
  模块设计上参照了tensorflow。因为使用了全并行的设计,所以没有引入时序,也没有做流水线~~我不信哪块FPGA板子的部件延迟会大过总线周期~~,所以在资源占用上很不合理,可能需要在规模很大的FPGA板子上才能实现一个较大的网络吧~~也就是说本项目毫无卵用~~</Br></Br>
|
| 26 |
+
|
| 27 |
+
有以下几个模块:
|
| 28 |
+
|
| 29 |
+
### Conv2d
|
| 30 |
+
|
| 31 |
+
**说明:**
|
| 32 |
+
|
| 33 |
+
  卷积模块,可以进行二维卷积。支持多个卷积核,不同步长,是否启用边缘0填充等
|
| 34 |
+
|
| 35 |
+
**可配置参数:**
|
| 36 |
+
|
| 37 |
+
| 名称 | 说明 | 默认值 |
|
| 38 |
+
| ------------- | ----------------------------------- | ------ |
|
| 39 |
+
| BITWIDTH | 数据位宽 | 8 |
|
| 40 |
+
| DATAWIDTH | 图像的宽度 | 28 |
|
| 41 |
+
| DATAHEIGHT | 图像的高度 | 28 |
|
| 42 |
+
| DATACHANNEL | 图像通道数 | 3 |
|
| 43 |
+
| FILTERHEIGHT | 卷积核的高度 | 5 |
|
| 44 |
+
| FILTERWIDTH | 卷积核的宽度 | 5 |
|
| 45 |
+
| FILTERBATCH | 卷积核的数量 | 1 |
|
| 46 |
+
| STRIDEHEIGHT | 纵向步长 | 1 |
|
| 47 |
+
| STRIDEWIDTH | 横向步长 | 1 |
|
| 48 |
+
| PADDINGENABLE | 边缘是否使用0填充,1代表是,0代表否 | 0 |
|
| 49 |
+
|
| 50 |
+
**输入输出:**
|
| 51 |
+
|
| 52 |
+
| 名称 | 类型 | 说明 | 长度 |
|
| 53 |
+
| ------------ | ------ | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| 54 |
+
| data | input | 输入的图像,数据从第一个通道左上至最后一个通道右下排列,每一个像素值为有符号定点数 | BITWIDTH × DATAWIDTH × DATAHEIGHT × DATACHANNEL |
|
| 55 |
+
| filterWeight | input | 卷积核权值,从第一个卷积核左上开始,到最后一个卷积核右下,每一个值为有符号定点数 | BITWIDTH × FILTERHEIGHT × FILTERWIDTH × DATACHANNEL × FILTERBATCH |
|
| 56 |
+
| filterBias | input | 卷积核偏置,按卷积核顺序排列,每一个值为有符号定点数 | BITWIDTH × FILTERBATCH |
|
| 57 |
+
| result | output | 输出的特征图,从第一张左上开始,到最后一张右下,每一个值为有符号定点数 | BITWIDTH × FILTERBATCH × (PADDINGENABLE == 0 ? (DATAWIDTH - FILTERWIDTH + 1) ÷ STRIDEWIDTH : (DATAWIDTH ÷ STRIDEWIDTH)) × (PADDINGENABLE == 0 ? (DATAHEIGHT - FILTERHEIGHT + 1) ÷ STRIDEHEIGHT : (DATAHEIGHT ÷ STRIDEHEIGHT)) |
|
| 58 |
+
|
| 59 |
+
### Max_pool
|
| 60 |
+
|
| 61 |
+
**说明:**
|
| 62 |
+
|
| 63 |
+
  最大池化模块,可以对输入进行最大池化运算。
|
| 64 |
+
|
| 65 |
+
**可配置参数:**
|
| 66 |
+
|
| 67 |
+
| 名称 | 说明 | 默认值 |
|
| 68 |
+
| ----------- | ------------ | ------ |
|
| 69 |
+
| BITWIDTH | 数据位宽 | 8 |
|
| 70 |
+
| DATAWIDTH | 特征图的宽度 | 28 |
|
| 71 |
+
| DATAHEIGHT | 特征图的高度 | 28 |
|
| 72 |
+
| DATACHANNEL | 特征图通道数 | 3 |
|
| 73 |
+
| KWIDTH | 池化窗口宽度 | 2 |
|
| 74 |
+
| KHEIGHT | 池化窗口高度 | 2 |
|
| 75 |
+
|
| 76 |
+
**输入输出:**
|
| 77 |
+
|
| 78 |
+
| 名称 | 类型 | 说明 | 长度 |
|
| 79 |
+
| ------ | ------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
| 80 |
+
| data | input | 输入的特征图,像素数据从左上至右下排列,每一个值为有符号定点数 | BITWIDTH × DATAWIDTH × DATAHEIGHT × DATACHANNEL |
|
| 81 |
+
| result | output | 输出的特征图,从第一个通道左上到最后一个通道右下,每一个值为有符号定点数 | BITWIDTH × DATAWIDTH ÷ KWIDTH × DATAHEIGHT ÷ KHEIGHT × DATACHANNEL |
|
| 82 |
+
|
| 83 |
+
### Avg_pool
|
| 84 |
+
|
| 85 |
+
**说明:**
|
| 86 |
+
|
| 87 |
+
  平均池化模块,可以对输入进行平均池化运算。
|
| 88 |
+
|
| 89 |
+
**可配置参数:**
|
| 90 |
+
|
| 91 |
+
| 名称 | 说明 | 默认值 |
|
| 92 |
+
| ----------- | ------------ | ------ |
|
| 93 |
+
| BITWIDTH | 数据位宽 | 8 |
|
| 94 |
+
| DATAWIDTH | 特征图的宽度 | 28 |
|
| 95 |
+
| DATAHEIGHT | 特征图的高度 | 28 |
|
| 96 |
+
| DATACHANNEL | 特征图通道数 | 3 |
|
| 97 |
+
| KWIDTH | 池化窗口宽度 | 2 |
|
| 98 |
+
| KHEIGHT | 池化窗口高度 | 2 |
|
| 99 |
+
|
| 100 |
+
**输入输出:**
|
| 101 |
+
|
| 102 |
+
| 名称 | 类型 | 说明 | 长度 |
|
| 103 |
+
| ------ | ------ | -------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
|
| 104 |
+
| data | input | 输入的特征图,数据从第一个通道左上至最后一个通道右下排列,每一个值为有符号定点数 | BITWIDTH × DATAWIDTH × DATAHEIGHT × DATACHANNEL |
|
| 105 |
+
| result | output | 输出的特征图,从第一个通道左上到最后一个通道右下,每一个值为有符号定点数 | BITWIDTH × DATAWIDTH ÷ KWIDTH × DATAHEIGHT ÷ KHEIGHT × DATACHANNEL |
|
| 106 |
+
|
| 107 |
+
### Relu_activation
|
| 108 |
+
|
| 109 |
+
**说明:**
|
| 110 |
+
|
| 111 |
+
  ReLU激活函数模块。可以根据情况决定卷积之后的特征图要不要连接激活函数。
|
| 112 |
+
|
| 113 |
+
**可配置参数:**
|
| 114 |
+
|
| 115 |
+
| 名称 | 说明 | 默认值 |
|
| 116 |
+
| ----------- | ------------ | ------ |
|
| 117 |
+
| BITWIDTH | 数据位宽 | 8 |
|
| 118 |
+
| DATAWIDTH | 特征图的宽度 | 28 |
|
| 119 |
+
| DATAHEIGHT | 特征图的高度 | 28 |
|
| 120 |
+
| DATACHANNEL | 特征图通道数 | 3 |
|
| 121 |
+
|
| 122 |
+
**输入输出:**
|
| 123 |
+
|
| 124 |
+
| 名称 | 类型 | 说明 | 长度 |
|
| 125 |
+
| ------ | ------ | -------------------------------------------------------------------------------- | ----------------------------------------------- |
|
| 126 |
+
| data | input | 输入的特征图,数据从第一个通道左上至最后一个通道右下排列,每一个值为有符号定点数 | BITWIDTH × DATAWIDTH × DATAHEIGHT × DATACHANNEL |
|
| 127 |
+
| result | output | 输出的特征图,从第一个通道左上到最后一个通道右下,每一个值为有符号定点数 | BITWIDTH × DATAHEIGHT × DATAWIDTH × DATACHANNEL |
|
| 128 |
+
|
| 129 |
+
### FullConnect
|
| 130 |
+
|
| 131 |
+
**说明:**
|
| 132 |
+
|
| 133 |
+
  全连接层模块。数据会被展开为一维矩阵,进行全连接运算。
|
| 134 |
+
|
| 135 |
+
**可配置参数:**
|
| 136 |
+
|
| 137 |
+
| 名称 | 说明 | 默认值 |
|
| 138 |
+
| ----------- | ---------------------- | ------ |
|
| 139 |
+
| BITWIDTH | 数据位宽 | 8 |
|
| 140 |
+
| LENGTH | 输入数据展开后的长度 | 25 |
|
| 141 |
+
| FILTERBATCH | 全连接层参数矩阵的个数 | 1 |
|
| 142 |
+
|
| 143 |
+
**输入输出:**
|
| 144 |
+
|
| 145 |
+
| 名称 | 类型 | 说明 | 长度 |
|
| 146 |
+
| ------ | ------ | ---------------------------------------------------------------------------------- | ------------------------------- |
|
| 147 |
+
| data | input | 输入的特征图,数据从第一个通道左上至最后一个通道右下排列,每一个值为有符号定点数 | BITWIDTH × LENGTH |
|
| 148 |
+
| weight | input | 参数矩阵的权值,从第一个参数矩阵开头至最后一个参数矩阵结尾,每一个值为有符号定点数 | BITWIDTH × LENGTH × FILTERBATCH |
|
| 149 |
+
| bias | input | 参数矩阵的偏置,按参数矩阵顺序排列,每一个值为有符号定点数 | BITWIDTH × FILTERBATCH |
|
| 150 |
+
| result | output | 输出结果也为一维矩阵,每一个值为有符号定点数,顺序对应权值矩阵的顺序 | BITWIDTH × FILTERBATCH |
|
| 151 |
+
|
| 152 |
+
## 使用示例
|
| 153 |
+
|
| 154 |
+
```verilog
|
| 155 |
+
input [4703:0] data;
|
| 156 |
+
output [7:0] result;
|
| 157 |
+
|
| 158 |
+
reg [1295:0] weight1;
|
| 159 |
+
reg [47:0] bias1;
|
| 160 |
+
wire [6911:0] cov_result1;
|
| 161 |
+
wire [1727:0] result1, result1_activation;
|
| 162 |
+
|
| 163 |
+
reg [1295:0] weight2;
|
| 164 |
+
reg [23:0] bias2;
|
| 165 |
+
wire [383:0] cov_result2;
|
| 166 |
+
wire [95:0] result2, result2_activation;
|
| 167 |
+
|
| 168 |
+
reg [1919:0] weight3;
|
| 169 |
+
reg [159:0] bias3;
|
| 170 |
+
wire [159:0] result3;
|
| 171 |
+
|
| 172 |
+
reg [159:0] weight4;
|
| 173 |
+
reg [7:0] bias4;
|
| 174 |
+
|
| 175 |
+
Conv2d#(8, 14, 14, 3, 3, 3, 6, 1, 1, 0) conv2d_1(data, weight1, bias1, cov_result1);
|
| 176 |
+
Max_pool#(8, 12, 12, 6, 2, 2) max_pool_1(cov_result1, result1);
|
| 177 |
+
Relu_activation#(8, 6, 6, 6) relu_activation_1(result1, result1_activation);
|
| 178 |
+
|
| 179 |
+
Conv2d#(8, 6, 6, 6, 3, 3, 3, 1, 1, 0) conv2d_2(result1_activation, weight2, bias2, cov_result2);
|
| 180 |
+
Max_pool#(8, 4, 4, 3, 2, 2) max_pool_2(cov_result2, result2);
|
| 181 |
+
Relu_activation#(8, 2, 2, 3) relu_activation_2(result2, result2_activation);
|
| 182 |
+
|
| 183 |
+
FullConnect#(8, 12, 20) fullConnect_1(result2_activation, weight3, bias3, result3);
|
| 184 |
+
|
| 185 |
+
FullConnect#(8, 20, 1) fullConnect_2(result3, weight4, bias4, result);
|
| 186 |
+
```
|
| 187 |
+
|
| 188 |
+
上面这段代码创建了一个输入为14×14,包含两个卷积层,两个全连接层的CNN。卷积核大小是3×3,卷积层采用最大池化,窗口大小为2×2,并且使用ReLU激活函数,第一个卷积层有6个卷积核,第二个卷积层有3个卷积核。
|
QShen3_CNN-FPGA/src/Avg.v
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Company:
|
| 4 |
+
// Engineer:
|
| 5 |
+
//
|
| 6 |
+
// Create Date: 2018/04/15 14:18:06
|
| 7 |
+
// Design Name:
|
| 8 |
+
// Module Name: Avg
|
| 9 |
+
// Project Name:
|
| 10 |
+
// Target Devices:
|
| 11 |
+
// Tool Versions:
|
| 12 |
+
// Description:
|
| 13 |
+
//
|
| 14 |
+
// Dependencies:
|
| 15 |
+
//
|
| 16 |
+
// Revision:
|
| 17 |
+
// Revision 0.01 - File Created
|
| 18 |
+
// Additional Comments:
|
| 19 |
+
//
|
| 20 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
module Avg#(
|
| 24 |
+
parameter BITWIDTH = 8,
|
| 25 |
+
parameter LENGTH = 4
|
| 26 |
+
)
|
| 27 |
+
(
|
| 28 |
+
input [BITWIDTH * LENGTH - 1 : 0] data,
|
| 29 |
+
output reg signed [BITWIDTH - 1 : 0] result
|
| 30 |
+
);
|
| 31 |
+
|
| 32 |
+
wire signed [BITWIDTH - 1:0] dataArray[0:LENGTH - 1];
|
| 33 |
+
genvar i;
|
| 34 |
+
generate
|
| 35 |
+
for(i = 0; i < LENGTH; i = i + 1) begin
|
| 36 |
+
assign dataArray[i] = data[i * BITWIDTH + BITWIDTH - 1: i * BITWIDTH];
|
| 37 |
+
end
|
| 38 |
+
endgenerate
|
| 39 |
+
|
| 40 |
+
integer j, sum;
|
| 41 |
+
always @(*) begin
|
| 42 |
+
sum = 0;
|
| 43 |
+
for(j = 0; j < LENGTH; j = j + 1) begin
|
| 44 |
+
sum = sum + dataArray[j];
|
| 45 |
+
end
|
| 46 |
+
result = sum / LENGTH;
|
| 47 |
+
end
|
| 48 |
+
|
| 49 |
+
endmodule
|
QShen3_CNN-FPGA/src/Avg_pool.v
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Company:
|
| 4 |
+
// Engineer:
|
| 5 |
+
//
|
| 6 |
+
// Create Date: 2018/04/15 14:29:19
|
| 7 |
+
// Design Name:
|
| 8 |
+
// Module Name: Avg_pool
|
| 9 |
+
// Project Name:
|
| 10 |
+
// Target Devices:
|
| 11 |
+
// Tool Versions:
|
| 12 |
+
// Description:
|
| 13 |
+
//
|
| 14 |
+
// Dependencies:
|
| 15 |
+
//
|
| 16 |
+
// Revision:
|
| 17 |
+
// Revision 0.01 - File Created
|
| 18 |
+
// Additional Comments:
|
| 19 |
+
//
|
| 20 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
module Avg_pool#(
|
| 24 |
+
parameter integer BITWIDTH = 8,
|
| 25 |
+
|
| 26 |
+
parameter integer DATAWIDTH = 28,
|
| 27 |
+
parameter integer DATAHEIGHT = 28,
|
| 28 |
+
parameter integer DATACHANNEL = 3,
|
| 29 |
+
|
| 30 |
+
parameter integer KWIDTH = 2,
|
| 31 |
+
parameter integer KHEIGHT = 2
|
| 32 |
+
)
|
| 33 |
+
(
|
| 34 |
+
//input clk,
|
| 35 |
+
//input clken,
|
| 36 |
+
input [BITWIDTH * DATAWIDTH * DATAHEIGHT * DATACHANNEL - 1 : 0]data,
|
| 37 |
+
output [BITWIDTH * DATAWIDTH / KWIDTH * DATAHEIGHT / KHEIGHT * DATACHANNEL - 1 : 0] result
|
| 38 |
+
);
|
| 39 |
+
|
| 40 |
+
wire [BITWIDTH - 1 : 0] dataArray[0 : DATACHANNEL - 1][0 : DATAHEIGHT-1][0 : DATAWIDTH - 1];
|
| 41 |
+
wire [BITWIDTH * KHEIGHT * KWIDTH - 1 : 0]paramArray [0: DATACHANNEL - 1][0: DATAHEIGHT / KHEIGHT - 1][0: DATAWIDTH / KWIDTH - 1];
|
| 42 |
+
|
| 43 |
+
//wire [BITWIDTH * DATAWIDTH / KWIDTH * DATAHEIGHT / KHEIGHT * DATACHANNEL - 1 : 0] out;
|
| 44 |
+
|
| 45 |
+
genvar i, j, k, m, n;
|
| 46 |
+
generate
|
| 47 |
+
for(i = 0; i < DATACHANNEL; i = i + 1) begin
|
| 48 |
+
for(j = 0; j < DATAHEIGHT; j = j + 1) begin
|
| 49 |
+
for(k = 0; k < DATAWIDTH; k = k + 1) begin
|
| 50 |
+
assign dataArray[i][j][k] = data[(i * DATAHEIGHT * DATAWIDTH + j * DATAHEIGHT + k) * BITWIDTH + BITWIDTH - 1:(i * DATAHEIGHT * DATAWIDTH + j * DATAHEIGHT + k) * BITWIDTH];
|
| 51 |
+
end
|
| 52 |
+
end
|
| 53 |
+
end
|
| 54 |
+
endgenerate
|
| 55 |
+
|
| 56 |
+
generate
|
| 57 |
+
for(i = 0; i < DATACHANNEL; i = i + 1) begin
|
| 58 |
+
for(j = 0; j < DATAHEIGHT / KHEIGHT; j = j + 1) begin
|
| 59 |
+
for(k = 0; k < DATAWIDTH / KWIDTH; k = k + 1) begin
|
| 60 |
+
for(m = j * 2; m < j * 2 + KHEIGHT; m = m + 1) begin
|
| 61 |
+
for(n = k * 2; n < k * 2 + KWIDTH; n = n + 1) begin
|
| 62 |
+
assign paramArray[i][j][k][((m - j * 2) * KWIDTH + n - k * 2) * BITWIDTH + BITWIDTH - 1:((m - j * 2) * KWIDTH + n - k * 2) * BITWIDTH] = dataArray[i][m][n];
|
| 63 |
+
end
|
| 64 |
+
end
|
| 65 |
+
end
|
| 66 |
+
end
|
| 67 |
+
end
|
| 68 |
+
endgenerate
|
| 69 |
+
|
| 70 |
+
generate
|
| 71 |
+
for(i = 0; i < DATACHANNEL; i = i + 1) begin
|
| 72 |
+
for(j = 0; j < DATAHEIGHT / KHEIGHT; j = j + 1) begin
|
| 73 |
+
for(k = 0; k < DATAWIDTH / KWIDTH; k = k + 1) begin
|
| 74 |
+
Avg#(BITWIDTH, KHEIGHT * KWIDTH) avg(paramArray[i][j][k], result[(i * DATAHEIGHT / KHEIGHT * DATAWIDTH / KWIDTH + j * DATAWIDTH / KWIDTH + k) * BITWIDTH + BITWIDTH - 1:(i * DATAHEIGHT / KHEIGHT * DATAWIDTH / KWIDTH + j * DATAWIDTH / KWIDTH + k) * BITWIDTH]);
|
| 75 |
+
end
|
| 76 |
+
end
|
| 77 |
+
end
|
| 78 |
+
endgenerate
|
| 79 |
+
|
| 80 |
+
// always @(posedge clk) begin
|
| 81 |
+
// if(clken == 1) begin
|
| 82 |
+
// result = out;
|
| 83 |
+
// end
|
| 84 |
+
// end
|
| 85 |
+
|
| 86 |
+
endmodule
|
QShen3_CNN-FPGA/src/Conv2d.v
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Company:
|
| 4 |
+
// Engineer:
|
| 5 |
+
//
|
| 6 |
+
// Create Date: 2018/04/11 15:34:00
|
| 7 |
+
// Design Name:
|
| 8 |
+
// Module Name: Conv2d
|
| 9 |
+
// Project Name:
|
| 10 |
+
// Target Devices:
|
| 11 |
+
// Tool Versions:
|
| 12 |
+
// Description:
|
| 13 |
+
//
|
| 14 |
+
// Dependencies:
|
| 15 |
+
//
|
| 16 |
+
// Revision:
|
| 17 |
+
// Revision 0.01 - File Created
|
| 18 |
+
// Additional Comments:
|
| 19 |
+
//
|
| 20 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
module Conv2d #(
|
| 24 |
+
parameter integer BITWIDTH = 8,
|
| 25 |
+
|
| 26 |
+
parameter integer DATAWIDTH = 28,
|
| 27 |
+
parameter integer DATAHEIGHT = 28,
|
| 28 |
+
parameter integer DATACHANNEL = 3,
|
| 29 |
+
|
| 30 |
+
parameter integer FILTERHEIGHT = 5,
|
| 31 |
+
parameter integer FILTERWIDTH = 5,
|
| 32 |
+
parameter integer FILTERBATCH = 1,
|
| 33 |
+
|
| 34 |
+
parameter integer STRIDEHEIGHT = 1,
|
| 35 |
+
parameter integer STRIDEWIDTH = 1,
|
| 36 |
+
|
| 37 |
+
parameter integer PADDINGENABLE = 0
|
| 38 |
+
)
|
| 39 |
+
(
|
| 40 |
+
//input clk,
|
| 41 |
+
//input clken,
|
| 42 |
+
input [BITWIDTH * DATAWIDTH * DATAHEIGHT * DATACHANNEL - 1 : 0]data,
|
| 43 |
+
input [BITWIDTH * FILTERHEIGHT * FILTERWIDTH * DATACHANNEL * FILTERBATCH - 1 : 0]filterWeight,
|
| 44 |
+
input [BITWIDTH * FILTERBATCH - 1 : 0] filterBias,
|
| 45 |
+
output [(BITWIDTH * 2) * FILTERBATCH * (PADDINGENABLE == 0 ? (DATAWIDTH - FILTERWIDTH + 1) / STRIDEWIDTH : (DATAWIDTH / STRIDEWIDTH)) * (PADDINGENABLE == 0 ? (DATAHEIGHT - FILTERHEIGHT + 1) / STRIDEHEIGHT : (DATAHEIGHT / STRIDEHEIGHT)) - 1 : 0] result
|
| 46 |
+
);
|
| 47 |
+
|
| 48 |
+
wire [BITWIDTH - 1 : 0] dataArray[0 : DATACHANNEL - 1][0 : DATAHEIGHT-1][0 : DATAWIDTH - 1];
|
| 49 |
+
wire [BITWIDTH - 1 : 0] dataArrayWithPadding[0 : DATACHANNEL - 1][0 : (PADDINGENABLE == 1 ? DATAHEIGHT + FILTERHEIGHT - 1 : DATAHEIGHT)-1][0 : (PADDINGENABLE == 1 ? DATAWIDTH + FILTERWIDTH - 1 : DATAWIDTH)-1];
|
| 50 |
+
wire [BITWIDTH * FILTERHEIGHT * FILTERWIDTH * DATACHANNEL - 1 : 0] paramArray[0: (PADDINGENABLE == 1 ? DATAHEIGHT / STRIDEHEIGHT: (DATAHEIGHT - FILTERHEIGHT + 1) / STRIDEHEIGHT)-1][0: (PADDINGENABLE == 1 ? DATAWIDTH / STRIDEWIDTH : (DATAWIDTH - FILTERWIDTH + 1) / STRIDEWIDTH)-1];
|
| 51 |
+
wire [BITWIDTH * DATACHANNEL * FILTERHEIGHT * FILTERWIDTH - 1 : 0] filterWeightArray[0: FILTERBATCH - 1];
|
| 52 |
+
|
| 53 |
+
wire [(BITWIDTH * 2) * FILTERBATCH * (PADDINGENABLE == 0 ? (DATAWIDTH - FILTERWIDTH + 1) / STRIDEWIDTH : (DATAWIDTH / STRIDEWIDTH)) * (PADDINGENABLE == 0 ? (DATAHEIGHT - FILTERHEIGHT + 1) / STRIDEHEIGHT : (DATAHEIGHT / STRIDEHEIGHT)) - 1 : 0] out;
|
| 54 |
+
|
| 55 |
+
genvar i, j, k, m, n;
|
| 56 |
+
generate
|
| 57 |
+
for(i = 0; i < DATACHANNEL; i = i + 1) begin
|
| 58 |
+
for(j = 0; j < DATAHEIGHT; j = j + 1) begin
|
| 59 |
+
for(k = 0; k < DATAWIDTH; k = k + 1) begin
|
| 60 |
+
assign dataArray[i][j][k] = data[(i * DATAHEIGHT * DATAWIDTH + j * DATAHEIGHT + k) * BITWIDTH + BITWIDTH - 1:(i * DATAHEIGHT * DATAWIDTH + j * DATAHEIGHT + k) * BITWIDTH];
|
| 61 |
+
end
|
| 62 |
+
end
|
| 63 |
+
end
|
| 64 |
+
endgenerate
|
| 65 |
+
|
| 66 |
+
generate
|
| 67 |
+
for(i = 0; i < DATACHANNEL; i = i + 1) begin
|
| 68 |
+
for(m = 0; m < (PADDINGENABLE == 1 ? DATAHEIGHT + FILTERHEIGHT - 1 : DATAHEIGHT); m = m + 1) begin
|
| 69 |
+
for(n = 0; n < (PADDINGENABLE == 1 ? DATAWIDTH + FILTERWIDTH - 1 : DATAWIDTH); n = n + 1) begin
|
| 70 |
+
if(PADDINGENABLE == 1) begin
|
| 71 |
+
if(m < (FILTERHEIGHT / 2) || m > (DATAHEIGHT + FILTERHEIGHT / 2 - 1)) begin
|
| 72 |
+
assign dataArrayWithPadding[i][m][n] = 0;
|
| 73 |
+
end
|
| 74 |
+
else if(n < (FILTERWIDTH / 2) || n > (DATAWIDTH + FILTERWIDTH / 2 - 1)) begin
|
| 75 |
+
assign dataArrayWithPadding[i][m][n] = 0;
|
| 76 |
+
end
|
| 77 |
+
else begin
|
| 78 |
+
assign dataArrayWithPadding[i][m][n] = dataArray[i][m - FILTERHEIGHT / 2][n - FILTERWIDTH / 2];
|
| 79 |
+
end
|
| 80 |
+
end
|
| 81 |
+
else begin
|
| 82 |
+
assign dataArrayWithPadding[i][m][n] = dataArray[i][m][n];
|
| 83 |
+
end
|
| 84 |
+
end
|
| 85 |
+
end
|
| 86 |
+
end
|
| 87 |
+
endgenerate
|
| 88 |
+
|
| 89 |
+
generate
|
| 90 |
+
for(j = FILTERHEIGHT / 2; j < (PADDINGENABLE == 1 ? DATAHEIGHT + FILTERHEIGHT - 1 - FILTERHEIGHT / 2: DATAHEIGHT - FILTERHEIGHT / 2); j = j + STRIDEHEIGHT) begin
|
| 91 |
+
for(k = FILTERWIDTH / 2; k < (PADDINGENABLE == 1 ? DATAWIDTH + FILTERWIDTH - 1 - FILTERWIDTH / 2 : DATAWIDTH - FILTERWIDTH / 2); k = k + STRIDEWIDTH) begin
|
| 92 |
+
for(i = 0; i < DATACHANNEL; i = i + 1) begin
|
| 93 |
+
for(m = j - FILTERHEIGHT / 2; m <= j + FILTERHEIGHT / 2; m = m + 1) begin
|
| 94 |
+
for(n = k - FILTERWIDTH / 2; n <= k + FILTERWIDTH / 2; n = n + 1) begin
|
| 95 |
+
assign paramArray[(j - FILTERHEIGHT / 2) / STRIDEHEIGHT][(k - FILTERWIDTH / 2) / STRIDEWIDTH][(i * FILTERHEIGHT * FILTERWIDTH + (m - j + FILTERHEIGHT / 2) * FILTERWIDTH + (n - k + FILTERWIDTH / 2)) * BITWIDTH + BITWIDTH - 1:(i * FILTERHEIGHT * FILTERWIDTH + (m - j + FILTERHEIGHT / 2) * FILTERWIDTH + (n - k + FILTERWIDTH / 2)) * BITWIDTH] =
|
| 96 |
+
dataArrayWithPadding[i][m][n];
|
| 97 |
+
end
|
| 98 |
+
end
|
| 99 |
+
end
|
| 100 |
+
end
|
| 101 |
+
end
|
| 102 |
+
endgenerate
|
| 103 |
+
|
| 104 |
+
generate
|
| 105 |
+
for(i = 0; i < FILTERBATCH; i = i + 1) begin
|
| 106 |
+
assign filterWeightArray[i] = filterWeight[(i + 1) * DATACHANNEL * FILTERHEIGHT * FILTERWIDTH * BITWIDTH - 1: i * DATACHANNEL * FILTERHEIGHT * FILTERWIDTH * BITWIDTH];
|
| 107 |
+
end
|
| 108 |
+
endgenerate
|
| 109 |
+
|
| 110 |
+
generate
|
| 111 |
+
for(i = 0; i < FILTERBATCH; i = i + 1) begin
|
| 112 |
+
for(m = 0; m < (PADDINGENABLE == 1 ? DATAHEIGHT / STRIDEHEIGHT: (DATAHEIGHT - FILTERHEIGHT + 1) / STRIDEHEIGHT); m = m + 1) begin
|
| 113 |
+
for(n = 0; n < (PADDINGENABLE == 1 ? DATAWIDTH / STRIDEWIDTH : (DATAWIDTH - FILTERWIDTH + 1) / STRIDEWIDTH); n = n + 1) begin
|
| 114 |
+
ConvKernel#(BITWIDTH, DATACHANNEL, FILTERHEIGHT, FILTERWIDTH) convKernel(paramArray[m][n],
|
| 115 |
+
filterWeightArray[i],
|
| 116 |
+
filterBias[(i + 1) * BITWIDTH - 1 :i * BITWIDTH],
|
| 117 |
+
result[(i * (PADDINGENABLE == 1 ? DATAHEIGHT / STRIDEHEIGHT: (DATAHEIGHT - FILTERHEIGHT + 1) / STRIDEHEIGHT) * (PADDINGENABLE == 1 ? DATAWIDTH / STRIDEWIDTH : (DATAWIDTH - FILTERWIDTH + 1) / STRIDEWIDTH) * BITWIDTH * 2 + m * (PADDINGENABLE == 1 ? DATAWIDTH / STRIDEWIDTH : (DATAWIDTH - FILTERWIDTH + 1) / STRIDEWIDTH) * BITWIDTH * 2 + n) * 2 * BITWIDTH + 2 * BITWIDTH - 1:(i * (PADDINGENABLE == 1 ? DATAHEIGHT / STRIDEHEIGHT: (DATAHEIGHT - FILTERHEIGHT + 1) / STRIDEHEIGHT) * (PADDINGENABLE == 1 ? DATAWIDTH / STRIDEWIDTH : (DATAWIDTH - FILTERWIDTH + 1) / STRIDEWIDTH) * BITWIDTH * 2 + m * (PADDINGENABLE == 1 ? DATAWIDTH / STRIDEWIDTH : (DATAWIDTH - FILTERWIDTH + 1) / STRIDEWIDTH) * BITWIDTH * 2 + n * 2 * BITWIDTH)]);
|
| 118 |
+
end
|
| 119 |
+
end
|
| 120 |
+
end
|
| 121 |
+
endgenerate
|
| 122 |
+
|
| 123 |
+
// always @(posedge clk) begin
|
| 124 |
+
// if(clken == 1) begin
|
| 125 |
+
// result = out;
|
| 126 |
+
// end
|
| 127 |
+
// end
|
| 128 |
+
|
| 129 |
+
endmodule
|
QShen3_CNN-FPGA/src/ConvKernel.v
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Company:
|
| 4 |
+
// Engineer:
|
| 5 |
+
//
|
| 6 |
+
// Create Date: 2018/04/11 16:12:39
|
| 7 |
+
// Design Name:
|
| 8 |
+
// Module Name: ConvKernel
|
| 9 |
+
// Project Name:
|
| 10 |
+
// Target Devices:
|
| 11 |
+
// Tool Versions:
|
| 12 |
+
// Description:
|
| 13 |
+
//
|
| 14 |
+
// Dependencies:
|
| 15 |
+
//
|
| 16 |
+
// Revision:
|
| 17 |
+
// Revision 0.01 - File Created
|
| 18 |
+
// Additional Comments:
|
| 19 |
+
//
|
| 20 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
module ConvKernel#(
|
| 24 |
+
parameter integer BITWIDTH = 8,
|
| 25 |
+
|
| 26 |
+
parameter integer DATACHANNEL = 3,
|
| 27 |
+
|
| 28 |
+
parameter integer FILTERHEIGHT = 5,
|
| 29 |
+
parameter integer FILTERWIDTH = 5
|
| 30 |
+
)
|
| 31 |
+
(
|
| 32 |
+
input [BITWIDTH * DATACHANNEL * FILTERHEIGHT * FILTERWIDTH - 1 : 0]data,
|
| 33 |
+
input [BITWIDTH * DATACHANNEL * FILTERHEIGHT * FILTERWIDTH - 1 : 0]weight,
|
| 34 |
+
input [BITWIDTH - 1 : 0] bias,
|
| 35 |
+
output reg signed [BITWIDTH * 2 -1 : 0]result
|
| 36 |
+
);
|
| 37 |
+
|
| 38 |
+
wire signed [BITWIDTH * 2 - 1 : 0]out[FILTERHEIGHT * FILTERWIDTH * DATACHANNEL - 1 : 0];
|
| 39 |
+
|
| 40 |
+
generate
|
| 41 |
+
genvar i;
|
| 42 |
+
for(i = 0; i < FILTERHEIGHT * FILTERWIDTH * DATACHANNEL; i = i + 1) begin
|
| 43 |
+
Mult#(BITWIDTH) mult(data[(i + 1) * BITWIDTH - 1 : i * BITWIDTH], weight[(i + 1) * BITWIDTH - 1 : i * BITWIDTH], out[i]);
|
| 44 |
+
end
|
| 45 |
+
endgenerate
|
| 46 |
+
|
| 47 |
+
integer j;
|
| 48 |
+
always @(*) begin
|
| 49 |
+
result = 0;
|
| 50 |
+
for(j = 0; j < FILTERHEIGHT * FILTERWIDTH * DATACHANNEL; j = j + 1) begin
|
| 51 |
+
result = result + out[j];
|
| 52 |
+
end
|
| 53 |
+
result = result + bias;
|
| 54 |
+
end
|
| 55 |
+
|
| 56 |
+
endmodule
|
QShen3_CNN-FPGA/src/FullConnect.v
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Company:
|
| 4 |
+
// Engineer:
|
| 5 |
+
//
|
| 6 |
+
// Create Date: 2018/04/18 13:47:58
|
| 7 |
+
// Design Name:
|
| 8 |
+
// Module Name: FullConnect
|
| 9 |
+
// Project Name:
|
| 10 |
+
// Target Devices:
|
| 11 |
+
// Tool Versions:
|
| 12 |
+
// Description:
|
| 13 |
+
//
|
| 14 |
+
// Dependencies:
|
| 15 |
+
//
|
| 16 |
+
// Revision:
|
| 17 |
+
// Revision 0.01 - File Created
|
| 18 |
+
// Additional Comments:
|
| 19 |
+
//
|
| 20 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
module FullConnect#(
|
| 24 |
+
parameter BITWIDTH = 8,
|
| 25 |
+
|
| 26 |
+
parameter LENGTH = 25,
|
| 27 |
+
|
| 28 |
+
parameter FILTERBATCH = 1
|
| 29 |
+
)
|
| 30 |
+
(
|
| 31 |
+
//input clk,
|
| 32 |
+
//input clken,
|
| 33 |
+
input [BITWIDTH * LENGTH - 1 : 0] data,
|
| 34 |
+
input [BITWIDTH * LENGTH * FILTERBATCH - 1 : 0] weight,
|
| 35 |
+
input [BITWIDTH * FILTERBATCH - 1 : 0] bias,
|
| 36 |
+
output [BITWIDTH * 2 * FILTERBATCH - 1 : 0] result
|
| 37 |
+
);
|
| 38 |
+
|
| 39 |
+
//reg [BITWIDTH * 2 * LENGTH * FILTERBATCH- 1:0] out;
|
| 40 |
+
wire [BITWIDTH * 2 - 1:0] out [0:FILTERBATCH - 1][0:LENGTH - 1];
|
| 41 |
+
wire signed [BITWIDTH - 1:0] biasArray[0:FILTERBATCH - 1];
|
| 42 |
+
reg signed [BITWIDTH * 2 - 1:0] resultArray [0:FILTERBATCH - 1];
|
| 43 |
+
|
| 44 |
+
//wire [BITWIDTH * 2 * FILTERBATCH - 1 : 0] out2;
|
| 45 |
+
|
| 46 |
+
genvar i, j;
|
| 47 |
+
generate
|
| 48 |
+
for(i = 0; i < FILTERBATCH; i = i + 1) begin
|
| 49 |
+
assign biasArray[i] = bias[(i + 1) * BITWIDTH - 1: i * BITWIDTH];
|
| 50 |
+
assign result[(i + 1) * BITWIDTH * 2 - 1: i * BITWIDTH * 2] = resultArray[i];
|
| 51 |
+
end
|
| 52 |
+
endgenerate
|
| 53 |
+
|
| 54 |
+
generate
|
| 55 |
+
for(i = 0; i < FILTERBATCH; i = i + 1) begin
|
| 56 |
+
for(j = 0; j < LENGTH; j = j + 1) begin
|
| 57 |
+
Mult#(BITWIDTH) mult(data[(j + 1) * BITWIDTH - 1:j * BITWIDTH], weight[(i * LENGTH + j) * BITWIDTH + BITWIDTH - 1 : (i * LENGTH + j) * BITWIDTH], out[i][j]);
|
| 58 |
+
end
|
| 59 |
+
end
|
| 60 |
+
endgenerate
|
| 61 |
+
|
| 62 |
+
integer sum, m, n;
|
| 63 |
+
always @(*) begin
|
| 64 |
+
for(m = 0; m < FILTERBATCH; m = m + 1) begin
|
| 65 |
+
sum = 0;
|
| 66 |
+
for(n = 0; n < LENGTH; n = n + 1) begin
|
| 67 |
+
sum = sum + out[m][n];
|
| 68 |
+
end
|
| 69 |
+
sum = sum + biasArray[m];
|
| 70 |
+
resultArray[m] = sum;
|
| 71 |
+
end
|
| 72 |
+
end
|
| 73 |
+
|
| 74 |
+
// always @(posedge clk) begin
|
| 75 |
+
// if(clken == 1) begin
|
| 76 |
+
// result = out2;
|
| 77 |
+
// end
|
| 78 |
+
// end
|
| 79 |
+
|
| 80 |
+
endmodule
|
QShen3_CNN-FPGA/src/Max.v
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Company:
|
| 4 |
+
// Engineer:
|
| 5 |
+
//
|
| 6 |
+
// Create Date: 2018/04/15 13:56:38
|
| 7 |
+
// Design Name:
|
| 8 |
+
// Module Name: Max
|
| 9 |
+
// Project Name:
|
| 10 |
+
// Target Devices:
|
| 11 |
+
// Tool Versions:
|
| 12 |
+
// Description:
|
| 13 |
+
//
|
| 14 |
+
// Dependencies:
|
| 15 |
+
//
|
| 16 |
+
// Revision:
|
| 17 |
+
// Revision 0.01 - File Created
|
| 18 |
+
// Additional Comments:
|
| 19 |
+
//
|
| 20 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
module Max#(
|
| 24 |
+
parameter BITWIDTH = 8,
|
| 25 |
+
parameter LENGTH = 4
|
| 26 |
+
)
|
| 27 |
+
(
|
| 28 |
+
input [BITWIDTH * LENGTH - 1 : 0] data,
|
| 29 |
+
output reg signed [BITWIDTH - 1 : 0] result
|
| 30 |
+
);
|
| 31 |
+
|
| 32 |
+
wire signed [BITWIDTH - 1:0] dataArray[0:LENGTH - 1];
|
| 33 |
+
genvar i;
|
| 34 |
+
generate
|
| 35 |
+
for(i = 0; i < LENGTH; i = i + 1) begin
|
| 36 |
+
assign dataArray[i] = data[i * BITWIDTH + BITWIDTH - 1: i * BITWIDTH];
|
| 37 |
+
end
|
| 38 |
+
endgenerate
|
| 39 |
+
|
| 40 |
+
integer j;
|
| 41 |
+
always @(*) begin
|
| 42 |
+
result = -127;
|
| 43 |
+
for(j = 0; j < LENGTH; j = j + 1) begin
|
| 44 |
+
if(dataArray[j] > result) begin
|
| 45 |
+
result = dataArray[j];
|
| 46 |
+
end
|
| 47 |
+
end
|
| 48 |
+
end
|
| 49 |
+
|
| 50 |
+
endmodule
|
QShen3_CNN-FPGA/src/Max_pool.v
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Company:
|
| 4 |
+
// Engineer:
|
| 5 |
+
//
|
| 6 |
+
// Create Date: 2018/04/15 14:29:19
|
| 7 |
+
// Design Name:
|
| 8 |
+
// Module Name: Max_pool
|
| 9 |
+
// Project Name:
|
| 10 |
+
// Target Devices:
|
| 11 |
+
// Tool Versions:
|
| 12 |
+
// Description:
|
| 13 |
+
//
|
| 14 |
+
// Dependencies:
|
| 15 |
+
//
|
| 16 |
+
// Revision:
|
| 17 |
+
// Revision 0.01 - File Created
|
| 18 |
+
// Additional Comments:
|
| 19 |
+
//
|
| 20 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
module Max_pool#(
|
| 24 |
+
parameter integer BITWIDTH = 8,
|
| 25 |
+
|
| 26 |
+
parameter integer DATAWIDTH = 28,
|
| 27 |
+
parameter integer DATAHEIGHT = 28,
|
| 28 |
+
parameter integer DATACHANNEL = 3,
|
| 29 |
+
|
| 30 |
+
parameter integer KWIDTH = 2,
|
| 31 |
+
parameter integer KHEIGHT = 2
|
| 32 |
+
)
|
| 33 |
+
(
|
| 34 |
+
//input clk,
|
| 35 |
+
//input clken,
|
| 36 |
+
input [BITWIDTH * DATAWIDTH * DATAHEIGHT * DATACHANNEL - 1 : 0]data,
|
| 37 |
+
output reg [BITWIDTH * DATAWIDTH / KWIDTH * DATAHEIGHT / KHEIGHT * DATACHANNEL - 1 : 0] result
|
| 38 |
+
);
|
| 39 |
+
|
| 40 |
+
wire [BITWIDTH - 1 : 0] dataArray[0 : DATACHANNEL - 1][0 : DATAHEIGHT-1][0 : DATAWIDTH - 1];
|
| 41 |
+
wire [BITWIDTH * KHEIGHT * KWIDTH - 1 : 0]paramArray [0: DATACHANNEL - 1][0: DATAHEIGHT / KHEIGHT - 1][0: DATAWIDTH / KWIDTH - 1];
|
| 42 |
+
|
| 43 |
+
//wire [BITWIDTH * DATAWIDTH / KWIDTH * DATAHEIGHT / KHEIGHT * DATACHANNEL - 1 : 0] out;
|
| 44 |
+
|
| 45 |
+
genvar i, j, k, m, n;
|
| 46 |
+
generate
|
| 47 |
+
for(i = 0; i < DATACHANNEL; i = i + 1) begin
|
| 48 |
+
for(j = 0; j < DATAHEIGHT; j = j + 1) begin
|
| 49 |
+
for(k = 0; k < DATAWIDTH; k = k + 1) begin
|
| 50 |
+
assign dataArray[i][j][k] = data[(i * DATAHEIGHT * DATAWIDTH + j * DATAHEIGHT + k) * BITWIDTH + BITWIDTH - 1:(i * DATAHEIGHT * DATAWIDTH + j * DATAHEIGHT + k) * BITWIDTH];
|
| 51 |
+
end
|
| 52 |
+
end
|
| 53 |
+
end
|
| 54 |
+
endgenerate
|
| 55 |
+
|
| 56 |
+
generate
|
| 57 |
+
for(i = 0; i < DATACHANNEL; i = i + 1) begin
|
| 58 |
+
for(j = 0; j < DATAHEIGHT / KHEIGHT; j = j + 1) begin
|
| 59 |
+
for(k = 0; k < DATAWIDTH / KWIDTH; k = k + 1) begin
|
| 60 |
+
for(m = j * 2; m < j * 2 + KHEIGHT; m = m + 1) begin
|
| 61 |
+
for(n = k * 2; n < k * 2 + KWIDTH; n = n + 1) begin
|
| 62 |
+
assign paramArray[i][j][k][((m - j * 2) * KWIDTH + n - k * 2) * BITWIDTH + BITWIDTH - 1:((m - j * 2) * KWIDTH + n - k * 2) * BITWIDTH] = dataArray[i][m][n];
|
| 63 |
+
end
|
| 64 |
+
end
|
| 65 |
+
end
|
| 66 |
+
end
|
| 67 |
+
end
|
| 68 |
+
endgenerate
|
| 69 |
+
|
| 70 |
+
generate
|
| 71 |
+
for(i = 0; i < DATACHANNEL; i = i + 1) begin
|
| 72 |
+
for(j = 0; j < DATAHEIGHT / KHEIGHT; j = j + 1) begin
|
| 73 |
+
for(k = 0; k < DATAWIDTH / KWIDTH; k = k + 1) begin
|
| 74 |
+
Max#(BITWIDTH, KHEIGHT * KWIDTH) max(paramArray[i][j][k], result[(i * DATAHEIGHT / KHEIGHT * DATAWIDTH / KWIDTH + j * DATAWIDTH / KWIDTH + k) * BITWIDTH + BITWIDTH - 1:(i * DATAHEIGHT / KHEIGHT * DATAWIDTH / KWIDTH + j * DATAWIDTH / KWIDTH + k) * BITWIDTH]);
|
| 75 |
+
end
|
| 76 |
+
end
|
| 77 |
+
end
|
| 78 |
+
endgenerate
|
| 79 |
+
|
| 80 |
+
// always @(posedge clk) begin
|
| 81 |
+
// if(clken == 1) begin
|
| 82 |
+
// result = out;
|
| 83 |
+
// end
|
| 84 |
+
// end
|
| 85 |
+
|
| 86 |
+
endmodule
|
QShen3_CNN-FPGA/src/Mult.v
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Company:
|
| 4 |
+
// Engineer:
|
| 5 |
+
//
|
| 6 |
+
// Create Date: 2018/04/11 16:17:19
|
| 7 |
+
// Design Name:
|
| 8 |
+
// Module Name: Mult
|
| 9 |
+
// Project Name:
|
| 10 |
+
// Target Devices:
|
| 11 |
+
// Tool Versions:
|
| 12 |
+
// Description:
|
| 13 |
+
//
|
| 14 |
+
// Dependencies:
|
| 15 |
+
//
|
| 16 |
+
// Revision:
|
| 17 |
+
// Revision 0.01 - File Created
|
| 18 |
+
// Additional Comments:
|
| 19 |
+
//
|
| 20 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
module Mult#(
|
| 24 |
+
parameter BITWIDTH = 8
|
| 25 |
+
)
|
| 26 |
+
(
|
| 27 |
+
input signed [BITWIDTH-1:0] a,
|
| 28 |
+
input signed [BITWIDTH-1:0] b,
|
| 29 |
+
output signed [BITWIDTH * 2 - 1:0] c
|
| 30 |
+
);
|
| 31 |
+
|
| 32 |
+
assign c = a * b;
|
| 33 |
+
//assign c = 1;
|
| 34 |
+
|
| 35 |
+
endmodule
|
QShen3_CNN-FPGA/src/Relu.v
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Company:
|
| 4 |
+
// Engineer:
|
| 5 |
+
//
|
| 6 |
+
// Create Date: 2018/04/16 16:52:03
|
| 7 |
+
// Design Name:
|
| 8 |
+
// Module Name: Relu
|
| 9 |
+
// Project Name:
|
| 10 |
+
// Target Devices:
|
| 11 |
+
// Tool Versions:
|
| 12 |
+
// Description:
|
| 13 |
+
//
|
| 14 |
+
// Dependencies:
|
| 15 |
+
//
|
| 16 |
+
// Revision:
|
| 17 |
+
// Revision 0.01 - File Created
|
| 18 |
+
// Additional Comments:
|
| 19 |
+
//
|
| 20 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
module Relu#(
|
| 24 |
+
parameter BITWIDTH = 8,
|
| 25 |
+
parameter THRESSHOLD = 0
|
| 26 |
+
)
|
| 27 |
+
(
|
| 28 |
+
input signed [BITWIDTH - 1:0] data,
|
| 29 |
+
output signed [BITWIDTH - 1:0] result
|
| 30 |
+
);
|
| 31 |
+
|
| 32 |
+
assign result = data > THRESSHOLD ? data : THRESSHOLD;
|
| 33 |
+
endmodule
|
QShen3_CNN-FPGA/src/Relu_activation.v
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 3 |
+
// Company:
|
| 4 |
+
// Engineer:
|
| 5 |
+
//
|
| 6 |
+
// Create Date: 2018/04/16 16:57:49
|
| 7 |
+
// Design Name:
|
| 8 |
+
// Module Name: Relu_activation
|
| 9 |
+
// Project Name:
|
| 10 |
+
// Target Devices:
|
| 11 |
+
// Tool Versions:
|
| 12 |
+
// Description:
|
| 13 |
+
//
|
| 14 |
+
// Dependencies:
|
| 15 |
+
//
|
| 16 |
+
// Revision:
|
| 17 |
+
// Revision 0.01 - File Created
|
| 18 |
+
// Additional Comments:
|
| 19 |
+
//
|
| 20 |
+
//////////////////////////////////////////////////////////////////////////////////
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
module Relu_activation#(
|
| 24 |
+
parameter integer BITWIDTH = 8,
|
| 25 |
+
|
| 26 |
+
parameter integer DATAWIDTH = 28,
|
| 27 |
+
parameter integer DATAHEIGHT = 28,
|
| 28 |
+
parameter integer DATACHANNEL = 3
|
| 29 |
+
)
|
| 30 |
+
(
|
| 31 |
+
//input clk,
|
| 32 |
+
//input clken,
|
| 33 |
+
input [BITWIDTH * DATAHEIGHT * DATAWIDTH * DATACHANNEL - 1:0] data,
|
| 34 |
+
output reg [BITWIDTH * DATAHEIGHT * DATAWIDTH * DATACHANNEL - 1:0] result
|
| 35 |
+
);
|
| 36 |
+
|
| 37 |
+
//wire [BITWIDTH * DATAHEIGHT * DATAWIDTH * DATACHANNEL - 1:0] out;
|
| 38 |
+
|
| 39 |
+
genvar i, j, k;
|
| 40 |
+
generate
|
| 41 |
+
for(i = 0; i < DATACHANNEL; i = i + 1) begin
|
| 42 |
+
for(j = 0; j < DATAHEIGHT; j = j + 1) begin
|
| 43 |
+
for(k = 0; k < DATAWIDTH; k = k + 1) begin
|
| 44 |
+
Relu#(BITWIDTH) relu(data[(i * DATAHEIGHT * DATAWIDTH + j * DATAWIDTH + k) * BITWIDTH + BITWIDTH - 1:(i * DATAHEIGHT * DATAWIDTH + j * DATAWIDTH + k) * BITWIDTH], result[(i * DATAHEIGHT * DATAWIDTH + j * DATAWIDTH + k) * BITWIDTH + BITWIDTH - 1:(i * DATAHEIGHT * DATAWIDTH + j * DATAWIDTH + k) * BITWIDTH]);
|
| 45 |
+
end
|
| 46 |
+
end
|
| 47 |
+
end
|
| 48 |
+
endgenerate
|
| 49 |
+
|
| 50 |
+
// always @(posedge clk) begin
|
| 51 |
+
// if(clken == 1) begin
|
| 52 |
+
// result = out;
|
| 53 |
+
// end
|
| 54 |
+
// end
|
| 55 |
+
|
| 56 |
+
endmodule
|
The-OpenROAD-Project_OpenSTA/.clang-format
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This is "close" to correct but has a number of bugs that prevent
|
| 2 |
+
# using it on the source tree.
|
| 3 |
+
Language: Cpp
|
| 4 |
+
BasedOnStyle: Google
|
| 5 |
+
AccessModifierOffset: -2
|
| 6 |
+
AlignOperands: false
|
| 7 |
+
AllowAllArgumentsOnNextLine: false
|
| 8 |
+
AllowAllConstructorInitializersOnNextLine: false
|
| 9 |
+
AllowAllParametersOfDeclarationOnNextLine: false
|
| 10 |
+
AllowShortIfStatementsOnASingleLine: Never
|
| 11 |
+
AllowShortLoopsOnASingleLine: false
|
| 12 |
+
AlwaysBreakAfterReturnType: TopLevel
|
| 13 |
+
BinPackArguments: true
|
| 14 |
+
# fails
|
| 15 |
+
BinPackParameters: AlwaysOnePerLine
|
| 16 |
+
BraceWrapping:
|
| 17 |
+
AfterClass: true
|
| 18 |
+
AfterStruct: true
|
| 19 |
+
AfterFunction: true
|
| 20 |
+
BeforeElse: true
|
| 21 |
+
BreakBeforeBinaryOperators: NonAssignment
|
| 22 |
+
BreakBeforeBraces: Custom
|
| 23 |
+
# fails if all initializers fit on one line
|
| 24 |
+
BreakConstructorInitializers: AfterColon
|
| 25 |
+
ColumnLimit: 85
|
| 26 |
+
# fails
|
| 27 |
+
ConstructorInitializerIndentWidth: 2
|
| 28 |
+
IncludeBlocks: Preserve
|
| 29 |
+
PackConstructorInitializers: Never
|
| 30 |
+
PointerAlignment: Right
|
| 31 |
+
SortIncludes: Never
|
The-OpenROAD-Project_OpenSTA/.clang-tidy
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Checks: >
|
| 2 |
+
clang-diagnostic-*,
|
| 3 |
+
clang-analyzer-*,
|
| 4 |
+
-clang-analyzer-core.NonNullParamChecker,
|
| 5 |
+
-clang-analyzer-core.CallAndMessage,
|
| 6 |
+
-clang-analyzer-core.uninitialized.UndefReturn,
|
| 7 |
+
-clang-analyzer-cplusplus.NewDeleteLeaks,
|
| 8 |
+
-clang-analyzer-optin.performance.Padding,
|
| 9 |
+
readability-*,
|
| 10 |
+
-readability-identifier-naming,
|
| 11 |
+
-readability-braces-around-statements,
|
| 12 |
+
-readability-convert-member-functions-to-static,
|
| 13 |
+
-readability-else-after-return,
|
| 14 |
+
-readability-function-cognitive-complexity,
|
| 15 |
+
-readability-inconsistent-ifelse-braces,
|
| 16 |
+
-readability-identifier-length,
|
| 17 |
+
-readability-implicit-bool-conversion,
|
| 18 |
+
-readability-isolate-declaration,
|
| 19 |
+
-readability-magic-numbers,
|
| 20 |
+
-readability-make-member-function-const,
|
| 21 |
+
-readability-math-missing-parentheses,
|
| 22 |
+
-readability-named-parameter,
|
| 23 |
+
-readability-qualified-auto,
|
| 24 |
+
-readability-redundant-access-specifiers,
|
| 25 |
+
-readability-simplify-boolean-expr,
|
| 26 |
+
-readability-static-definition-in-anonymous-namespace,
|
| 27 |
+
-readability-suspicious-call-argument,
|
| 28 |
+
-readability-uppercase-literal-suffix,
|
| 29 |
+
-readability-use-anyofallof,
|
| 30 |
+
google-*,
|
| 31 |
+
-google-readability-avoid-underscore-in-googletest-name,
|
| 32 |
+
-google-readability-braces-around-statements,
|
| 33 |
+
-google-readability-casting,
|
| 34 |
+
-google-readability-todo,
|
| 35 |
+
-google-runtime-references,
|
| 36 |
+
-google-explicit-constructor,
|
| 37 |
+
performance-*,
|
| 38 |
+
-performance-enum-size,
|
| 39 |
+
bugprone-*,
|
| 40 |
+
-bugprone-branch-clone,
|
| 41 |
+
-bugprone-easily-swappable-parameters,
|
| 42 |
+
-bugprone-exception-escape,
|
| 43 |
+
-bugprone-macro-parentheses,
|
| 44 |
+
-bugprone-move-forwarding-reference,
|
| 45 |
+
-bugprone-narrowing-conversions,
|
| 46 |
+
-bugprone-suspicious-missing-comma,
|
| 47 |
+
-bugprone-throwing-static-initialization,
|
| 48 |
+
modernize-*,
|
| 49 |
+
-modernize-avoid-bind,
|
| 50 |
+
-modernize-avoid-c-arrays,
|
| 51 |
+
-modernize-concat-nested-namespaces,
|
| 52 |
+
-modernize-macro-to-enum,
|
| 53 |
+
-modernize-pass-by-value,
|
| 54 |
+
-modernize-raw-string-literal,
|
| 55 |
+
-modernize-return-braced-init-list,
|
| 56 |
+
-modernize-use-auto,
|
| 57 |
+
-modernize-use-nodiscard,
|
| 58 |
+
-modernize-use-trailing-return-type,
|
| 59 |
+
-modernize-use-transparent-functors,
|
| 60 |
+
misc-*,
|
| 61 |
+
-misc-const-correctness,
|
| 62 |
+
-misc-multiple-inheritance,
|
| 63 |
+
-misc-no-recursion,
|
| 64 |
+
-misc-non-private-member-variables-in-classes,
|
| 65 |
+
-misc-redundant-expression,
|
| 66 |
+
-misc-unused-parameters,
|
| 67 |
+
-misc-use-anonymous-namespace,
|
| 68 |
+
-misc-use-internal-linkage,
|
| 69 |
+
-misc-include-cleaner
|
| 70 |
+
|
| 71 |
+
# Only report diagnostics in headers under this tree (app/, include/sta/, build-generated
|
| 72 |
+
# headers, etc.).
|
| 73 |
+
# Excludes system and third-party paths such as /opt/local/include.
|
| 74 |
+
HeaderFilterRegex: '.*/(app|cmake|dcalc|graph|liberty|network|parasitics|power|sdc|sdf|search|spice|tcl|util|verilog|include/sta|build/include/sta)/.*'
|
| 75 |
+
|
| 76 |
+
# util/gzstream.hh
|
| 77 |
+
# util/FlexDisableRegister.hh
|
| 78 |
+
# Bison-generated parser headers (build/{Liberty,Verilog,...}Parse.hh)
|
| 79 |
+
# Homebrew and MacPorts third-party headers.
|
| 80 |
+
ExcludeHeaderFilterRegex: '(^/opt/(homebrew|local)/.*)|((.*/)?(gzstream\.hh|FlexDisableRegister\.hh|(Liberty|Verilog|Sdf|Spef|Saif|LibExpr)Parse\.hh)$)'
|
| 81 |
+
SystemHeaders: false
|
| 82 |
+
FormatStyle: none
|
The-OpenROAD-Project_OpenSTA/.cursor/rules/cpp-coding-standards.mdc
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: C++ coding standards and formatting for OpenSTA
|
| 3 |
+
globs: ["**/*.cc", "**/*.hh", "**/*.h"]
|
| 4 |
+
alwaysApply: true
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# C++ Coding Standards
|
| 8 |
+
|
| 9 |
+
## File-internal helpers (translation-unit local)
|
| 10 |
+
|
| 11 |
+
- For helpers used only in one `.cc` file, put them in the **same namespace** as the rest of the implementation (e.g. `namespace sta { ... }`).
|
| 12 |
+
- Mark them **`static`** at namespace scope so they have internal linkage.
|
| 13 |
+
- **Do not** wrap them in an **anonymous namespace** in this project (no `namespace { ... }` file-static helpers). The user preference is `static` inside the real namespace, not a nested anonymous namespace inside `sta` or at file scope before `sta`.
|
| 14 |
+
|
| 15 |
+
## Line Width
|
| 16 |
+
|
| 17 |
+
- **Keep lines under 90 characters** to match `.clang-format` (ColumnLimit: 90).
|
| 18 |
+
- Only break a line when it would exceed 90 characters. Do not introduce unnecessary line breaks when the expression fits on one line.
|
| 19 |
+
- When a break is needed, break at logical points: after commas, before operators. Keep the first argument on the same line as the opening paren (do not break immediately after an opening paren).
|
| 20 |
+
|
| 21 |
+
## Naming Conventions
|
| 22 |
+
|
| 23 |
+
- **Classes**: Upper camel case (`ClassName`)
|
| 24 |
+
- **Member functions**: Lower camel case (`memberFunction`)
|
| 25 |
+
- **Member variables**: Snake case with trailing underscore (`member_variable_`)
|
| 26 |
+
- **Functions**: Lower camel case (`functionName`)
|
| 27 |
+
- **Variables**: Snake case
|
| 28 |
+
|
| 29 |
+
## Code Style
|
| 30 |
+
|
| 31 |
+
- Use `#pragma once` for header guards.
|
| 32 |
+
- Return type on the line before the function name; arguments on separate lines when long.
|
| 33 |
+
- No braces for single-line if/for; use braces for multi-line bodies.
|
| 34 |
+
- Prefer `std::string` over `char*` for string members.
|
| 35 |
+
- Prefer pass-by-value and move for sink parameters (parameters that get stored).
|
| 36 |
+
|
| 37 |
+
## Control flow
|
| 38 |
+
|
| 39 |
+
- Prefer positive `if` conditions that wrap the main logic instead of early
|
| 40 |
+
`continue` or `return` to skip work.
|
| 41 |
+
- Example: use `if (!visited.contains(vertex)) { ... }` rather than
|
| 42 |
+
`if (visited.contains(vertex)) continue;`.
|
| 43 |
+
|
| 44 |
+
## File Extensions
|
| 45 |
+
|
| 46 |
+
- C++ source: `.cc`
|
| 47 |
+
- C++ headers: `.hh`
|
| 48 |
+
|
| 49 |
+
## Include order
|
| 50 |
+
|
| 51 |
+
Sort `#include` lines **lexicographically by the path inside** `<>`
|
| 52 |
+
or `""` (case-sensitive). Separate **groups** with a single blank line.
|
| 53 |
+
|
| 54 |
+
### Translation units (`*.cc`)
|
| 55 |
+
|
| 56 |
+
1. **Primary header(s)** for this file only:
|
| 57 |
+
- `#include "Stem.hh"` where `Stem` matches the basename of the `.cc` file (e.g. `Foo.cc` → `Foo.hh`).
|
| 58 |
+
- If the file uses a paired private header, include `#include "StemPvt.hh"` **immediately after** `Stem.hh` (e.g. `MakeTimingModel.cc` → `MakeTimingModel.hh` then `MakeTimingModelPvt.hh`).
|
| 59 |
+
- Do **not** pull in other headers just because their names share a prefix with `Stem` (e.g. `SearchClass.hh` is not a “primary” include for `Search.cc`; it belongs in the project group below).
|
| 60 |
+
|
| 61 |
+
2. **System / standard library** headers: `#include <...>` lines, sorted alphabetically.
|
| 62 |
+
|
| 63 |
+
3. **All other project** headers: `#include "..."` lines, sorted alphabetically (including `search/Crpr.hh`-style paths and includes from `liberty/`, etc.).
|
| 64 |
+
|
| 65 |
+
If a **comment or special block** intentionally splits the include list (e.g. a third-party note before `#include "cudd.h"`), keep that structure; sort only within each contiguous run of `#include` lines unless merging groups is clearly safe.
|
| 66 |
+
|
| 67 |
+
### Headers (`*.hh`)
|
| 68 |
+
|
| 69 |
+
After `#pragma once` (and the file’s license block, if present):
|
| 70 |
+
|
| 71 |
+
1. **System** `#include <...>` lines, sorted alphabetically.
|
| 72 |
+
|
| 73 |
+
2. **Project** `#include "..."` lines, sorted alphabetically.
|
The-OpenROAD-Project_OpenSTA/.cursor/rules/cpp-indentation.mdc
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: C++ function call indentation for OpenSTA
|
| 3 |
+
globs: ["**/*.cc", "**/*.hh", "**/*.h"]
|
| 4 |
+
alwaysApply: false
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# C++ Function Call Indentation
|
| 8 |
+
|
| 9 |
+
## Short Calls — Single Line
|
| 10 |
+
|
| 11 |
+
When arguments fit within the column limit (90 chars), keep them on one line:
|
| 12 |
+
|
| 13 |
+
```cpp
|
| 14 |
+
// ✅ GOOD
|
| 15 |
+
adjusted_data_arrival = delaySum(required, data_shift_to_enable_clk, this);
|
| 16 |
+
|
| 17 |
+
// ❌ BAD
|
| 18 |
+
adjusted_data_arrival = delaySum(required,
|
| 19 |
+
data_shift_to_enable_clk,
|
| 20 |
+
this);
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
## Nested Function Calls — Align Under Inner Call
|
| 24 |
+
|
| 25 |
+
When breaking nested calls across lines:
|
| 26 |
+
- Indent continuation lines of the inner call under its first argument (align with content after `innerFunc(`).
|
| 27 |
+
- Place remaining outer arguments on the same line as the inner call's closing `)`, indented under the outer function.
|
| 28 |
+
|
| 29 |
+
```cpp
|
| 30 |
+
// ✅ GOOD
|
| 31 |
+
required = delayDiff(delaySum(max_delay,
|
| 32 |
+
search_->clkPathArrival(disable_path),
|
| 33 |
+
this),
|
| 34 |
+
margin, this);
|
| 35 |
+
|
| 36 |
+
// ❌ BAD
|
| 37 |
+
required = delayDiff(
|
| 38 |
+
delaySum(max_delay,
|
| 39 |
+
search_->clkPathArrival(disable_path),
|
| 40 |
+
this),
|
| 41 |
+
margin,
|
| 42 |
+
this);
|
| 43 |
+
```
|
The-OpenROAD-Project_OpenSTA/.cursor/rules/opensta-tests.mdc
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
description: Where OpenSTA regression tests live (pvt/test vs public test/)
|
| 3 |
+
alwaysApply: true
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# OpenSTA tests and regression
|
| 7 |
+
|
| 8 |
+
- **Primary suite:** Most regression tests, Tcl drivers, and golden `.ok` files live under **`pvt/test/`** (private / separate repo, often opened as a second workspace root alongside `master`).
|
| 9 |
+
- **Public subset:** **`test/`** at the OpenSTA repo root holds a smaller set of tests shipped with the public tree (e.g. `test/regression`, `*.tcl`, `*.ok` there).
|
| 10 |
+
|
| 11 |
+
When searching for a test name, regression lists, or updating goldens, **check `pvt/test` first**, then `test/`.
|
| 12 |
+
|
| 13 |
+
Typical driver: `pvt/test/regression` (or `test/regression` for the public list). Built `sta` binary is usually `master/build/sta` relative to the main checkout.
|
The-OpenROAD-Project_OpenSTA/.dockerignore
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.gitignore
|
| 2 |
+
Dockerfile
|
| 3 |
+
README
|
| 4 |
+
INSTALL
|
The-OpenROAD-Project_OpenSTA/.github/ISSUE_TEMPLATE/bug_report.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: Bug report
|
| 3 |
+
about: File upstream
|
| 4 |
+
title: ''
|
| 5 |
+
labels: ''
|
| 6 |
+
assignees: ''
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
Issues or PRs should be filed with the upstream [parallaxsw/OpenSTA](https://github.com/parallaxsw/OpenSTA). This is effectively a fork (though not strictly for historical reasons).
|
The-OpenROAD-Project_OpenSTA/.github/dependabot.yml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: 2
|
| 2 |
+
updates:
|
| 3 |
+
- package-ecosystem: "github-actions"
|
| 4 |
+
directory: "/"
|
| 5 |
+
schedule:
|
| 6 |
+
interval: "daily"
|
| 7 |
+
open-pull-requests-limit: 5
|
| 8 |
+
cooldown:
|
| 9 |
+
default-days: 7
|
| 10 |
+
groups:
|
| 11 |
+
actions:
|
| 12 |
+
patterns:
|
| 13 |
+
- "*"
|
| 14 |
+
|
| 15 |
+
- package-ecosystem: "docker"
|
| 16 |
+
directory: "/"
|
| 17 |
+
schedule:
|
| 18 |
+
interval: "daily"
|
| 19 |
+
open-pull-requests-limit: 5
|
| 20 |
+
cooldown:
|
| 21 |
+
default-days: 7
|
| 22 |
+
groups:
|
| 23 |
+
images:
|
| 24 |
+
patterns:
|
| 25 |
+
- "*"
|
The-OpenROAD-Project_OpenSTA/.github/workflows/buildifier.yaml
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Lint Bazel
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- master
|
| 7 |
+
pull_request:
|
| 8 |
+
branches:
|
| 9 |
+
- master
|
| 10 |
+
|
| 11 |
+
jobs:
|
| 12 |
+
buildifier:
|
| 13 |
+
runs-on: 'ubuntu-latest'
|
| 14 |
+
strategy:
|
| 15 |
+
fail-fast: false
|
| 16 |
+
matrix:
|
| 17 |
+
check:
|
| 18 |
+
- name: Run buildifier format
|
| 19 |
+
run: ./buildifier -r -mode=check -lint=off .
|
| 20 |
+
- name: Run buildifier lint
|
| 21 |
+
run: ./buildifier -r -lint=warn .
|
| 22 |
+
name: ${{ matrix.check.name }}
|
| 23 |
+
env:
|
| 24 |
+
BUILDIFIER_VERSION: v8.2.1
|
| 25 |
+
|
| 26 |
+
steps:
|
| 27 |
+
- name: Checkout Code
|
| 28 |
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
| 29 |
+
|
| 30 |
+
- name: Cache buildifier
|
| 31 |
+
id: cache-buildifier
|
| 32 |
+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
| 33 |
+
with:
|
| 34 |
+
path: ./buildifier
|
| 35 |
+
key: ${{ runner.os }}-buildifier-${{ env.BUILDIFIER_VERSION }}
|
| 36 |
+
|
| 37 |
+
- name: Download buildifier
|
| 38 |
+
if: steps.cache-buildifier.outputs.cache-hit != 'true'
|
| 39 |
+
run: |
|
| 40 |
+
wget https://github.com/bazelbuild/buildtools/releases/download/${BUILDIFIER_VERSION}/buildifier-linux-amd64 -O buildifier
|
| 41 |
+
chmod +x buildifier
|
| 42 |
+
|
| 43 |
+
- name: ${{ matrix.check.name }}
|
| 44 |
+
run: ${{ matrix.check.run }}
|
The-OpenROAD-Project_OpenSTA/.github/workflows/ci.yml
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
pull_request:
|
| 6 |
+
|
| 7 |
+
jobs:
|
| 8 |
+
# Primary native Linux build used for install artifacts.
|
| 9 |
+
linux-ubuntu:
|
| 10 |
+
if: github.repository_owner != 'The-OpenROAD-Project-private'
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
steps:
|
| 13 |
+
- name: Checkout
|
| 14 |
+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
| 15 |
+
with:
|
| 16 |
+
submodules: true
|
| 17 |
+
|
| 18 |
+
- name: Set up dependencies
|
| 19 |
+
run: |
|
| 20 |
+
sudo apt-get update
|
| 21 |
+
sudo apt-get install -y \
|
| 22 |
+
flex \
|
| 23 |
+
libfl-dev \
|
| 24 |
+
bison \
|
| 25 |
+
tcl-dev \
|
| 26 |
+
tcl-tclreadline \
|
| 27 |
+
libeigen3-dev \
|
| 28 |
+
ninja-build \
|
| 29 |
+
libgtest-dev
|
| 30 |
+
|
| 31 |
+
- name: Set up cudd-3.0.0
|
| 32 |
+
run: |
|
| 33 |
+
wget https://github.com/oscc-ip/artifact/releases/download/cudd-3.0.0/build.tar.gz
|
| 34 |
+
mkdir -p cudd
|
| 35 |
+
tar -zxvf build.tar.gz -Ccudd
|
| 36 |
+
|
| 37 |
+
- name: Build
|
| 38 |
+
run: |
|
| 39 |
+
mkdir build
|
| 40 |
+
cd build
|
| 41 |
+
cmake .. -G Ninja -DCUDD_DIR=$(pwd)/../cudd -DCMAKE_INSTALL_PREFIX=$(pwd)/install -DCMAKE_BUILD_TYPE=Release
|
| 42 |
+
cmake --build . --target all -- -j $(nproc)
|
| 43 |
+
cmake --install .
|
| 44 |
+
tar -zcvf build.tar.gz -Cinstall .
|
| 45 |
+
|
| 46 |
+
- name: Test
|
| 47 |
+
run: |
|
| 48 |
+
cd test
|
| 49 |
+
./regression
|
| 50 |
+
|
| 51 |
+
- name: Upload Artifacts
|
| 52 |
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
| 53 |
+
if: ${{ !cancelled() }}
|
| 54 |
+
with:
|
| 55 |
+
name: artifact-ubuntu
|
| 56 |
+
path: |
|
| 57 |
+
build/install/*
|
| 58 |
+
retention-days: 1
|
| 59 |
+
|
| 60 |
+
- name: Upload Test Result
|
| 61 |
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
| 62 |
+
if: ${{ !cancelled() }}
|
| 63 |
+
with:
|
| 64 |
+
name: result-ubuntu
|
| 65 |
+
path: |
|
| 66 |
+
test/results/*
|
| 67 |
+
|
| 68 |
+
# Native macOS coverage via Brewfile.
|
| 69 |
+
macos:
|
| 70 |
+
if: github.repository_owner != 'The-OpenROAD-Project-private'
|
| 71 |
+
runs-on: macos-latest
|
| 72 |
+
timeout-minutes: 30
|
| 73 |
+
steps:
|
| 74 |
+
- name: Checkout
|
| 75 |
+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
| 76 |
+
with:
|
| 77 |
+
submodules: true
|
| 78 |
+
|
| 79 |
+
- name: Install dependencies
|
| 80 |
+
run: brew bundle
|
| 81 |
+
|
| 82 |
+
- name: Build
|
| 83 |
+
run: |
|
| 84 |
+
eval "$(/opt/homebrew/bin/brew shellenv)"
|
| 85 |
+
export PATH="$(brew --prefix flex)/bin:$PATH"
|
| 86 |
+
export PATH="$(brew --prefix bison)/bin:$PATH"
|
| 87 |
+
export TCL_LIBRARY="$(brew --prefix tcl-tk@8)/lib/libtcl8.6.dylib"
|
| 88 |
+
export TCL_INCLUDE_PATH="$(brew --prefix tcl-tk@8)/include/tcl-tk"
|
| 89 |
+
export FLEX_INCLUDE_DIR="$(brew --prefix flex)/include"
|
| 90 |
+
cmake -S . -B build \
|
| 91 |
+
-D TCL_LIBRARY=$TCL_LIBRARY \
|
| 92 |
+
-D TCL_INCLUDE_PATH=$TCL_INCLUDE_PATH \
|
| 93 |
+
-D FLEX_INCLUDE_DIR=$FLEX_INCLUDE_DIR \
|
| 94 |
+
-DCMAKE_BUILD_TYPE=Release
|
| 95 |
+
cmake --build build -j "$(sysctl -n hw.ncpu)"
|
| 96 |
+
|
| 97 |
+
- name: Test
|
| 98 |
+
run: |
|
| 99 |
+
cd test
|
| 100 |
+
./regression || (cat results/diffs && exit 1)
|
| 101 |
+
|
| 102 |
+
- name: Upload Test Result
|
| 103 |
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
| 104 |
+
if: ${{ !cancelled() }}
|
| 105 |
+
with:
|
| 106 |
+
name: result-macos
|
| 107 |
+
path: |
|
| 108 |
+
test/results/*
|
The-OpenROAD-Project_OpenSTA/.github/workflows/github-actions-are-differences-found.yml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Check that OK files are up to date
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
|
| 6 |
+
jobs:
|
| 7 |
+
No-Diffs-In-Ok-Files:
|
| 8 |
+
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}
|
| 9 |
+
steps:
|
| 10 |
+
- name: Check out repository code
|
| 11 |
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
| 12 |
+
with:
|
| 13 |
+
fetch-depth: 0
|
| 14 |
+
- name: Check ok files
|
| 15 |
+
run: |
|
| 16 |
+
set +e
|
| 17 |
+
grep --include="*.ok" -Rn "Differences found "
|
| 18 |
+
if [[ "$?" == "0" ]]; then
|
| 19 |
+
exit 1
|
| 20 |
+
fi
|
The-OpenROAD-Project_OpenSTA/.github/workflows/on-delete.yml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Cleanup staging branch on delete
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
delete:
|
| 5 |
+
|
| 6 |
+
env:
|
| 7 |
+
ROT13_STAGING_OWNER: ${{ secrets.ROT13_STAGING_OWNER }}
|
| 8 |
+
ROT13_UPSTREAM_OWNER: ${{ secrets.ROT13_UPSTREAM_OWNER }}
|
| 9 |
+
ROT13_UPSTREAM_BRANCH: ${{ secrets.ROT13_UPSTREAM_BRANCH }}
|
| 10 |
+
|
| 11 |
+
jobs:
|
| 12 |
+
Delete-From-Staging:
|
| 13 |
+
name: Delete branch from staging
|
| 14 |
+
|
| 15 |
+
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}
|
| 16 |
+
|
| 17 |
+
permissions:
|
| 18 |
+
# Read-only access so we don't accidentally try to push to *this* repository.
|
| 19 |
+
contents: read
|
| 20 |
+
|
| 21 |
+
# Only run on the private repository.
|
| 22 |
+
if: github.event.repository.private
|
| 23 |
+
steps:
|
| 24 |
+
- name: Detect configuration.
|
| 25 |
+
uses: The-OpenROAD-Project/actions/auto_config@main
|
| 26 |
+
|
| 27 |
+
- name: Delete branch from staging repository.
|
| 28 |
+
uses: The-OpenROAD-Project/actions/delete_from@main
|
| 29 |
+
continue-on-error: true
|
| 30 |
+
with:
|
| 31 |
+
owner: ${{ env.STAGING_OWNER }}
|
| 32 |
+
repo: ${{ env.STAGING_REPO }}
|
| 33 |
+
branch: ${{ env.STAGING_BRANCH }}
|
| 34 |
+
deployToken: ${{ secrets.STAGING_GITHUB_TOKEN }}
|
The-OpenROAD-Project_OpenSTA/.github/workflows/on-label.yml
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Labelled Ready to Sync Public
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
types: [labeled]
|
| 6 |
+
|
| 7 |
+
env:
|
| 8 |
+
ROT13_STAGING_OWNER: ${{ secrets.ROT13_STAGING_OWNER }}
|
| 9 |
+
ROT13_UPSTREAM_OWNER: ${{ secrets.ROT13_UPSTREAM_OWNER }}
|
| 10 |
+
ROT13_UPSTREAM_BRANCH: ${{ secrets.ROT13_UPSTREAM_BRANCH }}
|
| 11 |
+
|
| 12 |
+
jobs:
|
| 13 |
+
Push-To-Staging:
|
| 14 |
+
name: Push to staging
|
| 15 |
+
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}
|
| 16 |
+
|
| 17 |
+
permissions:
|
| 18 |
+
# Read-only access so we don't accidentally try to push to *this* repository.
|
| 19 |
+
contents: read
|
| 20 |
+
# Pull request write access, so we can remove the label.
|
| 21 |
+
issues: write
|
| 22 |
+
pull-requests: write
|
| 23 |
+
# Deployment write access, so we can add the nice deployment info.
|
| 24 |
+
deployments: write
|
| 25 |
+
|
| 26 |
+
# Only run on the private repository.
|
| 27 |
+
if: github.event.repository.private && github.event.label.name == 'Ready To Sync Public'
|
| 28 |
+
steps:
|
| 29 |
+
- name: Detect configuration
|
| 30 |
+
uses: The-OpenROAD-Project/actions/auto_config@main
|
| 31 |
+
|
| 32 |
+
- name: Removing label '${{ github.event.label.name }}'
|
| 33 |
+
uses: The-OpenROAD-Project/actions/remove_label@main
|
| 34 |
+
continue-on-error: true
|
| 35 |
+
|
| 36 |
+
- name: Clone repository
|
| 37 |
+
uses: The-OpenROAD-Project/actions/clone_from@main
|
| 38 |
+
with:
|
| 39 |
+
branch: ${{ env.PRIVATE_BRANCH }}
|
| 40 |
+
checkout: true
|
| 41 |
+
|
| 42 |
+
- name: Run security scan
|
| 43 |
+
uses: The-OpenROAD-Project/actions/security_scan_on_push@main
|
| 44 |
+
|
| 45 |
+
- name: Push to staging repository.
|
| 46 |
+
uses: The-OpenROAD-Project/actions/push_to@main
|
| 47 |
+
with:
|
| 48 |
+
owner: ${{ env.STAGING_OWNER }}
|
| 49 |
+
repo: ${{ env.STAGING_REPO }}
|
| 50 |
+
branch: ${{ env.STAGING_BRANCH }}
|
| 51 |
+
deployToken: ${{ secrets.STAGING_GITHUB_TOKEN }}
|
| 52 |
+
force: true
|
| 53 |
+
|
| 54 |
+
- id: resolve_key
|
| 55 |
+
name: Compute per-user secret key
|
| 56 |
+
env:
|
| 57 |
+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
| 58 |
+
run: |
|
| 59 |
+
key=$(echo "$PR_AUTHOR" | tr 'a-z-' 'A-Z_')
|
| 60 |
+
echo "key=$key" >> "$GITHUB_OUTPUT"
|
| 61 |
+
|
| 62 |
+
- id: resolve_token
|
| 63 |
+
name: Pick per-user PAT or fall back to bot token
|
| 64 |
+
env:
|
| 65 |
+
USER_PAT: ${{ secrets[format('PAT_{0}', steps.resolve_key.outputs.key)] }}
|
| 66 |
+
BOT_TOKEN: ${{ secrets.STAGING_GITHUB_TOKEN }}
|
| 67 |
+
run: |
|
| 68 |
+
if [ -n "$USER_PAT" ]; then
|
| 69 |
+
echo "::add-mask::$USER_PAT"
|
| 70 |
+
echo "token=$USER_PAT" >> "$GITHUB_OUTPUT"
|
| 71 |
+
echo "source=user-pat" >> "$GITHUB_OUTPUT"
|
| 72 |
+
echo "Using per-user PAT for PR creation"
|
| 73 |
+
else
|
| 74 |
+
echo "::add-mask::$BOT_TOKEN"
|
| 75 |
+
echo "token=$BOT_TOKEN" >> "$GITHUB_OUTPUT"
|
| 76 |
+
echo "source=bot-fallback" >> "$GITHUB_OUTPUT"
|
| 77 |
+
echo "No per-user PAT found; falling back to bot token"
|
| 78 |
+
fi
|
| 79 |
+
|
| 80 |
+
- id: send_pr
|
| 81 |
+
name: Create PR if needed.
|
| 82 |
+
uses: The-OpenROAD-Project/actions/send_pr@main
|
| 83 |
+
env:
|
| 84 |
+
STAGING_GITHUB_TOKEN: ${{ steps.resolve_token.outputs.token }}
|
| 85 |
+
|
| 86 |
+
- name: Linking to PR using deployment.
|
| 87 |
+
uses: The-OpenROAD-Project/actions/link_pr@main
|
| 88 |
+
env:
|
| 89 |
+
GITHUB_TOKEN: ${{ github.token }}
|
| 90 |
+
UPSTREAM_PR: ${{ steps.send_pr.outputs.pr }}
|
The-OpenROAD-Project_OpenSTA/.github/workflows/on-push.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Scan Code with pre commit trigger
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
pull_request:
|
| 6 |
+
branches:
|
| 7 |
+
- master
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
Security-Scan:
|
| 11 |
+
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}
|
| 12 |
+
steps:
|
| 13 |
+
- name: Check out repository code
|
| 14 |
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
| 15 |
+
- name: run security_scan_on_push
|
| 16 |
+
uses: The-OpenROAD-Project/actions/security_scan_on_push@main
|
The-OpenROAD-Project_OpenSTA/.github/workflows/sync-from-upstream.yml
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Automatically sync branch from upstream.
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
schedule:
|
| 5 |
+
- cron: "*/5 * * * *"
|
| 6 |
+
|
| 7 |
+
workflow_dispatch:
|
| 8 |
+
inputs:
|
| 9 |
+
force:
|
| 10 |
+
description: Use GitHub --force push.
|
| 11 |
+
default:
|
| 12 |
+
|
| 13 |
+
repository_dispatch:
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
jobs:
|
| 17 |
+
Sync-Branch-From-Upstream:
|
| 18 |
+
name: Automatic sync 'master' from The-OpenROAD-Project/OpenSTA
|
| 19 |
+
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}
|
| 20 |
+
|
| 21 |
+
# Only allow one action to run at a time.
|
| 22 |
+
concurrency: sync-branch-from-upstream
|
| 23 |
+
|
| 24 |
+
# Action needs no permissions, as push is granted via adding a deploy key
|
| 25 |
+
# with write access to the $DEPLOY_KEY secret.
|
| 26 |
+
permissions:
|
| 27 |
+
contents: read
|
| 28 |
+
|
| 29 |
+
# Don't run on the upstream repository and only run on the right branch.
|
| 30 |
+
if: ${{ (github.repository != 'The-OpenROAD-Project/OpenSTA') && endsWith(github.ref, '/master') }}
|
| 31 |
+
|
| 32 |
+
steps:
|
| 33 |
+
|
| 34 |
+
- uses: The-OpenROAD-Project/actions/upstream_sync@main
|
| 35 |
+
env:
|
| 36 |
+
HAS_DEPLOY_KEY: ${{ !!(secrets.DEPLOY_KEY) }}
|
| 37 |
+
if: ${{ env.HAS_DEPLOY_KEY == 'true' }}
|
| 38 |
+
with:
|
| 39 |
+
upstreamRepo: The-OpenROAD-Project/OpenSTA
|
| 40 |
+
upstreamBranch: master
|
| 41 |
+
# To always overwrite master branch, set UPSTREAM_SYNC to the exact
|
| 42 |
+
# string 'always overwrite master branch'.
|
| 43 |
+
# You can also manually trigger a workflow dispatch with the force
|
| 44 |
+
# value equal to 'true'.
|
| 45 |
+
force: ${{ github.event.inputs.force || (secrets.UPSTREAM_SYNC == 'always overwrite master branch') }}
|
| 46 |
+
deployKey: ${{ secrets.DEPLOY_KEY }}
|
The-OpenROAD-Project_OpenSTA/.gitignore
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.rej
|
| 2 |
+
*.orig
|
| 3 |
+
TAGS
|
| 4 |
+
*~
|
| 5 |
+
\#*#
|
| 6 |
+
.#*
|
| 7 |
+
.~lock.*\.*#
|
| 8 |
+
.DS_Store
|
| 9 |
+
.vscode
|
| 10 |
+
.idea
|
| 11 |
+
Makefile
|
| 12 |
+
gmon.out
|
| 13 |
+
|
| 14 |
+
cmake-build-debug
|
| 15 |
+
coverage-output
|
| 16 |
+
build
|
| 17 |
+
pvt
|
| 18 |
+
|
| 19 |
+
# iverilog turd
|
| 20 |
+
examples/gcd_tb
|
| 21 |
+
|
| 22 |
+
doc/._Sta.docx
|
| 23 |
+
|
| 24 |
+
test/results
|
| 25 |
+
*/test/results
|
| 26 |
+
# ngspice turd
|
| 27 |
+
test/b3v3_1check.log
|
| 28 |
+
|
| 29 |
+
doc/messages.txt
|
| 30 |
+
|
| 31 |
+
# clangd turds
|
| 32 |
+
.cache/
|
| 33 |
+
|
| 34 |
+
# openroad ctest turds
|
| 35 |
+
cmake_test*
|
The-OpenROAD-Project_OpenSTA/BUILD.bazel
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: BSD-3-Clause
|
| 2 |
+
# Copyright (c) 2025, The OpenROAD Authors
|
| 3 |
+
|
| 4 |
+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
|
| 5 |
+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
| 6 |
+
load("//bazel:bison.bzl", "genyacc")
|
| 7 |
+
load("//bazel:flex.bzl", "genlex")
|
| 8 |
+
load("//bazel:tcl_encode_sta.bzl", "tcl_encode_sta")
|
| 9 |
+
load("//bazel:tcl_wrap_cc.bzl", "tcl_wrap_cc")
|
| 10 |
+
|
| 11 |
+
package(
|
| 12 |
+
default_visibility = ["//:__subpackages__"],
|
| 13 |
+
# features = ["layering_check"],
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
genlex(
|
| 17 |
+
name = "LibExprLex",
|
| 18 |
+
src = "liberty/LibExprLex.ll",
|
| 19 |
+
out = "liberty/LibExprLex.cc",
|
| 20 |
+
prefix = "LibExprLex_",
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
genyacc(
|
| 24 |
+
name = "LibExprParse",
|
| 25 |
+
src = "liberty/LibExprParse.yy",
|
| 26 |
+
header_out = "liberty/LibExprParse.hh",
|
| 27 |
+
prefix = "LibExprParse_",
|
| 28 |
+
source_out = "liberty/LibExprParse.cc",
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
# Liberty Parser
|
| 32 |
+
genlex(
|
| 33 |
+
name = "LibertyLex",
|
| 34 |
+
src = "liberty/LibertyLex.ll",
|
| 35 |
+
out = "liberty/LibertyLex.cc",
|
| 36 |
+
prefix = "LibertyLex_",
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
genyacc(
|
| 40 |
+
name = "LibertyParser",
|
| 41 |
+
src = "liberty/LibertyParse.yy",
|
| 42 |
+
extra_outs = ["liberty/LibertyLocation.hh"],
|
| 43 |
+
header_out = "liberty/LibertyParse.hh",
|
| 44 |
+
prefix = "LibertyParse_",
|
| 45 |
+
source_out = "liberty/LibertyParse.cc",
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
# Spef scan/parse.
|
| 49 |
+
genlex(
|
| 50 |
+
name = "SpefLex",
|
| 51 |
+
src = "parasitics/SpefLex.ll",
|
| 52 |
+
out = "parasitics/SpefLex.cc",
|
| 53 |
+
prefix = "SpefLex_",
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
genyacc(
|
| 57 |
+
name = "SpefParser",
|
| 58 |
+
src = "parasitics/SpefParse.yy",
|
| 59 |
+
extra_outs = ["parasitics/SpefLocation.hh"],
|
| 60 |
+
header_out = "parasitics/SpefParse.hh",
|
| 61 |
+
prefix = "SpefParse_",
|
| 62 |
+
source_out = "parasitics/SpefParse.cc",
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
# Verilog scan/parse.
|
| 66 |
+
genlex(
|
| 67 |
+
name = "VerilogLex",
|
| 68 |
+
src = "verilog/VerilogLex.ll",
|
| 69 |
+
out = "verilog/VerilogLex.cc",
|
| 70 |
+
prefix = "VerilogLex_",
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
genyacc(
|
| 74 |
+
name = "VerilogParser",
|
| 75 |
+
src = "verilog/VerilogParse.yy",
|
| 76 |
+
extra_outs = ["verilog/VerilogLocation.hh"],
|
| 77 |
+
header_out = "verilog/VerilogParse.hh",
|
| 78 |
+
prefix = "VerilogParse_",
|
| 79 |
+
source_out = "verilog/VerilogParse.cc",
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
# sdf scan/parse.
|
| 83 |
+
genlex(
|
| 84 |
+
name = "SdfLex",
|
| 85 |
+
src = "sdf/SdfLex.ll",
|
| 86 |
+
out = "sdf/SdfLex.cc",
|
| 87 |
+
prefix = "SdfLex_",
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
genyacc(
|
| 91 |
+
name = "SdfParser",
|
| 92 |
+
src = "sdf/SdfParse.yy",
|
| 93 |
+
extra_outs = ["sdf/SdfLocation.hh"],
|
| 94 |
+
header_out = "sdf/SdfParse.hh",
|
| 95 |
+
prefix = "SdfParse_",
|
| 96 |
+
source_out = "sdf/SdfParse.cc",
|
| 97 |
+
)
|
| 98 |
+
|
| 99 |
+
genlex(
|
| 100 |
+
name = "SaifLex",
|
| 101 |
+
src = "power/SaifLex.ll",
|
| 102 |
+
out = "power/SaifLex.cc",
|
| 103 |
+
prefix = "SaifLex_",
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
genyacc(
|
| 107 |
+
name = "SaifParser",
|
| 108 |
+
src = "power/SaifParse.yy",
|
| 109 |
+
extra_outs = ["power/SaifLocation.hh"],
|
| 110 |
+
header_out = "power/SaifParse.hh",
|
| 111 |
+
prefix = "SaifParse_",
|
| 112 |
+
source_out = "power/SaifParse.cc",
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
# The order here is very important as the script to encode these relies on it
|
| 116 |
+
tcl_srcs = [
|
| 117 |
+
"tcl/Util.tcl",
|
| 118 |
+
"tcl/CmdUtil.tcl",
|
| 119 |
+
"tcl/Init.tcl",
|
| 120 |
+
"tcl/CmdArgs.tcl",
|
| 121 |
+
"tcl/Property.tcl",
|
| 122 |
+
"tcl/Sta.tcl",
|
| 123 |
+
"sdc/Variables.tcl",
|
| 124 |
+
"tcl/Splash.tcl",
|
| 125 |
+
"graph/Graph.tcl",
|
| 126 |
+
"liberty/Liberty.tcl",
|
| 127 |
+
"network/Link.tcl",
|
| 128 |
+
"network/Network.tcl",
|
| 129 |
+
"network/NetworkEdit.tcl",
|
| 130 |
+
"search/Search.tcl",
|
| 131 |
+
"dcalc/DelayCalc.tcl",
|
| 132 |
+
"parasitics/Parasitics.tcl",
|
| 133 |
+
"power/Power.tcl",
|
| 134 |
+
"sdc/Sdc.tcl",
|
| 135 |
+
"sdf/Sdf.tcl",
|
| 136 |
+
"verilog/Verilog.tcl",
|
| 137 |
+
"spice/WriteSpice.tcl",
|
| 138 |
+
]
|
| 139 |
+
|
| 140 |
+
exports_files([
|
| 141 |
+
"etc/TclEncode.tcl",
|
| 142 |
+
])
|
| 143 |
+
|
| 144 |
+
# Files used only by the standalone OpenSTA shell. OpenROAD supplies its own
|
| 145 |
+
# equivalents (Init via ord, Link/Verilog via dbSta), so they are excluded from
|
| 146 |
+
# the set re-exported to dbSta.
|
| 147 |
+
sta_only_tcl = [
|
| 148 |
+
"tcl/Init.tcl",
|
| 149 |
+
"network/Link.tcl",
|
| 150 |
+
"verilog/Verilog.tcl",
|
| 151 |
+
]
|
| 152 |
+
|
| 153 |
+
# Re-exported to dbSta (and thus the OpenROAD binary). Derived from tcl_srcs so
|
| 154 |
+
# a new command file added there automatically flows here unless explicitly
|
| 155 |
+
# listed in sta_only_tcl. Single source of truth = tcl_srcs.
|
| 156 |
+
exported_tcl = [f for f in tcl_srcs if f not in sta_only_tcl]
|
| 157 |
+
|
| 158 |
+
filegroup(
|
| 159 |
+
name = "tcl_scripts",
|
| 160 |
+
srcs = exported_tcl,
|
| 161 |
+
visibility = [
|
| 162 |
+
"//:__subpackages__",
|
| 163 |
+
],
|
| 164 |
+
)
|
| 165 |
+
|
| 166 |
+
tcl_encode_sta(
|
| 167 |
+
name = "StaTclInitVar",
|
| 168 |
+
srcs = tcl_srcs,
|
| 169 |
+
char_array_name = "tcl_inits",
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
genrule(
|
| 173 |
+
name = "StaConfig",
|
| 174 |
+
srcs = [],
|
| 175 |
+
outs = ["include/sta/StaConfig.hh"],
|
| 176 |
+
cmd = """echo -e '
|
| 177 |
+
#pragma once
|
| 178 |
+
#define STA_VERSION "2.7.0"
|
| 179 |
+
#define STA_GIT_SHA1 "f21d4a3878e2531e3af4930818d9b5968aad9416"
|
| 180 |
+
#define SSTA 0
|
| 181 |
+
#define ZLIB_FOUND
|
| 182 |
+
#define HAVE_CXX_STD_FORMAT 1' > \"$@\"
|
| 183 |
+
""",
|
| 184 |
+
visibility = ["//:__subpackages__"],
|
| 185 |
+
)
|
| 186 |
+
|
| 187 |
+
cc_library(
|
| 188 |
+
name = "config",
|
| 189 |
+
hdrs = [":StaConfig"],
|
| 190 |
+
includes = [
|
| 191 |
+
"include",
|
| 192 |
+
"include/sta",
|
| 193 |
+
],
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
filegroup(
|
| 197 |
+
name = "sta_swig_files",
|
| 198 |
+
srcs = [
|
| 199 |
+
"app/StaApp.i",
|
| 200 |
+
"dcalc/DelayCalc.i",
|
| 201 |
+
"graph/Graph.i",
|
| 202 |
+
"liberty/Liberty.i",
|
| 203 |
+
"network/Network.i",
|
| 204 |
+
"network/NetworkEdit.i",
|
| 205 |
+
"parasitics/Parasitics.i",
|
| 206 |
+
"power/Power.i",
|
| 207 |
+
"sdc/Sdc.i",
|
| 208 |
+
"sdf/Sdf.i",
|
| 209 |
+
"search/Property.i",
|
| 210 |
+
"search/Search.i",
|
| 211 |
+
"spice/WriteSpice.i",
|
| 212 |
+
"tcl/Exception.i",
|
| 213 |
+
"tcl/StaTclTypes.i",
|
| 214 |
+
"util/Util.i",
|
| 215 |
+
"verilog/Verilog.i",
|
| 216 |
+
],
|
| 217 |
+
visibility = ["//:__subpackages__"],
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
tcl_wrap_cc(
|
| 221 |
+
name = "StaApp",
|
| 222 |
+
srcs = [
|
| 223 |
+
":sta_swig_files",
|
| 224 |
+
],
|
| 225 |
+
namespace_prefix = "sta",
|
| 226 |
+
root_swig_src = "app/StaApp.i",
|
| 227 |
+
swig_includes = [
|
| 228 |
+
".",
|
| 229 |
+
],
|
| 230 |
+
)
|
| 231 |
+
|
| 232 |
+
parser_cc = [
|
| 233 |
+
# Liberty Expression Parser
|
| 234 |
+
":liberty/LibExprParse.cc",
|
| 235 |
+
":liberty/LibExprLex.cc",
|
| 236 |
+
# Liberty Parser
|
| 237 |
+
":liberty/LibertyLex.cc",
|
| 238 |
+
":liberty/LibertyParse.cc",
|
| 239 |
+
# Spef scan/parse.
|
| 240 |
+
":parasitics/SpefLex.cc",
|
| 241 |
+
":parasitics/SpefParse.cc",
|
| 242 |
+
# Verilog scan/parse.
|
| 243 |
+
":verilog/VerilogLex.cc",
|
| 244 |
+
":verilog/VerilogParse.cc",
|
| 245 |
+
# sdf scan/parse.
|
| 246 |
+
":sdf/SdfLex.cc",
|
| 247 |
+
":sdf/SdfParse.cc",
|
| 248 |
+
# Saif scan/parse.
|
| 249 |
+
":power/SaifLex.cc",
|
| 250 |
+
":power/SaifParse.cc",
|
| 251 |
+
]
|
| 252 |
+
|
| 253 |
+
parser_headers = [
|
| 254 |
+
# Liberty Expression Parser
|
| 255 |
+
":liberty/LibExprParse.hh",
|
| 256 |
+
# Liberty Parser
|
| 257 |
+
":liberty/LibertyParse.hh",
|
| 258 |
+
":liberty/LibertyLocation.hh",
|
| 259 |
+
# Spef scan/parse.
|
| 260 |
+
":parasitics/SpefParse.hh",
|
| 261 |
+
":parasitics/SpefLocation.hh",
|
| 262 |
+
# Verilog scan/parse.
|
| 263 |
+
":verilog/VerilogParse.hh",
|
| 264 |
+
":verilog/VerilogLocation.hh",
|
| 265 |
+
# sdf scan/parse.
|
| 266 |
+
":sdf/SdfParse.hh",
|
| 267 |
+
":sdf/SdfLocation.hh",
|
| 268 |
+
# Saif scan/parse.
|
| 269 |
+
":power/SaifParse.hh",
|
| 270 |
+
":power/SaifLocation.hh",
|
| 271 |
+
]
|
| 272 |
+
|
| 273 |
+
cc_binary(
|
| 274 |
+
name = "opensta",
|
| 275 |
+
srcs = [
|
| 276 |
+
"app/Main.cc",
|
| 277 |
+
":StaApp",
|
| 278 |
+
":StaTclInitVar",
|
| 279 |
+
],
|
| 280 |
+
copts = [
|
| 281 |
+
"-Wno-error",
|
| 282 |
+
"-Wall",
|
| 283 |
+
"-Wextra",
|
| 284 |
+
"-pedantic",
|
| 285 |
+
"-Wno-cast-qual", # typically from TCL swigging
|
| 286 |
+
"-Wno-missing-braces", # typically from TCL swigging
|
| 287 |
+
"-Wredundant-decls",
|
| 288 |
+
"-Wformat-security",
|
| 289 |
+
"-Wno-unused-parameter",
|
| 290 |
+
"-Wno-sign-compare",
|
| 291 |
+
],
|
| 292 |
+
defines = ["BAZEL_BUILD"],
|
| 293 |
+
features = ["-use_header_modules"],
|
| 294 |
+
includes = [
|
| 295 |
+
"",
|
| 296 |
+
"dcalc",
|
| 297 |
+
"include/sta",
|
| 298 |
+
"util",
|
| 299 |
+
],
|
| 300 |
+
malloc = "@tcmalloc//tcmalloc",
|
| 301 |
+
visibility = ["//visibility:public"],
|
| 302 |
+
deps = [
|
| 303 |
+
":config",
|
| 304 |
+
":opensta_lib",
|
| 305 |
+
"//:tcl_readline_setup",
|
| 306 |
+
"//bazel:tcl_library_init",
|
| 307 |
+
"@tcl_lang//:tcl",
|
| 308 |
+
],
|
| 309 |
+
)
|
| 310 |
+
|
| 311 |
+
cc_library(
|
| 312 |
+
name = "opensta_lib",
|
| 313 |
+
srcs = parser_cc +
|
| 314 |
+
parser_headers + glob(
|
| 315 |
+
include = [
|
| 316 |
+
"dcalc/*.cc",
|
| 317 |
+
"dcalc/*.hh",
|
| 318 |
+
"graph/*.cc",
|
| 319 |
+
"liberty/*.cc",
|
| 320 |
+
"liberty/*.hh",
|
| 321 |
+
"network/*.cc",
|
| 322 |
+
"parasitics/*.cc",
|
| 323 |
+
"parasitics/*.hh",
|
| 324 |
+
"power/*.cc",
|
| 325 |
+
"power/*.hh",
|
| 326 |
+
"sdc/*.cc",
|
| 327 |
+
"sdc/*.hh",
|
| 328 |
+
"sdf/*.cc",
|
| 329 |
+
"sdf/*.hh",
|
| 330 |
+
"search/*.cc",
|
| 331 |
+
"search/*.hh",
|
| 332 |
+
"spice/*.cc",
|
| 333 |
+
"spice/*.hh",
|
| 334 |
+
"tcl/*.cc",
|
| 335 |
+
"util/*.cc",
|
| 336 |
+
"util/*.hh",
|
| 337 |
+
"verilog/*.cc",
|
| 338 |
+
"verilog/*.hh",
|
| 339 |
+
],
|
| 340 |
+
exclude = [
|
| 341 |
+
"graph/Delay.cc",
|
| 342 |
+
"liberty/LibertyExt.cc",
|
| 343 |
+
"util/Machine*.cc",
|
| 344 |
+
],
|
| 345 |
+
) + [
|
| 346 |
+
"app/StaMain.cc",
|
| 347 |
+
] + select({
|
| 348 |
+
"@platforms//os:linux": ["util/MachineLinux.cc"],
|
| 349 |
+
"@platforms//os:osx": ["util/MachineApple.cc"],
|
| 350 |
+
"@platforms//os:windows": ["util/MachineWin32.cc"],
|
| 351 |
+
"//conditions:default": ["util/MachineUnknown.cc"],
|
| 352 |
+
}),
|
| 353 |
+
hdrs = glob(
|
| 354 |
+
include = ["include/sta/*.hh"],
|
| 355 |
+
) + [
|
| 356 |
+
# Required for swig
|
| 357 |
+
"search/Tag.hh",
|
| 358 |
+
"dcalc/ArcDcalcWaveforms.hh",
|
| 359 |
+
"power/Power.hh",
|
| 360 |
+
"power/VcdParse.hh",
|
| 361 |
+
"power/VcdReader.hh",
|
| 362 |
+
"power/SaifReader.hh",
|
| 363 |
+
"sdf/SdfReader.hh",
|
| 364 |
+
"sdf/ReportAnnotation.hh",
|
| 365 |
+
"sdf/SdfWriter.hh",
|
| 366 |
+
"search/Levelize.hh",
|
| 367 |
+
"search/ReportPath.hh",
|
| 368 |
+
"spice/WritePathSpice.hh",
|
| 369 |
+
"dcalc/PrimaDelayCalc.hh",
|
| 370 |
+
# Needed by src/dbSta to synthesize LibertyCells programmatically.
|
| 371 |
+
"liberty/LibertyBuilder.hh",
|
| 372 |
+
],
|
| 373 |
+
copts = [
|
| 374 |
+
"-Wno-error",
|
| 375 |
+
"-Wall",
|
| 376 |
+
"-Wextra",
|
| 377 |
+
"-pedantic",
|
| 378 |
+
"-Wno-cast-qual", # typically from TCL swigging
|
| 379 |
+
"-Wno-missing-braces", # typically from TCL swigging
|
| 380 |
+
"-Wredundant-decls",
|
| 381 |
+
"-Wformat-security",
|
| 382 |
+
"-Wno-unused-parameter",
|
| 383 |
+
"-Wno-sign-compare",
|
| 384 |
+
"-fopenmp",
|
| 385 |
+
],
|
| 386 |
+
features = [
|
| 387 |
+
"-use_header_modules",
|
| 388 |
+
],
|
| 389 |
+
includes = [
|
| 390 |
+
".",
|
| 391 |
+
"dcalc",
|
| 392 |
+
"include",
|
| 393 |
+
"include/sta",
|
| 394 |
+
"liberty",
|
| 395 |
+
"parasitics",
|
| 396 |
+
"power",
|
| 397 |
+
"sdf",
|
| 398 |
+
"util",
|
| 399 |
+
"verilog",
|
| 400 |
+
],
|
| 401 |
+
visibility = ["//:__subpackages__"],
|
| 402 |
+
deps = [
|
| 403 |
+
":config",
|
| 404 |
+
"@cudd",
|
| 405 |
+
"@eigen", # keep. Is used, but with <>-includes
|
| 406 |
+
"@openmp", # keep. Is needed ? Nobody includes omp.h
|
| 407 |
+
"@rules_flex//flex:current_flex_toolchain",
|
| 408 |
+
"@tcl_lang//:tcl", # keep. Is used, but with <>-includes
|
| 409 |
+
"@zlib", # keep. Is used, but with <>-includes
|
| 410 |
+
],
|
| 411 |
+
)
|
| 412 |
+
|
| 413 |
+
filegroup(
|
| 414 |
+
name = "tcl_util",
|
| 415 |
+
srcs = [
|
| 416 |
+
"tcl/Util.tcl",
|
| 417 |
+
],
|
| 418 |
+
visibility = ["//visibility:public"],
|
| 419 |
+
)
|
The-OpenROAD-Project_OpenSTA/Brewfile
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
brew "bison"
|
| 2 |
+
brew "cmake"
|
| 3 |
+
brew "eigen"
|
| 4 |
+
brew "flex"
|
| 5 |
+
brew "googletest"
|
| 6 |
+
brew "swig"
|
| 7 |
+
brew "tcl-tk@8"
|
| 8 |
+
|
| 9 |
+
tap "mht208/formal"
|
| 10 |
+
brew "mht208/formal/cudd", trusted: true
|
The-OpenROAD-Project_OpenSTA/CMakeLists.txt
ADDED
|
@@ -0,0 +1,731 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OpenSTA, Static Timing Analyzer
|
| 2 |
+
# Copyright (c) 2026, Parallax Software, Inc.
|
| 3 |
+
#
|
| 4 |
+
# This program is free software: you can redistribute it and/or modify
|
| 5 |
+
# it under the terms of the GNU General Public License as published by
|
| 6 |
+
# the Free Software Foundation, either version 3 of the License, or
|
| 7 |
+
# (at your option) any later version.
|
| 8 |
+
#
|
| 9 |
+
# This program is distributed in the hope that it will be useful,
|
| 10 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
+
# GNU General Public License for more details.
|
| 13 |
+
#
|
| 14 |
+
# You should have received a copy of the GNU General Public License
|
| 15 |
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 16 |
+
#
|
| 17 |
+
# The origin of this software must not be misrepresented; you must not
|
| 18 |
+
# claim that you wrote the original software.
|
| 19 |
+
#
|
| 20 |
+
# Altered source versions must be plainly marked as such, and must not be
|
| 21 |
+
# misrepresented as being the original software.
|
| 22 |
+
#
|
| 23 |
+
# This notice may not be removed or altered from any source distribution.
|
| 24 |
+
|
| 25 |
+
cmake_minimum_required (VERSION 3.16)
|
| 26 |
+
|
| 27 |
+
project(STA VERSION 3.1.0
|
| 28 |
+
LANGUAGES CXX
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
option(CUDD_DIR "CUDD BDD package directory")
|
| 32 |
+
option(USE_TCL_READLINE "Use TCL readline package" ON)
|
| 33 |
+
option(ENABLE_TSAN "Compile with thread santizer enabled" OFF)
|
| 34 |
+
option(ENABLE_ASAN "Compile with address santizer enabled" OFF)
|
| 35 |
+
|
| 36 |
+
# Turn on to debug compiler args.
|
| 37 |
+
set(CMAKE_VERBOSE_MAKEFILE OFF)
|
| 38 |
+
|
| 39 |
+
# Write compile_commands.json to the build directory for clang-tidy.
|
| 40 |
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
| 41 |
+
|
| 42 |
+
set(STA_HOME ${PROJECT_SOURCE_DIR})
|
| 43 |
+
message(STATUS "STA version: ${PROJECT_VERSION}")
|
| 44 |
+
|
| 45 |
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
| 46 |
+
include(GetGitRevisionDescription)
|
| 47 |
+
get_git_head_revision(GIT_REFSPEC STA_GIT_SHA1)
|
| 48 |
+
message(STATUS "STA git sha: ${STA_GIT_SHA1}")
|
| 49 |
+
|
| 50 |
+
# Default to bulding optimnized/release executable.
|
| 51 |
+
if(NOT CMAKE_BUILD_TYPE)
|
| 52 |
+
set(CMAKE_BUILD_TYPE RELEASE)
|
| 53 |
+
endif()
|
| 54 |
+
|
| 55 |
+
message(STATUS "System name: ${CMAKE_SYSTEM_NAME}")
|
| 56 |
+
message(STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
|
| 57 |
+
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
| 58 |
+
message(STATUS "Build CXX_FLAGS: ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")
|
| 59 |
+
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
|
| 60 |
+
|
| 61 |
+
# Enable Link-Time Optimization (LTO) for Release builds.
|
| 62 |
+
include(CheckIPOSupported)
|
| 63 |
+
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
|
| 64 |
+
if(ipo_supported)
|
| 65 |
+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
|
| 66 |
+
message(STATUS "IPO/LTO: enabled for Release builds")
|
| 67 |
+
else()
|
| 68 |
+
message(STATUS "IPO/LTO: not supported - ${ipo_error}")
|
| 69 |
+
endif()
|
| 70 |
+
|
| 71 |
+
################################################################
|
| 72 |
+
#
|
| 73 |
+
# Source files.
|
| 74 |
+
#
|
| 75 |
+
################################################################
|
| 76 |
+
|
| 77 |
+
set(STA_SOURCE
|
| 78 |
+
app/StaMain.cc
|
| 79 |
+
|
| 80 |
+
dcalc/ArcDcalcWaveforms.cc
|
| 81 |
+
dcalc/ArcDelayCalc.cc
|
| 82 |
+
dcalc/ArnoldiDelayCalc.cc
|
| 83 |
+
dcalc/ArnoldiReduce.cc
|
| 84 |
+
dcalc/CcsCeffDelayCalc.cc
|
| 85 |
+
dcalc/Delay.cc
|
| 86 |
+
dcalc/DelayCalc.cc
|
| 87 |
+
dcalc/DelayCalcBase.cc
|
| 88 |
+
dcalc/DelayNormal.cc
|
| 89 |
+
dcalc/DelayScalar.cc
|
| 90 |
+
dcalc/DelaySkewNormal.cc
|
| 91 |
+
dcalc/DmpCeff.cc
|
| 92 |
+
dcalc/DmpDelayCalc.cc
|
| 93 |
+
dcalc/FindRoot.cc
|
| 94 |
+
dcalc/GraphDelayCalc.cc
|
| 95 |
+
dcalc/LumpedCapDelayCalc.cc
|
| 96 |
+
dcalc/NetCaps.cc
|
| 97 |
+
dcalc/ParallelDelayCalc.cc
|
| 98 |
+
dcalc/PrimaDelayCalc.cc
|
| 99 |
+
dcalc/UnitDelayCalc.cc
|
| 100 |
+
|
| 101 |
+
graph/Graph.cc
|
| 102 |
+
graph/GraphCmp.cc
|
| 103 |
+
|
| 104 |
+
liberty/EquivCells.cc
|
| 105 |
+
liberty/FuncExpr.cc
|
| 106 |
+
liberty/InternalPower.cc
|
| 107 |
+
liberty/LeakagePower.cc
|
| 108 |
+
liberty/Liberty.cc
|
| 109 |
+
liberty/LibertyBuilder.cc
|
| 110 |
+
liberty/LibExprReader.cc
|
| 111 |
+
liberty/LibertyParser.cc
|
| 112 |
+
liberty/LibertyReader.cc
|
| 113 |
+
liberty/LibertyWriter.cc
|
| 114 |
+
liberty/LinearModel.cc
|
| 115 |
+
liberty/Sequential.cc
|
| 116 |
+
liberty/TableModel.cc
|
| 117 |
+
liberty/TimingArc.cc
|
| 118 |
+
liberty/TimingModel.cc
|
| 119 |
+
liberty/TimingRole.cc
|
| 120 |
+
liberty/Units.cc
|
| 121 |
+
liberty/Wireload.cc
|
| 122 |
+
|
| 123 |
+
network/ConcreteLibrary.cc
|
| 124 |
+
network/ConcreteNetwork.cc
|
| 125 |
+
network/HpinDrvrLoad.cc
|
| 126 |
+
network/Network.cc
|
| 127 |
+
network/NetworkCmp.cc
|
| 128 |
+
network/ParseBus.cc
|
| 129 |
+
network/PortDirection.cc
|
| 130 |
+
network/SdcNetwork.cc
|
| 131 |
+
network/VerilogNamespace.cc
|
| 132 |
+
|
| 133 |
+
parasitics/ConcreteParasitics.cc
|
| 134 |
+
parasitics/EstimateParasitics.cc
|
| 135 |
+
parasitics/Parasitics.cc
|
| 136 |
+
parasitics/ReduceParasitics.cc
|
| 137 |
+
parasitics/ReportParasiticAnnotation.cc
|
| 138 |
+
parasitics/SpefNamespace.cc
|
| 139 |
+
parasitics/SpefReader.cc
|
| 140 |
+
parasitics/SpefReaderPvt.hh
|
| 141 |
+
|
| 142 |
+
power/Power.cc
|
| 143 |
+
power/ReportPower.cc
|
| 144 |
+
power/VcdReader.cc
|
| 145 |
+
power/SaifReader.cc
|
| 146 |
+
power/VcdParse.cc
|
| 147 |
+
|
| 148 |
+
sdc/Clock.cc
|
| 149 |
+
sdc/ClockGatingCheck.cc
|
| 150 |
+
sdc/ClockGroups.cc
|
| 151 |
+
sdc/ClockInsertion.cc
|
| 152 |
+
sdc/ClockLatency.cc
|
| 153 |
+
sdc/CycleAccting.cc
|
| 154 |
+
sdc/DataCheck.cc
|
| 155 |
+
sdc/DeratingFactors.cc
|
| 156 |
+
sdc/DisabledPorts.cc
|
| 157 |
+
sdc/ExceptionPath.cc
|
| 158 |
+
sdc/FilterObjects.cc
|
| 159 |
+
sdc/InputDrive.cc
|
| 160 |
+
sdc/PinPair.cc
|
| 161 |
+
sdc/PortDelay.cc
|
| 162 |
+
sdc/PortExtCap.cc
|
| 163 |
+
sdc/Sdc.cc
|
| 164 |
+
sdc/SdcCmdComment.cc
|
| 165 |
+
sdc/Variables.cc
|
| 166 |
+
sdc/WriteSdc.cc
|
| 167 |
+
|
| 168 |
+
sdf/ReportAnnotation.cc
|
| 169 |
+
sdf/SdfReader.cc
|
| 170 |
+
sdf/SdfWriter.cc
|
| 171 |
+
|
| 172 |
+
search/Bdd.cc
|
| 173 |
+
search/Bfs.cc
|
| 174 |
+
search/CheckMaxSkews.cc
|
| 175 |
+
search/CheckMinPeriods.cc
|
| 176 |
+
search/CheckMinPulseWidths.cc
|
| 177 |
+
search/CheckCapacitances.cc
|
| 178 |
+
search/CheckFanouts.cc
|
| 179 |
+
search/CheckSlews.cc
|
| 180 |
+
search/CheckTiming.cc
|
| 181 |
+
search/ClkInfo.cc
|
| 182 |
+
search/ClkLatency.cc
|
| 183 |
+
search/ClkNetwork.cc
|
| 184 |
+
search/ClkSkew.cc
|
| 185 |
+
search/Crpr.cc
|
| 186 |
+
search/FindRegister.cc
|
| 187 |
+
search/GatedClk.cc
|
| 188 |
+
search/Genclks.cc
|
| 189 |
+
search/Latches.cc
|
| 190 |
+
search/Levelize.cc
|
| 191 |
+
search/MakeTimingModel.cc
|
| 192 |
+
search/Mode.cc
|
| 193 |
+
search/Path.cc
|
| 194 |
+
search/Path.cc
|
| 195 |
+
search/PathEnd.cc
|
| 196 |
+
search/PathEnum.cc
|
| 197 |
+
search/PathExpanded.cc
|
| 198 |
+
search/PathGroup.cc
|
| 199 |
+
search/PocvMode.cc
|
| 200 |
+
search/Property.cc
|
| 201 |
+
search/ReportPath.cc
|
| 202 |
+
search/Search.cc
|
| 203 |
+
search/SearchPred.cc
|
| 204 |
+
search/Scene.cc
|
| 205 |
+
search/Sim.cc
|
| 206 |
+
search/Sta.cc
|
| 207 |
+
search/StaState.cc
|
| 208 |
+
search/Tag.cc
|
| 209 |
+
search/TagGroup.cc
|
| 210 |
+
search/VertexVisitor.cc
|
| 211 |
+
search/VisitPathEnds.cc
|
| 212 |
+
search/WorstSlack.cc
|
| 213 |
+
|
| 214 |
+
spice/WritePathSpice.cc
|
| 215 |
+
spice/WriteSpice.cc
|
| 216 |
+
spice/Xyce.cc
|
| 217 |
+
|
| 218 |
+
tcl/TclTypeHelpers.cc
|
| 219 |
+
|
| 220 |
+
util/Debug.cc
|
| 221 |
+
util/DispatchQueue.cc
|
| 222 |
+
util/Error.cc
|
| 223 |
+
util/Fuzzy.cc
|
| 224 |
+
util/Hash.cc
|
| 225 |
+
util/MinMax.cc
|
| 226 |
+
util/PatternMatch.cc
|
| 227 |
+
util/Report.cc
|
| 228 |
+
util/ReportStd.cc
|
| 229 |
+
util/ReportTcl.cc
|
| 230 |
+
util/RiseFallMinMax.cc
|
| 231 |
+
util/RiseFallMinMaxDelay.cc
|
| 232 |
+
util/RiseFallValues.cc
|
| 233 |
+
util/Stats.cc
|
| 234 |
+
util/StringUtil.cc
|
| 235 |
+
util/Transition.cc
|
| 236 |
+
|
| 237 |
+
verilog/VerilogReader.cc
|
| 238 |
+
verilog/VerilogWriter.cc
|
| 239 |
+
)
|
| 240 |
+
|
| 241 |
+
if(APPLE)
|
| 242 |
+
list(APPEND STA_SOURCE util/MachineApple.cc)
|
| 243 |
+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
| 244 |
+
list(APPEND STA_SOURCE util/MachineLinux.cc)
|
| 245 |
+
elseif(WIN32)
|
| 246 |
+
list(APPEND STA_SOURCE util/MachineWin32.cc)
|
| 247 |
+
else()
|
| 248 |
+
list(APPEND STA_SOURCE util/MachineUnknown.cc)
|
| 249 |
+
endif()
|
| 250 |
+
|
| 251 |
+
# Source files.
|
| 252 |
+
set(STA_TCL_FILES
|
| 253 |
+
tcl/Init.tcl
|
| 254 |
+
tcl/Util.tcl
|
| 255 |
+
tcl/CmdArgs.tcl
|
| 256 |
+
tcl/CmdUtil.tcl
|
| 257 |
+
tcl/Property.tcl
|
| 258 |
+
tcl/Sta.tcl
|
| 259 |
+
tcl/Splash.tcl
|
| 260 |
+
dcalc/DelayCalc.tcl
|
| 261 |
+
graph/Graph.tcl
|
| 262 |
+
liberty/Liberty.tcl
|
| 263 |
+
network/Link.tcl
|
| 264 |
+
network/Network.tcl
|
| 265 |
+
network/NetworkEdit.tcl
|
| 266 |
+
parasitics/Parasitics.tcl
|
| 267 |
+
power/Power.tcl
|
| 268 |
+
sdc/Sdc.tcl
|
| 269 |
+
sdc/Variables.tcl
|
| 270 |
+
sdf/Sdf.tcl
|
| 271 |
+
search/Search.tcl
|
| 272 |
+
spice/WriteSpice.tcl
|
| 273 |
+
verilog/Verilog.tcl
|
| 274 |
+
)
|
| 275 |
+
|
| 276 |
+
################################################################
|
| 277 |
+
#
|
| 278 |
+
# Flex/bison scanner/parsers
|
| 279 |
+
#
|
| 280 |
+
################################################################
|
| 281 |
+
|
| 282 |
+
# Earlier versions of flex use 'register' declarations that are illegal in c++17.
|
| 283 |
+
#find_package(FLEX 2.6.4)
|
| 284 |
+
find_package(FLEX)
|
| 285 |
+
find_package(BISON REQUIRED 3.2)
|
| 286 |
+
|
| 287 |
+
# Verilog scan/parse.
|
| 288 |
+
flex_target(VerilogLex ${STA_HOME}/verilog/VerilogLex.ll
|
| 289 |
+
${CMAKE_CURRENT_BINARY_DIR}/VerilogLex.cc)
|
| 290 |
+
bison_target(VerilogParse ${STA_HOME}/verilog/VerilogParse.yy
|
| 291 |
+
${CMAKE_CURRENT_BINARY_DIR}/VerilogParse.cc)
|
| 292 |
+
add_flex_bison_dependency(VerilogLex VerilogParse)
|
| 293 |
+
|
| 294 |
+
# Liberty scan/parse.
|
| 295 |
+
flex_target(LibertyLex ${STA_HOME}/liberty/LibertyLex.ll
|
| 296 |
+
${CMAKE_CURRENT_BINARY_DIR}/LibertyLex.cc)
|
| 297 |
+
bison_target(LibertyParse ${STA_HOME}/liberty/LibertyParse.yy
|
| 298 |
+
${CMAKE_CURRENT_BINARY_DIR}/LibertyParse.cc)
|
| 299 |
+
add_flex_bison_dependency(LibertyLex LibertyParse)
|
| 300 |
+
|
| 301 |
+
# Liberty Expr scan/parse.
|
| 302 |
+
flex_target(LibExprLex ${STA_HOME}/liberty/LibExprLex.ll
|
| 303 |
+
${CMAKE_CURRENT_BINARY_DIR}/LibExprLex.cc)
|
| 304 |
+
bison_target(LibExprParse ${STA_HOME}/liberty/LibExprParse.yy
|
| 305 |
+
${CMAKE_CURRENT_BINARY_DIR}/LibExprParse.cc)
|
| 306 |
+
add_flex_bison_dependency(LibExprLex LibExprParse)
|
| 307 |
+
|
| 308 |
+
# Sdf scan/parse.
|
| 309 |
+
flex_target(SdfLex ${STA_HOME}/sdf/SdfLex.ll
|
| 310 |
+
${CMAKE_CURRENT_BINARY_DIR}/SdfLex.cc)
|
| 311 |
+
bison_target(SdfParse ${STA_HOME}/sdf/SdfParse.yy
|
| 312 |
+
${CMAKE_CURRENT_BINARY_DIR}/SdfParse.cc)
|
| 313 |
+
add_flex_bison_dependency(SdfLex SdfParse)
|
| 314 |
+
|
| 315 |
+
# Spef scan/parse.
|
| 316 |
+
flex_target(SpefLex ${STA_HOME}/parasitics/SpefLex.ll
|
| 317 |
+
${CMAKE_CURRENT_BINARY_DIR}/SpefLex.cc)
|
| 318 |
+
bison_target(SpefParse ${STA_HOME}/parasitics/SpefParse.yy
|
| 319 |
+
${CMAKE_CURRENT_BINARY_DIR}/SpefParse.cc)
|
| 320 |
+
add_flex_bison_dependency(SpefLex SpefParse)
|
| 321 |
+
|
| 322 |
+
# Saif scan/parse.
|
| 323 |
+
flex_target(SaifLex ${STA_HOME}/power/SaifLex.ll
|
| 324 |
+
${CMAKE_CURRENT_BINARY_DIR}/SaifLex.cc)
|
| 325 |
+
bison_target(SaifParse ${STA_HOME}/power/SaifParse.yy
|
| 326 |
+
${CMAKE_CURRENT_BINARY_DIR}/SaifParse.cc)
|
| 327 |
+
add_flex_bison_dependency(SaifLex SaifParse)
|
| 328 |
+
|
| 329 |
+
# Suppress -Wsign-compare in flex-generated code (yyleng vs int loop counter).
|
| 330 |
+
# Only needed with older GCC (e.g. CentOS 7 stock 4.8.5); newer GCC/flex handle it.
|
| 331 |
+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
| 332 |
+
set_source_files_properties(
|
| 333 |
+
${FLEX_VerilogLex_OUTPUTS}
|
| 334 |
+
${FLEX_LibertyLex_OUTPUTS}
|
| 335 |
+
${FLEX_LibExprLex_OUTPUTS}
|
| 336 |
+
${FLEX_SdfLex_OUTPUTS}
|
| 337 |
+
${FLEX_SpefLex_OUTPUTS}
|
| 338 |
+
${FLEX_SaifLex_OUTPUTS}
|
| 339 |
+
PROPERTIES COMPILE_FLAGS "-Wno-sign-compare"
|
| 340 |
+
)
|
| 341 |
+
endif()
|
| 342 |
+
|
| 343 |
+
################################################################
|
| 344 |
+
|
| 345 |
+
set(STA_TCL_INIT ${CMAKE_CURRENT_BINARY_DIR}/StaTclInitVar.cc)
|
| 346 |
+
|
| 347 |
+
# TCL files included as part of the executable are shoved into StaTclInitVar.cc.
|
| 348 |
+
# These files are encoded and shipped as part of the executable
|
| 349 |
+
# so that they do not have to be installed on the client host.
|
| 350 |
+
add_custom_command(OUTPUT ${STA_TCL_INIT}
|
| 351 |
+
COMMAND etc/TclEncode.tcl ${STA_TCL_INIT} tcl_inits ${STA_TCL_FILES}
|
| 352 |
+
WORKING_DIRECTORY ${STA_HOME}
|
| 353 |
+
DEPENDS ${STA_TCL_FILES} etc/TclEncode.tcl
|
| 354 |
+
)
|
| 355 |
+
|
| 356 |
+
################################################################
|
| 357 |
+
#
|
| 358 |
+
# Library dependencies
|
| 359 |
+
#
|
| 360 |
+
################################################################
|
| 361 |
+
|
| 362 |
+
# OSX tcl is deprecated and prints a warning, so look for a user installed
|
| 363 |
+
# version before using the system version.
|
| 364 |
+
# I tried to override the library search order instead but failed.
|
| 365 |
+
# CMAKE_FIND_FRAMEWORK LAST bypasses the version in the framework directory
|
| 366 |
+
# but not the one in /usr/lib.
|
| 367 |
+
# This calls cmake/FindTCL.cmake
|
| 368 |
+
# Do not use REQUIRED because it also requires TK, which is not used by OpenSTA.
|
| 369 |
+
find_package(TCL)
|
| 370 |
+
|
| 371 |
+
# Referenced by util/StaConfig.hh.cmake
|
| 372 |
+
set(TCL_READLINE 0)
|
| 373 |
+
# check for tclReadline
|
| 374 |
+
if (USE_TCL_READLINE)
|
| 375 |
+
set(TCL_READLINE_POSSIBLE_NAMES
|
| 376 |
+
tclreadline-2.1.0
|
| 377 |
+
tclreadline-2.3.2
|
| 378 |
+
tclreadline-2.3.6
|
| 379 |
+
tclreadline-2.3.7
|
| 380 |
+
tclreadline-2.3.8
|
| 381 |
+
)
|
| 382 |
+
find_library(TCL_READLINE_LIBRARY
|
| 383 |
+
NAMES tclreadline ${TCL_READLINE_POSSIBLE_NAMES}
|
| 384 |
+
PATHS ${TCL_LIB_PATHS}
|
| 385 |
+
)
|
| 386 |
+
if (TCL_READLINE_LIBRARY)
|
| 387 |
+
message(STATUS "TCL readline library: ${TCL_READLINE_LIBRARY}")
|
| 388 |
+
else()
|
| 389 |
+
message(STATUS "TCL readline library: NOT FOUND")
|
| 390 |
+
endif()
|
| 391 |
+
|
| 392 |
+
find_path(TCL_READLINE_INCLUDE tclreadline.h)
|
| 393 |
+
if (TCL_READLINE_INCLUDE)
|
| 394 |
+
message(STATUS "TCL readline header: ${TCL_READLINE_INCLUDE}/tclreadline.h")
|
| 395 |
+
else()
|
| 396 |
+
message(STATUS "TCL readline header: NOT FOUND")
|
| 397 |
+
endif()
|
| 398 |
+
|
| 399 |
+
if (TCL_READLINE_LIBRARY AND TCL_READLINE_INCLUDE)
|
| 400 |
+
set(TCL_READLINE 1)
|
| 401 |
+
endif()
|
| 402 |
+
endif()
|
| 403 |
+
|
| 404 |
+
# Zlib
|
| 405 |
+
include(FindZLIB)
|
| 406 |
+
|
| 407 |
+
find_package(Threads)
|
| 408 |
+
|
| 409 |
+
find_package(Eigen3 REQUIRED)
|
| 410 |
+
|
| 411 |
+
# See if std::format is available and if nor install fmt.
|
| 412 |
+
include(CheckCXXSourceCompiles)
|
| 413 |
+
set(_sta_fmt_check_saved_flags "${CMAKE_REQUIRED_FLAGS}")
|
| 414 |
+
if(MSVC)
|
| 415 |
+
string(APPEND CMAKE_REQUIRED_FLAGS " /std:c++20")
|
| 416 |
+
else()
|
| 417 |
+
string(APPEND CMAKE_REQUIRED_FLAGS " -std=c++20")
|
| 418 |
+
endif()
|
| 419 |
+
check_cxx_source_compiles("
|
| 420 |
+
#include <format>
|
| 421 |
+
#include <string>
|
| 422 |
+
int main() { (void)std::format(\"{}\", 42); return 0; }
|
| 423 |
+
" HAVE_CXX_STD_FORMAT)
|
| 424 |
+
set(CMAKE_REQUIRED_FLAGS "${_sta_fmt_check_saved_flags}")
|
| 425 |
+
|
| 426 |
+
if(HAVE_CXX_STD_FORMAT)
|
| 427 |
+
message(STATUS "std::format: available")
|
| 428 |
+
else()
|
| 429 |
+
# Use spdlog's bundled fmt when available to avoid ODR violations.
|
| 430 |
+
find_package(spdlog QUIET)
|
| 431 |
+
if(spdlog_FOUND)
|
| 432 |
+
message(STATUS "std::format: using spdlog's bundled fmt")
|
| 433 |
+
set(STA_USE_SPDLOG_FMT TRUE)
|
| 434 |
+
get_target_property(_spdlog_inc spdlog::spdlog INTERFACE_INCLUDE_DIRECTORIES)
|
| 435 |
+
set(_fmt_dir "${CMAKE_CURRENT_BINARY_DIR}/_spdlog_fmt")
|
| 436 |
+
file(MAKE_DIRECTORY "${_fmt_dir}")
|
| 437 |
+
file(CREATE_LINK "${_spdlog_inc}/spdlog/fmt/bundled" "${_fmt_dir}/fmt" SYMBOLIC)
|
| 438 |
+
else()
|
| 439 |
+
message(STATUS "std::format: building fmt library")
|
| 440 |
+
include(FetchContent)
|
| 441 |
+
FetchContent_Declare(fmt
|
| 442 |
+
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
|
| 443 |
+
GIT_TAG 11.0.2
|
| 444 |
+
)
|
| 445 |
+
FetchContent_MakeAvailable(fmt)
|
| 446 |
+
endif()
|
| 447 |
+
endif()
|
| 448 |
+
|
| 449 |
+
include(cmake/FindCUDD.cmake)
|
| 450 |
+
|
| 451 |
+
# configure a header file to pass some of the CMake settings
|
| 452 |
+
configure_file(${STA_HOME}/util/StaConfig.hh.cmake
|
| 453 |
+
${CMAKE_CURRENT_BINARY_DIR}/include/sta/StaConfig.hh
|
| 454 |
+
)
|
| 455 |
+
|
| 456 |
+
###########################################################
|
| 457 |
+
# Swig
|
| 458 |
+
###########################################################
|
| 459 |
+
|
| 460 |
+
find_package(SWIG 3.0 REQUIRED)
|
| 461 |
+
message(STATUS "SWIG version: ${SWIG_VERSION}")
|
| 462 |
+
include(UseSWIG)
|
| 463 |
+
|
| 464 |
+
set(STA_SWIG_FILE app/StaApp.i)
|
| 465 |
+
|
| 466 |
+
set_property(SOURCE ${STA_SWIG_FILE}
|
| 467 |
+
PROPERTY CPLUSPLUS ON
|
| 468 |
+
)
|
| 469 |
+
# SWIG flags (CMake UseSWIG).
|
| 470 |
+
set_property(SOURCE ${STA_SWIG_FILE}
|
| 471 |
+
PROPERTY COMPILE_OPTIONS
|
| 472 |
+
-module sta
|
| 473 |
+
-namespace
|
| 474 |
+
-prefix sta
|
| 475 |
+
)
|
| 476 |
+
|
| 477 |
+
set(SWIG_FILES
|
| 478 |
+
${STA_HOME}/dcalc/DelayCalc.i
|
| 479 |
+
${STA_HOME}/graph/Graph.i
|
| 480 |
+
${STA_HOME}/liberty/Liberty.i
|
| 481 |
+
${STA_HOME}/network/Network.i
|
| 482 |
+
${STA_HOME}/network/NetworkEdit.i
|
| 483 |
+
${STA_HOME}/parasitics/Parasitics.i
|
| 484 |
+
${STA_HOME}/power/Power.i
|
| 485 |
+
${STA_HOME}/sdc/Sdc.i
|
| 486 |
+
${STA_HOME}/sdf/Sdf.i
|
| 487 |
+
${STA_HOME}/search/Property.i
|
| 488 |
+
${STA_HOME}/search/Search.i
|
| 489 |
+
${STA_HOME}/spice/WriteSpice.i
|
| 490 |
+
${STA_HOME}/tcl/Exception.i
|
| 491 |
+
${STA_HOME}/tcl/StaTclTypes.i
|
| 492 |
+
${STA_HOME}/util/Util.i
|
| 493 |
+
${STA_HOME}/verilog/Verilog.i
|
| 494 |
+
)
|
| 495 |
+
|
| 496 |
+
set_property(SOURCE ${STA_SWIG_FILE}
|
| 497 |
+
PROPERTY DEPENDS ${SWIG_FILES}
|
| 498 |
+
)
|
| 499 |
+
|
| 500 |
+
swig_add_library(sta_swig
|
| 501 |
+
LANGUAGE tcl
|
| 502 |
+
TYPE STATIC
|
| 503 |
+
SOURCES ${STA_SWIG_FILE}
|
| 504 |
+
)
|
| 505 |
+
|
| 506 |
+
get_target_property(STA_SWIG_CXX_FILE sta_swig SOURCES)
|
| 507 |
+
|
| 508 |
+
set_source_files_properties(${STA_SWIG_CXX_FILE}
|
| 509 |
+
PROPERTIES
|
| 510 |
+
# No simple way to modify the swig template that emits code full of warnings
|
| 511 |
+
# so suppress them.
|
| 512 |
+
COMPILE_OPTIONS "-Wunused-variable;-Wno-cast-qual;-Wno-missing-braces;-Wno-deprecated-declarations"
|
| 513 |
+
)
|
| 514 |
+
|
| 515 |
+
target_link_libraries(sta_swig
|
| 516 |
+
PUBLIC
|
| 517 |
+
OpenSTA
|
| 518 |
+
)
|
| 519 |
+
|
| 520 |
+
# result build/CMakeFiles/sta_swig.dir/StaAppTCL_wrap.cxx
|
| 521 |
+
target_include_directories(sta_swig
|
| 522 |
+
PUBLIC
|
| 523 |
+
include/sta
|
| 524 |
+
|
| 525 |
+
PRIVATE
|
| 526 |
+
${STA_HOME}
|
| 527 |
+
${TCL_INCLUDE_PATH}
|
| 528 |
+
${CMAKE_CURRENT_BINARY_DIR}/include/sta
|
| 529 |
+
)
|
| 530 |
+
|
| 531 |
+
# Pass sta_swig include directories to SWIG as -I (same paths as the C++ build).
|
| 532 |
+
set_property(TARGET sta_swig PROPERTY SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE)
|
| 533 |
+
|
| 534 |
+
###########################################################
|
| 535 |
+
# Library
|
| 536 |
+
###########################################################
|
| 537 |
+
|
| 538 |
+
add_library(OpenSTA)
|
| 539 |
+
|
| 540 |
+
target_sources(OpenSTA
|
| 541 |
+
PRIVATE
|
| 542 |
+
${STA_SOURCE}
|
| 543 |
+
|
| 544 |
+
${STA_TCL_INIT}
|
| 545 |
+
|
| 546 |
+
${FLEX_LibExprLex_OUTPUTS}
|
| 547 |
+
${BISON_LibExprParse_OUTPUTS}
|
| 548 |
+
${FLEX_LibertyLex_OUTPUTS}
|
| 549 |
+
${BISON_LibertyParse_OUTPUTS}
|
| 550 |
+
|
| 551 |
+
${FLEX_SpefLex_OUTPUTS}
|
| 552 |
+
${BISON_SpefParse_OUTPUTS}
|
| 553 |
+
|
| 554 |
+
${FLEX_SdfLex_OUTPUTS}
|
| 555 |
+
${BISON_SdfParse_OUTPUTS}
|
| 556 |
+
|
| 557 |
+
${FLEX_VerilogLex_OUTPUTS}
|
| 558 |
+
${BISON_VerilogParse_OUTPUTS}
|
| 559 |
+
|
| 560 |
+
${FLEX_SaifLex_OUTPUTS}
|
| 561 |
+
${BISON_SaifParse_OUTPUTS}
|
| 562 |
+
)
|
| 563 |
+
|
| 564 |
+
target_link_libraries(OpenSTA
|
| 565 |
+
Eigen3::Eigen
|
| 566 |
+
${TCL_LIBRARY}
|
| 567 |
+
${CMAKE_THREAD_LIBS_INIT}
|
| 568 |
+
${CUDD_LIB}
|
| 569 |
+
)
|
| 570 |
+
|
| 571 |
+
if(NOT HAVE_CXX_STD_FORMAT)
|
| 572 |
+
if(STA_USE_SPDLOG_FMT)
|
| 573 |
+
target_include_directories(OpenSTA PUBLIC "${_fmt_dir}")
|
| 574 |
+
target_link_libraries(OpenSTA spdlog::spdlog)
|
| 575 |
+
else()
|
| 576 |
+
target_link_libraries(OpenSTA fmt::fmt)
|
| 577 |
+
endif()
|
| 578 |
+
endif()
|
| 579 |
+
|
| 580 |
+
if (ZLIB_LIBRARIES)
|
| 581 |
+
target_link_libraries(OpenSTA ${ZLIB_LIBRARIES})
|
| 582 |
+
endif()
|
| 583 |
+
|
| 584 |
+
target_include_directories(OpenSTA
|
| 585 |
+
PUBLIC
|
| 586 |
+
include
|
| 587 |
+
${TCL_INCLUDE_PATH}
|
| 588 |
+
${FLEX_INCLUDE_DIRS}
|
| 589 |
+
${CMAKE_CURRENT_BINARY_DIR}/include/sta
|
| 590 |
+
|
| 591 |
+
PRIVATE
|
| 592 |
+
include/sta
|
| 593 |
+
${STA_HOME}
|
| 594 |
+
${CUDD_INCLUDE}
|
| 595 |
+
# For flex to find location.hh
|
| 596 |
+
${CMAKE_CURRENT_BINARY_DIR}
|
| 597 |
+
)
|
| 598 |
+
|
| 599 |
+
if (TCL_READLINE)
|
| 600 |
+
target_link_libraries(OpenSTA ${TCL_READLINE_LIBRARY})
|
| 601 |
+
target_include_directories(OpenSTA
|
| 602 |
+
PUBLIC
|
| 603 |
+
${TCL_READLINE_INCLUDE})
|
| 604 |
+
endif()
|
| 605 |
+
|
| 606 |
+
# common to gcc/clang
|
| 607 |
+
set(CXX_FLAGS -Wall -Wextra -pedantic -Wcast-qual -Wredundant-decls
|
| 608 |
+
-Wformat-security -Werror=misleading-indentation -Wundef)
|
| 609 |
+
|
| 610 |
+
if(ENABLE_TSAN)
|
| 611 |
+
message(STATUS "Thread sanitizer: ${ENABLE_TSAN}")
|
| 612 |
+
set(CXX_FLAGS "${CXX_FLAGS};-fsanitize=thread")
|
| 613 |
+
string(APPEND CMAKE_EXE_LINKER_FLAGS " -fsanitize=thread")
|
| 614 |
+
endif()
|
| 615 |
+
|
| 616 |
+
if(ENABLE_ASAN)
|
| 617 |
+
message(STATUS "Address sanitizer: ${ENABLE_ASAN}")
|
| 618 |
+
set(CXX_FLAGS "${CXX_FLAGS};-fsanitize=address")
|
| 619 |
+
string(APPEND CMAKE_EXE_LINKER_FLAGS " -fsanitize=address")
|
| 620 |
+
endif()
|
| 621 |
+
|
| 622 |
+
target_compile_options(OpenSTA
|
| 623 |
+
PRIVATE
|
| 624 |
+
$<$<CXX_COMPILER_ID:GNU>:${CXX_FLAGS} -Wno-format-zero-length>
|
| 625 |
+
$<$<CXX_COMPILER_ID:Clang>:${CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments>
|
| 626 |
+
$<$<CXX_COMPILER_ID:AppleClang>:${CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments>
|
| 627 |
+
)
|
| 628 |
+
|
| 629 |
+
# Disable compiler specific extensions like gnu++11.
|
| 630 |
+
set_target_properties(OpenSTA PROPERTIES CXX_EXTENSIONS OFF)
|
| 631 |
+
target_compile_features(OpenSTA PUBLIC cxx_std_20)
|
| 632 |
+
|
| 633 |
+
message(STATUS "STA library: ${CMAKE_BINARY_DIR}/libOpenSTA.a")
|
| 634 |
+
|
| 635 |
+
###########################################################
|
| 636 |
+
# Executable
|
| 637 |
+
###########################################################
|
| 638 |
+
|
| 639 |
+
# Note executable and lib name cannot be the same because
|
| 640 |
+
# on osx something is case insensitive. Using STA for the
|
| 641 |
+
# lib name results in "No rule to make target ../depend.
|
| 642 |
+
add_executable(sta app/Main.cc)
|
| 643 |
+
|
| 644 |
+
target_link_libraries(sta
|
| 645 |
+
PRIVATE
|
| 646 |
+
sta_swig
|
| 647 |
+
OpenSTA
|
| 648 |
+
)
|
| 649 |
+
|
| 650 |
+
message(STATUS "STA executable: ${CMAKE_BINARY_DIR}/sta")
|
| 651 |
+
|
| 652 |
+
################################################################
|
| 653 |
+
# Install
|
| 654 |
+
# cmake .. -DCMAKE_INSTALL_PREFIX=<prefix_path>
|
| 655 |
+
|
| 656 |
+
# executable
|
| 657 |
+
install(TARGETS sta DESTINATION bin)
|
| 658 |
+
|
| 659 |
+
# library
|
| 660 |
+
install(TARGETS OpenSTA DESTINATION lib)
|
| 661 |
+
|
| 662 |
+
# include
|
| 663 |
+
install(DIRECTORY include/sta DESTINATION include)
|
| 664 |
+
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/sta DESTINATION include)
|
| 665 |
+
|
| 666 |
+
################################################################
|
| 667 |
+
|
| 668 |
+
add_custom_target(sta_tags
|
| 669 |
+
COMMAND etags -o TAGS
|
| 670 |
+
${STA_SOURCE}
|
| 671 |
+
*/*.hh
|
| 672 |
+
include/sta/*.hh
|
| 673 |
+
${CMAKE_CURRENT_BINARY_DIR}/include/sta/*.hh
|
| 674 |
+
${SWIG_FILES}
|
| 675 |
+
${SWIG_FILES}
|
| 676 |
+
|
| 677 |
+
# Append tcl tags.
|
| 678 |
+
# Note that the regexp used for tcl files is broken in etags so provide one that works.
|
| 679 |
+
COMMAND etags -a -o TAGS --language=none
|
| 680 |
+
--regex='/^[ \\t]*proc[ \\t]+[a-zA-Z0-9_]+/'
|
| 681 |
+
${STA_TCL_FILES}
|
| 682 |
+
WORKING_DIRECTORY ${STA_HOME}
|
| 683 |
+
)
|
| 684 |
+
|
| 685 |
+
add_custom_command(
|
| 686 |
+
TARGET OpenSTA
|
| 687 |
+
POST_BUILD
|
| 688 |
+
COMMAND ${STA_HOME}/etc/FindMessages.tcl > ${STA_HOME}/doc/messages.txt || true
|
| 689 |
+
WORKING_DIRECTORY ${STA_HOME}
|
| 690 |
+
)
|
| 691 |
+
|
| 692 |
+
################################################################
|
| 693 |
+
# Tests
|
| 694 |
+
################################################################
|
| 695 |
+
|
| 696 |
+
option(BUILD_TESTS "Build unit tests" ON)
|
| 697 |
+
if(BUILD_TESTS)
|
| 698 |
+
enable_testing()
|
| 699 |
+
find_package(GTest REQUIRED)
|
| 700 |
+
include(GoogleTest)
|
| 701 |
+
|
| 702 |
+
# Helper: register a list of Tcl tests for a module.
|
| 703 |
+
# Usage:
|
| 704 |
+
# sta_module_tests("search" TESTS timing analysis ...)
|
| 705 |
+
function(sta_module_tests module_name)
|
| 706 |
+
cmake_parse_arguments(ARG "" "" "TESTS" ${ARGN})
|
| 707 |
+
foreach(test_name ${ARG_TESTS})
|
| 708 |
+
add_test(
|
| 709 |
+
NAME tcl.${module_name}.${test_name}
|
| 710 |
+
COMMAND bash ${STA_HOME}/test/regression.sh $<TARGET_FILE:sta> ${module_name}_${test_name}
|
| 711 |
+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
| 712 |
+
)
|
| 713 |
+
set_tests_properties(tcl.${module_name}.${test_name} PROPERTIES LABELS "tcl;module_${module_name}")
|
| 714 |
+
endforeach()
|
| 715 |
+
endfunction()
|
| 716 |
+
|
| 717 |
+
add_subdirectory(test)
|
| 718 |
+
# Per-module tests
|
| 719 |
+
add_subdirectory(util/test)
|
| 720 |
+
add_subdirectory(liberty/test)
|
| 721 |
+
add_subdirectory(graph/test)
|
| 722 |
+
add_subdirectory(network/test)
|
| 723 |
+
add_subdirectory(sdc/test)
|
| 724 |
+
add_subdirectory(sdf/test)
|
| 725 |
+
add_subdirectory(dcalc/test)
|
| 726 |
+
add_subdirectory(search/test)
|
| 727 |
+
add_subdirectory(parasitics/test)
|
| 728 |
+
add_subdirectory(power/test)
|
| 729 |
+
add_subdirectory(verilog/test)
|
| 730 |
+
add_subdirectory(spice/test)
|
| 731 |
+
endif()
|
The-OpenROAD-Project_OpenSTA/Dockerfile.ubuntu22.04
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ubuntu:22.04
|
| 2 |
+
LABEL author="James Cherry"
|
| 3 |
+
LABEL maintainer="James Cherry <cherry@parallaxsw.com>"
|
| 4 |
+
|
| 5 |
+
# Install basics
|
| 6 |
+
ARG DEBIAN_FRONTEND=noninteractive
|
| 7 |
+
RUN apt-get update && \
|
| 8 |
+
apt-get install -y \
|
| 9 |
+
git \
|
| 10 |
+
wget \
|
| 11 |
+
cmake \
|
| 12 |
+
gcc \
|
| 13 |
+
gdb \
|
| 14 |
+
tcl-dev \
|
| 15 |
+
tcl-tclreadline \
|
| 16 |
+
swig \
|
| 17 |
+
bison \
|
| 18 |
+
flex \
|
| 19 |
+
automake \
|
| 20 |
+
autotools-dev \
|
| 21 |
+
libgtest-dev \
|
| 22 |
+
libeigen3-dev \
|
| 23 |
+
libfmt-dev
|
| 24 |
+
|
| 25 |
+
# Download CUDD
|
| 26 |
+
RUN wget https://raw.githubusercontent.com/davidkebo/cudd/main/cudd_versions/cudd-3.0.0.tar.gz && \
|
| 27 |
+
tar -xvf cudd-3.0.0.tar.gz && \
|
| 28 |
+
rm cudd-3.0.0.tar.gz
|
| 29 |
+
|
| 30 |
+
# Build CUDD
|
| 31 |
+
RUN cd cudd-3.0.0 && \
|
| 32 |
+
mkdir ../cudd && \
|
| 33 |
+
./configure && \
|
| 34 |
+
make -j`nproc`
|
| 35 |
+
|
| 36 |
+
# Copy files and install OpenSTA
|
| 37 |
+
RUN mkdir OpenSTA
|
| 38 |
+
COPY . OpenSTA
|
| 39 |
+
RUN cd OpenSTA && \
|
| 40 |
+
rm -rf build && \
|
| 41 |
+
mkdir build && \
|
| 42 |
+
cd build && \
|
| 43 |
+
cmake -DCUDD_DIR=../cudd-3.0.0 .. && \
|
| 44 |
+
make -j`nproc`
|
| 45 |
+
|
| 46 |
+
# Run sta on entry
|
| 47 |
+
ENTRYPOINT ["OpenSTA/build/sta"]
|
The-OpenROAD-Project_OpenSTA/Dockerfile.ubuntu24.04
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ubuntu:24.04
|
| 2 |
+
LABEL author="James Cherry"
|
| 3 |
+
LABEL maintainer="James Cherry <cherry@parallaxsw.com>"
|
| 4 |
+
|
| 5 |
+
# Install basics
|
| 6 |
+
ARG DEBIAN_FRONTEND=noninteractive
|
| 7 |
+
RUN apt-get update && \
|
| 8 |
+
apt-get install -y \
|
| 9 |
+
git \
|
| 10 |
+
wget \
|
| 11 |
+
cmake \
|
| 12 |
+
gcc \
|
| 13 |
+
gdb \
|
| 14 |
+
tcl-dev \
|
| 15 |
+
tcl-tclreadline \
|
| 16 |
+
swig \
|
| 17 |
+
bison \
|
| 18 |
+
flex \
|
| 19 |
+
automake \
|
| 20 |
+
autotools-dev \
|
| 21 |
+
libeigen3-dev \
|
| 22 |
+
libfmt-dev
|
| 23 |
+
|
| 24 |
+
# Download CUDD
|
| 25 |
+
RUN wget https://raw.githubusercontent.com/davidkebo/cudd/main/cudd_versions/cudd-3.0.0.tar.gz && \
|
| 26 |
+
tar -xvf cudd-3.0.0.tar.gz && \
|
| 27 |
+
rm cudd-3.0.0.tar.gz
|
| 28 |
+
|
| 29 |
+
# Build CUDD
|
| 30 |
+
RUN cd cudd-3.0.0 && \
|
| 31 |
+
mkdir ../cudd && \
|
| 32 |
+
./configure && \
|
| 33 |
+
make -j`nproc`
|
| 34 |
+
|
| 35 |
+
# Copy files and install OpenSTA
|
| 36 |
+
RUN mkdir OpenSTA
|
| 37 |
+
COPY . OpenSTA
|
| 38 |
+
RUN cd OpenSTA && \
|
| 39 |
+
rm -rf build && \
|
| 40 |
+
mkdir build && \
|
| 41 |
+
cd build && \
|
| 42 |
+
cmake -DCUDD_DIR=../cudd-3.0.0 .. && \
|
| 43 |
+
make -j`nproc`
|
| 44 |
+
|
| 45 |
+
# Run sta on entry
|
| 46 |
+
ENTRYPOINT ["OpenSTA/build/sta"]
|
The-OpenROAD-Project_OpenSTA/Jenkinsfile
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@Library('utils@main') _
|
| 2 |
+
|
| 3 |
+
k8sPodTemplate(coordinator: true, cloud: utilPickCloud()) {
|
| 4 |
+
pipelineOpenSTA(k8s: true)
|
| 5 |
+
}
|
The-OpenROAD-Project_OpenSTA/LICENSE
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
|
|
|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3 |
+
|
| 4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
| 5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 6 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
Preamble
|
| 9 |
+
|
| 10 |
+
The GNU General Public License is a free, copyleft license for
|
| 11 |
+
software and other kinds of works.
|
| 12 |
+
|
| 13 |
+
The licenses for most software and other practical works are designed
|
| 14 |
+
to take away your freedom to share and change the works. By contrast,
|
| 15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
| 16 |
+
share and change all versions of a program--to make sure it remains free
|
| 17 |
+
software for all its users. We, the Free Software Foundation, use the
|
| 18 |
+
GNU General Public License for most of our software; it applies also to
|
| 19 |
+
any other work released this way by its authors. You can apply it to
|
| 20 |
+
your programs, too.
|
| 21 |
+
|
| 22 |
+
When we speak of free software, we are referring to freedom, not
|
| 23 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 24 |
+
have the freedom to distribute copies of free software (and charge for
|
| 25 |
+
them if you wish), that you receive source code or can get it if you
|
| 26 |
+
want it, that you can change the software or use pieces of it in new
|
| 27 |
+
free programs, and that you know you can do these things.
|
| 28 |
+
|
| 29 |
+
To protect your rights, we need to prevent others from denying you
|
| 30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
| 31 |
+
certain responsibilities if you distribute copies of the software, or if
|
| 32 |
+
you modify it: responsibilities to respect the freedom of others.
|
| 33 |
+
|
| 34 |
+
For example, if you distribute copies of such a program, whether
|
| 35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
| 36 |
+
freedoms that you received. You must make sure that they, too, receive
|
| 37 |
+
or can get the source code. And you must show them these terms so they
|
| 38 |
+
know their rights.
|
| 39 |
+
|
| 40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
| 41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
| 42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
| 43 |
+
|
| 44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
| 45 |
+
that there is no warranty for this free software. For both users' and
|
| 46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
| 47 |
+
changed, so that their problems will not be attributed erroneously to
|
| 48 |
+
authors of previous versions.
|
| 49 |
+
|
| 50 |
+
Some devices are designed to deny users access to install or run
|
| 51 |
+
modified versions of the software inside them, although the manufacturer
|
| 52 |
+
can do so. This is fundamentally incompatible with the aim of
|
| 53 |
+
protecting users' freedom to change the software. The systematic
|
| 54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
| 55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
| 56 |
+
have designed this version of the GPL to prohibit the practice for those
|
| 57 |
+
products. If such problems arise substantially in other domains, we
|
| 58 |
+
stand ready to extend this provision to those domains in future versions
|
| 59 |
+
of the GPL, as needed to protect the freedom of users.
|
| 60 |
+
|
| 61 |
+
Finally, every program is threatened constantly by software patents.
|
| 62 |
+
States should not allow patents to restrict development and use of
|
| 63 |
+
software on general-purpose computers, but in those that do, we wish to
|
| 64 |
+
avoid the special danger that patents applied to a free program could
|
| 65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
| 66 |
+
patents cannot be used to render the program non-free.
|
| 67 |
+
|
| 68 |
+
The precise terms and conditions for copying, distribution and
|
| 69 |
+
modification follow.
|
| 70 |
+
|
| 71 |
+
TERMS AND CONDITIONS
|
| 72 |
+
|
| 73 |
+
0. Definitions.
|
| 74 |
+
|
| 75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
| 76 |
+
|
| 77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 78 |
+
works, such as semiconductor masks.
|
| 79 |
+
|
| 80 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 82 |
+
"recipients" may be individuals or organizations.
|
| 83 |
+
|
| 84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 85 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 86 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 87 |
+
earlier work or a work "based on" the earlier work.
|
| 88 |
+
|
| 89 |
+
A "covered work" means either the unmodified Program or a work based
|
| 90 |
+
on the Program.
|
| 91 |
+
|
| 92 |
+
To "propagate" a work means to do anything with it that, without
|
| 93 |
+
permission, would make you directly or secondarily liable for
|
| 94 |
+
infringement under applicable copyright law, except executing it on a
|
| 95 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 96 |
+
distribution (with or without modification), making available to the
|
| 97 |
+
public, and in some countries other activities as well.
|
| 98 |
+
|
| 99 |
+
To "convey" a work means any kind of propagation that enables other
|
| 100 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 102 |
+
|
| 103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 104 |
+
to the extent that it includes a convenient and prominently visible
|
| 105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 106 |
+
tells the user that there is no warranty for the work (except to the
|
| 107 |
+
extent that warranties are provided), that licensees may convey the
|
| 108 |
+
work under this License, and how to view a copy of this License. If
|
| 109 |
+
the interface presents a list of user commands or options, such as a
|
| 110 |
+
menu, a prominent item in the list meets this criterion.
|
| 111 |
+
|
| 112 |
+
1. Source Code.
|
| 113 |
+
|
| 114 |
+
The "source code" for a work means the preferred form of the work
|
| 115 |
+
for making modifications to it. "Object code" means any non-source
|
| 116 |
+
form of a work.
|
| 117 |
+
|
| 118 |
+
A "Standard Interface" means an interface that either is an official
|
| 119 |
+
standard defined by a recognized standards body, or, in the case of
|
| 120 |
+
interfaces specified for a particular programming language, one that
|
| 121 |
+
is widely used among developers working in that language.
|
| 122 |
+
|
| 123 |
+
The "System Libraries" of an executable work include anything, other
|
| 124 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 125 |
+
packaging a Major Component, but which is not part of that Major
|
| 126 |
+
Component, and (b) serves only to enable use of the work with that
|
| 127 |
+
Major Component, or to implement a Standard Interface for which an
|
| 128 |
+
implementation is available to the public in source code form. A
|
| 129 |
+
"Major Component", in this context, means a major essential component
|
| 130 |
+
(kernel, window system, and so on) of the specific operating system
|
| 131 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 132 |
+
produce the work, or an object code interpreter used to run it.
|
| 133 |
+
|
| 134 |
+
The "Corresponding Source" for a work in object code form means all
|
| 135 |
+
the source code needed to generate, install, and (for an executable
|
| 136 |
+
work) run the object code and to modify the work, including scripts to
|
| 137 |
+
control those activities. However, it does not include the work's
|
| 138 |
+
System Libraries, or general-purpose tools or generally available free
|
| 139 |
+
programs which are used unmodified in performing those activities but
|
| 140 |
+
which are not part of the work. For example, Corresponding Source
|
| 141 |
+
includes interface definition files associated with source files for
|
| 142 |
+
the work, and the source code for shared libraries and dynamically
|
| 143 |
+
linked subprograms that the work is specifically designed to require,
|
| 144 |
+
such as by intimate data communication or control flow between those
|
| 145 |
+
subprograms and other parts of the work.
|
| 146 |
+
|
| 147 |
+
The Corresponding Source need not include anything that users
|
| 148 |
+
can regenerate automatically from other parts of the Corresponding
|
| 149 |
+
Source.
|
| 150 |
+
|
| 151 |
+
The Corresponding Source for a work in source code form is that
|
| 152 |
+
same work.
|
| 153 |
+
|
| 154 |
+
2. Basic Permissions.
|
| 155 |
+
|
| 156 |
+
All rights granted under this License are granted for the term of
|
| 157 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 158 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 159 |
+
permission to run the unmodified Program. The output from running a
|
| 160 |
+
covered work is covered by this License only if the output, given its
|
| 161 |
+
content, constitutes a covered work. This License acknowledges your
|
| 162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 163 |
+
|
| 164 |
+
You may make, run and propagate covered works that you do not
|
| 165 |
+
convey, without conditions so long as your license otherwise remains
|
| 166 |
+
in force. You may convey covered works to others for the sole purpose
|
| 167 |
+
of having them make modifications exclusively for you, or provide you
|
| 168 |
+
with facilities for running those works, provided that you comply with
|
| 169 |
+
the terms of this License in conveying all material for which you do
|
| 170 |
+
not control copyright. Those thus making or running the covered works
|
| 171 |
+
for you must do so exclusively on your behalf, under your direction
|
| 172 |
+
and control, on terms that prohibit them from making any copies of
|
| 173 |
+
your copyrighted material outside their relationship with you.
|
| 174 |
+
|
| 175 |
+
Conveying under any other circumstances is permitted solely under
|
| 176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 177 |
+
makes it unnecessary.
|
| 178 |
+
|
| 179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 180 |
+
|
| 181 |
+
No covered work shall be deemed part of an effective technological
|
| 182 |
+
measure under any applicable law fulfilling obligations under article
|
| 183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 184 |
+
similar laws prohibiting or restricting circumvention of such
|
| 185 |
+
measures.
|
| 186 |
+
|
| 187 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 188 |
+
circumvention of technological measures to the extent such circumvention
|
| 189 |
+
is effected by exercising rights under this License with respect to
|
| 190 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 191 |
+
modification of the work as a means of enforcing, against the work's
|
| 192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 193 |
+
technological measures.
|
| 194 |
+
|
| 195 |
+
4. Conveying Verbatim Copies.
|
| 196 |
+
|
| 197 |
+
You may convey verbatim copies of the Program's source code as you
|
| 198 |
+
receive it, in any medium, provided that you conspicuously and
|
| 199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 200 |
+
keep intact all notices stating that this License and any
|
| 201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 202 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 203 |
+
recipients a copy of this License along with the Program.
|
| 204 |
+
|
| 205 |
+
You may charge any price or no price for each copy that you convey,
|
| 206 |
+
and you may offer support or warranty protection for a fee.
|
| 207 |
+
|
| 208 |
+
5. Conveying Modified Source Versions.
|
| 209 |
+
|
| 210 |
+
You may convey a work based on the Program, or the modifications to
|
| 211 |
+
produce it from the Program, in the form of source code under the
|
| 212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 213 |
+
|
| 214 |
+
a) The work must carry prominent notices stating that you modified
|
| 215 |
+
it, and giving a relevant date.
|
| 216 |
+
|
| 217 |
+
b) The work must carry prominent notices stating that it is
|
| 218 |
+
released under this License and any conditions added under section
|
| 219 |
+
7. This requirement modifies the requirement in section 4 to
|
| 220 |
+
"keep intact all notices".
|
| 221 |
+
|
| 222 |
+
c) You must license the entire work, as a whole, under this
|
| 223 |
+
License to anyone who comes into possession of a copy. This
|
| 224 |
+
License will therefore apply, along with any applicable section 7
|
| 225 |
+
additional terms, to the whole of the work, and all its parts,
|
| 226 |
+
regardless of how they are packaged. This License gives no
|
| 227 |
+
permission to license the work in any other way, but it does not
|
| 228 |
+
invalidate such permission if you have separately received it.
|
| 229 |
+
|
| 230 |
+
d) If the work has interactive user interfaces, each must display
|
| 231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 233 |
+
work need not make them do so.
|
| 234 |
+
|
| 235 |
+
A compilation of a covered work with other separate and independent
|
| 236 |
+
works, which are not by their nature extensions of the covered work,
|
| 237 |
+
and which are not combined with it such as to form a larger program,
|
| 238 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 240 |
+
used to limit the access or legal rights of the compilation's users
|
| 241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 242 |
+
in an aggregate does not cause this License to apply to the other
|
| 243 |
+
parts of the aggregate.
|
| 244 |
+
|
| 245 |
+
6. Conveying Non-Source Forms.
|
| 246 |
+
|
| 247 |
+
You may convey a covered work in object code form under the terms
|
| 248 |
+
of sections 4 and 5, provided that you also convey the
|
| 249 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 250 |
+
in one of these ways:
|
| 251 |
+
|
| 252 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 253 |
+
(including a physical distribution medium), accompanied by the
|
| 254 |
+
Corresponding Source fixed on a durable physical medium
|
| 255 |
+
customarily used for software interchange.
|
| 256 |
+
|
| 257 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 258 |
+
(including a physical distribution medium), accompanied by a
|
| 259 |
+
written offer, valid for at least three years and valid for as
|
| 260 |
+
long as you offer spare parts or customer support for that product
|
| 261 |
+
model, to give anyone who possesses the object code either (1) a
|
| 262 |
+
copy of the Corresponding Source for all the software in the
|
| 263 |
+
product that is covered by this License, on a durable physical
|
| 264 |
+
medium customarily used for software interchange, for a price no
|
| 265 |
+
more than your reasonable cost of physically performing this
|
| 266 |
+
conveying of source, or (2) access to copy the
|
| 267 |
+
Corresponding Source from a network server at no charge.
|
| 268 |
+
|
| 269 |
+
c) Convey individual copies of the object code with a copy of the
|
| 270 |
+
written offer to provide the Corresponding Source. This
|
| 271 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 272 |
+
only if you received the object code with such an offer, in accord
|
| 273 |
+
with subsection 6b.
|
| 274 |
+
|
| 275 |
+
d) Convey the object code by offering access from a designated
|
| 276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 277 |
+
Corresponding Source in the same way through the same place at no
|
| 278 |
+
further charge. You need not require recipients to copy the
|
| 279 |
+
Corresponding Source along with the object code. If the place to
|
| 280 |
+
copy the object code is a network server, the Corresponding Source
|
| 281 |
+
may be on a different server (operated by you or a third party)
|
| 282 |
+
that supports equivalent copying facilities, provided you maintain
|
| 283 |
+
clear directions next to the object code saying where to find the
|
| 284 |
+
Corresponding Source. Regardless of what server hosts the
|
| 285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 286 |
+
available for as long as needed to satisfy these requirements.
|
| 287 |
+
|
| 288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 289 |
+
you inform other peers where the object code and Corresponding
|
| 290 |
+
Source of the work are being offered to the general public at no
|
| 291 |
+
charge under subsection 6d.
|
| 292 |
+
|
| 293 |
+
A separable portion of the object code, whose source code is excluded
|
| 294 |
+
from the Corresponding Source as a System Library, need not be
|
| 295 |
+
included in conveying the object code work.
|
| 296 |
+
|
| 297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 298 |
+
tangible personal property which is normally used for personal, family,
|
| 299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 302 |
+
product received by a particular user, "normally used" refers to a
|
| 303 |
+
typical or common use of that class of product, regardless of the status
|
| 304 |
+
of the particular user or of the way in which the particular user
|
| 305 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 306 |
+
is a consumer product regardless of whether the product has substantial
|
| 307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 308 |
+
the only significant mode of use of the product.
|
| 309 |
+
|
| 310 |
+
"Installation Information" for a User Product means any methods,
|
| 311 |
+
procedures, authorization keys, or other information required to install
|
| 312 |
+
and execute modified versions of a covered work in that User Product from
|
| 313 |
+
a modified version of its Corresponding Source. The information must
|
| 314 |
+
suffice to ensure that the continued functioning of the modified object
|
| 315 |
+
code is in no case prevented or interfered with solely because
|
| 316 |
+
modification has been made.
|
| 317 |
+
|
| 318 |
+
If you convey an object code work under this section in, or with, or
|
| 319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 320 |
+
part of a transaction in which the right of possession and use of the
|
| 321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 322 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 323 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 324 |
+
by the Installation Information. But this requirement does not apply
|
| 325 |
+
if neither you nor any third party retains the ability to install
|
| 326 |
+
modified object code on the User Product (for example, the work has
|
| 327 |
+
been installed in ROM).
|
| 328 |
+
|
| 329 |
+
The requirement to provide Installation Information does not include a
|
| 330 |
+
requirement to continue to provide support service, warranty, or updates
|
| 331 |
+
for a work that has been modified or installed by the recipient, or for
|
| 332 |
+
the User Product in which it has been modified or installed. Access to a
|
| 333 |
+
network may be denied when the modification itself materially and
|
| 334 |
+
adversely affects the operation of the network or violates the rules and
|
| 335 |
+
protocols for communication across the network.
|
| 336 |
+
|
| 337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 338 |
+
in accord with this section must be in a format that is publicly
|
| 339 |
+
documented (and with an implementation available to the public in
|
| 340 |
+
source code form), and must require no special password or key for
|
| 341 |
+
unpacking, reading or copying.
|
| 342 |
+
|
| 343 |
+
7. Additional Terms.
|
| 344 |
+
|
| 345 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 346 |
+
License by making exceptions from one or more of its conditions.
|
| 347 |
+
Additional permissions that are applicable to the entire Program shall
|
| 348 |
+
be treated as though they were included in this License, to the extent
|
| 349 |
+
that they are valid under applicable law. If additional permissions
|
| 350 |
+
apply only to part of the Program, that part may be used separately
|
| 351 |
+
under those permissions, but the entire Program remains governed by
|
| 352 |
+
this License without regard to the additional permissions.
|
| 353 |
+
|
| 354 |
+
When you convey a copy of a covered work, you may at your option
|
| 355 |
+
remove any additional permissions from that copy, or from any part of
|
| 356 |
+
it. (Additional permissions may be written to require their own
|
| 357 |
+
removal in certain cases when you modify the work.) You may place
|
| 358 |
+
additional permissions on material, added by you to a covered work,
|
| 359 |
+
for which you have or can give appropriate copyright permission.
|
| 360 |
+
|
| 361 |
+
Notwithstanding any other provision of this License, for material you
|
| 362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 363 |
+
that material) supplement the terms of this License with terms:
|
| 364 |
+
|
| 365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 366 |
+
terms of sections 15 and 16 of this License; or
|
| 367 |
+
|
| 368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 369 |
+
author attributions in that material or in the Appropriate Legal
|
| 370 |
+
Notices displayed by works containing it; or
|
| 371 |
+
|
| 372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 373 |
+
requiring that modified versions of such material be marked in
|
| 374 |
+
reasonable ways as different from the original version; or
|
| 375 |
+
|
| 376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 377 |
+
authors of the material; or
|
| 378 |
+
|
| 379 |
+
e) Declining to grant rights under trademark law for use of some
|
| 380 |
+
trade names, trademarks, or service marks; or
|
| 381 |
+
|
| 382 |
+
f) Requiring indemnification of licensors and authors of that
|
| 383 |
+
material by anyone who conveys the material (or modified versions of
|
| 384 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 385 |
+
any liability that these contractual assumptions directly impose on
|
| 386 |
+
those licensors and authors.
|
| 387 |
+
|
| 388 |
+
All other non-permissive additional terms are considered "further
|
| 389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 390 |
+
received it, or any part of it, contains a notice stating that it is
|
| 391 |
+
governed by this License along with a term that is a further
|
| 392 |
+
restriction, you may remove that term. If a license document contains
|
| 393 |
+
a further restriction but permits relicensing or conveying under this
|
| 394 |
+
License, you may add to a covered work material governed by the terms
|
| 395 |
+
of that license document, provided that the further restriction does
|
| 396 |
+
not survive such relicensing or conveying.
|
| 397 |
+
|
| 398 |
+
If you add terms to a covered work in accord with this section, you
|
| 399 |
+
must place, in the relevant source files, a statement of the
|
| 400 |
+
additional terms that apply to those files, or a notice indicating
|
| 401 |
+
where to find the applicable terms.
|
| 402 |
+
|
| 403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 404 |
+
form of a separately written license, or stated as exceptions;
|
| 405 |
+
the above requirements apply either way.
|
| 406 |
+
|
| 407 |
+
8. Termination.
|
| 408 |
+
|
| 409 |
+
You may not propagate or modify a covered work except as expressly
|
| 410 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 411 |
+
modify it is void, and will automatically terminate your rights under
|
| 412 |
+
this License (including any patent licenses granted under the third
|
| 413 |
+
paragraph of section 11).
|
| 414 |
+
|
| 415 |
+
However, if you cease all violation of this License, then your
|
| 416 |
+
license from a particular copyright holder is reinstated (a)
|
| 417 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 419 |
+
holder fails to notify you of the violation by some reasonable means
|
| 420 |
+
prior to 60 days after the cessation.
|
| 421 |
+
|
| 422 |
+
Moreover, your license from a particular copyright holder is
|
| 423 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 424 |
+
violation by some reasonable means, this is the first time you have
|
| 425 |
+
received notice of violation of this License (for any work) from that
|
| 426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 427 |
+
your receipt of the notice.
|
| 428 |
+
|
| 429 |
+
Termination of your rights under this section does not terminate the
|
| 430 |
+
licenses of parties who have received copies or rights from you under
|
| 431 |
+
this License. If your rights have been terminated and not permanently
|
| 432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 433 |
+
material under section 10.
|
| 434 |
+
|
| 435 |
+
9. Acceptance Not Required for Having Copies.
|
| 436 |
+
|
| 437 |
+
You are not required to accept this License in order to receive or
|
| 438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 440 |
+
to receive a copy likewise does not require acceptance. However,
|
| 441 |
+
nothing other than this License grants you permission to propagate or
|
| 442 |
+
modify any covered work. These actions infringe copyright if you do
|
| 443 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 444 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 445 |
+
|
| 446 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 447 |
+
|
| 448 |
+
Each time you convey a covered work, the recipient automatically
|
| 449 |
+
receives a license from the original licensors, to run, modify and
|
| 450 |
+
propagate that work, subject to this License. You are not responsible
|
| 451 |
+
for enforcing compliance by third parties with this License.
|
| 452 |
+
|
| 453 |
+
An "entity transaction" is a transaction transferring control of an
|
| 454 |
+
organization, or substantially all assets of one, or subdividing an
|
| 455 |
+
organization, or merging organizations. If propagation of a covered
|
| 456 |
+
work results from an entity transaction, each party to that
|
| 457 |
+
transaction who receives a copy of the work also receives whatever
|
| 458 |
+
licenses to the work the party's predecessor in interest had or could
|
| 459 |
+
give under the previous paragraph, plus a right to possession of the
|
| 460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 461 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 462 |
+
|
| 463 |
+
You may not impose any further restrictions on the exercise of the
|
| 464 |
+
rights granted or affirmed under this License. For example, you may
|
| 465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 466 |
+
rights granted under this License, and you may not initiate litigation
|
| 467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 468 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 469 |
+
sale, or importing the Program or any portion of it.
|
| 470 |
+
|
| 471 |
+
11. Patents.
|
| 472 |
+
|
| 473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 474 |
+
License of the Program or a work on which the Program is based. The
|
| 475 |
+
work thus licensed is called the contributor's "contributor version".
|
| 476 |
+
|
| 477 |
+
A contributor's "essential patent claims" are all patent claims
|
| 478 |
+
owned or controlled by the contributor, whether already acquired or
|
| 479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 480 |
+
by this License, of making, using, or selling its contributor version,
|
| 481 |
+
but do not include claims that would be infringed only as a
|
| 482 |
+
consequence of further modification of the contributor version. For
|
| 483 |
+
purposes of this definition, "control" includes the right to grant
|
| 484 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 485 |
+
this License.
|
| 486 |
+
|
| 487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 488 |
+
patent license under the contributor's essential patent claims, to
|
| 489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 490 |
+
propagate the contents of its contributor version.
|
| 491 |
+
|
| 492 |
+
In the following three paragraphs, a "patent license" is any express
|
| 493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 494 |
+
(such as an express permission to practice a patent or covenant not to
|
| 495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 496 |
+
party means to make such an agreement or commitment not to enforce a
|
| 497 |
+
patent against the party.
|
| 498 |
+
|
| 499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 500 |
+
and the Corresponding Source of the work is not available for anyone
|
| 501 |
+
to copy, free of charge and under the terms of this License, through a
|
| 502 |
+
publicly available network server or other readily accessible means,
|
| 503 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 506 |
+
consistent with the requirements of this License, to extend the patent
|
| 507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 508 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 509 |
+
covered work in a country, or your recipient's use of the covered work
|
| 510 |
+
in a country, would infringe one or more identifiable patents in that
|
| 511 |
+
country that you have reason to believe are valid.
|
| 512 |
+
|
| 513 |
+
If, pursuant to or in connection with a single transaction or
|
| 514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 515 |
+
covered work, and grant a patent license to some of the parties
|
| 516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 517 |
+
or convey a specific copy of the covered work, then the patent license
|
| 518 |
+
you grant is automatically extended to all recipients of the covered
|
| 519 |
+
work and works based on it.
|
| 520 |
+
|
| 521 |
+
A patent license is "discriminatory" if it does not include within
|
| 522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 524 |
+
specifically granted under this License. You may not convey a covered
|
| 525 |
+
work if you are a party to an arrangement with a third party that is
|
| 526 |
+
in the business of distributing software, under which you make payment
|
| 527 |
+
to the third party based on the extent of your activity of conveying
|
| 528 |
+
the work, and under which the third party grants, to any of the
|
| 529 |
+
parties who would receive the covered work from you, a discriminatory
|
| 530 |
+
patent license (a) in connection with copies of the covered work
|
| 531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 532 |
+
for and in connection with specific products or compilations that
|
| 533 |
+
contain the covered work, unless you entered into that arrangement,
|
| 534 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 535 |
+
|
| 536 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 537 |
+
any implied license or other defenses to infringement that may
|
| 538 |
+
otherwise be available to you under applicable patent law.
|
| 539 |
+
|
| 540 |
+
12. No Surrender of Others' Freedom.
|
| 541 |
+
|
| 542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 543 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 546 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 548 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 549 |
+
the Program, the only way you could satisfy both those terms and this
|
| 550 |
+
License would be to refrain entirely from conveying the Program.
|
| 551 |
+
|
| 552 |
+
13. Use with the GNU Affero General Public License.
|
| 553 |
+
|
| 554 |
+
Notwithstanding any other provision of this License, you have
|
| 555 |
+
permission to link or combine any covered work with a work licensed
|
| 556 |
+
under version 3 of the GNU Affero General Public License into a single
|
| 557 |
+
combined work, and to convey the resulting work. The terms of this
|
| 558 |
+
License will continue to apply to the part which is the covered work,
|
| 559 |
+
but the special requirements of the GNU Affero General Public License,
|
| 560 |
+
section 13, concerning interaction through a network will apply to the
|
| 561 |
+
combination as such.
|
| 562 |
+
|
| 563 |
+
14. Revised Versions of this License.
|
| 564 |
+
|
| 565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 566 |
+
the GNU General Public License from time to time. Such new versions will
|
| 567 |
+
be similar in spirit to the present version, but may differ in detail to
|
| 568 |
+
address new problems or concerns.
|
| 569 |
+
|
| 570 |
+
Each version is given a distinguishing version number. If the
|
| 571 |
+
Program specifies that a certain numbered version of the GNU General
|
| 572 |
+
Public License "or any later version" applies to it, you have the
|
| 573 |
+
option of following the terms and conditions either of that numbered
|
| 574 |
+
version or of any later version published by the Free Software
|
| 575 |
+
Foundation. If the Program does not specify a version number of the
|
| 576 |
+
GNU General Public License, you may choose any version ever published
|
| 577 |
+
by the Free Software Foundation.
|
| 578 |
+
|
| 579 |
+
If the Program specifies that a proxy can decide which future
|
| 580 |
+
versions of the GNU General Public License can be used, that proxy's
|
| 581 |
+
public statement of acceptance of a version permanently authorizes you
|
| 582 |
+
to choose that version for the Program.
|
| 583 |
+
|
| 584 |
+
Later license versions may give you additional or different
|
| 585 |
+
permissions. However, no additional obligations are imposed on any
|
| 586 |
+
author or copyright holder as a result of your choosing to follow a
|
| 587 |
+
later version.
|
| 588 |
+
|
| 589 |
+
15. Disclaimer of Warranty.
|
| 590 |
+
|
| 591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 599 |
+
|
| 600 |
+
16. Limitation of Liability.
|
| 601 |
+
|
| 602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 610 |
+
SUCH DAMAGES.
|
| 611 |
+
|
| 612 |
+
17. Interpretation of Sections 15 and 16.
|
| 613 |
+
|
| 614 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 615 |
+
above cannot be given local legal effect according to their terms,
|
| 616 |
+
reviewing courts shall apply local law that most closely approximates
|
| 617 |
+
an absolute waiver of all civil liability in connection with the
|
| 618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 619 |
+
copy of the Program in return for a fee.
|
| 620 |
+
|
| 621 |
+
END OF TERMS AND CONDITIONS
|
| 622 |
+
|
| 623 |
+
How to Apply These Terms to Your New Programs
|
| 624 |
+
|
| 625 |
+
If you develop a new program, and you want it to be of the greatest
|
| 626 |
+
possible use to the public, the best way to achieve this is to make it
|
| 627 |
+
free software which everyone can redistribute and change under these terms.
|
| 628 |
+
|
| 629 |
+
To do so, attach the following notices to the program. It is safest
|
| 630 |
+
to attach them to the start of each source file to most effectively
|
| 631 |
+
state the exclusion of warranty; and each file should have at least
|
| 632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 633 |
+
|
| 634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 635 |
+
Copyright (C) <year> <name of author>
|
| 636 |
+
|
| 637 |
+
This program is free software: you can redistribute it and/or modify
|
| 638 |
+
it under the terms of the GNU General Public License as published by
|
| 639 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 640 |
+
(at your option) any later version.
|
| 641 |
+
|
| 642 |
+
This program is distributed in the hope that it will be useful,
|
| 643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 645 |
+
GNU General Public License for more details.
|
| 646 |
+
|
| 647 |
+
You should have received a copy of the GNU General Public License
|
| 648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 649 |
+
|
| 650 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 651 |
+
|
| 652 |
+
If the program does terminal interaction, make it output a short
|
| 653 |
+
notice like this when it starts in an interactive mode:
|
| 654 |
+
|
| 655 |
+
<program> Copyright (C) <year> <name of author>
|
| 656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
| 657 |
+
This is free software, and you are welcome to redistribute it
|
| 658 |
+
under certain conditions; type `show c' for details.
|
| 659 |
+
|
| 660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
| 661 |
+
parts of the General Public License. Of course, your program's commands
|
| 662 |
+
might be different; for a GUI interface, you would use an "about box".
|
| 663 |
+
|
| 664 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
| 667 |
+
<https://www.gnu.org/licenses/>.
|
| 668 |
+
|
| 669 |
+
The GNU General Public License does not permit incorporating your program
|
| 670 |
+
into proprietary programs. If your program is a subroutine library, you
|
| 671 |
+
may consider it more useful to permit linking proprietary applications with
|
| 672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
| 673 |
+
Public License instead of this License. But first, please read
|
| 674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
The-OpenROAD-Project_OpenSTA/README.md
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Parallax Static Timing Analyzer
|
| 2 |
+
|
| 3 |
+
OpenSTA is a gate level static timing verifier. As a stand-alone
|
| 4 |
+
executable it can be used to verify the timing of a design using
|
| 5 |
+
standard file formats.
|
| 6 |
+
|
| 7 |
+
* Verilog netlist
|
| 8 |
+
* Liberty library
|
| 9 |
+
* SDC timing constraints
|
| 10 |
+
* SDF delay annotation
|
| 11 |
+
* SPEF parasitics
|
| 12 |
+
* VCD power acitivies
|
| 13 |
+
* SAIF power acitivies
|
| 14 |
+
|
| 15 |
+
OpenSTA uses a TCL command interpreter to read the design, specify
|
| 16 |
+
timing constraints and print timing reports.
|
| 17 |
+
|
| 18 |
+
##### Clocks
|
| 19 |
+
* Generated
|
| 20 |
+
* Latency
|
| 21 |
+
* Source latency (insertion delay)
|
| 22 |
+
* Uncertainty
|
| 23 |
+
* Propagated/Ideal
|
| 24 |
+
* Gated clock checks
|
| 25 |
+
* Multiple frequency clocks
|
| 26 |
+
|
| 27 |
+
##### Exception paths
|
| 28 |
+
* False path
|
| 29 |
+
* Multicycle path
|
| 30 |
+
* Min/Max path delay
|
| 31 |
+
* Exception points
|
| 32 |
+
* -from clock/pin/instance -through pin/net -to clock/pin/instance
|
| 33 |
+
* Edge specific exception points
|
| 34 |
+
* -rise_from/-fall_from, -rise_through/-fall_through, -rise_to/-fall_to
|
| 35 |
+
|
| 36 |
+
##### Delay calculation
|
| 37 |
+
* Integrated Dartu/Menezes/Pileggi RC effective capacitance algorithm
|
| 38 |
+
* External delay calculator API
|
| 39 |
+
|
| 40 |
+
##### Analysis
|
| 41 |
+
* Report timing checks -from, -through, -to, multiple paths to endpoint
|
| 42 |
+
* Report delay calculation
|
| 43 |
+
* Check timing setup
|
| 44 |
+
|
| 45 |
+
##### Timing Engine
|
| 46 |
+
OpenSTA is architected to be easily bolted on to other tools as a
|
| 47 |
+
timing engine. By using a network adapter, OpenSTA can access the host
|
| 48 |
+
netlist data structures without duplicating them.
|
| 49 |
+
|
| 50 |
+
* Query based incremental update of delays, arrival and required times
|
| 51 |
+
* Simulator to propagate constants from constraints and netlist tie high/low
|
| 52 |
+
|
| 53 |
+
See doc/OpenSTA.pdf for command documentation.
|
| 54 |
+
See doc/ChangeLog.txt for changes to commands.
|
| 55 |
+
See doc/StaApi.txt for timing engine API documentation.
|
| 56 |
+
|
| 57 |
+
OpenSTA is dual licensed. It is released under GPL v3 as OpenSTA and
|
| 58 |
+
is also licensed for commerical applications by Parallax Software without
|
| 59 |
+
the GPL's requirements.
|
| 60 |
+
|
| 61 |
+
OpenSTA is open source, meaning the sources are published and can be
|
| 62 |
+
compiled locally. Derivative works are supported as long as they
|
| 63 |
+
adhere to the GPL license requirements. However, OpenSTA is not
|
| 64 |
+
supported by a public community of developers as many other open
|
| 65 |
+
source projects are. The copyright and development are exclusive to
|
| 66 |
+
Parallax Software.
|
| 67 |
+
|
| 68 |
+
Removing copyright and license notices from OpenSTA sources (or any
|
| 69 |
+
other open source project for that matter) is illegal. This should be
|
| 70 |
+
obvious, but the author of OpenSTA has discovered two different cases
|
| 71 |
+
where the copyright and license were removed from source files that
|
| 72 |
+
were copied.
|
| 73 |
+
|
| 74 |
+
The official git repository is located at
|
| 75 |
+
https://github.com/parallaxsw/OpenSTA.git. Any forks from this code
|
| 76 |
+
base have not passed extensive regression testing which is not
|
| 77 |
+
publicly available.
|
| 78 |
+
|
| 79 |
+
## Build from source
|
| 80 |
+
|
| 81 |
+
OpenSTA is built with CMake.
|
| 82 |
+
|
| 83 |
+
### Prerequisites
|
| 84 |
+
|
| 85 |
+
The build dependency versions are shown below. Other versions may
|
| 86 |
+
work, but these are the versions used for development.
|
| 87 |
+
|
| 88 |
+
```
|
| 89 |
+
Ubuntu Macos
|
| 90 |
+
22.04.2 14.5
|
| 91 |
+
cmake 3.24.2 3.29.2
|
| 92 |
+
clang 15.0.0
|
| 93 |
+
gcc 11.4.0
|
| 94 |
+
tcl 8.6 8.6.16
|
| 95 |
+
swig 4.1.0 4.1.1
|
| 96 |
+
bison 3.8.2 3.8.2
|
| 97 |
+
flex 2.6.4 2.6.4
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
External library dependencies:
|
| 101 |
+
```
|
| 102 |
+
Ubuntu Darwin License
|
| 103 |
+
eigen 3.4.0 3.4.0 MPL2 required
|
| 104 |
+
cudd 3.0.0 3.0.0 BSD required
|
| 105 |
+
tclreadline 2.3.8 2.3.8 BSD optional
|
| 106 |
+
zLib 1.2.5 1.2.8 zlib optional
|
| 107 |
+
libfmt 8.1.1 N/A MIT required if std::format not available
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
The [TCL readline library](https://tclreadline.sourceforge.net/tclreadline.html)
|
| 111 |
+
links the GNU readline library to the TCL interpreter for command line
|
| 112 |
+
editing To enable TCL readline support use the following Cmake option:
|
| 113 |
+
See (https://tclreadline.sourceforge.net/) for TCL readline
|
| 114 |
+
documentation. To change the overly verbose default prompt, add
|
| 115 |
+
something this to your ~/.sta init file:
|
| 116 |
+
|
| 117 |
+
```
|
| 118 |
+
if { ![catch {package require tclreadline}] } {
|
| 119 |
+
proc tclreadline::prompt1 {} {
|
| 120 |
+
return "> "
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
The Zlib library is an optional. If CMake finds libz, OpenSTA can
|
| 126 |
+
read Liberty, Verilog, SDF, SPF, and SPEF files compressed with gzip.
|
| 127 |
+
|
| 128 |
+
[CUDD](https://github.com/cuddorg/cudd) is a binary decision diagram (BDD)
|
| 129 |
+
package that is used to improve conditional timing arc handling, constant
|
| 130 |
+
propagation, power activity propagation and spice netlist generation.
|
| 131 |
+
|
| 132 |
+
Download and build CUDD:
|
| 133 |
+
|
| 134 |
+
```
|
| 135 |
+
git clone https://github.com/cuddorg/cudd.git
|
| 136 |
+
cd cudd
|
| 137 |
+
git checkout 3.0.0
|
| 138 |
+
./configure
|
| 139 |
+
make
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
You can use the "configure --prefix" option and "make install" to install CUDD
|
| 143 |
+
in a different directory.
|
| 144 |
+
|
| 145 |
+
Modern c++ compilers that support c++20 include support for std::format.
|
| 146 |
+
With older compilers like gcc 11 on Ubuntu 22.04 and Centos7 the fmt library
|
| 147 |
+
is used instead. If it is not installed locally, the github repository is
|
| 148 |
+
downloaded and compiled in the build directory.
|
| 149 |
+
|
| 150 |
+
### Building with CMake
|
| 151 |
+
|
| 152 |
+
Use the following commands to checkout the git repository and build the
|
| 153 |
+
OpenSTA library and excutable.
|
| 154 |
+
|
| 155 |
+
```
|
| 156 |
+
git clone https://github.com/parallaxsw/OpenSTA.git
|
| 157 |
+
cd OpenSTA
|
| 158 |
+
mkdir build
|
| 159 |
+
cd build
|
| 160 |
+
cmake -DCUDD_DIR=<CUDD_INSTALL_DIR> ..
|
| 161 |
+
make
|
| 162 |
+
```
|
| 163 |
+
The default build type is release to compile optimized code.
|
| 164 |
+
The resulting executable is in `build/sta`.
|
| 165 |
+
The library without a `main()` procedure is `build/libOpenSTA.a`.
|
| 166 |
+
|
| 167 |
+
Optional CMake variables passed as -D<var>=<value> arguments to CMake are show below.
|
| 168 |
+
|
| 169 |
+
```
|
| 170 |
+
CMAKE_BUILD_TYPE DEBUG|RELEASE
|
| 171 |
+
CMAKE_CXX_FLAGS - additional compiler flags
|
| 172 |
+
TCL_LIBRARY - path to tcl library
|
| 173 |
+
TCL_HEADER - path to tcl.h
|
| 174 |
+
CUDD_DIR - path to cudd installation
|
| 175 |
+
ZLIB_ROOT - path to zlib
|
| 176 |
+
CMAKE_INSTALL_PREFIX
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
If `TCL_LIBRARY` is specified the CMake script will attempt to locate
|
| 180 |
+
the header from the library path.
|
| 181 |
+
|
| 182 |
+
The default install directory is `/usr/local`.
|
| 183 |
+
To install in a different directory with CMake use the CMAKE_INSTALL_PREFIX option.
|
| 184 |
+
|
| 185 |
+
If you make changes to `CMakeLists.txt` you may need to clean out
|
| 186 |
+
existing CMake cached variable values by deleting all of the
|
| 187 |
+
files in the build directory.
|
| 188 |
+
|
| 189 |
+
## Build with Docker
|
| 190 |
+
|
| 191 |
+
AN alternative way to build and run OpenSTA is with
|
| 192 |
+
[Docker](https://www.docker.com). After installing Docker, the
|
| 193 |
+
following command builds a Docker image.
|
| 194 |
+
|
| 195 |
+
```
|
| 196 |
+
cd OpenSTA
|
| 197 |
+
docker build --file Dockerfile.ubuntu24.04 --tag opensta_ubuntu24.04 .
|
| 198 |
+
or
|
| 199 |
+
docker build --file Dockerfile.centos7 --tag opensta_centos7 .
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
The centos7 build on mac/OsX with ARM processorts requires the platform
|
| 203 |
+
to be specified.
|
| 204 |
+
|
| 205 |
+
```
|
| 206 |
+
docker build --file Dockerfile.centos7 --platform=linux/amd64 --tag opensta_centos7 .
|
| 207 |
+
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
To run a docker container using the OpenSTA image, use the -v option
|
| 211 |
+
to docker to mount direcories with data to use and -i to run
|
| 212 |
+
interactively.
|
| 213 |
+
|
| 214 |
+
```
|
| 215 |
+
docker run -i -v $HOME:/data opensta
|
| 216 |
+
```
|
| 217 |
+
|
| 218 |
+
## Build on Macos/Darwin
|
| 219 |
+
|
| 220 |
+
The XCode versions of Tcl, Flex and Bison cannot be used to build OpenSTA.
|
| 221 |
+
Use Homebrew to install them. The following command installs the tools
|
| 222 |
+
required to build OpenSTA in the Brewfile.
|
| 223 |
+
|
| 224 |
+
```
|
| 225 |
+
brew bundle install
|
| 226 |
+
```
|
| 227 |
+
|
| 228 |
+
Set these variables before using cmake to cirumvent the Xcode versions.
|
| 229 |
+
|
| 230 |
+
```
|
| 231 |
+
# flex/bison override apple version
|
| 232 |
+
export PATH="$(brew --prefix bison)/bin:${PATH}"
|
| 233 |
+
export PATH="$(brew --prefix flex)/bin:${PATH}"
|
| 234 |
+
export CMAKE_INCLUDE_PATH="$(brew --prefix flex)/include"
|
| 235 |
+
export CMAKE_LIBRARY_PATH="$(brew --prefix flex)/lib;$(brew --prefix bison)/lib"
|
| 236 |
+
```
|
| 237 |
+
|
| 238 |
+
Homebrew does not support tclreadline, but the macports system does
|
| 239 |
+
(see https://www.macports.org).
|
| 240 |
+
|
| 241 |
+
## Install using a package manager
|
| 242 |
+
|
| 243 |
+
### Guix
|
| 244 |
+
|
| 245 |
+
OpenSTA is available in the [default repositories](https://hpc.guix.info/package/opensta):
|
| 246 |
+
|
| 247 |
+
```
|
| 248 |
+
guix install opensta
|
| 249 |
+
```
|
| 250 |
+
|
| 251 |
+
## Bug Reports
|
| 252 |
+
|
| 253 |
+
Use the Issues tab on the github repository to report bugs.
|
| 254 |
+
|
| 255 |
+
Each issue/bug should be a separate issue. The subject of the issue
|
| 256 |
+
should be a short description of the problem. Attach a test case to
|
| 257 |
+
reproduce the issue as described below. Issues without test cases are
|
| 258 |
+
unlikely to get a response.
|
| 259 |
+
|
| 260 |
+
The test case should have a tcl command file recreates the issue named
|
| 261 |
+
run.tcl. If is are more than one command file using the same data
|
| 262 |
+
files, there should be separate command files, run1.tcl, run2.tcl
|
| 263 |
+
etc. The bug report can refer to these command files by name.
|
| 264 |
+
|
| 265 |
+
Command files should not have absolute filenames like
|
| 266 |
+
"/home/john/OpenSTA_bug/write_path_spice/dump_spice" in them.
|
| 267 |
+
These obviously are not portable. Use filenames relative to the test
|
| 268 |
+
case directory.
|
| 269 |
+
|
| 270 |
+
The files in the test case should be collected into a directory.
|
| 271 |
+
The contents of the directory should be collected into a compressed
|
| 272 |
+
tarfile.
|
| 273 |
+
|
| 274 |
+
## Contributions
|
| 275 |
+
|
| 276 |
+
Contributors must sign the Contributor License Agreement (doc/CLA.txt)
|
| 277 |
+
when submitting pull requests.
|
| 278 |
+
|
| 279 |
+
All contributors should read doc/CodingGuidelines.txt for notes on
|
| 280 |
+
making code that adheres to the existing naming and formatting style.
|
| 281 |
+
|
| 282 |
+
Contributions that claim 4% performance improvements in OpenROAD flow
|
| 283 |
+
scripts will largely be ignored. Small performance improvements
|
| 284 |
+
simply do not justify the time required to audit and verify the changes.
|
| 285 |
+
|
| 286 |
+
Contributions that add dependencies on external libraries like boost,
|
| 287 |
+
abseil and Intel TBB will not be accepted.
|
| 288 |
+
|
| 289 |
+
As the author of OpenSTA I vastly prefer writing code to reviewing
|
| 290 |
+
code. I don't have the patience to go round after round to correct
|
| 291 |
+
code formatting that is not consistent with the rest of the code.
|
| 292 |
+
|
| 293 |
+
## Authors
|
| 294 |
+
|
| 295 |
+
* James Cherry
|
| 296 |
+
|
| 297 |
+
* William Scott authored the arnoldi delay calculator at Blaze, Inc
|
| 298 |
+
which was subsequently licensed to Nefelus, Inc that has graciously
|
| 299 |
+
contributed it to OpenSTA.
|
| 300 |
+
|
| 301 |
+
## License
|
| 302 |
+
|
| 303 |
+
OpenSTA, Static Timing Analyzer
|
| 304 |
+
Copyright (c) 2023, Parallax Software, Inc.
|
| 305 |
+
|
| 306 |
+
This program is free software: you can redistribute it and/or modify
|
| 307 |
+
it under the terms of the GNU General Public License as published by
|
| 308 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 309 |
+
(at your option) any later version.
|
| 310 |
+
|
| 311 |
+
This program is distributed in the hope that it will be useful,
|
| 312 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 313 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 314 |
+
GNU General Public License for more details.
|
| 315 |
+
|
| 316 |
+
You should have received a copy of the GNU General Public License
|
| 317 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
The-OpenROAD-Project_OpenSTA/app/Main.cc
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// OpenSTA, Static Timing Analyzer
|
| 2 |
+
// Copyright (c) 2025, Parallax Software, Inc.
|
| 3 |
+
//
|
| 4 |
+
// This program is free software: you can redistribute it and/or modify
|
| 5 |
+
// it under the terms of the GNU General Public License as published by
|
| 6 |
+
// the Free Software Foundation, either version 3 of the License, or
|
| 7 |
+
// (at your option) any later version.
|
| 8 |
+
//
|
| 9 |
+
// This program is distributed in the hope that it will be useful,
|
| 10 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
+
// GNU General Public License for more details.
|
| 13 |
+
//
|
| 14 |
+
// You should have received a copy of the GNU General Public License
|
| 15 |
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 16 |
+
//
|
| 17 |
+
// The origin of this software must not be misrepresented; you must not
|
| 18 |
+
// claim that you wrote the original software.
|
| 19 |
+
//
|
| 20 |
+
// Altered source versions must be plainly marked as such, and must not be
|
| 21 |
+
// misrepresented as being the original software.
|
| 22 |
+
//
|
| 23 |
+
// This notice may not be removed or altered from any source distribution.
|
| 24 |
+
|
| 25 |
+
#include "StaMain.hh"
|
| 26 |
+
#include "StaConfig.hh" // STA_VERSION
|
| 27 |
+
|
| 28 |
+
#include <stdio.h>
|
| 29 |
+
#include <cstdlib> // exit
|
| 30 |
+
#include <filesystem>
|
| 31 |
+
#include <string_view>
|
| 32 |
+
#include <tcl.h>
|
| 33 |
+
|
| 34 |
+
#ifdef BAZEL_BUILD
|
| 35 |
+
#include "bazel/tcl_library_init.h"
|
| 36 |
+
#include "src/tcl_readline_setup.h"
|
| 37 |
+
#endif
|
| 38 |
+
|
| 39 |
+
#if TCL_READLINE
|
| 40 |
+
#include <tclreadline.h>
|
| 41 |
+
#endif
|
| 42 |
+
|
| 43 |
+
#include "Sta.hh"
|
| 44 |
+
|
| 45 |
+
namespace sta {
|
| 46 |
+
extern const char *tcl_inits[];
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
using sta::stringEq;
|
| 50 |
+
using sta::findCmdLineFlag;
|
| 51 |
+
using sta::Sta;
|
| 52 |
+
using sta::initSta;
|
| 53 |
+
using sta::evalTclInit;
|
| 54 |
+
using sta::sourceTclFile;
|
| 55 |
+
using sta::parseThreadsArg;
|
| 56 |
+
using sta::tcl_inits;
|
| 57 |
+
|
| 58 |
+
// Swig uses C linkage for init functions.
|
| 59 |
+
extern "C" {
|
| 60 |
+
extern int Sta_Init(Tcl_Interp *interp);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
static int cmd_argc;
|
| 64 |
+
static char **cmd_argv;
|
| 65 |
+
static const char *init_filename = ".sta";
|
| 66 |
+
|
| 67 |
+
static void
|
| 68 |
+
showUsage(std::string_view prog,
|
| 69 |
+
std::string_view init_filename);
|
| 70 |
+
static int
|
| 71 |
+
tclAppInit(Tcl_Interp *interp);
|
| 72 |
+
static int
|
| 73 |
+
staTclAppInit(int argc,
|
| 74 |
+
char *argv[],
|
| 75 |
+
std::string_view init_filename,
|
| 76 |
+
Tcl_Interp *interp);
|
| 77 |
+
static void
|
| 78 |
+
initStaApp(int &argc,
|
| 79 |
+
char *argv[],
|
| 80 |
+
Tcl_Interp *interp);
|
| 81 |
+
|
| 82 |
+
int
|
| 83 |
+
main(int argc,
|
| 84 |
+
char *argv[])
|
| 85 |
+
{
|
| 86 |
+
if (argc == 2 && stringEq(argv[1], "-help")) {
|
| 87 |
+
showUsage(argv[0], init_filename);
|
| 88 |
+
return 0;
|
| 89 |
+
}
|
| 90 |
+
else if (argc == 2 && stringEq(argv[1], "-version")) {
|
| 91 |
+
printf("%s\n", STA_VERSION);
|
| 92 |
+
return 0;
|
| 93 |
+
}
|
| 94 |
+
else {
|
| 95 |
+
// Set argc to 1 so Tcl_Main doesn't source any files.
|
| 96 |
+
// Store argc and argv in static variables for tclAppInit.
|
| 97 |
+
cmd_argc = argc;
|
| 98 |
+
cmd_argv = argv;
|
| 99 |
+
// Tcl_Main never returns.
|
| 100 |
+
Tcl_Main(1, argv, tclAppInit);
|
| 101 |
+
return 0;
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
static int
|
| 106 |
+
tclAppInit(Tcl_Interp *interp)
|
| 107 |
+
{
|
| 108 |
+
return staTclAppInit(cmd_argc, cmd_argv, init_filename, interp);
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
// Tcl init executed inside Tcl_Main.
|
| 112 |
+
static int
|
| 113 |
+
staTclAppInit(int argc,
|
| 114 |
+
char *argv[],
|
| 115 |
+
std::string_view init_filename,
|
| 116 |
+
Tcl_Interp *interp)
|
| 117 |
+
{
|
| 118 |
+
#ifdef BAZEL_BUILD
|
| 119 |
+
if (in_bazel::SetupTclEnvironment(interp) == TCL_ERROR) {
|
| 120 |
+
return TCL_ERROR;
|
| 121 |
+
}
|
| 122 |
+
#endif
|
| 123 |
+
|
| 124 |
+
// source init.tcl
|
| 125 |
+
if (Tcl_Init(interp) == TCL_ERROR)
|
| 126 |
+
return TCL_ERROR;
|
| 127 |
+
|
| 128 |
+
bool has_readline = false;
|
| 129 |
+
#ifdef BAZEL_BUILD
|
| 130 |
+
has_readline = (ord::SetupTclReadlineLibrary(interp) == TCL_OK);
|
| 131 |
+
#endif
|
| 132 |
+
#if TCL_READLINE
|
| 133 |
+
if (Tclreadline_Init(interp) == TCL_ERROR)
|
| 134 |
+
return TCL_ERROR;
|
| 135 |
+
Tcl_StaticPackage(interp, "tclreadline", Tclreadline_Init, Tclreadline_SafeInit);
|
| 136 |
+
if (Tcl_EvalFile(interp, TCLRL_LIBRARY "/tclreadlineInit.tcl") != TCL_OK)
|
| 137 |
+
printf("Failed to load tclreadline.tcl\n");
|
| 138 |
+
else
|
| 139 |
+
has_readline = true;
|
| 140 |
+
#endif
|
| 141 |
+
|
| 142 |
+
initStaApp(argc, argv, interp);
|
| 143 |
+
|
| 144 |
+
if (!findCmdLineFlag(argc, argv, "-no_splash"))
|
| 145 |
+
Tcl_Eval(interp, "sta::show_splash");
|
| 146 |
+
|
| 147 |
+
if (!findCmdLineFlag(argc, argv, "-no_init")) {
|
| 148 |
+
const char *home = getenv("HOME");
|
| 149 |
+
if (home) {
|
| 150 |
+
std::string init_path = home;
|
| 151 |
+
init_path += "/";
|
| 152 |
+
init_path.append(init_filename);
|
| 153 |
+
if (std::filesystem::is_regular_file(init_path.c_str()))
|
| 154 |
+
sourceTclFile(init_path.c_str(), true, true, interp);
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
bool exit_after_cmd_file = findCmdLineFlag(argc, argv, "-exit");
|
| 159 |
+
|
| 160 |
+
if (argc > 2
|
| 161 |
+
|| (argc > 1 && argv[1][0] == '-')) {
|
| 162 |
+
showUsage(argv[0], init_filename);
|
| 163 |
+
exit(1);
|
| 164 |
+
}
|
| 165 |
+
else {
|
| 166 |
+
if (argc == 2) {
|
| 167 |
+
char *cmd_file = argv[1];
|
| 168 |
+
if (cmd_file) {
|
| 169 |
+
int result = sourceTclFile(cmd_file, false, false, interp);
|
| 170 |
+
if (exit_after_cmd_file) {
|
| 171 |
+
int exit_code = (result == TCL_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
|
| 172 |
+
exit(exit_code);
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
return has_readline ? Tcl_Eval(interp, "::tclreadline::Loop") : TCL_OK;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
static void
|
| 182 |
+
initStaApp(int &argc,
|
| 183 |
+
char *argv[],
|
| 184 |
+
Tcl_Interp *interp)
|
| 185 |
+
{
|
| 186 |
+
initSta();
|
| 187 |
+
Sta *sta = new Sta;
|
| 188 |
+
Sta::setSta(sta);
|
| 189 |
+
sta->makeComponents();
|
| 190 |
+
sta->setTclInterp(interp);
|
| 191 |
+
int thread_count = parseThreadsArg(argc, argv);
|
| 192 |
+
sta->setThreadCount(thread_count);
|
| 193 |
+
|
| 194 |
+
// Define swig TCL commands.
|
| 195 |
+
Sta_Init(interp);
|
| 196 |
+
// Eval encoded sta TCL sources.
|
| 197 |
+
evalTclInit(interp, tcl_inits);
|
| 198 |
+
Tcl_Eval(interp, "init_sta_cmds");
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
static void
|
| 202 |
+
showUsage(std::string_view prog,
|
| 203 |
+
std::string_view init_filename)
|
| 204 |
+
{
|
| 205 |
+
sta::print(stdout, "Usage: {} [-help] [-version] [-no_init] [-exit] cmd_file\n",
|
| 206 |
+
prog);
|
| 207 |
+
sta::print(stdout, " -help show help and exit\n");
|
| 208 |
+
sta::print(stdout, " -version show version and exit\n");
|
| 209 |
+
sta::print(stdout, " -no_init do not read {} init file\n",
|
| 210 |
+
init_filename);
|
| 211 |
+
sta::print(stdout, " -threads count|max use count threads\n");
|
| 212 |
+
sta::print(stdout, " -no_splash do not show the license splash at startup\n");
|
| 213 |
+
sta::print(stdout, " -exit exit after reading cmd_file\n");
|
| 214 |
+
sta::print(stdout, " cmd_file source cmd_file\n");
|
| 215 |
+
}
|
The-OpenROAD-Project_OpenSTA/app/StaApp.i
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%module sta
|
| 2 |
+
|
| 3 |
+
// OpenSTA, Static Timing Analyzer
|
| 4 |
+
// Copyright (c) 2025, Parallax Software, Inc.
|
| 5 |
+
//
|
| 6 |
+
// This program is free software: you can redistribute it and/or modify
|
| 7 |
+
// it under the terms of the GNU General Public License as published by
|
| 8 |
+
// the Free Software Foundation, either version 3 of the License, or
|
| 9 |
+
// (at your option) any later version.
|
| 10 |
+
//
|
| 11 |
+
// This program is distributed in the hope that it will be useful,
|
| 12 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 14 |
+
// GNU General Public License for more details.
|
| 15 |
+
//
|
| 16 |
+
// You should have received a copy of the GNU General Public License
|
| 17 |
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 18 |
+
//
|
| 19 |
+
// The origin of this software must not be misrepresented; you must not
|
| 20 |
+
// claim that you wrote the original software.
|
| 21 |
+
//
|
| 22 |
+
// Altered source versions must be plainly marked as such, and must not be
|
| 23 |
+
// misrepresented as being the original software.
|
| 24 |
+
//
|
| 25 |
+
// This notice may not be removed or altered from any source distribution.
|
| 26 |
+
|
| 27 |
+
%include "tcl/Exception.i"
|
| 28 |
+
%include "tcl/StaTclTypes.i"
|
| 29 |
+
%include "dcalc/DelayCalc.i"
|
| 30 |
+
%include "graph/Graph.i"
|
| 31 |
+
%include "liberty/Liberty.i"
|
| 32 |
+
%include "network/Network.i"
|
| 33 |
+
%include "network/NetworkEdit.i"
|
| 34 |
+
%include "parasitics/Parasitics.i"
|
| 35 |
+
%include "power/Power.i"
|
| 36 |
+
%include "sdc/Sdc.i"
|
| 37 |
+
%include "sdf/Sdf.i"
|
| 38 |
+
%include "search/Search.i"
|
| 39 |
+
%include "search/Property.i"
|
| 40 |
+
%include "util/Util.i"
|
| 41 |
+
%include "spice/WriteSpice.i"
|
| 42 |
+
%include "verilog/Verilog.i"
|
The-OpenROAD-Project_OpenSTA/app/StaMain.cc
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// OpenSTA, Static Timing Analyzer
|
| 2 |
+
// Copyright (c) 2026, Parallax Software, Inc.
|
| 3 |
+
//
|
| 4 |
+
// This program is free software: you can redistribute it and/or modify
|
| 5 |
+
// it under the terms of the GNU General Public License as published by
|
| 6 |
+
// the Free Software Foundation, either version 3 of the License, or
|
| 7 |
+
// (at your option) any later version.
|
| 8 |
+
//
|
| 9 |
+
// This program is distributed in the hope that it will be useful,
|
| 10 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
+
// GNU General Public License for more details.
|
| 13 |
+
//
|
| 14 |
+
// You should have received a copy of the GNU General Public License
|
| 15 |
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 16 |
+
//
|
| 17 |
+
// The origin of this software must not be misrepresented; you must not
|
| 18 |
+
// claim that you wrote the original software.
|
| 19 |
+
//
|
| 20 |
+
// Altered source versions must be plainly marked as such, and must not be
|
| 21 |
+
// misrepresented as being the original software.
|
| 22 |
+
//
|
| 23 |
+
// This notice may not be removed or altered from any source distribution.
|
| 24 |
+
|
| 25 |
+
#include "StaMain.hh"
|
| 26 |
+
|
| 27 |
+
#include <string>
|
| 28 |
+
#include <string_view>
|
| 29 |
+
#include <tcl.h>
|
| 30 |
+
#include <cstdlib>
|
| 31 |
+
#include <sys/stat.h>
|
| 32 |
+
|
| 33 |
+
#include "Machine.hh"
|
| 34 |
+
#include "StringUtil.hh"
|
| 35 |
+
#include "Sta.hh"
|
| 36 |
+
|
| 37 |
+
namespace sta {
|
| 38 |
+
|
| 39 |
+
int
|
| 40 |
+
parseThreadsArg(int &argc,
|
| 41 |
+
char *argv[])
|
| 42 |
+
{
|
| 43 |
+
char *thread_arg = findCmdLineKey(argc, argv, "-threads");
|
| 44 |
+
if (thread_arg) {
|
| 45 |
+
if (stringEqual(thread_arg, "max"))
|
| 46 |
+
return processorCount();
|
| 47 |
+
else if (isDigits(thread_arg))
|
| 48 |
+
return std::stoi(thread_arg);
|
| 49 |
+
else
|
| 50 |
+
fprintf(stderr,"Warning: -threads must be max or a positive integer.\n");
|
| 51 |
+
}
|
| 52 |
+
return 1;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
bool
|
| 56 |
+
findCmdLineFlag(int &argc,
|
| 57 |
+
char *argv[],
|
| 58 |
+
std::string_view flag)
|
| 59 |
+
{
|
| 60 |
+
for (int i = 1; i < argc; i++) {
|
| 61 |
+
char *arg = argv[i];
|
| 62 |
+
if (std::string_view(arg) == flag) {
|
| 63 |
+
// Remove flag from argv.
|
| 64 |
+
for (int j = i + 1; j < argc; j++, i++)
|
| 65 |
+
argv[i] = argv[j];
|
| 66 |
+
argc--;
|
| 67 |
+
argv[argc] = nullptr;
|
| 68 |
+
return true;
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
return false;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
char *
|
| 75 |
+
findCmdLineKey(int &argc,
|
| 76 |
+
char *argv[],
|
| 77 |
+
std::string_view key)
|
| 78 |
+
{
|
| 79 |
+
for (int i = 1; i < argc; i++) {
|
| 80 |
+
char *arg = argv[i];
|
| 81 |
+
if (std::string_view(arg) == key && i + 1 < argc) {
|
| 82 |
+
char *value = argv[i + 1];
|
| 83 |
+
// Remove key and value from argv.
|
| 84 |
+
for (int j = i + 2; j < argc; j++, i++)
|
| 85 |
+
argv[i] = argv[j];
|
| 86 |
+
argc -= 2;
|
| 87 |
+
argv[argc] = nullptr;
|
| 88 |
+
return value;
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
return nullptr;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
// Use overridden version of source to echo cmds and results.
|
| 95 |
+
int
|
| 96 |
+
sourceTclFile(const char *filename,
|
| 97 |
+
bool echo,
|
| 98 |
+
bool verbose,
|
| 99 |
+
Tcl_Interp *interp)
|
| 100 |
+
{
|
| 101 |
+
std::string cmd = sta::format("sta::include_file {} {} {}",
|
| 102 |
+
filename,
|
| 103 |
+
echo ? "1" : "0",
|
| 104 |
+
verbose ? "1" : "0");
|
| 105 |
+
int code = Tcl_Eval(interp, cmd.c_str());
|
| 106 |
+
const char *result = Tcl_GetStringResult(interp);
|
| 107 |
+
if (result[0] != '\0')
|
| 108 |
+
printf("%s\n", result);
|
| 109 |
+
return code;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
void
|
| 113 |
+
evalTclInit(Tcl_Interp *interp,
|
| 114 |
+
const char *inits[])
|
| 115 |
+
{
|
| 116 |
+
char *unencoded = unencode(inits);
|
| 117 |
+
if (Tcl_Eval(interp, unencoded) != TCL_OK) {
|
| 118 |
+
// Get a backtrace for the error.
|
| 119 |
+
Tcl_Eval(interp, "$errorInfo");
|
| 120 |
+
const char *tcl_err = Tcl_GetStringResult(interp);
|
| 121 |
+
fprintf(stderr, "Error: TCL init script: %s.\n", tcl_err);
|
| 122 |
+
fprintf(stderr, " Try deleting TclInitVar.cc and rebuilding.\n");
|
| 123 |
+
exit(0);
|
| 124 |
+
}
|
| 125 |
+
delete [] unencoded;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
char *
|
| 129 |
+
unencode(const char *inits[])
|
| 130 |
+
{
|
| 131 |
+
size_t length = 0;
|
| 132 |
+
for (const char **e = inits; *e; e++) {
|
| 133 |
+
const char *init = *e;
|
| 134 |
+
length += strlen(init);
|
| 135 |
+
}
|
| 136 |
+
char *unencoded = new char[length / 3 + 1];
|
| 137 |
+
char *u = unencoded;
|
| 138 |
+
for (const char **e = inits; *e; e++) {
|
| 139 |
+
const char *init = *e;
|
| 140 |
+
size_t init_length = strlen(init);
|
| 141 |
+
for (const char *s = init; s < &init[init_length]; s += 3) {
|
| 142 |
+
char code[4] = {s[0], s[1], s[2], '\0'};
|
| 143 |
+
char ch = atoi(code);
|
| 144 |
+
*u++ = ch;
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
*u = '\0';
|
| 148 |
+
return unencoded;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
} // namespace sta
|
The-OpenROAD-Project_OpenSTA/cmake/FindCUDD.cmake
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
################################################################
|
| 2 |
+
#
|
| 3 |
+
# Locate CUDD bdd package.
|
| 4 |
+
#
|
| 5 |
+
################################################################
|
| 6 |
+
find_library(CUDD_LIB
|
| 7 |
+
NAME cudd
|
| 8 |
+
PATHS ${CUDD_DIR}
|
| 9 |
+
PATH_SUFFIXES lib lib/cudd cudd/.libs
|
| 10 |
+
)
|
| 11 |
+
if (CUDD_LIB)
|
| 12 |
+
message(STATUS "CUDD library: ${CUDD_LIB}")
|
| 13 |
+
get_filename_component(CUDD_LIB_DIR "${CUDD_LIB}" PATH)
|
| 14 |
+
get_filename_component(CUDD_LIB_PARENT1 "${CUDD_LIB_DIR}" PATH)
|
| 15 |
+
find_file(CUDD_HEADER cudd.h
|
| 16 |
+
PATHS ${CUDD_LIB_PARENT1} ${CUDD_LIB_PARENT1}/include ${CUDD_LIB_PARENT1}/include/cudd)
|
| 17 |
+
if (CUDD_HEADER)
|
| 18 |
+
get_filename_component(CUDD_INCLUDE "${CUDD_HEADER}" PATH)
|
| 19 |
+
message(STATUS "CUDD header: ${CUDD_HEADER}")
|
| 20 |
+
else()
|
| 21 |
+
message(STATUS "CUDD header: not found")
|
| 22 |
+
endif()
|
| 23 |
+
else()
|
| 24 |
+
message(STATUS "CUDD library: not found")
|
| 25 |
+
endif()
|
The-OpenROAD-Project_OpenSTA/cmake/FindTCL.cmake
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OpenSTA, Static Timing Analyzer
|
| 2 |
+
# Copyright (c) 2019, Parallax Software, Inc.
|
| 3 |
+
#
|
| 4 |
+
# This program is free software: you can redistribute it and/or modify
|
| 5 |
+
# it under the terms of the GNU General Public License as published by
|
| 6 |
+
# the Free Software Foundation, either version 3 of the License, or
|
| 7 |
+
# (at your option) any later version.
|
| 8 |
+
#
|
| 9 |
+
# This program is distributed in the hope that it will be useful,
|
| 10 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
+
# GNU General Public License for more details.
|
| 13 |
+
#
|
| 14 |
+
# You should have received a copy of the GNU General Public License
|
| 15 |
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 16 |
+
|
| 17 |
+
################################################################
|
| 18 |
+
#
|
| 19 |
+
# Locate TCL library.
|
| 20 |
+
#
|
| 21 |
+
# Note that the cmake findTcl module is hopeless for OSX
|
| 22 |
+
# because there doesn't appear to be a way to override
|
| 23 |
+
# searching OSX system directories before unix directories.
|
| 24 |
+
|
| 25 |
+
set(TCL_POSSIBLE_NAMES
|
| 26 |
+
#tcl90 tcl9.0
|
| 27 |
+
tcl87 tcl8.7
|
| 28 |
+
tcl86 tcl8.6
|
| 29 |
+
tcl85 tcl8.5
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
# TCL lib path guesses.
|
| 33 |
+
if (NOT TCL_LIB_PATHS)
|
| 34 |
+
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
| 35 |
+
file(GLOB tcl_homebrew_libs
|
| 36 |
+
/opt/homebrew/Cellar/tcl-tk@8/*/lib
|
| 37 |
+
)
|
| 38 |
+
set(TCL_LIB_PATHS
|
| 39 |
+
${tcl_homebrew_libs}
|
| 40 |
+
/opt/homebrew/opt/tcl-tk/lib /usr/local/lib)
|
| 41 |
+
set(TCL_NO_DEFAULT_PATH TRUE)
|
| 42 |
+
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
| 43 |
+
set(TCL_LIB_PATHS /usr/lib /usr/lib64 /usr/local/lib)
|
| 44 |
+
set(TCL_NO_DEFAULT_PATH FALSE)
|
| 45 |
+
endif()
|
| 46 |
+
endif()
|
| 47 |
+
|
| 48 |
+
if (NOT TCL_LIBRARY)
|
| 49 |
+
# bagbiter cmake doesn't have a way to pass NO_DEFAULT_PATH as a parameter.
|
| 50 |
+
if (TCL_NO_DEFAULT_PATH)
|
| 51 |
+
find_library(TCL_LIBRARY
|
| 52 |
+
NAMES tcl ${TCL_POSSIBLE_NAMES}
|
| 53 |
+
PATHS ${TCL_LIB_PATHS}
|
| 54 |
+
NO_DEFAULT_PATH
|
| 55 |
+
)
|
| 56 |
+
else()
|
| 57 |
+
find_library(TCL_LIBRARY
|
| 58 |
+
NAMES tcl ${TCL_POSSIBLE_NAMES}
|
| 59 |
+
PATHS ${TCL_LIB_PATHS}
|
| 60 |
+
)
|
| 61 |
+
endif()
|
| 62 |
+
endif()
|
| 63 |
+
message(STATUS "TCL library: ${TCL_LIBRARY}")
|
| 64 |
+
|
| 65 |
+
get_filename_component(TCL_LIB_DIR "${TCL_LIBRARY}" PATH)
|
| 66 |
+
get_filename_component(TCL_LIB_PARENT1 "${TCL_LIB_DIR}" PATH)
|
| 67 |
+
get_filename_component(TCL_LIB_PARENT2 "${TCL_LIB_PARENT1}" PATH)
|
| 68 |
+
|
| 69 |
+
# Locate tcl.h
|
| 70 |
+
if (NOT TCL_HEADER)
|
| 71 |
+
find_file(TCL_HEADER tcl.h
|
| 72 |
+
PATHS ${TCL_LIB_PARENT1} ${TCL_LIB_PARENT2}
|
| 73 |
+
PATH_SUFFIXES include include/tcl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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# - Returns a version string from Git
|
| 2 |
+
#
|
| 3 |
+
# These functions force a re-configure on each git commit so that you can
|
| 4 |
+
# trust the values of the variables in your build system.
|
| 5 |
+
#
|
| 6 |
+
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
|
| 7 |
+
#
|
| 8 |
+
# Returns the refspec and sha hash of the current head revision
|
| 9 |
+
#
|
| 10 |
+
# git_describe(<var> [<additional arguments to git describe> ...])
|
| 11 |
+
#
|
| 12 |
+
# Returns the results of git describe on the source tree, and adjusting
|
| 13 |
+
# the output so that it tests false if an error occurs.
|
| 14 |
+
#
|
| 15 |
+
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
| 16 |
+
#
|
| 17 |
+
# Returns the results of git describe --exact-match on the source tree,
|
| 18 |
+
# and adjusting the output so that it tests false if there was no exact
|
| 19 |
+
# matching tag.
|
| 20 |
+
#
|
| 21 |
+
# git_local_changes(<var>)
|
| 22 |
+
#
|
| 23 |
+
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
|
| 24 |
+
# Uses the return code of "git diff-index --quiet HEAD --".
|
| 25 |
+
# Does not regard untracked files.
|
| 26 |
+
#
|
| 27 |
+
# Requires CMake 2.6 or newer (uses the 'function' command)
|
| 28 |
+
#
|
| 29 |
+
# Original Author:
|
| 30 |
+
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
| 31 |
+
# http://academic.cleardefinition.com
|
| 32 |
+
# Iowa State University HCI Graduate Program/VRAC
|
| 33 |
+
#
|
| 34 |
+
# Copyright Iowa State University 2009-2010.
|
| 35 |
+
# Distributed under the Boost Software License, Version 1.0.
|
| 36 |
+
# (See accompanying file LICENSE_1_0.txt or copy at
|
| 37 |
+
# http://www.boost.org/LICENSE_1_0.txt)
|
| 38 |
+
|
| 39 |
+
if(__get_git_revision_description)
|
| 40 |
+
return()
|
| 41 |
+
endif()
|
| 42 |
+
set(__get_git_revision_description YES)
|
| 43 |
+
|
| 44 |
+
# We must run the following at "include" time, not at function call time,
|
| 45 |
+
# to find the path to this module rather than the path to a calling list file
|
| 46 |
+
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
| 47 |
+
|
| 48 |
+
function(get_git_head_revision _refspecvar _hashvar)
|
| 49 |
+
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
| 50 |
+
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
| 51 |
+
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
| 52 |
+
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
|
| 53 |
+
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
| 54 |
+
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
|
| 55 |
+
# We have reached the root directory, we are not in git
|
| 56 |
+
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
| 57 |
+
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
| 58 |
+
return()
|
| 59 |
+
endif()
|
| 60 |
+
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
| 61 |
+
endwhile()
|
| 62 |
+
# check if this is a submodule
|
| 63 |
+
if(NOT IS_DIRECTORY ${GIT_DIR})
|
| 64 |
+
file(READ ${GIT_DIR} submodule)
|
| 65 |
+
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
|
| 66 |
+
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
| 67 |
+
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
|
| 68 |
+
endif()
|
| 69 |
+
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
| 70 |
+
if(NOT EXISTS "${GIT_DATA}")
|
| 71 |
+
file(MAKE_DIRECTORY "${GIT_DATA}")
|
| 72 |
+
endif()
|
| 73 |
+
|
| 74 |
+
if(NOT EXISTS "${GIT_DIR}/HEAD")
|
| 75 |
+
return()
|
| 76 |
+
endif()
|
| 77 |
+
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
| 78 |
+
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
|
| 79 |
+
|
| 80 |
+
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
| 81 |
+
"${GIT_DATA}/grabRef.cmake"
|
| 82 |
+
@ONLY)
|
| 83 |
+
include("${GIT_DATA}/grabRef.cmake")
|
| 84 |
+
|
| 85 |
+
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
|
| 86 |
+
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
|
| 87 |
+
endfunction()
|
| 88 |
+
|
| 89 |
+
function(git_describe _var)
|
| 90 |
+
if(NOT GIT_FOUND)
|
| 91 |
+
find_package(Git QUIET)
|
| 92 |
+
endif()
|
| 93 |
+
get_git_head_revision(refspec hash)
|
| 94 |
+
if(NOT GIT_FOUND)
|
| 95 |
+
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
| 96 |
+
return()
|
| 97 |
+
endif()
|
| 98 |
+
if(NOT hash)
|
| 99 |
+
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
| 100 |
+
return()
|
| 101 |
+
endif()
|
| 102 |
+
|
| 103 |
+
# TODO sanitize
|
| 104 |
+
#if((${ARGN}" MATCHES "&&") OR
|
| 105 |
+
# (ARGN MATCHES "||") OR
|
| 106 |
+
# (ARGN MATCHES "\\;"))
|
| 107 |
+
# message("Please report the following error to the project!")
|
| 108 |
+
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
| 109 |
+
#endif()
|
| 110 |
+
|
| 111 |
+
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
| 112 |
+
|
| 113 |
+
execute_process(COMMAND
|
| 114 |
+
"${GIT_EXECUTABLE}"
|
| 115 |
+
describe
|
| 116 |
+
${hash}
|
| 117 |
+
${ARGN}
|
| 118 |
+
WORKING_DIRECTORY
|
| 119 |
+
"${CMAKE_CURRENT_SOURCE_DIR}"
|
| 120 |
+
RESULT_VARIABLE
|
| 121 |
+
res
|
| 122 |
+
OUTPUT_VARIABLE
|
| 123 |
+
out
|
| 124 |
+
ERROR_QUIET
|
| 125 |
+
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
| 126 |
+
if(NOT res EQUAL 0)
|
| 127 |
+
set(out "${out}-${res}-NOTFOUND")
|
| 128 |
+
endif()
|
| 129 |
+
|
| 130 |
+
set(${_var} "${out}" PARENT_SCOPE)
|
| 131 |
+
endfunction()
|
| 132 |
+
|
| 133 |
+
function(git_get_exact_tag _var)
|
| 134 |
+
git_describe(out --exact-match ${ARGN})
|
| 135 |
+
set(${_var} "${out}" PARENT_SCOPE)
|
| 136 |
+
endfunction()
|
| 137 |
+
|
| 138 |
+
function(git_local_changes _var)
|
| 139 |
+
if(NOT GIT_FOUND)
|
| 140 |
+
find_package(Git QUIET)
|
| 141 |
+
endif()
|
| 142 |
+
get_git_head_revision(refspec hash)
|
| 143 |
+
if(NOT GIT_FOUND)
|
| 144 |
+
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
| 145 |
+
return()
|
| 146 |
+
endif()
|
| 147 |
+
if(NOT hash)
|
| 148 |
+
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
| 149 |
+
return()
|
| 150 |
+
endif()
|
| 151 |
+
|
| 152 |
+
execute_process(COMMAND
|
| 153 |
+
"${GIT_EXECUTABLE}"
|
| 154 |
+
diff-index --quiet HEAD --
|
| 155 |
+
WORKING_DIRECTORY
|
| 156 |
+
"${CMAKE_CURRENT_SOURCE_DIR}"
|
| 157 |
+
RESULT_VARIABLE
|
| 158 |
+
res
|
| 159 |
+
OUTPUT_VARIABLE
|
| 160 |
+
out
|
| 161 |
+
ERROR_QUIET
|
| 162 |
+
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
| 163 |
+
if(res EQUAL 0)
|
| 164 |
+
set(${_var} "CLEAN" PARENT_SCOPE)
|
| 165 |
+
else()
|
| 166 |
+
set(${_var} "DIRTY" PARENT_SCOPE)
|
| 167 |
+
endif()
|
| 168 |
+
endfunction()
|
The-OpenROAD-Project_OpenSTA/cmake/GetGitRevisionDescription.cmake.in
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# Internal file for GetGitRevisionDescription.cmake
|
| 3 |
+
#
|
| 4 |
+
# Requires CMake 2.6 or newer (uses the 'function' command)
|
| 5 |
+
#
|
| 6 |
+
# Original Author:
|
| 7 |
+
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
| 8 |
+
# http://academic.cleardefinition.com
|
| 9 |
+
# Iowa State University HCI Graduate Program/VRAC
|
| 10 |
+
#
|
| 11 |
+
# Copyright Iowa State University 2009-2010.
|
| 12 |
+
# Distributed under the Boost Software License, Version 1.0.
|
| 13 |
+
# (See accompanying file LICENSE_1_0.txt or copy at
|
| 14 |
+
# http://www.boost.org/LICENSE_1_0.txt)
|
| 15 |
+
|
| 16 |
+
set(HEAD_HASH)
|
| 17 |
+
|
| 18 |
+
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
| 19 |
+
|
| 20 |
+
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
| 21 |
+
if(HEAD_CONTENTS MATCHES "ref")
|
| 22 |
+
# named branch
|
| 23 |
+
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
| 24 |
+
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
| 25 |
+
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
| 26 |
+
else()
|
| 27 |
+
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
| 28 |
+
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
| 29 |
+
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
| 30 |
+
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
| 31 |
+
endif()
|
| 32 |
+
endif()
|
| 33 |
+
else()
|
| 34 |
+
# detached HEAD
|
| 35 |
+
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
| 36 |
+
endif()
|
| 37 |
+
|
| 38 |
+
if(NOT HEAD_HASH)
|
| 39 |
+
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
| 40 |
+
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
| 41 |
+
endif()
|
The-OpenROAD-Project_OpenSTA/dcalc/ArcDcalcWaveforms.cc
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// OpenSTA, Static Timing Analyzer
|
| 2 |
+
// Copyright (c) 2026, Parallax Software, Inc.
|
| 3 |
+
//
|
| 4 |
+
// This program is free software: you can redistribute it and/or modify
|
| 5 |
+
// it under the terms of the GNU General Public License as published by
|
| 6 |
+
// the Free Software Foundation, either version 3 of the License, or
|
| 7 |
+
// (at your option) any later version.
|
| 8 |
+
//
|
| 9 |
+
// This program is distributed in the hope that it will be useful,
|
| 10 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
+
// GNU General Public License for more details.
|
| 13 |
+
//
|
| 14 |
+
// You should have received a copy of the GNU General Public License
|
| 15 |
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 16 |
+
//
|
| 17 |
+
// The origin of this software must not be misrepresented; you must not
|
| 18 |
+
// claim that you wrote the original software.
|
| 19 |
+
//
|
| 20 |
+
// Altered source versions must be plainly marked as such, and must not be
|
| 21 |
+
// misrepresented as being the original software.
|
| 22 |
+
//
|
| 23 |
+
// This notice may not be removed or altered from any source distribution.
|
| 24 |
+
|
| 25 |
+
#include "ArcDcalcWaveforms.hh"
|
| 26 |
+
|
| 27 |
+
#include <memory>
|
| 28 |
+
|
| 29 |
+
#include "ArcDelayCalc.hh"
|
| 30 |
+
#include "Graph.hh"
|
| 31 |
+
#include "GraphDelayCalc.hh"
|
| 32 |
+
#include "Liberty.hh"
|
| 33 |
+
#include "Network.hh"
|
| 34 |
+
#include "Report.hh"
|
| 35 |
+
|
| 36 |
+
namespace sta {
|
| 37 |
+
|
| 38 |
+
Waveform
|
| 39 |
+
ArcDcalcWaveforms::inputWaveform(ArcDcalcArg &dcalc_arg,
|
| 40 |
+
const Scene *scene,
|
| 41 |
+
const MinMax *min_max,
|
| 42 |
+
const StaState *sta)
|
| 43 |
+
{
|
| 44 |
+
const Network *network = sta->network();
|
| 45 |
+
Graph *graph = sta->graph();
|
| 46 |
+
Report *report = sta->report();
|
| 47 |
+
const Pin *in_pin = dcalc_arg.inPin();
|
| 48 |
+
LibertyPort *link_port = network->libertyPort(in_pin);
|
| 49 |
+
if (link_port) {
|
| 50 |
+
LibertyPort *port = link_port->scenePort(scene, min_max);
|
| 51 |
+
const RiseFall *in_rf = dcalc_arg.inEdge();
|
| 52 |
+
DriverWaveform *driver_waveform = port->driverWaveform(in_rf);
|
| 53 |
+
if (driver_waveform) {
|
| 54 |
+
const Vertex *in_vertex = graph->pinLoadVertex(in_pin);
|
| 55 |
+
GraphDelayCalc *graph_dcalc = sta->graphDelayCalc();
|
| 56 |
+
Slew in_slew = graph_dcalc->edgeFromSlew(in_vertex, in_rf,
|
| 57 |
+
dcalc_arg.arc()->role(),
|
| 58 |
+
scene, min_max);
|
| 59 |
+
LibertyLibrary *library = port->libertyLibrary();
|
| 60 |
+
float vdd;
|
| 61 |
+
bool vdd_exists;
|
| 62 |
+
library->supplyVoltage("VDD", vdd, vdd_exists);
|
| 63 |
+
if (!vdd_exists)
|
| 64 |
+
report->error(1751, "VDD not defined in library {}", library->name());
|
| 65 |
+
float slew1 = delayAsFloat(in_slew, min_max, sta);
|
| 66 |
+
Waveform in_waveform = driver_waveform->waveform(slew1);
|
| 67 |
+
// Delay time axis.
|
| 68 |
+
FloatSeq time_values;
|
| 69 |
+
for (float time : in_waveform.axis1()->values())
|
| 70 |
+
time_values.push_back(time + dcalc_arg.inputDelay());
|
| 71 |
+
TableAxisPtr time_axis = std::make_shared<TableAxis>(TableAxisVariable::time,
|
| 72 |
+
std::move(time_values));
|
| 73 |
+
// Scale the waveform from 0:vdd.
|
| 74 |
+
FloatSeq *scaled_values = new FloatSeq;
|
| 75 |
+
for (float value : *in_waveform.values()) {
|
| 76 |
+
float scaled_value = (in_rf == RiseFall::rise())
|
| 77 |
+
? value * vdd
|
| 78 |
+
: (1.0 - value) * vdd;
|
| 79 |
+
scaled_values->push_back(scaled_value);
|
| 80 |
+
}
|
| 81 |
+
return Waveform(scaled_values, time_axis);
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
return Waveform();
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
} // namespace sta
|
The-OpenROAD-Project_OpenSTA/dcalc/ArcDcalcWaveforms.hh
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// OpenSTA, Static Timing Analyzer
|
| 2 |
+
// Copyright (c) 2026, Parallax Software, Inc.
|
| 3 |
+
//
|
| 4 |
+
// This program is free software: you can redistribute it and/or modify
|
| 5 |
+
// it under the terms of the GNU General Public License as published by
|
| 6 |
+
// the Free Software Foundation, either version 3 of the License, or
|
| 7 |
+
// (at your option) any later version.
|
| 8 |
+
//
|
| 9 |
+
// This program is distributed in the hope that it will be useful,
|
| 10 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
+
// GNU General Public License for more details.
|
| 13 |
+
//
|
| 14 |
+
// You should have received a copy of the GNU General Public License
|
| 15 |
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 16 |
+
//
|
| 17 |
+
// The origin of this software must not be misrepresented; you must not
|
| 18 |
+
// claim that you wrote the original software.
|
| 19 |
+
//
|
| 20 |
+
// Altered source versions must be plainly marked as such, and must not be
|
| 21 |
+
// misrepresented as being the original software.
|
| 22 |
+
//
|
| 23 |
+
// This notice may not be removed or altered from any source distribution.
|
| 24 |
+
|
| 25 |
+
#pragma once
|
| 26 |
+
|
| 27 |
+
#include "MinMax.hh"
|
| 28 |
+
#include "TableModel.hh"
|
| 29 |
+
#include "NetworkClass.hh"
|
| 30 |
+
|
| 31 |
+
namespace sta {
|
| 32 |
+
|
| 33 |
+
class StaState;
|
| 34 |
+
class Scene;
|
| 35 |
+
class ArcDcalcArg;
|
| 36 |
+
|
| 37 |
+
// Abstract class for delay calculation waveforms for ploting.
|
| 38 |
+
class ArcDcalcWaveforms
|
| 39 |
+
{
|
| 40 |
+
public:
|
| 41 |
+
// Record waveform for drvr/load pin.
|
| 42 |
+
virtual void watchPin(const Pin *pin) = 0;
|
| 43 |
+
virtual void clearWatchPins() = 0;
|
| 44 |
+
virtual PinSeq watchPins() const = 0;
|
| 45 |
+
virtual Waveform watchWaveform(const Pin *pin) = 0;
|
| 46 |
+
|
| 47 |
+
protected:
|
| 48 |
+
Waveform inputWaveform(ArcDcalcArg &dcalc_arg,
|
| 49 |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2026, Parallax Software, Inc.
|
| 3 |
+
//
|
| 4 |
+
// This program is free software: you can redistribute it and/or modify
|
| 5 |
+
// it under the terms of the GNU General Public License as published by
|
| 6 |
+
// the Free Software Foundation, either version 3 of the License, or
|
| 7 |
+
// (at your option) any later version.
|
| 8 |
+
//
|
| 9 |
+
// This program is distributed in the hope that it will be useful,
|
| 10 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
+
// GNU General Public License for more details.
|
| 13 |
+
//
|
| 14 |
+
// You should have received a copy of the GNU General Public License
|
| 15 |
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 16 |
+
//
|
| 17 |
+
// The origin of this software must not be misrepresented; you must not
|
| 18 |
+
// claim that you wrote the original software.
|
| 19 |
+
//
|
| 20 |
+
// Altered source versions must be plainly marked as such, and must not be
|
| 21 |
+
// misrepresented as being the original software.
|
| 22 |
+
//
|
| 23 |
+
// This notice may not be removed or altered from any source distribution.
|
| 24 |
+
|
| 25 |
+
#include "ArcDelayCalc.hh"
|
| 26 |
+
|
| 27 |
+
#include <cstdlib>
|
| 28 |
+
#include <string>
|
| 29 |
+
|
| 30 |
+
#include "Graph.hh"
|
| 31 |
+
#include "Liberty.hh"
|
| 32 |
+
#include "Network.hh"
|
| 33 |
+
#include "StringUtil.hh"
|
| 34 |
+
#include "TimingArc.hh"
|
| 35 |
+
#include "Units.hh"
|
| 36 |
+
|
| 37 |
+
namespace sta {
|
| 38 |
+
|
| 39 |
+
ArcDelayCalc::ArcDelayCalc(StaState *sta):
|
| 40 |
+
StaState(sta)
|
| 41 |
+
{
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
void
|
| 45 |
+
ArcDelayCalc::gateDelay(const TimingArc *arc,
|
| 46 |
+
const Slew &in_slew,
|
| 47 |
+
float load_cap,
|
| 48 |
+
const Parasitic *parasitic,
|
| 49 |
+
float,
|
| 50 |
+
const Pvt *,
|
| 51 |
+
const Scene *scene,
|
| 52 |
+
const MinMax *min_max,
|
| 53 |
+
// Return values.
|
| 54 |
+
ArcDelay &gate_delay,
|
| 55 |
+
Slew &drvr_slew)
|
| 56 |
+
{
|
| 57 |
+
LoadPinIndexMap load_pin_index_map(network_);
|
| 58 |
+
ArcDcalcResult dcalc_result = gateDelay(nullptr, arc, in_slew, load_cap, parasitic,
|
| 59 |
+
load_pin_index_map, scene, min_max);
|
| 60 |
+
gate_delay = dcalc_result.gateDelay();
|
| 61 |
+
drvr_slew = dcalc_result.drvrSlew();
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
////////////////////////////////////////////////////////////////
|
| 65 |
+
|
| 66 |
+
// For TCL %typemap(in) ArcDcalcArg.
|
| 67 |
+
ArcDcalcArg
|
| 68 |
+
makeArcDcalcArg(std::string_view inst_name,
|
| 69 |
+
std::string_view in_port_name,
|
| 70 |
+
std::string_view in_rf_name,
|
| 71 |
+
std::string_view drvr_port_name,
|
| 72 |
+
std::string_view drvr_rf_name,
|
| 73 |
+
std::string_view input_delay_str,
|
| 74 |
+
const StaState *sta)
|
| 75 |
+
{
|
| 76 |
+
Report *report = sta->report();
|
| 77 |
+
const Network *network = sta->sdcNetwork();
|
| 78 |
+
const Instance *inst = network->findInstance(inst_name);
|
| 79 |
+
if (inst) {
|
| 80 |
+
const Pin *in_pin = network->findPin(inst, in_port_name);
|
| 81 |
+
if (in_pin) {
|
| 82 |
+
const RiseFall *in_rf = RiseFall::find(in_rf_name);
|
| 83 |
+
if (in_rf) {
|
| 84 |
+
const Pin *drvr_pin = network->findPin(inst, drvr_port_name);
|
| 85 |
+
if (drvr_pin) {
|
| 86 |
+
const RiseFall *drvr_rf = RiseFall::find(drvr_rf_name);
|
| 87 |
+
if (drvr_rf) {
|
| 88 |
+
const std::string input_delay_buf(input_delay_str);
|
| 89 |
+
auto [input_delay, valid] = stringFloat(input_delay_buf);
|
| 90 |
+
input_delay = sta->units()->timeUnit()->userToSta(input_delay);
|
| 91 |
+
|
| 92 |
+
const Graph *graph = sta->graph();
|
| 93 |
+
Edge *edge;
|
| 94 |
+
const TimingArc *arc;
|
| 95 |
+
graph->gateEdgeArc(in_pin, in_rf, drvr_pin, drvr_rf, edge, arc);
|
| 96 |
+
if (edge)
|
| 97 |
+
return ArcDcalcArg(in_pin, drvr_pin, edge, arc, input_delay);
|
| 98 |
+
else {
|
| 99 |
+
const Network *network = sta->network();
|
| 100 |
+
const Instance *inst = network->instance(in_pin);
|
| 101 |
+
report->warn(2100, "no timing arc for {} input/driver pins.",
|
| 102 |
+
network->pathName(inst));
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
else
|
| 106 |
+
report->warn(2101, "{} not a valid rise/fall.", drvr_rf_name);
|
| 107 |
+
}
|
| 108 |
+
else
|
| 109 |
+
report->warn(2102, "Pin {}/{} not found.", inst_name, drvr_port_name);
|
| 110 |
+
}
|
| 111 |
+
else
|
| 112 |
+
report->warn(2103, "{} not a valid rise/fall.", in_rf_name);
|
| 113 |
+
}
|
| 114 |
+
else
|
| 115 |
+
report->warn(2104, "Pin {}/{} not found.", inst_name, in_port_name);
|
| 116 |
+
}
|
| 117 |
+
else
|
| 118 |
+
report->warn(2105, "Instance {} not found.", inst_name);
|
| 119 |
+
return ArcDcalcArg();
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
ArcDcalcArg::ArcDcalcArg() :
|
| 123 |
+
in_pin_(nullptr),
|
| 124 |
+
drvr_pin_(nullptr),
|
| 125 |
+
edge_(nullptr),
|
| 126 |
+
arc_(nullptr),
|
| 127 |
+
in_slew_(0.0),
|
| 128 |
+
load_cap_(0.0),
|
| 129 |
+
parasitic_(nullptr),
|
| 130 |
+
input_delay_(0.0)
|
| 131 |
+
{
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
ArcDcalcArg::ArcDcalcArg(const Pin *in_pin,
|
| 135 |
+
const Pin *drvr_pin,
|
| 136 |
+
Edge *edge,
|
| 137 |
+
const TimingArc *arc,
|
| 138 |
+
Slew in_slew,
|
| 139 |
+
float load_cap,
|
| 140 |
+
const Parasitic *parasitic) :
|
| 141 |
+
in_pin_(in_pin),
|
| 142 |
+
drvr_pin_(drvr_pin),
|
| 143 |
+
edge_(edge),
|
| 144 |
+
arc_(arc),
|
| 145 |
+
in_slew_(in_slew),
|
| 146 |
+
load_cap_(load_cap),
|
| 147 |
+
parasitic_(parasitic),
|
| 148 |
+
input_delay_(0.0)
|
| 149 |
+
{
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
ArcDcalcArg::ArcDcalcArg(const Pin *in_pin,
|
| 153 |
+
const Pin *drvr_pin,
|
| 154 |
+
Edge *edge,
|
| 155 |
+
const TimingArc *arc,
|
| 156 |
+
float input_delay) :
|
| 157 |
+
in_pin_(in_pin),
|
| 158 |
+
drvr_pin_(drvr_pin),
|
| 159 |
+
edge_(edge),
|
| 160 |
+
arc_(arc),
|
| 161 |
+
in_slew_(0.0),
|
| 162 |
+
load_cap_(0.0),
|
| 163 |
+
parasitic_(nullptr),
|
| 164 |
+
input_delay_(input_delay)
|
| 165 |
+
{
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
ArcDcalcArg::ArcDcalcArg(const ArcDcalcArg &arg) = default;
|
| 169 |
+
|
| 170 |
+
const RiseFall *
|
| 171 |
+
ArcDcalcArg::inEdge() const
|
| 172 |
+
{
|
| 173 |
+
return arc_->fromEdge()->asRiseFall();
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
Vertex *
|
| 177 |
+
ArcDcalcArg::drvrVertex(const Graph *graph) const
|
| 178 |
+
{
|
| 179 |
+
return edge_->to(graph);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
LibertyCell *
|
| 183 |
+
ArcDcalcArg::drvrCell() const
|
| 184 |
+
{
|
| 185 |
+
|
| 186 |
+
return arc_->to()->libertyCell();
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
LibertyLibrary *
|
| 190 |
+
ArcDcalcArg::drvrLibrary() const
|
| 191 |
+
{
|
| 192 |
+
return arc_->to()->libertyLibrary();
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
const RiseFall *
|
| 196 |
+
ArcDcalcArg::drvrEdge() const
|
| 197 |
+
{
|
| 198 |
+
return arc_->toEdge()->asRiseFall();
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
void
|
| 202 |
+
ArcDcalcArg::setSceneArc(const Scene *scene,
|
| 203 |
+
const MinMax *min_max)
|
| 204 |
+
{
|
| 205 |
+
arc_ = arc_->sceneArc(scene->libertyIndex(min_max));
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
const Net *
|
| 209 |
+
ArcDcalcArg::drvrNet(const Network *network) const
|
| 210 |
+
{
|
| 211 |
+
return network->net(drvr_pin_);
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
float
|
| 215 |
+
ArcDcalcArg::inSlewFlt() const
|
| 216 |
+
{
|
| 217 |
+
return delayAsFloat(in_slew_);
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
void
|
| 221 |
+
ArcDcalcArg::setInSlew(Slew in_slew)
|
| 222 |
+
{
|
| 223 |
+
in_slew_ = in_slew;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
void
|
| 227 |
+
ArcDcalcArg::setParasitic(const Parasitic *parasitic)
|
| 228 |
+
{
|
| 229 |
+
parasitic_ = parasitic;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
void
|
| 233 |
+
ArcDcalcArg::setLoadCap(float load_cap)
|
| 234 |
+
{
|
| 235 |
+
load_cap_ = load_cap;
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
void
|
| 239 |
+
ArcDcalcArg::setInputDelay(float input_delay)
|
| 240 |
+
{
|
| 241 |
+
input_delay_ = input_delay;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
////////////////////////////////////////////////////////////////
|
| 245 |
+
|
| 246 |
+
ArcDcalcResult::ArcDcalcResult() :
|
| 247 |
+
gate_delay_(0.0),
|
| 248 |
+
drvr_slew_(0.0)
|
| 249 |
+
{
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
ArcDcalcResult::ArcDcalcResult(size_t load_count) :
|
| 253 |
+
gate_delay_(0.0),
|
| 254 |
+
drvr_slew_(0.0)
|
| 255 |
+
{
|
| 256 |
+
wire_delays_.resize(load_count);
|
| 257 |
+
load_slews_.resize(load_count);
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
void
|
| 261 |
+
ArcDcalcResult::setGateDelay(const ArcDelay &gate_delay)
|
| 262 |
+
{
|
| 263 |
+
gate_delay_ = gate_delay;
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
void
|
| 267 |
+
ArcDcalcResult::setDrvrSlew(const Slew &drvr_slew)
|
| 268 |
+
{
|
| 269 |
+
drvr_slew_ = drvr_slew;
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
const ArcDelay &
|
| 273 |
+
ArcDcalcResult::wireDelay(size_t load_idx) const
|
| 274 |
+
{
|
| 275 |
+
return wire_delays_[load_idx];
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
void
|
| 279 |
+
ArcDcalcResult::setWireDelay(size_t load_idx,
|
| 280 |
+
const ArcDelay &wire_delay)
|
| 281 |
+
{
|
| 282 |
+
wire_delays_[load_idx] = wire_delay;
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
void
|
| 286 |
+
ArcDcalcResult::setLoadCount(size_t load_count)
|
| 287 |
+
{
|
| 288 |
+
wire_delays_.resize(load_count);
|
| 289 |
+
load_slews_.resize(load_count);
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
const Slew &
|
| 293 |
+
ArcDcalcResult::loadSlew(size_t load_idx) const
|
| 294 |
+
{
|
| 295 |
+
return load_slews_[load_idx];
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
void
|
| 299 |
+
ArcDcalcResult::setLoadSlew(size_t load_idx,
|
| 300 |
+
const Slew &load_slew)
|
| 301 |
+
{
|
| 302 |
+
load_slews_[load_idx] = load_slew;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
} // namespace sta
|
The-OpenROAD-Project_OpenSTA/dcalc/Arnoldi.hh
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// OpenSTA, Static Timing Analyzer
|
| 2 |
+
// Copyright (c) 2026, Parallax Software, Inc.
|
| 3 |
+
//
|
| 4 |
+
// This program is free software: you can redistribute it and/or modify
|
| 5 |
+
// it under the terms of the GNU General Public License as published by
|
| 6 |
+
// the Free Software Foundation, either version 3 of the License, or
|
| 7 |
+
// (at your option) any later version.
|
| 8 |
+
//
|
| 9 |
+
// This program is distributed in the hope that it will be useful,
|
| 10 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
+
// GNU General Public License for more details.
|
| 13 |
+
//
|
| 14 |
+
// You should have received a copy of the GNU General Public License
|
| 15 |
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 16 |
+
//
|
| 17 |
+
// The origin of this software must not be misrepresented; you must not
|
| 18 |
+
// claim that you wrote the original software.
|
| 19 |
+
//
|
| 20 |
+
// Altered source versions must be plainly marked as such, and must not be
|
| 21 |
+
// misrepresented as being the original software.
|
| 22 |
+
//
|
| 23 |
+
// This notice may not be removed or altered from any source distribution.
|
| 24 |
+
|
| 25 |
+
// (c) 2018 Nefelus, Inc.
|
| 26 |
+
//
|
| 27 |
+
// Author: W. Scott
|
| 28 |
+
|
| 29 |
+
#pragma once
|
| 30 |
+
|
| 31 |
+
#include "parasitics/ConcreteParasiticsPvt.hh"
|
| 32 |
+
|
| 33 |
+
namespace sta {
|
| 34 |
+
|
| 35 |
+
struct delay_work;
|
| 36 |
+
|
| 37 |
+
class GateTableModel;
|
| 38 |
+
class Pin;
|
| 39 |
+
|
| 40 |
+
//
|
| 41 |
+
// single-driver arnoldi model
|
| 42 |
+
//
|
| 43 |
+
class arnoldi1
|
| 44 |
+
{
|
| 45 |
+
public:
|
| 46 |
+
arnoldi1() { order=0; n=0; d=nullptr; e=nullptr; U=nullptr; ctot=0.0; sqc=0.0; }
|
| 47 |
+
~arnoldi1();
|
| 48 |
+
double elmore(int k);
|
| 49 |
+
|
| 50 |
+
//
|
| 51 |
+
// calculate poles/residues for given rdrive
|
| 52 |
+
//
|
| 53 |
+
void calculate_poles_res(delay_work *D,double rdrive);
|
| 54 |
+
|
| 55 |
+
public:
|
| 56 |
+
int order;
|
| 57 |
+
int n; // number of terms, including driver
|
| 58 |
+
double *d; // [order]
|
| 59 |
+
double *e; // [order-1]
|
| 60 |
+
double **U; // [order][n]
|
| 61 |
+
double ctot;
|
| 62 |
+
double sqc;
|
| 63 |
+
};
|
| 64 |
+
|
| 65 |
+
// This is the rcmodel, without Rd.
|
| 66 |
+
// n is the number of terms
|
| 67 |
+
// The vectors U[j] are of size n
|
| 68 |
+
class rcmodel : public ConcreteParasitic,
|
| 69 |
+
public arnoldi1
|
| 70 |
+
{
|
| 71 |
+
public:
|
| 72 |
+
~rcmodel() override;
|
| 73 |
+
float capacitance() const override;
|
| 74 |
+
PinSet unannotatedLoads(const Pin *drvr_pin,
|
| 75 |
+
const Parasitics *parasitics) const override;
|
| 76 |
+
|
| 77 |
+
const Pin **pinV{nullptr}; // [n]
|
| 78 |
+
};
|
| 79 |
+
|
| 80 |
+
struct timing_table
|
| 81 |
+
{
|
| 82 |
+
const GateTableModel *table;
|
| 83 |
+
const LibertyCell *cell;
|
| 84 |
+
const Pvt *pvt;
|
| 85 |
+
float in_slew;
|
| 86 |
+
};
|
| 87 |
+
|
| 88 |
+
} // namespace sta
|
The-OpenROAD-Project_OpenSTA/dcalc/Arnoldi.txt
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The method is used for simulation with a time-and-voltage-dependent
|
| 2 |
+
current source. But it is simpler to describe with a linear driver.
|
| 3 |
+
Suppose we are given:
|
| 4 |
+
voltage nodes 1,..n initialized to V[j]=1.0
|
| 5 |
+
a resistor network described by a conductance matrix G[j,k]
|
| 6 |
+
a drive resistance from node 1 to ground, Rdrv
|
| 7 |
+
capacitance of the nodes, c[j], also written as a
|
| 8 |
+
diagonal matrix C[j,k]
|
| 9 |
+
The node voltages will fall to zero with time.
|
| 10 |
+
Matrix equation:
|
| 11 |
+
GV+CdV/dt = -(V[0]/Rdrv)e0
|
| 12 |
+
where e0 is the unit vector (1,0,0,..0).
|
| 13 |
+
Let G' be the matrix formed by taking G and adding 1/Rdrv in the
|
| 14 |
+
[0,0] position. Then we are solving G'V + CdV/dt = 0.
|
| 15 |
+
Let R be the inverse of G'. (In implementation, R may not actually
|
| 16 |
+
be formed as a matrix, instead some method of producing RV given V).
|
| 17 |
+
The exact solution would diagonalize sqrt(C) R sqrt(C).
|
| 18 |
+
|
| 19 |
+
The Arnoldi method takes a matrix M and a vector of interest V, and
|
| 20 |
+
considers the subspace of vectors near V in terms of the action of M,
|
| 21 |
+
that is, the space spanned by V, MV, MMV, etc, for a small number of
|
| 22 |
+
powers. We do this here, but instead of finding the part of MV orthogonal
|
| 23 |
+
to V, we find the part of RCV that is C-orthogonal of V. We use C
|
| 24 |
+
as the metric, so the basis vectors U0, U1, U2 that we generate satisfy
|
| 25 |
+
Ui.CUj = (i==j?1:0)
|
| 26 |
+
|
| 27 |
+
U0 = (1,1,..1)/sqrt(sum C)
|
| 28 |
+
representing the initial value of V, V[j] = sqrt(n)U0[j] at t=0.
|
| 29 |
+
sum(C) = C[0]+..C[n-1], so U0.C U0 = 1.
|
| 30 |
+
Let:
|
| 31 |
+
W = R C U0
|
| 32 |
+
d0 = U0.C W
|
| 33 |
+
W' = W - d0 U0
|
| 34 |
+
e0 = sqrt(W'.C W')
|
| 35 |
+
U1 = W'/e0
|
| 36 |
+
Then: U0.C U0 = U1.C U1 = 1, U0.C U1 = 0, and
|
| 37 |
+
R C U0 = d0 U0 + e0 U1
|
| 38 |
+
Next step:
|
| 39 |
+
W = R C U1
|
| 40 |
+
d1 = U1.C W
|
| 41 |
+
W' = W - d1 U1 - e0 U0
|
| 42 |
+
e1 = sqrt(W'.C W')
|
| 43 |
+
U2 = W'/e1
|
| 44 |
+
and we have U2.C U2 = 1, U2.C U1 = U2.C U0 = 0, and
|
| 45 |
+
RC U1 = e0 U0 + d1 U1 + e1 U2
|
| 46 |
+
In this way, RC, which in nonsymmetric in the original basis,
|
| 47 |
+
becomes a symmetric tridiagonal matrix in the U0,U1,.. basis.
|
| 48 |
+
We stop at, say, U3. The resulting 4x4 tridiagonal matrix is
|
| 49 |
+
positive definite, because it is the projection of sqrt(C)R sqrt(C)
|
| 50 |
+
to a subspace. So the eigenvalues of this small tridiagonal matrix
|
| 51 |
+
are guaranteed to be positive. This is the advantage over AWE.
|
| 52 |
+
|
| 53 |
+
In the actual implementation, I remember there was some way of
|
| 54 |
+
isolating the node 0 where drive resistance is attached, so that the
|
| 55 |
+
tridiagonal matrix (d,e) can be recalculated without knowing Rdrv,
|
| 56 |
+
and then just the first d0,e0 updated when the Rdrv is known, or
|
| 57 |
+
when Rdrv changes in a simulation.
|
The-OpenROAD-Project_OpenSTA/dcalc/ArnoldiDelayCalc.cc
ADDED
|
@@ -0,0 +1,1529 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// OpenSTA, Static Timing Analyzer
|
| 2 |
+
// Copyright (c) 2026, Parallax Software, Inc.
|
| 3 |
+
//
|
| 4 |
+
// This program is free software: you can redistribute it and/or modify
|
| 5 |
+
// it under the terms of the GNU General Public License as published by
|
| 6 |
+
// the Free Software Foundation, either version 3 of the License, or
|
| 7 |
+
// (at your option) any later version.
|
| 8 |
+
//
|
| 9 |
+
// This program is distributed in the hope that it will be useful,
|
| 10 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
+
// GNU General Public License for more details.
|
| 13 |
+
//
|
| 14 |
+
// You should have received a copy of the GNU General Public License
|
| 15 |
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 16 |
+
//
|
| 17 |
+
// The origin of this software must not be misrepresented; you must not
|
| 18 |
+
// claim that you wrote the original software.
|
| 19 |
+
//
|
| 20 |
+
// Altered source versions must be plainly marked as such, and must not be
|
| 21 |
+
// misrepresented as being the original software.
|
| 22 |
+
//
|
| 23 |
+
// This notice may not be removed or altered from any source distribution.
|
| 24 |
+
|
| 25 |
+
// (c) 2018 Nefelus, Inc.
|
| 26 |
+
//
|
| 27 |
+
// Author: W. Scott
|
| 28 |
+
|
| 29 |
+
#include "ArnoldiDelayCalc.hh"
|
| 30 |
+
|
| 31 |
+
#include <algorithm>
|
| 32 |
+
#include <cmath> // abs
|
| 33 |
+
#include <cstddef>
|
| 34 |
+
#include <cstdio>
|
| 35 |
+
#include <numbers>
|
| 36 |
+
|
| 37 |
+
#include "ArcDelayCalc.hh"
|
| 38 |
+
#include "Arnoldi.hh"
|
| 39 |
+
#include "ArnoldiReduce.hh"
|
| 40 |
+
#include "Debug.hh"
|
| 41 |
+
#include "DelayCalc.hh"
|
| 42 |
+
#include "Graph.hh"
|
| 43 |
+
#include "GraphDelayCalc.hh"
|
| 44 |
+
#include "Liberty.hh"
|
| 45 |
+
#include "LumpedCapDelayCalc.hh"
|
| 46 |
+
#include "Network.hh"
|
| 47 |
+
#include "Parasitics.hh"
|
| 48 |
+
#include "PortDirection.hh"
|
| 49 |
+
#include "Report.hh"
|
| 50 |
+
#include "Sdc.hh"
|
| 51 |
+
#include "TableModel.hh"
|
| 52 |
+
#include "TimingArc.hh"
|
| 53 |
+
#include "TimingModel.hh"
|
| 54 |
+
#include "Units.hh"
|
| 55 |
+
#include "Variables.hh"
|
| 56 |
+
|
| 57 |
+
namespace sta {
|
| 58 |
+
// NOLINTBEGIN(modernize-avoid-c-style-cast)
|
| 59 |
+
|
| 60 |
+
// wireload8 is n^2
|
| 61 |
+
// do not delete arnoldi parasitics
|
| 62 |
+
// handle rspf parasitics?
|
| 63 |
+
|
| 64 |
+
// mv static functions to ArnoldiDelayCalc
|
| 65 |
+
// need slew only lookup for
|
| 66 |
+
// ra_delay
|
| 67 |
+
// ra_get_r
|
| 68 |
+
// ra_get_s
|
| 69 |
+
|
| 70 |
+
struct delay_work;
|
| 71 |
+
struct delay_c;
|
| 72 |
+
|
| 73 |
+
////////////////////////////////////////////////////////////////
|
| 74 |
+
|
| 75 |
+
static delay_work *delay_work_create();
|
| 76 |
+
static void
|
| 77 |
+
delay_work_destroy(delay_work *D);
|
| 78 |
+
static double *
|
| 79 |
+
delay_work_get_residues(delay_work *D,
|
| 80 |
+
int term_index);
|
| 81 |
+
|
| 82 |
+
static bool
|
| 83 |
+
tridiagEV(int n,
|
| 84 |
+
const double *din,
|
| 85 |
+
const double *ein,
|
| 86 |
+
double *d,
|
| 87 |
+
double **v);
|
| 88 |
+
|
| 89 |
+
//////////////////////////////////////////////////////////////
|
| 90 |
+
|
| 91 |
+
struct delay_c
|
| 92 |
+
{
|
| 93 |
+
double slew_derate;
|
| 94 |
+
double vlo;
|
| 95 |
+
double vhi;
|
| 96 |
+
double vlg;
|
| 97 |
+
double smin;
|
| 98 |
+
double x1;
|
| 99 |
+
double y1;
|
| 100 |
+
double vmid; // falling convention, should be >= 0.5
|
| 101 |
+
};
|
| 102 |
+
|
| 103 |
+
// workspace for pole-residue -> delay calculations
|
| 104 |
+
// delay_work
|
| 105 |
+
// max order is 32
|
| 106 |
+
struct delay_work
|
| 107 |
+
{
|
| 108 |
+
double slew_derate;
|
| 109 |
+
double slew_factor; // (0,1.0] table_slew = slew_factor * full_slew
|
| 110 |
+
delay_c cV[2];
|
| 111 |
+
delay_c *c;
|
| 112 |
+
|
| 113 |
+
double lo_thresh;
|
| 114 |
+
double hi_thresh;
|
| 115 |
+
|
| 116 |
+
int nmax;
|
| 117 |
+
double poles[32]; // 1/tau
|
| 118 |
+
double **resi; // resi[jrec][h] h=0,..order
|
| 119 |
+
double *v[32];
|
| 120 |
+
double *w[32];
|
| 121 |
+
double aa[32];
|
| 122 |
+
};
|
| 123 |
+
|
| 124 |
+
////////////////////////////////////////////////////////////////
|
| 125 |
+
|
| 126 |
+
class ArnoldiDelayCalc : public LumpedCapDelayCalc
|
| 127 |
+
{
|
| 128 |
+
public:
|
| 129 |
+
ArnoldiDelayCalc(StaState *sta);
|
| 130 |
+
ArnoldiDelayCalc(const ArnoldiDelayCalc &dcalc);
|
| 131 |
+
~ArnoldiDelayCalc() override;
|
| 132 |
+
ArcDelayCalc *copy() override;
|
| 133 |
+
std::string_view name() const override { return "arnoldi"; }
|
| 134 |
+
Parasitic *findParasitic(const Pin *drvr_pin,
|
| 135 |
+
const RiseFall *rf,
|
| 136 |
+
const Scene *scene,
|
| 137 |
+
const MinMax *min_max) override;
|
| 138 |
+
Parasitic *reduceParasitic(const Parasitic *parasitic_network,
|
| 139 |
+
const Pin *drvr_pin,
|
| 140 |
+
const RiseFall *rf,
|
| 141 |
+
const Scene *scene,
|
| 142 |
+
const MinMax *min_max) override;
|
| 143 |
+
ArcDcalcResult inputPortDelay(const Pin *port_pin,
|
| 144 |
+
float in_slew,
|
| 145 |
+
const RiseFall *rf,
|
| 146 |
+
const Parasitic *parasitic,
|
| 147 |
+
const LoadPinIndexMap &load_pin_index_map,
|
| 148 |
+
const Scene *scene,
|
| 149 |
+
const MinMax *min_max) override;
|
| 150 |
+
ArcDcalcResult gateDelay(const Pin *drvr_pin,
|
| 151 |
+
const TimingArc *arc,
|
| 152 |
+
const Slew &in_slew,
|
| 153 |
+
// Pass in load_cap or parasitic.
|
| 154 |
+
float load_cap,
|
| 155 |
+
const Parasitic *parasitic,
|
| 156 |
+
const LoadPinIndexMap &load_pin_index_map,
|
| 157 |
+
const Scene *scene,
|
| 158 |
+
const MinMax *min_max) override;
|
| 159 |
+
std::string reportGateDelay(const Pin *drvr_pin,
|
| 160 |
+
const TimingArc *arc,
|
| 161 |
+
const Slew &in_slew,
|
| 162 |
+
float load_cap,
|
| 163 |
+
const Parasitic *parasitic,
|
| 164 |
+
const LoadPinIndexMap &load_pin_index_map,
|
| 165 |
+
const Scene *scene,
|
| 166 |
+
const MinMax *min_max,
|
| 167 |
+
int digits) override;
|
| 168 |
+
void finishDrvrPin() override;
|
| 169 |
+
void delay_work_set_thresholds(delay_work *D,
|
| 170 |
+
double lo,
|
| 171 |
+
double hi,
|
| 172 |
+
bool rising,
|
| 173 |
+
double derate);
|
| 174 |
+
|
| 175 |
+
private:
|
| 176 |
+
ArcDcalcResult gateDelaySlew(const LibertyCell *drvr_cell,
|
| 177 |
+
const TimingArc *arc,
|
| 178 |
+
const GateTableModel *table_model,
|
| 179 |
+
const Slew &in_slew,
|
| 180 |
+
const LoadPinIndexMap &load_pin_index_map,
|
| 181 |
+
const Pvt *pvt);
|
| 182 |
+
void ar1_ceff_delay(delay_work *D,
|
| 183 |
+
timing_table *tab,
|
| 184 |
+
arnoldi1 *mod,
|
| 185 |
+
double *delays,
|
| 186 |
+
double *slews);
|
| 187 |
+
double ra_rdelay_1(timing_table *tab,
|
| 188 |
+
double ctot);
|
| 189 |
+
double ra_get_r(delay_work *D,
|
| 190 |
+
timing_table *tab,
|
| 191 |
+
double rdelay,
|
| 192 |
+
double ctot);
|
| 193 |
+
double ra_get_s(delay_work *D,
|
| 194 |
+
timing_table *tab,
|
| 195 |
+
double r,
|
| 196 |
+
double c);
|
| 197 |
+
void ra_solve_for_s(delay_work *D,
|
| 198 |
+
double p,
|
| 199 |
+
double tlohi,
|
| 200 |
+
double &s);
|
| 201 |
+
// from poles and residues, solve for t20,t50,t80
|
| 202 |
+
void pr_solve1(double s,
|
| 203 |
+
int order,
|
| 204 |
+
double *p,
|
| 205 |
+
double *rr,
|
| 206 |
+
double v1,
|
| 207 |
+
double *t1);
|
| 208 |
+
void pr_solve3(double s,
|
| 209 |
+
int order,
|
| 210 |
+
double *p,
|
| 211 |
+
double *rr,
|
| 212 |
+
double vhi,
|
| 213 |
+
double *thi,
|
| 214 |
+
double vmid,
|
| 215 |
+
double *tmid,
|
| 216 |
+
double vlo,
|
| 217 |
+
double *tlo);
|
| 218 |
+
|
| 219 |
+
//
|
| 220 |
+
// routines for linear drive model and ceff
|
| 221 |
+
//
|
| 222 |
+
double pr_ceff(double s,
|
| 223 |
+
double rdrive,
|
| 224 |
+
int order,
|
| 225 |
+
double *p,
|
| 226 |
+
double *rr,
|
| 227 |
+
double ceff_time);
|
| 228 |
+
double ra_solve_for_t(double p,
|
| 229 |
+
double s,
|
| 230 |
+
double v);
|
| 231 |
+
void ra_solve_for_pt(double ps,
|
| 232 |
+
double v,
|
| 233 |
+
double *pt,
|
| 234 |
+
double *d);
|
| 235 |
+
void ra_calc_c(double lo,
|
| 236 |
+
double hi,
|
| 237 |
+
double *c_smin,
|
| 238 |
+
double *c_x1,
|
| 239 |
+
double *c_y1);
|
| 240 |
+
|
| 241 |
+
rcmodel *rcmodel_{nullptr};
|
| 242 |
+
int _pinNmax;
|
| 243 |
+
double *_delayV;
|
| 244 |
+
double *_slewV;
|
| 245 |
+
int pin_n_;
|
| 246 |
+
ArnoldiReduce *reduce_;
|
| 247 |
+
delay_work *delay_work_;
|
| 248 |
+
};
|
| 249 |
+
|
| 250 |
+
ArcDelayCalc *
|
| 251 |
+
makeArnoldiDelayCalc(StaState *sta)
|
| 252 |
+
{
|
| 253 |
+
return new ArnoldiDelayCalc(sta);
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
ArnoldiDelayCalc::ArnoldiDelayCalc(StaState *sta) :
|
| 257 |
+
LumpedCapDelayCalc(sta),
|
| 258 |
+
reduce_(new ArnoldiReduce(sta)),
|
| 259 |
+
delay_work_(delay_work_create())
|
| 260 |
+
{
|
| 261 |
+
_pinNmax = 1024;
|
| 262 |
+
_delayV = (double*)malloc(_pinNmax * sizeof(double));
|
| 263 |
+
_slewV = (double*)malloc(_pinNmax * sizeof(double));
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
ArnoldiDelayCalc::ArnoldiDelayCalc(const ArnoldiDelayCalc &dcalc) :
|
| 267 |
+
LumpedCapDelayCalc(dcalc),
|
| 268 |
+
reduce_(new ArnoldiReduce(this)),
|
| 269 |
+
delay_work_(delay_work_create())
|
| 270 |
+
{
|
| 271 |
+
_pinNmax = dcalc._pinNmax;
|
| 272 |
+
_delayV = (double*)malloc(_pinNmax * sizeof(double));
|
| 273 |
+
_slewV = (double*)malloc(_pinNmax * sizeof(double));
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
ArcDelayCalc *
|
| 277 |
+
ArnoldiDelayCalc::copy()
|
| 278 |
+
{
|
| 279 |
+
return new ArnoldiDelayCalc(*this);
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
ArnoldiDelayCalc::~ArnoldiDelayCalc()
|
| 283 |
+
{
|
| 284 |
+
delay_work_destroy(delay_work_);
|
| 285 |
+
free(_delayV);
|
| 286 |
+
free(_slewV);
|
| 287 |
+
delete reduce_;
|
| 288 |
+
delete rcmodel_;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
Parasitic *
|
| 292 |
+
ArnoldiDelayCalc::findParasitic(const Pin *drvr_pin,
|
| 293 |
+
const RiseFall *drvr_rf,
|
| 294 |
+
const Scene *scene,
|
| 295 |
+
const MinMax *min_max)
|
| 296 |
+
{
|
| 297 |
+
Parasitic *parasitic = nullptr;
|
| 298 |
+
const Sdc *sdc = scene->sdc();
|
| 299 |
+
Parasitics *parasitics = scene->parasitics(min_max);
|
| 300 |
+
if (parasitics == nullptr
|
| 301 |
+
// set_load net has precedence over parasitics.
|
| 302 |
+
|| network_->direction(drvr_pin)->isInternal())
|
| 303 |
+
return nullptr;
|
| 304 |
+
Parasitic *parasitic_network =
|
| 305 |
+
parasitics->findParasiticNetwork(drvr_pin);
|
| 306 |
+
if (parasitic_network == nullptr) {
|
| 307 |
+
Wireload *wireload = sdc->wireload(min_max);
|
| 308 |
+
if (wireload) {
|
| 309 |
+
float pin_cap, wire_cap, fanout;
|
| 310 |
+
bool has_wire_cap;
|
| 311 |
+
graph_delay_calc_->netCaps(drvr_pin, drvr_rf, scene, min_max,
|
| 312 |
+
pin_cap, wire_cap, fanout, has_wire_cap);
|
| 313 |
+
parasitic_network = parasitics->makeWireloadNetwork(drvr_pin, wireload,
|
| 314 |
+
fanout, scene, min_max);
|
| 315 |
+
}
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
if (parasitic_network) {
|
| 319 |
+
rcmodel_ = reduce_->reduceToArnoldi(parasitic_network, drvr_pin,
|
| 320 |
+
parasitics->couplingCapFactor(),
|
| 321 |
+
drvr_rf, scene, min_max);
|
| 322 |
+
// Arnoldi parasitics are their own class that are not saved in the parasitic db.
|
| 323 |
+
parasitic = rcmodel_;
|
| 324 |
+
}
|
| 325 |
+
return parasitic;
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
Parasitic *
|
| 329 |
+
ArnoldiDelayCalc::reduceParasitic(const Parasitic *,
|
| 330 |
+
const Pin *,
|
| 331 |
+
const RiseFall *,
|
| 332 |
+
const Scene *,
|
| 333 |
+
const MinMax *)
|
| 334 |
+
{
|
| 335 |
+
// Decline because reduced arnoldi parasitics are not stored in the parasitics db.
|
| 336 |
+
return nullptr;
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
void
|
| 340 |
+
ArnoldiDelayCalc::finishDrvrPin()
|
| 341 |
+
{
|
| 342 |
+
delete rcmodel_;
|
| 343 |
+
rcmodel_ = nullptr;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
ArcDcalcResult
|
| 347 |
+
ArnoldiDelayCalc::inputPortDelay(const Pin *,
|
| 348 |
+
float in_slew,
|
| 349 |
+
const RiseFall *rf,
|
| 350 |
+
const Parasitic *parasitic,
|
| 351 |
+
const LoadPinIndexMap &load_pin_index_map,
|
| 352 |
+
const Scene *,
|
| 353 |
+
const MinMax *)
|
| 354 |
+
{
|
| 355 |
+
rcmodel_ = nullptr;
|
| 356 |
+
_delayV[0] = 0.0;
|
| 357 |
+
_slewV[0] = in_slew;
|
| 358 |
+
|
| 359 |
+
LibertyLibrary *drvr_library = network_->defaultLibertyLibrary();
|
| 360 |
+
ArcDcalcResult dcalc_result(load_pin_index_map.size());
|
| 361 |
+
if (parasitic) {
|
| 362 |
+
rcmodel_ = reinterpret_cast<rcmodel*>(const_cast<Parasitic*>(parasitic));
|
| 363 |
+
pin_n_ = rcmodel_->n;
|
| 364 |
+
if (pin_n_ >= _pinNmax) {
|
| 365 |
+
_pinNmax *= 2;
|
| 366 |
+
if (pin_n_ >= _pinNmax) _pinNmax += pin_n_;
|
| 367 |
+
_pinNmax *= 2;
|
| 368 |
+
_delayV = (double*)realloc(_delayV,_pinNmax * sizeof(double));
|
| 369 |
+
_slewV = (double*)realloc(_slewV,_pinNmax * sizeof(double));
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
pin_n_ = rcmodel_->n;
|
| 373 |
+
double slew_derate = drvr_library->slewDerateFromLibrary();
|
| 374 |
+
double lo_thresh = drvr_library->slewLowerThreshold(rf);
|
| 375 |
+
double hi_thresh = drvr_library->slewUpperThreshold(rf);
|
| 376 |
+
bool rising = (rf == RiseFall::rise());
|
| 377 |
+
delay_work_set_thresholds(delay_work_, lo_thresh, hi_thresh, rising, slew_derate);
|
| 378 |
+
delay_c *c = delay_work_->c;
|
| 379 |
+
double c_log = c->vlg;
|
| 380 |
+
|
| 381 |
+
for (int j=1;j<pin_n_;j++) {
|
| 382 |
+
double elmore = rcmodel_->elmore(j);
|
| 383 |
+
double wire_delay = std::numbers::ln2 * elmore;
|
| 384 |
+
double load_slew = in_slew + c_log*elmore/slew_derate;
|
| 385 |
+
_delayV[j] = wire_delay;
|
| 386 |
+
_slewV[j] = load_slew;
|
| 387 |
+
|
| 388 |
+
const Pin *load_pin = rcmodel_->pinV[j];
|
| 389 |
+
auto load_idx_itr = load_pin_index_map.find(load_pin);
|
| 390 |
+
if (load_idx_itr != load_pin_index_map.end()) {
|
| 391 |
+
size_t load_idx = load_idx_itr->second;
|
| 392 |
+
dcalc_result.setWireDelay(load_idx, wire_delay);
|
| 393 |
+
dcalc_result.setLoadSlew(load_idx, load_slew);
|
| 394 |
+
}
|
| 395 |
+
}
|
| 396 |
+
}
|
| 397 |
+
else
|
| 398 |
+
dcalc_result = makeResult(drvr_library, rf, 0.0, in_slew, load_pin_index_map);
|
| 399 |
+
return dcalc_result;
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
ArcDcalcResult
|
| 403 |
+
ArnoldiDelayCalc::gateDelay(const Pin *drvr_pin,
|
| 404 |
+
const TimingArc *arc,
|
| 405 |
+
const Slew &in_slew,
|
| 406 |
+
float load_cap,
|
| 407 |
+
const Parasitic *parasitic,
|
| 408 |
+
const LoadPinIndexMap &load_pin_index_map,
|
| 409 |
+
const Scene *scene,
|
| 410 |
+
const MinMax *min_max)
|
| 411 |
+
{
|
| 412 |
+
const LibertyCell *drvr_cell = arc->from()->libertyCell();
|
| 413 |
+
ConcreteParasitic *cparasitic =
|
| 414 |
+
reinterpret_cast<ConcreteParasitic*>(const_cast<Parasitic*>(parasitic));
|
| 415 |
+
rcmodel_ = dynamic_cast<rcmodel*>(cparasitic);
|
| 416 |
+
GateTableModel *table_model = arc->gateTableModel(scene, min_max);
|
| 417 |
+
if (table_model && rcmodel_) {
|
| 418 |
+
const Pvt *pvt = pinPvt(drvr_pin, scene, min_max);
|
| 419 |
+
return gateDelaySlew(drvr_cell, arc, table_model, in_slew, load_pin_index_map, pvt);
|
| 420 |
+
}
|
| 421 |
+
else
|
| 422 |
+
return LumpedCapDelayCalc::gateDelay(drvr_pin, arc, in_slew, load_cap,
|
| 423 |
+
parasitic, load_pin_index_map, scene, min_max);
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
ArcDcalcResult
|
| 427 |
+
ArnoldiDelayCalc::gateDelaySlew(const LibertyCell *drvr_cell,
|
| 428 |
+
const TimingArc *arc,
|
| 429 |
+
const GateTableModel *table_model,
|
| 430 |
+
const Slew &in_slew,
|
| 431 |
+
const LoadPinIndexMap &load_pin_index_map,
|
| 432 |
+
const Pvt *pvt)
|
| 433 |
+
{
|
| 434 |
+
pin_n_ = rcmodel_->n;
|
| 435 |
+
if (pin_n_ >= _pinNmax) {
|
| 436 |
+
_pinNmax *= 2;
|
| 437 |
+
if (pin_n_ >= _pinNmax) _pinNmax += pin_n_;
|
| 438 |
+
_delayV = (double*)realloc(_delayV,_pinNmax * sizeof(double));
|
| 439 |
+
_slewV = (double*)realloc(_slewV,_pinNmax * sizeof(double));
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
ArcDcalcResult dcalc_result(load_pin_index_map.size());
|
| 443 |
+
pin_n_ = rcmodel_->n;
|
| 444 |
+
const RiseFall *rf = arc->toEdge()->asRiseFall();
|
| 445 |
+
if (table_model && rf) {
|
| 446 |
+
const LibertyLibrary *drvr_library = drvr_cell->libertyLibrary();
|
| 447 |
+
double slew_derate = drvr_library->slewDerateFromLibrary();
|
| 448 |
+
double lo_thresh = drvr_library->slewLowerThreshold(rf);
|
| 449 |
+
double hi_thresh = drvr_library->slewUpperThreshold(rf);
|
| 450 |
+
bool rising = (rf == RiseFall::rise());
|
| 451 |
+
delay_work_set_thresholds(delay_work_, lo_thresh, hi_thresh, rising,
|
| 452 |
+
slew_derate);
|
| 453 |
+
if (rcmodel_->order > 0) {
|
| 454 |
+
timing_table tab;
|
| 455 |
+
tab.table = table_model;
|
| 456 |
+
tab.cell = drvr_cell;
|
| 457 |
+
tab.pvt = pvt;
|
| 458 |
+
tab.in_slew = delayAsFloat(in_slew);
|
| 459 |
+
ar1_ceff_delay(delay_work_, &tab, rcmodel_,
|
| 460 |
+
_delayV, _slewV);
|
| 461 |
+
}
|
| 462 |
+
dcalc_result.setGateDelay(_delayV[0]);
|
| 463 |
+
dcalc_result.setDrvrSlew(_slewV[0]);
|
| 464 |
+
|
| 465 |
+
if (rcmodel_) {
|
| 466 |
+
for (int i = 0; i < rcmodel_->n; i++) {
|
| 467 |
+
const Pin *load_pin = rcmodel_->pinV[i];
|
| 468 |
+
auto load_idx_itr = load_pin_index_map.find(load_pin);
|
| 469 |
+
if (load_idx_itr != load_pin_index_map.end()) {
|
| 470 |
+
size_t load_idx = load_idx_itr->second;
|
| 471 |
+
double wire_delay = _delayV[i] - _delayV[0];
|
| 472 |
+
double load_slew = _slewV[i];
|
| 473 |
+
thresholdAdjust(load_pin, drvr_library, rf, wire_delay, load_slew);
|
| 474 |
+
dcalc_result.setWireDelay(load_idx, wire_delay);
|
| 475 |
+
dcalc_result.setLoadSlew(load_idx, load_slew);
|
| 476 |
+
}
|
| 477 |
+
}
|
| 478 |
+
}
|
| 479 |
+
}
|
| 480 |
+
return dcalc_result;
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
std::string
|
| 484 |
+
ArnoldiDelayCalc::reportGateDelay(const Pin *drvr_pin,
|
| 485 |
+
const TimingArc *arc,
|
| 486 |
+
const Slew &in_slew,
|
| 487 |
+
float load_cap,
|
| 488 |
+
const Parasitic *parasitic,
|
| 489 |
+
const LoadPinIndexMap &load_pin_index_map,
|
| 490 |
+
const Scene *scene,
|
| 491 |
+
const MinMax *min_max,
|
| 492 |
+
int digits)
|
| 493 |
+
{
|
| 494 |
+
return LumpedCapDelayCalc::reportGateDelay(drvr_pin, arc, in_slew, load_cap,
|
| 495 |
+
parasitic, load_pin_index_map,
|
| 496 |
+
scene, min_max, digits);
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
////////////////////////////////////////////////////////////////
|
| 500 |
+
|
| 501 |
+
//
|
| 502 |
+
// arnoldi1.cpp
|
| 503 |
+
//
|
| 504 |
+
|
| 505 |
+
arnoldi1::~arnoldi1()
|
| 506 |
+
{
|
| 507 |
+
free(d);
|
| 508 |
+
free(reinterpret_cast<void *>(U));
|
| 509 |
+
}
|
| 510 |
+
|
| 511 |
+
double
|
| 512 |
+
arnoldi1::elmore(int k)
|
| 513 |
+
{
|
| 514 |
+
if (order==0) return 0.0;
|
| 515 |
+
if (order==1) return d[0];
|
| 516 |
+
double sqctot = 1.0/U[0][0];
|
| 517 |
+
double tau = d[0] + e[0]*U[1][k]*sqctot;
|
| 518 |
+
return tau;
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
delay_work *
|
| 522 |
+
delay_work_create()
|
| 523 |
+
{
|
| 524 |
+
int j;
|
| 525 |
+
delay_work *D = (delay_work*)malloc(sizeof(delay_work));
|
| 526 |
+
D->nmax = 256;
|
| 527 |
+
D->resi = (double**)malloc(static_cast<size_t>(D->nmax) * sizeof(double *));
|
| 528 |
+
D->resi[0] = (double*)malloc(static_cast<size_t>(D->nmax) * 32u * sizeof(double));
|
| 529 |
+
for (j=1;j<D->nmax;j++)
|
| 530 |
+
D->resi[j] = D->resi[0] + static_cast<ptrdiff_t>(j) * 32;
|
| 531 |
+
D->v[0] = (double*)malloc(static_cast<size_t>(32) * 32u * sizeof(double));
|
| 532 |
+
for (j=1;j<32;j++)
|
| 533 |
+
D->v[j] = D->v[0] + static_cast<ptrdiff_t>(j) * 32;
|
| 534 |
+
D->w[0] = (double*)malloc(32u * static_cast<size_t>(D->nmax) * sizeof(double));
|
| 535 |
+
for (j=1;j<32;j++)
|
| 536 |
+
D->w[j] = D->w[0] + static_cast<ptrdiff_t>(j) * D->nmax;
|
| 537 |
+
D->lo_thresh = 0.0;
|
| 538 |
+
D->hi_thresh = 0.0;
|
| 539 |
+
D->slew_derate = 0.0;
|
| 540 |
+
D->slew_factor = 0.0;
|
| 541 |
+
for (j=0;j<2;j++) {
|
| 542 |
+
D->cV[j].slew_derate = 0.0;
|
| 543 |
+
D->cV[j].vlo = 0.0;
|
| 544 |
+
D->cV[j].vhi = 0.0;
|
| 545 |
+
D->cV[j].vlg = 0.0;
|
| 546 |
+
D->cV[j].smin = 0.0;
|
| 547 |
+
D->cV[j].x1 = 0.0;
|
| 548 |
+
D->cV[j].y1 = 0.0;
|
| 549 |
+
D->cV[j].vmid = 0.0;
|
| 550 |
+
}
|
| 551 |
+
D->c = D->cV;
|
| 552 |
+
return D;
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
static void
|
| 556 |
+
delay_work_destroy(delay_work *D)
|
| 557 |
+
{
|
| 558 |
+
free(D->resi[0]);
|
| 559 |
+
free(reinterpret_cast<void *>(D->resi));
|
| 560 |
+
free(D->v[0]);
|
| 561 |
+
free(D->w[0]);
|
| 562 |
+
free(D);
|
| 563 |
+
}
|
| 564 |
+
|
| 565 |
+
static void
|
| 566 |
+
delay_work_alloc(delay_work *D,int n)
|
| 567 |
+
{
|
| 568 |
+
if (n<=D->nmax) return;
|
| 569 |
+
free(D->w[0]);
|
| 570 |
+
free(D->resi[0]);
|
| 571 |
+
free(reinterpret_cast<void *>(D->resi));
|
| 572 |
+
D->nmax *= 2;
|
| 573 |
+
D->nmax = std::max(n, D->nmax);
|
| 574 |
+
int j;
|
| 575 |
+
D->resi = (double**)malloc(static_cast<size_t>(D->nmax) * sizeof(double *));
|
| 576 |
+
D->resi[0] = (double*)malloc(static_cast<size_t>(D->nmax) * 32u * sizeof(double));
|
| 577 |
+
for (j=1;j<D->nmax;j++)
|
| 578 |
+
D->resi[j] = D->resi[0] + static_cast<ptrdiff_t>(j) * 32;
|
| 579 |
+
D->w[0] = (double*)malloc(32u * static_cast<size_t>(D->nmax) * sizeof(double));
|
| 580 |
+
for (j=1;j<32;j++)
|
| 581 |
+
D->w[j] = D->w[0] + static_cast<ptrdiff_t>(j) * D->nmax;
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
void
|
| 585 |
+
ArnoldiDelayCalc::delay_work_set_thresholds(delay_work *D,
|
| 586 |
+
double lo,
|
| 587 |
+
double hi,
|
| 588 |
+
bool rising,
|
| 589 |
+
double derate)
|
| 590 |
+
{
|
| 591 |
+
double mid = 0.5; // 0.0:1.0
|
| 592 |
+
int i = rising?1:0;
|
| 593 |
+
D->c = D->cV+ i;
|
| 594 |
+
// WRONG
|
| 595 |
+
bool changed = (lo != D->c->vlo || hi != D->c->vhi);
|
| 596 |
+
if (changed) {
|
| 597 |
+
if (!(lo>0.01 && hi<0.99)) {
|
| 598 |
+
lo = 0.1;
|
| 599 |
+
hi = 0.9;
|
| 600 |
+
derate = 0.8;
|
| 601 |
+
}
|
| 602 |
+
D->c->slew_derate = derate;
|
| 603 |
+
D->c->vlo = lo;
|
| 604 |
+
D->c->vhi = hi;
|
| 605 |
+
D->c->vmid = mid;
|
| 606 |
+
D->c->vlg = log(hi/lo);
|
| 607 |
+
ra_calc_c(lo,hi,
|
| 608 |
+
&(D->c->smin), &(D->c->x1),&(D->c->y1));
|
| 609 |
+
}
|
| 610 |
+
D->lo_thresh = D->c->vlo;
|
| 611 |
+
D->hi_thresh = D->c->vhi;
|
| 612 |
+
D->slew_derate = derate;
|
| 613 |
+
double measured_swing = D->c->vhi - D->c->vlo;
|
| 614 |
+
double reported_swing = measured_swing/D->slew_derate;
|
| 615 |
+
D->slew_factor = reported_swing;
|
| 616 |
+
}
|
| 617 |
+
|
| 618 |
+
static double *
|
| 619 |
+
delay_work_get_residues(delay_work *D,int term_index)
|
| 620 |
+
{
|
| 621 |
+
return D->resi[term_index];
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
//////////////////////////////////////////////////////////////
|
| 625 |
+
//
|
| 626 |
+
// calculate_poles_res
|
| 627 |
+
//
|
| 628 |
+
|
| 629 |
+
void arnoldi1::calculate_poles_res(delay_work *D,
|
| 630 |
+
double rdrive)
|
| 631 |
+
{
|
| 632 |
+
if (n > D->nmax) delay_work_alloc(D,n);
|
| 633 |
+
double *p = D->poles;
|
| 634 |
+
double **v = D->v;
|
| 635 |
+
double **w = D->w;
|
| 636 |
+
double *aa = D->aa;
|
| 637 |
+
double **resi = D->resi;
|
| 638 |
+
int h,j,k;
|
| 639 |
+
double sum, dsave;
|
| 640 |
+
|
| 641 |
+
dsave = d[0];
|
| 642 |
+
d[0] += rdrive*ctot;
|
| 643 |
+
if (!tridiagEV(order,d,e,p,v))
|
| 644 |
+
criticalError(204, "arnoldi delay calc failed.");
|
| 645 |
+
d[0] = dsave;
|
| 646 |
+
|
| 647 |
+
for (h=0;h<order;h++) {
|
| 648 |
+
p[h] = std::max(p[h], 1e-14); // .01ps floor
|
| 649 |
+
p[h] = 1.0/p[h];
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
for (h=0;h<order;h++) {
|
| 653 |
+
for (k=0;k<n;k++) {
|
| 654 |
+
sum = 0.0;
|
| 655 |
+
for (j=0;j<order;j++)
|
| 656 |
+
sum += v[h][j]*U[j][k];
|
| 657 |
+
w[h][k] = sum;
|
| 658 |
+
}
|
| 659 |
+
aa[h] = sqc*v[h][0];
|
| 660 |
+
}
|
| 661 |
+
|
| 662 |
+
for (j=0;j<n;j++) {
|
| 663 |
+
for (h=0;h<order;h++)
|
| 664 |
+
resi[j][h] = aa[h]*w[h][j];
|
| 665 |
+
}
|
| 666 |
+
}
|
| 667 |
+
|
| 668 |
+
////////////////////////////////////////////////////////////////
|
| 669 |
+
|
| 670 |
+
//
|
| 671 |
+
// tridiag.cpp
|
| 672 |
+
//
|
| 673 |
+
|
| 674 |
+
//
|
| 675 |
+
// tridiagonal eigenvalues and eigenvectors
|
| 676 |
+
// assuming all eigenvalues are positive
|
| 677 |
+
//
|
| 678 |
+
// tridiagEV(n, din, ein, d, v)
|
| 679 |
+
// din[0]..din[n-1] diagonal elements (input)
|
| 680 |
+
// ein[0]..ein[n-2] off-diagonal elements (input)
|
| 681 |
+
// d[0],..d[n-1] the eigenvalues (output)
|
| 682 |
+
// v[0],..v[n-1] the eigenvectors
|
| 683 |
+
// M*v[j] = p[j]*v[j]
|
| 684 |
+
//
|
| 685 |
+
// (M*v[j])[0] = d[0]*v[j][0]+e[0]*v[j][1]
|
| 686 |
+
// (M*v[j])[k] = d[k]*v[j][k]+e[k-1]*v[j][k-1]+e[k]*v[j][k+1] 0<k<n-1
|
| 687 |
+
// (M*v[j])[n-1] = d[n-1]*v[j][n-1]+e[n-2]*v[j][n-2]
|
| 688 |
+
//
|
| 689 |
+
static bool
|
| 690 |
+
tridiagEV(int n,
|
| 691 |
+
const double *din,
|
| 692 |
+
const double *ein,
|
| 693 |
+
double *d,
|
| 694 |
+
double **v)
|
| 695 |
+
{
|
| 696 |
+
int j,k;
|
| 697 |
+
for (j=0;j<n;j++) for (k=0;k<n;k++) v[j][k]=0.0;
|
| 698 |
+
for (j=0;j<n;j++) v[j][j] = 1.0;
|
| 699 |
+
|
| 700 |
+
int m,h,iter,i;
|
| 701 |
+
double s,r,p,g,f,c,b;
|
| 702 |
+
double e[32];
|
| 703 |
+
if (n>32)
|
| 704 |
+
return false;
|
| 705 |
+
|
| 706 |
+
for (i=0;i<n;i++) d[i] = din[i];
|
| 707 |
+
|
| 708 |
+
for (i=0;i<n-1;i++) e[i+1] = ein[i];
|
| 709 |
+
e[0] = 0.0;
|
| 710 |
+
for (h=n-1;h>=1;h--) {
|
| 711 |
+
iter = 0;
|
| 712 |
+
while (std::abs(e[h])>1e-18) { // 1e-6ps
|
| 713 |
+
m=0;
|
| 714 |
+
if (m != h) {
|
| 715 |
+
if (iter++ == 20)
|
| 716 |
+
return false;
|
| 717 |
+
g = (d[h-1]-d[h])/(2.0*e[h]);
|
| 718 |
+
r = sqrt(1.0+g*g); // watch overflow
|
| 719 |
+
g = d[m]-d[h]+e[h]/(g + (g<0?-r:r));
|
| 720 |
+
s = c = 1.0;
|
| 721 |
+
p = 0.0;
|
| 722 |
+
for (i=m+1;i<=h;i++) {
|
| 723 |
+
f = s*e[i];
|
| 724 |
+
b = c*e[i];
|
| 725 |
+
e[i-1] = r = sqrt(f*f+g*g); // watch
|
| 726 |
+
if (r == 0.0) {
|
| 727 |
+
d[i-1] -= p;
|
| 728 |
+
e[m] = 0.0;
|
| 729 |
+
break;
|
| 730 |
+
}
|
| 731 |
+
s = f/r;
|
| 732 |
+
c = g/r;
|
| 733 |
+
g = d[i-1]-p;
|
| 734 |
+
r = (d[i]-g)*s+2.0*c*b;
|
| 735 |
+
d[i-1] = g + (p=s*r);
|
| 736 |
+
g = c*r-b;
|
| 737 |
+
for (k=0;k<n;k++) {
|
| 738 |
+
f = v[i-1][k];
|
| 739 |
+
v[i-1][k] = s*v[i][k]+c*f;
|
| 740 |
+
v[i][k] = c*v[i][k]-s*f;
|
| 741 |
+
}
|
| 742 |
+
}
|
| 743 |
+
if (r == 0.0 && i <= h) continue;
|
| 744 |
+
d[h] -= p;
|
| 745 |
+
e[h] = g;
|
| 746 |
+
e[m] = 0.0;
|
| 747 |
+
}
|
| 748 |
+
}
|
| 749 |
+
}
|
| 750 |
+
|
| 751 |
+
for (i=0;i<n-1;i++) {
|
| 752 |
+
k = i;
|
| 753 |
+
p = d[k];
|
| 754 |
+
for (j=i+1;j<n;j++)
|
| 755 |
+
if (d[j] > p) { k=j; p=d[k]; }
|
| 756 |
+
if (k != i) {
|
| 757 |
+
d[k] = d[i];
|
| 758 |
+
d[i] = p;
|
| 759 |
+
for (j=0;j<n;j++) {
|
| 760 |
+
p = v[i][j];
|
| 761 |
+
v[i][j] = v[k][j];
|
| 762 |
+
v[k][j] = p;
|
| 763 |
+
}
|
| 764 |
+
}
|
| 765 |
+
}
|
| 766 |
+
|
| 767 |
+
return true;
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
////////////////////////////////////////////////////////////////
|
| 771 |
+
|
| 772 |
+
// prsolve.cpp
|
| 773 |
+
|
| 774 |
+
// get a waveform point
|
| 775 |
+
static void
|
| 776 |
+
pr_get_v(double t,
|
| 777 |
+
double s,
|
| 778 |
+
int order,
|
| 779 |
+
const double *p,
|
| 780 |
+
const double *rr,
|
| 781 |
+
double *va)
|
| 782 |
+
{
|
| 783 |
+
*va = 0.0;
|
| 784 |
+
int h;
|
| 785 |
+
for (h=0;h<order;h++) {
|
| 786 |
+
double pt = p[h]*t;
|
| 787 |
+
double ps = p[h]*s;
|
| 788 |
+
double f;
|
| 789 |
+
if (t<s) {
|
| 790 |
+
f = 1.0-t/s + (1.0-exp(-pt))/ps;
|
| 791 |
+
} else {
|
| 792 |
+
f = exp(ps-pt)*(1.0-exp(-ps))/ps;
|
| 793 |
+
}
|
| 794 |
+
*va += rr[h]*f;
|
| 795 |
+
}
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
static void
|
| 799 |
+
get_dv(double t,
|
| 800 |
+
double s,
|
| 801 |
+
int order,
|
| 802 |
+
const double *p,
|
| 803 |
+
const double *rr,
|
| 804 |
+
double *va,
|
| 805 |
+
double *dva)
|
| 806 |
+
{
|
| 807 |
+
*va = 0.0;
|
| 808 |
+
*dva = 0.0;
|
| 809 |
+
int h;
|
| 810 |
+
for (h=0;h<order;h++) {
|
| 811 |
+
double p1 = p[h];
|
| 812 |
+
double pt = p1*t;
|
| 813 |
+
double ps = p1*s;
|
| 814 |
+
double f,df,xtmp;
|
| 815 |
+
if (t<s) {
|
| 816 |
+
xtmp = (1.0-exp(-pt))/ps;
|
| 817 |
+
f = 1.0-t/s + xtmp;
|
| 818 |
+
df = -p1*xtmp;
|
| 819 |
+
} else {
|
| 820 |
+
f = exp(ps-pt)*(1.0-exp(-ps))/ps;
|
| 821 |
+
df = -p1*f;
|
| 822 |
+
}
|
| 823 |
+
*va += rr[h]*f;
|
| 824 |
+
*dva += rr[h]*df;
|
| 825 |
+
}
|
| 826 |
+
}
|
| 827 |
+
|
| 828 |
+
static double
|
| 829 |
+
solve_t_bracketed(double s,
|
| 830 |
+
int order,
|
| 831 |
+
const double *p,
|
| 832 |
+
const double *rr,
|
| 833 |
+
double val,
|
| 834 |
+
double x1,
|
| 835 |
+
double x2,
|
| 836 |
+
double v1,
|
| 837 |
+
double v2)
|
| 838 |
+
{
|
| 839 |
+
int j;
|
| 840 |
+
double df,dx,dxold,f,f2,f1;
|
| 841 |
+
double temp,xh,x_lo,rts;
|
| 842 |
+
double xacc = .001e-12; // .001ps
|
| 843 |
+
f1 = v1-val;
|
| 844 |
+
f2 = v2-val;
|
| 845 |
+
if (f1==0.0) return x1;
|
| 846 |
+
if (f2==0.0) return x2;
|
| 847 |
+
rts = (f1*x2-f2*x1)/(f1-f2);
|
| 848 |
+
if (f1<f2) {
|
| 849 |
+
x_lo = x1;
|
| 850 |
+
xh = x2;
|
| 851 |
+
if (0.0<f1) return x1;
|
| 852 |
+
if (f2<0.0) return x2;
|
| 853 |
+
} else {
|
| 854 |
+
x_lo = x2;
|
| 855 |
+
xh = x1;
|
| 856 |
+
if (0.0<f2) return x2;
|
| 857 |
+
if (f1<0.0) return x1;
|
| 858 |
+
}
|
| 859 |
+
dxold = std::abs(x2-x1);
|
| 860 |
+
dx = dxold;
|
| 861 |
+
get_dv(rts,s,order,p,rr,&f,&df);
|
| 862 |
+
f -= val;
|
| 863 |
+
double flast = 0.0;
|
| 864 |
+
for (j=1;j<10;j++) {
|
| 865 |
+
if ((((rts-xh)*df-f)*((rts-x_lo)*df-f) >= 0.0)
|
| 866 |
+
|| (std::abs(2.0*f) > std::abs(dxold*df))) {
|
| 867 |
+
dxold = dx;
|
| 868 |
+
dx = 0.5*(xh-x_lo);
|
| 869 |
+
if (flast*f >0.0) {
|
| 870 |
+
// 2 successive bisections in same direction,
|
| 871 |
+
// accelerate
|
| 872 |
+
if (f<0.0) dx = 0.9348*(xh-x_lo);
|
| 873 |
+
else dx = 0.0625*(xh-x_lo);
|
| 874 |
+
}
|
| 875 |
+
flast = f;
|
| 876 |
+
rts = x_lo+dx;
|
| 877 |
+
if (x_lo == rts) {
|
| 878 |
+
return rts;
|
| 879 |
+
}
|
| 880 |
+
} else {
|
| 881 |
+
dxold = dx;
|
| 882 |
+
dx = f/df;
|
| 883 |
+
flast = 0.0;
|
| 884 |
+
temp = rts;
|
| 885 |
+
rts -= dx;
|
| 886 |
+
if (temp == rts) {
|
| 887 |
+
return rts;
|
| 888 |
+
}
|
| 889 |
+
}
|
| 890 |
+
if (std::abs(dx) < xacc) {
|
| 891 |
+
return rts;
|
| 892 |
+
}
|
| 893 |
+
get_dv(rts,s,order,p,rr,&f,&df); f -= val;
|
| 894 |
+
if (f<0.0)
|
| 895 |
+
x_lo = rts;
|
| 896 |
+
else
|
| 897 |
+
xh = rts;
|
| 898 |
+
}
|
| 899 |
+
if (std::abs(f)<1e-6) // 1uV
|
| 900 |
+
return rts;
|
| 901 |
+
return 0.5*(x_lo+xh);
|
| 902 |
+
}
|
| 903 |
+
|
| 904 |
+
void
|
| 905 |
+
ArnoldiDelayCalc::pr_solve1(double s,
|
| 906 |
+
int order,
|
| 907 |
+
double *p,
|
| 908 |
+
double *rr,
|
| 909 |
+
double v1,
|
| 910 |
+
double *t1)
|
| 911 |
+
{
|
| 912 |
+
double tmin = 0.0,tmax = 0.0,vmin = 0.0,vmax = 0.0;
|
| 913 |
+
int h, h0 = 0;
|
| 914 |
+
while (order>1
|
| 915 |
+
&& rr[order-1]<1e-8 // 1e-8V
|
| 916 |
+
&& rr[order-1]>-1e-8)
|
| 917 |
+
order--;
|
| 918 |
+
if (rr[0]<0.5) {
|
| 919 |
+
for (h=1;h<order;h++) if (rr[h]>0.3 && rr[h]>rr[0]) { h0 = h; break; }
|
| 920 |
+
}
|
| 921 |
+
double p0 = p[h0];
|
| 922 |
+
double ps,vs,ta,va;
|
| 923 |
+
vs = 0.0;
|
| 924 |
+
for (h=0;h<order;h++) {
|
| 925 |
+
ps = p[h]*s;
|
| 926 |
+
vs += rr[h]*(1-exp(-ps))/ps;
|
| 927 |
+
}
|
| 928 |
+
if (vs<v1) {
|
| 929 |
+
// s dominates
|
| 930 |
+
ta = 0.5*(1+v1)*s;
|
| 931 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 932 |
+
if (va<v1) {
|
| 933 |
+
tmax = ta; vmax = va;
|
| 934 |
+
ta = v1*s;
|
| 935 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 936 |
+
if (va<v1) {
|
| 937 |
+
// ignoring a typical error at drive node, that comes
|
| 938 |
+
// from slight inaccuracies in rr
|
| 939 |
+
if (!(rr[order-1]>1.0 && p[order-1]>500.0 && va>v1-0.002))
|
| 940 |
+
debugPrint(debug_, "arnoldi", 1, "err, pr_solve1, va<v1");
|
| 941 |
+
}
|
| 942 |
+
tmin = ta; vmin = va;
|
| 943 |
+
} else {
|
| 944 |
+
tmin = ta; vmin = va;
|
| 945 |
+
ta = s;
|
| 946 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 947 |
+
while (va>v1) {
|
| 948 |
+
tmin = ta; vmin = va;
|
| 949 |
+
ta *= 2.0;
|
| 950 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 951 |
+
}
|
| 952 |
+
if (va>v1)
|
| 953 |
+
debugPrint(debug_, "arnoldi", 1, "err, pr_solve1, va>v1");
|
| 954 |
+
tmax = ta; vmax = va;
|
| 955 |
+
}
|
| 956 |
+
} else {
|
| 957 |
+
// s is irrelevant
|
| 958 |
+
ta = s; va = vs;
|
| 959 |
+
while (va >= v1) {
|
| 960 |
+
tmin = ta;
|
| 961 |
+
vmin = va;
|
| 962 |
+
ta += 1.0/p0;
|
| 963 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 964 |
+
}
|
| 965 |
+
tmax = ta; vmax = va;
|
| 966 |
+
}
|
| 967 |
+
*t1 = solve_t_bracketed(s,order,p,rr,v1,tmin,tmax,vmin,vmax);
|
| 968 |
+
}
|
| 969 |
+
|
| 970 |
+
void
|
| 971 |
+
ArnoldiDelayCalc::pr_solve3(double s,
|
| 972 |
+
int order,
|
| 973 |
+
double *p,
|
| 974 |
+
double *rr,
|
| 975 |
+
double vhi,
|
| 976 |
+
double *thi,
|
| 977 |
+
double vmid,
|
| 978 |
+
double *tmid,
|
| 979 |
+
double vlo,
|
| 980 |
+
double *tlo)
|
| 981 |
+
{
|
| 982 |
+
// falling, thi<tmin<tlo
|
| 983 |
+
double tmin2,tmax2,vmin2,vmax2;
|
| 984 |
+
double tmin5,tmax5,vmin5,vmax5;
|
| 985 |
+
double tmin8,tmax8,vmin8,vmax8;
|
| 986 |
+
int h, h0 = 0;
|
| 987 |
+
while (order>1
|
| 988 |
+
&& rr[order-1]<1e-8 // 1e-8V
|
| 989 |
+
&& rr[order-1]>-1e-8)
|
| 990 |
+
order--;
|
| 991 |
+
if (rr[0]<0.5) {
|
| 992 |
+
for (h=1;h<order;h++) if (rr[h]>0.3 && rr[h]>rr[0]) { h0 = h; break; }
|
| 993 |
+
}
|
| 994 |
+
double p0 = p[h0];
|
| 995 |
+
p0 = std::min(p0, 10e+9); // 1/10ns cap
|
| 996 |
+
double ps,vs,ta,va;
|
| 997 |
+
vs = 0.0;
|
| 998 |
+
for (h=0;h<order;h++) {
|
| 999 |
+
ps = p[h]*s;
|
| 1000 |
+
vs += rr[h]*(1-exp(-ps))/ps;
|
| 1001 |
+
}
|
| 1002 |
+
if (vs<vlo) {
|
| 1003 |
+
// s dominates
|
| 1004 |
+
tmax8 = s; vmax8 = vs;
|
| 1005 |
+
ta = vhi*s;
|
| 1006 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1007 |
+
if (va < vmid) {
|
| 1008 |
+
tmax2 = tmax5 = tmin8 = ta;
|
| 1009 |
+
vmax2 = vmax5 = vmin8 = va;
|
| 1010 |
+
ta = vmid*s;
|
| 1011 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1012 |
+
if (va>vhi) {
|
| 1013 |
+
tmin2 = tmin5 = ta;
|
| 1014 |
+
vmin2 = vmin5 = va;
|
| 1015 |
+
tmin8 = ta; vmin8 = va;
|
| 1016 |
+
if (va<vmid) {
|
| 1017 |
+
tmax5 = ta; vmax5 = va;
|
| 1018 |
+
} else {
|
| 1019 |
+
tmin5 = ta; vmin5 = va;
|
| 1020 |
+
}
|
| 1021 |
+
} else {
|
| 1022 |
+
tmax2 = tmin5 = ta;
|
| 1023 |
+
vmax2 = vmin5 = va;
|
| 1024 |
+
ta = vlo*s;
|
| 1025 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1026 |
+
tmin2 = ta; vmin2 = va;
|
| 1027 |
+
}
|
| 1028 |
+
} else {
|
| 1029 |
+
// rare, s dominates but t=vhi*s is still above vmid
|
| 1030 |
+
tmin5 = tmin8 = ta;
|
| 1031 |
+
vmin5 = vmin8 = va;
|
| 1032 |
+
tmax5 = tmax8;
|
| 1033 |
+
vmax5 = vmax8;
|
| 1034 |
+
if (va > vhi) {
|
| 1035 |
+
tmin2 = tmin5;
|
| 1036 |
+
vmin2 = vmin5;
|
| 1037 |
+
tmax2 = tmax5;
|
| 1038 |
+
vmax2 = tmax5;
|
| 1039 |
+
} else {
|
| 1040 |
+
tmax2 = tmin5;
|
| 1041 |
+
vmax2 = vmin5;
|
| 1042 |
+
ta = vlo*s;
|
| 1043 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1044 |
+
tmin2 = ta; vmin2 = va;
|
| 1045 |
+
}
|
| 1046 |
+
}
|
| 1047 |
+
} else if (vs<vmid) {
|
| 1048 |
+
// not far from s
|
| 1049 |
+
tmax2 = tmax5 = tmin8 = s;
|
| 1050 |
+
vmax2 = vmax5 = vmin8 = vs;
|
| 1051 |
+
ta = s + 1.6/p0;
|
| 1052 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1053 |
+
while (va>vlo) {
|
| 1054 |
+
tmin8 = ta; vmin8 = va;
|
| 1055 |
+
ta += 1.0/p0;
|
| 1056 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1057 |
+
}
|
| 1058 |
+
tmax8 = ta; vmax8 = va;
|
| 1059 |
+
ta = vmid*s;
|
| 1060 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1061 |
+
tmin5 = ta; vmin5 = va;
|
| 1062 |
+
if (va>vhi) {
|
| 1063 |
+
tmin2 = ta; vmin2 = va;
|
| 1064 |
+
} else {
|
| 1065 |
+
tmax2 = ta; vmax2 = va;
|
| 1066 |
+
ta = vlo*s;
|
| 1067 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1068 |
+
tmin2 = ta; vmin2 = va;
|
| 1069 |
+
}
|
| 1070 |
+
} else if (vs<vhi) {
|
| 1071 |
+
tmax2 = tmin5 = tmin8 = s;
|
| 1072 |
+
vmax2 = vmin5 = vmin8 = vs;
|
| 1073 |
+
ta = vlo*s;
|
| 1074 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1075 |
+
tmin2 = ta; vmin2 = va;
|
| 1076 |
+
ta = s + 0.7/p0;
|
| 1077 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1078 |
+
while (va>vmid) {
|
| 1079 |
+
tmin5 = ta;
|
| 1080 |
+
tmin8 = ta;
|
| 1081 |
+
vmin5 = va;
|
| 1082 |
+
ta += 0.7/p0;
|
| 1083 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1084 |
+
}
|
| 1085 |
+
tmax5 = ta; vmax5 = va;
|
| 1086 |
+
if (va < vlo) {
|
| 1087 |
+
tmax8 = ta; vmax8 = va;
|
| 1088 |
+
} else {
|
| 1089 |
+
tmin8 = ta; vmin8 = va;
|
| 1090 |
+
ta += 1.0/p0;
|
| 1091 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1092 |
+
while (va>vlo) {
|
| 1093 |
+
tmin8 = ta; vmin8 = va;
|
| 1094 |
+
ta += 1.0/p0;
|
| 1095 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1096 |
+
}
|
| 1097 |
+
tmax8 = ta; vmax8 = va;
|
| 1098 |
+
}
|
| 1099 |
+
} else {
|
| 1100 |
+
// s is irrelevant
|
| 1101 |
+
ta = s; va = vs;
|
| 1102 |
+
tmin2 = tmin5 = tmin8 = ta;
|
| 1103 |
+
vmin2 = vmin5 = vmin8 = va;
|
| 1104 |
+
while (va > vhi) {
|
| 1105 |
+
tmin2 = tmin5 = tmin8 = ta;
|
| 1106 |
+
vmin2 = vmin5 = vmin8 = va;
|
| 1107 |
+
ta += 1.0/p0;
|
| 1108 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1109 |
+
}
|
| 1110 |
+
tmax2 = ta; vmax2 = va;
|
| 1111 |
+
while (va > vmid) {
|
| 1112 |
+
tmin5 = tmin8 = ta;
|
| 1113 |
+
vmin5 = vmin8 = va;
|
| 1114 |
+
ta += 1.0/p0;
|
| 1115 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1116 |
+
}
|
| 1117 |
+
tmax5 = ta; vmax5 = va;
|
| 1118 |
+
while (va > vlo) {
|
| 1119 |
+
tmin8 = ta;
|
| 1120 |
+
vmin8 = va;
|
| 1121 |
+
ta += 1.0/p0;
|
| 1122 |
+
pr_get_v(ta,s,order,p,rr,&va);
|
| 1123 |
+
}
|
| 1124 |
+
tmax8 = ta; vmax8 = va;
|
| 1125 |
+
}
|
| 1126 |
+
|
| 1127 |
+
*thi = solve_t_bracketed(s,order,p,rr,vhi,tmin2,tmax2,vmin2,vmax2);
|
| 1128 |
+
*tmid= solve_t_bracketed(s,order,p,rr,vmid,tmin5,tmax5,vmin5,vmax5);
|
| 1129 |
+
*tlo= solve_t_bracketed(s,order,p,rr,vlo,tmin8,tmax8,vmin8,vmax8);
|
| 1130 |
+
}
|
| 1131 |
+
|
| 1132 |
+
static double
|
| 1133 |
+
calc_integ(double p,double s,double t)
|
| 1134 |
+
{
|
| 1135 |
+
// integral of f(t)-vin(t)
|
| 1136 |
+
double ps = p*s;
|
| 1137 |
+
double pt = p*t;
|
| 1138 |
+
double y,ept,eps;
|
| 1139 |
+
if (t<=s) {
|
| 1140 |
+
ept = (pt>40.0)?0.0:exp(-pt);
|
| 1141 |
+
y = ept-1.0+pt;
|
| 1142 |
+
} else {
|
| 1143 |
+
pt = pt-ps;
|
| 1144 |
+
ept = (pt>40.0)?0.0:exp(-pt);
|
| 1145 |
+
eps = (ps>40.0)?0.0:exp(-ps);
|
| 1146 |
+
y = ps - (1.0-eps)*ept;
|
| 1147 |
+
}
|
| 1148 |
+
y /= ps*p;
|
| 1149 |
+
return y;
|
| 1150 |
+
}
|
| 1151 |
+
|
| 1152 |
+
|
| 1153 |
+
double
|
| 1154 |
+
ArnoldiDelayCalc::pr_ceff(double s,
|
| 1155 |
+
double rdrive,
|
| 1156 |
+
int order,
|
| 1157 |
+
double *p,
|
| 1158 |
+
double *rr,
|
| 1159 |
+
double ceff_time)
|
| 1160 |
+
{
|
| 1161 |
+
double integi = 0.0;
|
| 1162 |
+
double ceff, v0;
|
| 1163 |
+
int j;
|
| 1164 |
+
for (j=0;j<order;j++) {
|
| 1165 |
+
integi += rr[j]*calc_integ(p[j],s,ceff_time);
|
| 1166 |
+
}
|
| 1167 |
+
integi /= rdrive;
|
| 1168 |
+
pr_get_v(ceff_time,s,order,p,rr,&v0);
|
| 1169 |
+
ceff = integi/(1.0-v0);
|
| 1170 |
+
return ceff;
|
| 1171 |
+
}
|
| 1172 |
+
|
| 1173 |
+
//////////////////////////////////////////////////////////////////
|
| 1174 |
+
|
| 1175 |
+
static double
|
| 1176 |
+
ra_hinv(double y,
|
| 1177 |
+
Debug *debug)
|
| 1178 |
+
{
|
| 1179 |
+
double x;
|
| 1180 |
+
if (y<1.0) {
|
| 1181 |
+
x = sqrt(2*y)+0.4*y;
|
| 1182 |
+
if (y<1e-4) return x;
|
| 1183 |
+
} else {
|
| 1184 |
+
x = y+1.0;
|
| 1185 |
+
}
|
| 1186 |
+
double ex = exp(-x);
|
| 1187 |
+
double f = x+ex-1.0-y;
|
| 1188 |
+
x += f/(ex-1.0);
|
| 1189 |
+
ex = exp(-x);
|
| 1190 |
+
f = x+ex-1.0-y;
|
| 1191 |
+
x += f/(ex-1.0);
|
| 1192 |
+
ex = exp(-x);
|
| 1193 |
+
f = x+ex-1.0-y;
|
| 1194 |
+
x += f/(ex-1.0);
|
| 1195 |
+
ex = exp(-x);
|
| 1196 |
+
f = x+ex-1.0-y;
|
| 1197 |
+
if (f<-1e-8 || f>1e-8)
|
| 1198 |
+
debugPrint(debug, "arnoldi", 1, "y f {:g} {:g}", y, f);
|
| 1199 |
+
return x;
|
| 1200 |
+
}
|
| 1201 |
+
|
| 1202 |
+
double
|
| 1203 |
+
ArnoldiDelayCalc::ra_solve_for_t(double p,
|
| 1204 |
+
double s,
|
| 1205 |
+
double v)
|
| 1206 |
+
{
|
| 1207 |
+
double t;
|
| 1208 |
+
double ps = p*s;
|
| 1209 |
+
if (ps>30.0) {
|
| 1210 |
+
t = (1.0+ps*(1.0-v)) / p;
|
| 1211 |
+
return t;
|
| 1212 |
+
}
|
| 1213 |
+
double eps = exp(ps);
|
| 1214 |
+
if ((1-ps*v)*eps >= 1.0) {
|
| 1215 |
+
t = log((eps-1.0)/(ps*v)) / p;
|
| 1216 |
+
} else {
|
| 1217 |
+
t = ra_hinv((1-v)*ps, debug_)/p;
|
| 1218 |
+
}
|
| 1219 |
+
return t;
|
| 1220 |
+
}
|
| 1221 |
+
|
| 1222 |
+
void
|
| 1223 |
+
ArnoldiDelayCalc::ra_solve_for_pt(double ps,
|
| 1224 |
+
double v,
|
| 1225 |
+
double *pt,
|
| 1226 |
+
double *d)
|
| 1227 |
+
{
|
| 1228 |
+
if (ps>30.0) {
|
| 1229 |
+
*pt = 1.0+ps*(1.0-v);
|
| 1230 |
+
*d = 1.0-v;
|
| 1231 |
+
return;
|
| 1232 |
+
}
|
| 1233 |
+
double eps = exp(ps);
|
| 1234 |
+
if ((1-ps*v)*eps >= 1.0) {
|
| 1235 |
+
*pt = log((eps-1.0)/(ps*v));
|
| 1236 |
+
*d = eps/(eps-1.0) - 1.0/ps;
|
| 1237 |
+
} else {
|
| 1238 |
+
*pt = ra_hinv((1-v)*ps, debug_);
|
| 1239 |
+
*d = (1.0-v)/(*pt - (1-v)*ps);
|
| 1240 |
+
}
|
| 1241 |
+
}
|
| 1242 |
+
|
| 1243 |
+
void
|
| 1244 |
+
ArnoldiDelayCalc::ra_calc_c(double vlo,
|
| 1245 |
+
double vhi,
|
| 1246 |
+
double *c_smin,
|
| 1247 |
+
double *c_x1,
|
| 1248 |
+
double *c_y1)
|
| 1249 |
+
{
|
| 1250 |
+
double a = log(1.0/vhi);
|
| 1251 |
+
*c_smin = a + ra_hinv((1.0-vhi)/vhi - a, debug_);
|
| 1252 |
+
double b = log(1.0/vlo);
|
| 1253 |
+
double c_s1 = b + ra_hinv((1.0-vlo)/vlo - b, debug_);
|
| 1254 |
+
double a1 = (exp(c_s1)-1.0)/c_s1;
|
| 1255 |
+
double den = log(a1/vlo) - ra_hinv((1.0-vhi)*c_s1, debug_);
|
| 1256 |
+
*c_x1 = (vhi-vlo)/den;
|
| 1257 |
+
*c_y1 = c_s1*(*c_x1);
|
| 1258 |
+
}
|
| 1259 |
+
|
| 1260 |
+
////////////////////////////////////////////////////////////////
|
| 1261 |
+
|
| 1262 |
+
//
|
| 1263 |
+
// ceff.cpp
|
| 1264 |
+
//
|
| 1265 |
+
|
| 1266 |
+
void
|
| 1267 |
+
ArnoldiDelayCalc::ra_solve_for_s(delay_work *D,
|
| 1268 |
+
double p,
|
| 1269 |
+
double tlohi,
|
| 1270 |
+
double &s)
|
| 1271 |
+
{
|
| 1272 |
+
delay_c *c = D->c;
|
| 1273 |
+
double vhi = c->vhi;
|
| 1274 |
+
double vlo = c->vlo;
|
| 1275 |
+
// s is 0-100
|
| 1276 |
+
// solve f(x,y)=0 with f = x*(ptlo(y/x)-pthi(y/x))-(vhi-vlo)
|
| 1277 |
+
// (x=0,y=1)
|
| 1278 |
+
// (x=x1,y=y1) c->x1,y1
|
| 1279 |
+
// (x=x2,y=y2) x2=(vhi-vlo)/log(vhi/vlo) y2=(c->smin)*x2
|
| 1280 |
+
double x1 = c->x1;
|
| 1281 |
+
double y1 = c->y1;
|
| 1282 |
+
double x2 = (vhi-vlo)/c->vlg;
|
| 1283 |
+
double y2 = (c->smin)*x2;
|
| 1284 |
+
double ptlo,dlo;
|
| 1285 |
+
double pthi,dhi;
|
| 1286 |
+
double f,df,x,y;
|
| 1287 |
+
x = c->vlg/(p*tlohi);
|
| 1288 |
+
|
| 1289 |
+
if (x <= x1) {
|
| 1290 |
+
y = y1 - 0.5*(x-x1);
|
| 1291 |
+
y = std::min(y, 1.0);
|
| 1292 |
+
} else {
|
| 1293 |
+
y = y1 - (x-x1)*(0.5 + 8*(x-x1));
|
| 1294 |
+
y = std::max(y, y2);
|
| 1295 |
+
}
|
| 1296 |
+
(void)y;
|
| 1297 |
+
|
| 1298 |
+
ra_solve_for_pt(p*s,vlo,&ptlo,&dlo);
|
| 1299 |
+
ra_solve_for_pt(p*s,vhi,&pthi,&dhi);
|
| 1300 |
+
f = (ptlo-pthi)/p - tlohi;
|
| 1301 |
+
df = dlo-dhi;
|
| 1302 |
+
s = s - f/df;
|
| 1303 |
+
if (std::abs(f)<.001e-12) return; // .001ps
|
| 1304 |
+
|
| 1305 |
+
ra_solve_for_pt(p*s,vlo,&ptlo,&dlo);
|
| 1306 |
+
ra_solve_for_pt(p*s,vhi,&pthi,&dhi);
|
| 1307 |
+
f = (ptlo-pthi)/p - tlohi;
|
| 1308 |
+
df = dlo-dhi;
|
| 1309 |
+
s = s - f/df;
|
| 1310 |
+
if (std::abs(f)<.001e-12) return; // .001ps
|
| 1311 |
+
|
| 1312 |
+
ra_solve_for_pt(p*s,vlo,&ptlo,&dlo);
|
| 1313 |
+
ra_solve_for_pt(p*s,vhi,&pthi,&dhi);
|
| 1314 |
+
f = (ptlo-pthi)/p - tlohi;
|
| 1315 |
+
df = dlo-dhi;
|
| 1316 |
+
s = s - f/df;
|
| 1317 |
+
if (std::abs(f)<.001e-12) return; // .001ps
|
| 1318 |
+
|
| 1319 |
+
ra_solve_for_pt(p*s,vlo,&ptlo,&dlo);
|
| 1320 |
+
ra_solve_for_pt(p*s,vhi,&pthi,&dhi);
|
| 1321 |
+
f = (ptlo-pthi)/p - tlohi;
|
| 1322 |
+
df = dlo-dhi;
|
| 1323 |
+
s = s - f/df;
|
| 1324 |
+
if (std::abs(f)<.001e-12) return; // .001ps
|
| 1325 |
+
|
| 1326 |
+
ra_solve_for_pt(p*s,vlo,&ptlo,&dlo);
|
| 1327 |
+
ra_solve_for_pt(p*s,vhi,&pthi,&dhi);
|
| 1328 |
+
f = (ptlo-pthi)/p - tlohi;
|
| 1329 |
+
df = dlo-dhi;
|
| 1330 |
+
s = s - f/df;
|
| 1331 |
+
|
| 1332 |
+
if (std::abs(f)>.5e-12) // .5ps
|
| 1333 |
+
debugPrint(debug_, "arnoldi", 1, "ra_solve_for_s p {:g} tlohi {} err {}",
|
| 1334 |
+
p,
|
| 1335 |
+
units_->timeUnit()->asString(tlohi),
|
| 1336 |
+
units_->timeUnit()->asString(f));
|
| 1337 |
+
}
|
| 1338 |
+
|
| 1339 |
+
/////////////////////////////////////////////////////////////////////
|
| 1340 |
+
// method 0:
|
| 1341 |
+
// r = a match to slew to (ctot, limited by cmin,cmax)
|
| 1342 |
+
// if r>rdelay, lower r
|
| 1343 |
+
// Now at any ceff (limited)
|
| 1344 |
+
// If slew(r,0,ceff) is too big
|
| 1345 |
+
// s = s_start(r,ceff), not smaller than Smin
|
| 1346 |
+
// accept the pessimistic output slew
|
| 1347 |
+
// Else
|
| 1348 |
+
// solve for s
|
| 1349 |
+
|
| 1350 |
+
// Rough translation of ra_get_r(sy_table) used by ar1_ceff_delay.
|
| 1351 |
+
double
|
| 1352 |
+
ArnoldiDelayCalc::ra_get_r(delay_work *D,
|
| 1353 |
+
timing_table *tab,
|
| 1354 |
+
double rdelay,
|
| 1355 |
+
double ctot)
|
| 1356 |
+
{
|
| 1357 |
+
// find the maximum r that allows a solution for s of
|
| 1358 |
+
// (s,r,ctot)-> output_slew
|
| 1359 |
+
// If this maximum is greater than rdelay, use rdelay.
|
| 1360 |
+
delay_c *c = D->c;
|
| 1361 |
+
double slew_derate = c->slew_derate;
|
| 1362 |
+
double c_log = c->vlg;
|
| 1363 |
+
float c1;
|
| 1364 |
+
double tlohi,r;
|
| 1365 |
+
c1 = ctot;
|
| 1366 |
+
float d1, s1;
|
| 1367 |
+
tab->table->gateDelay(tab->pvt, tab->in_slew, c1, d1, s1);
|
| 1368 |
+
tlohi = slew_derate*delayAsFloat(s1);
|
| 1369 |
+
r = tlohi/(c_log*c1);
|
| 1370 |
+
if (rdelay>0.0 && r > rdelay)
|
| 1371 |
+
r = rdelay;
|
| 1372 |
+
return r;
|
| 1373 |
+
}
|
| 1374 |
+
|
| 1375 |
+
double
|
| 1376 |
+
ArnoldiDelayCalc::ra_get_s(delay_work *D,
|
| 1377 |
+
timing_table *tab,
|
| 1378 |
+
double r,
|
| 1379 |
+
double c)
|
| 1380 |
+
{
|
| 1381 |
+
delay_c *con = D->c;
|
| 1382 |
+
double slew_derate = con->slew_derate;
|
| 1383 |
+
double c_log = con->vlg;
|
| 1384 |
+
double c_smin = con->smin;
|
| 1385 |
+
double tlohi,smin,s;
|
| 1386 |
+
float d1, s1;
|
| 1387 |
+
tab->table->gateDelay(tab->pvt, tab->in_slew, c, d1, s1);
|
| 1388 |
+
tlohi = slew_derate*delayAsFloat(s1);
|
| 1389 |
+
smin = r*c*c_smin; // c_smin = ra_hinv((1-vhi)/vhi-log(vhi)) + log(vhi);
|
| 1390 |
+
if (c_log*r*c >= tlohi) {
|
| 1391 |
+
s = smin;
|
| 1392 |
+
} else {
|
| 1393 |
+
s = smin+0.3*tlohi;
|
| 1394 |
+
ra_solve_for_s(D,1.0/(r*c),tlohi,s);
|
| 1395 |
+
}
|
| 1396 |
+
return s;
|
| 1397 |
+
}
|
| 1398 |
+
|
| 1399 |
+
/////////////////////////////////////////////////////////////////////
|
| 1400 |
+
// method 1:
|
| 1401 |
+
// determine the drive resistance from change in delay versus ctot
|
| 1402 |
+
// find the maximum r that allows a solution for s of
|
| 1403 |
+
// (s,r,ctot)-> output_slew
|
| 1404 |
+
// If this maximum is greater than rdelay, use rdelay.
|
| 1405 |
+
// calculate s,r,mod -> t50_srmod,
|
| 1406 |
+
// then t50_srmod+t50_sy-t50_sr
|
| 1407 |
+
|
| 1408 |
+
double
|
| 1409 |
+
ArnoldiDelayCalc::ra_rdelay_1(timing_table *tab,
|
| 1410 |
+
double ctot)
|
| 1411 |
+
{
|
| 1412 |
+
// determine the drive resistance from change in delay versus ctot
|
| 1413 |
+
float c1 = ctot;
|
| 1414 |
+
float c2 = 0.5*c1;
|
| 1415 |
+
if (c1==c2)
|
| 1416 |
+
return 0.0;
|
| 1417 |
+
float d1, d2, s1, s2;
|
| 1418 |
+
tab->table->gateDelay(tab->pvt, tab->in_slew, c1, d1, s1);
|
| 1419 |
+
tab->table->gateDelay(tab->pvt, tab->in_slew, c2, d2, s2);
|
| 1420 |
+
double dt50 = delayAsFloat(d1)-delayAsFloat(d2);
|
| 1421 |
+
if (dt50 <= 0.0)
|
| 1422 |
+
return 0.0;
|
| 1423 |
+
double rdelay = dt50/(c1-c2);
|
| 1424 |
+
return rdelay;
|
| 1425 |
+
}
|
| 1426 |
+
|
| 1427 |
+
void
|
| 1428 |
+
ArnoldiDelayCalc::ar1_ceff_delay(delay_work *D,
|
| 1429 |
+
timing_table *tab,
|
| 1430 |
+
arnoldi1 *mod,
|
| 1431 |
+
double *delays,
|
| 1432 |
+
double *slews)
|
| 1433 |
+
{
|
| 1434 |
+
delay_c *con = D->c;
|
| 1435 |
+
double slew_derate = con->slew_derate;
|
| 1436 |
+
double vhi = con->vhi;
|
| 1437 |
+
double vlo = con->vlo;
|
| 1438 |
+
double ctot = mod->ctot;
|
| 1439 |
+
double ceff,tlohi,t50_sy,r,s,t50_sr,rdelay;
|
| 1440 |
+
float df, sf;
|
| 1441 |
+
|
| 1442 |
+
debugPrint(debug_, "arnoldi", 1, "ctot={}",
|
| 1443 |
+
units_->capacitanceUnit()->asString(ctot));
|
| 1444 |
+
|
| 1445 |
+
rdelay = ra_rdelay_1(tab,ctot);
|
| 1446 |
+
if (rdelay == 0.0) {
|
| 1447 |
+
rdelay = 1e+3; // 1kohm
|
| 1448 |
+
}
|
| 1449 |
+
r = ra_get_r(D,tab,rdelay,ctot);
|
| 1450 |
+
if (! (r>0.0
|
| 1451 |
+
&& r<100e+3)) // 100khom
|
| 1452 |
+
rdelay = 1e+3; // 1kohm
|
| 1453 |
+
|
| 1454 |
+
bool bad = (r<rdelay);
|
| 1455 |
+
s = ra_get_s(D,tab,r,ctot);
|
| 1456 |
+
if (! (s>0.0
|
| 1457 |
+
&& s<100e-9)) // 100ns
|
| 1458 |
+
s = 0.5e-9; // .5ns
|
| 1459 |
+
|
| 1460 |
+
if (debug_->check("arnoldi", 1)) {
|
| 1461 |
+
double p = 1.0/(r*ctot);
|
| 1462 |
+
double thix,tlox;
|
| 1463 |
+
debugPrint(debug_, "arnoldi", 1, "at r={} s={}",
|
| 1464 |
+
units_->resistanceUnit()->asString(r),
|
| 1465 |
+
units_->timeUnit()->asString(s));
|
| 1466 |
+
thix = ra_solve_for_t(p,s,vhi);
|
| 1467 |
+
tlox = ra_solve_for_t(p,s,vlo);
|
| 1468 |
+
tab->table->gateDelay(tab->pvt,tab->in_slew, ctot, df, sf);
|
| 1469 |
+
debugPrint(debug_, "arnoldi", 1, "table slew (in_slew {} ctot {}) = {}",
|
| 1470 |
+
units_->timeUnit()->asString(tab->in_slew),
|
| 1471 |
+
units_->capacitanceUnit()->asString(ctot),
|
| 1472 |
+
delayAsString(sf, this));
|
| 1473 |
+
tlohi = slew_derate*delayAsFloat(sf);
|
| 1474 |
+
debugPrint(debug_, "arnoldi", 1, "tlohi {} {}",
|
| 1475 |
+
units_->timeUnit()->asString(tlohi),
|
| 1476 |
+
units_->timeUnit()->asString(tlox-thix));
|
| 1477 |
+
}
|
| 1478 |
+
ceff = ctot;
|
| 1479 |
+
|
| 1480 |
+
// calculate s,r,mod -> t50_srmod,
|
| 1481 |
+
// then t50_srmod+t50_sy-t50_sr
|
| 1482 |
+
|
| 1483 |
+
mod->calculate_poles_res(D,r);
|
| 1484 |
+
double *p = D->poles;
|
| 1485 |
+
double *rr = delay_work_get_residues(D,0);
|
| 1486 |
+
double thi,tlo,t50_srmod;
|
| 1487 |
+
pr_solve1(s,mod->order,p,rr,0.5,&t50_srmod);
|
| 1488 |
+
|
| 1489 |
+
int ceff_it,j;
|
| 1490 |
+
double ceff_time=0.0;
|
| 1491 |
+
|
| 1492 |
+
if (!bad) {
|
| 1493 |
+
for (ceff_it=0;ceff_it<3;ceff_it++) {
|
| 1494 |
+
|
| 1495 |
+
// calculate ceff
|
| 1496 |
+
ceff_time = s;
|
| 1497 |
+
ceff = pr_ceff(s,r,mod->order,p,rr,ceff_time);
|
| 1498 |
+
|
| 1499 |
+
if ((ceff-1e-20) < 0.0) { // 1e-8pf
|
| 1500 |
+
debugPrint(debug_, "arnoldi", 1,
|
| 1501 |
+
"Invalid effective capacitance, using total capacitance");
|
| 1502 |
+
ceff = ctot;
|
| 1503 |
+
}
|
| 1504 |
+
|
| 1505 |
+
// new mvs at ceff
|
| 1506 |
+
s = ra_get_s(D,tab,r,ceff);
|
| 1507 |
+
debugPrint(debug_, "arnoldi", 1, "new mvs s = {}",
|
| 1508 |
+
units_->timeUnit()->asString(s));
|
| 1509 |
+
}
|
| 1510 |
+
}
|
| 1511 |
+
debugPrint(debug_, "arnoldi", 1, "r {} s {} ceff_time {} ceff {}",
|
| 1512 |
+
units_->resistanceUnit()->asString(r),
|
| 1513 |
+
units_->timeUnit()->asString(s),
|
| 1514 |
+
units_->timeUnit()->asString(ceff_time),
|
| 1515 |
+
units_->capacitanceUnit()->asString(ceff));
|
| 1516 |
+
|
| 1517 |
+
tab->table->gateDelay(tab->pvt, tab->in_slew, ceff, df, sf);
|
| 1518 |
+
t50_sy = delayAsFloat(df);
|
| 1519 |
+
t50_sr = ra_solve_for_t(1.0/(r*ceff),s,0.5);
|
| 1520 |
+
for (j=0;j<mod->n;j++) {
|
| 1521 |
+
rr = delay_work_get_residues(D,j);
|
| 1522 |
+
pr_solve3(s,mod->order,p,rr,vhi,&thi,0.5,&t50_srmod,vlo,&tlo);
|
| 1523 |
+
delays[j] = t50_srmod + t50_sy - t50_sr;
|
| 1524 |
+
slews[j] = (tlo-thi)/slew_derate;
|
| 1525 |
+
}
|
| 1526 |
+
}
|
| 1527 |
+
|
| 1528 |
+
// NOLINTEND(modernize-avoid-c-style-cast)
|
| 1529 |
+
} // namespace sta
|