Skip to content

Commit

Permalink
Update Volare and Magic (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
donn authored Mar 21, 2023
1 parent 96e84e7 commit 71a6460
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 18 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
designs/* linguist-detectable=false
.github/* linguist-detectable=false
*.v linguist-detectable=false
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.0.0-a8
* Update `volare` dependency.
* Update `magic` version + make `magic` nix derivation more resilient.

# 2.0.0-a7

* Add the custom diode insertion script as a `Step` (disabled by default).
Expand Down
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

yosys ? import ./nix/yosys.nix { inherit pkgs; },

volare-rev ? "852e565f30f3445c6fa59f15cea85c461e3bdddd",
volare-sha256 ? "sha256-U8pyGJjEYlSU2oaofZIaUUNbkn9uHv5LQ5074ZUqZjA=",
volare-rev ? "25ac34672c7c76ef7efc0d7581ce35a16db0865a",
volare-sha256 ? "sha256-KEn8EwKSoMl6CrDbyRotZ5psgQVlQMYkJMeFo7V55Dc=",
volare ? let src = pkgs.fetchFromGitHub {
owner = "efabless";
repo = "volare";
Expand Down
19 changes: 7 additions & 12 deletions nix/magic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,20 @@

with pkgs; stdenv.mkDerivation rec {
name = "magic-vlsi";
rev = "8d08cb2f2f33c79bea478a79543721d476554c78";
rev = "d8f926865dd24ac78558e939f5c816cdc2cb4eb8";

src = fetchFromGitHub {
owner = "RTimothyEdwards";
repo = "magic";
inherit rev;
sha256 = "sha256-V+3XduqeUVjaua8JIhln0imLFs4og9ibeUOh0N5aXa0=";
sha256 = "sha256-LJqVJacBwBhHTwjcjUVu9Ga2j1mu6C8gYTcdKMW3fT0=";
};

patches = [
./patches/magic/csh.patch
./patches/magic/fprintf.patch
];

nativeBuildInputs = [ python3 tcsh gnused ];

# So here's the situation:
Expand All @@ -72,19 +77,9 @@ with pkgs; stdenv.mkDerivation rec {
];

preConfigure = ''
# csh -> tcsh
set -x
for file in ./scripts/*; do
sed -Ei 's@/bin/csh/?@/usr/bin/env tcsh@g' $file
done
set +x
# nix shebang fix
patchShebangs ./scripts
# Remove manual csh test
sed -i '5386,5388d' ./scripts/configure
# "Precompute" git rev-parse HEAD
sed -i 's@`git rev-parse HEAD`@${rev}@' ./scripts/defs.mak.in
'';
Expand Down
35 changes: 35 additions & 0 deletions nix/patches/magic/csh.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/scripts/configure b/scripts/configure
index 46b1549..5cfee2d 100755
--- a/scripts/configure
+++ b/scripts/configure
@@ -5383,9 +5383,7 @@ fi



-if test "x${CSH}" = "xno"; then
- as_fn_error $? "cannot find /bin/csh---cannot compile!" "$LINENO" 5
-fi
+

# Extract the first word of "python3", so it can be a program name with args.
set dummy python3; ac_word=$2
diff --git a/scripts/makedbh b/scripts/makedbh
index 01e4fa5..50426de 100755
--- a/scripts/makedbh
+++ b/scripts/makedbh
@@ -1,4 +1,4 @@
-#!/bin/csh -f
+#!/usr/bin/env tcsh -f
#
# makes the "database.h" (1st argument, $1) file from "database.h.in"
# (2nd argument, $2), setting various mask operation definitions
diff --git a/scripts/printmans b/scripts/printmans
index 05e2e1f..8d63c03 100755
--- a/scripts/printmans
+++ b/scripts/printmans
@@ -1,4 +1,4 @@
-#!/bin/csh -f
+#!/usr/bin/env tcsh -f

set cmd=($1)
shift argv
98 changes: 98 additions & 0 deletions nix/patches/magic/fprintf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
diff --git a/ext2spice/ext2spice.c b/ext2spice/ext2spice.c
index 802c420..aa6c958 100644
--- a/ext2spice/ext2spice.c
+++ b/ext2spice/ext2spice.c
@@ -3189,8 +3189,8 @@ int spcnAP(dterm, node, resClass, scale, asterm, psterm, m, outf, w)
return 1;
}

- if (asterm) sprintf(afmt, " %s=", asterm);
- if (psterm) sprintf(pfmt, " %s=", psterm);
+ if (asterm) snprintf(afmt, sizeof afmt, " %s=", asterm);
+ if (psterm) snprintf(pfmt, sizeof pfmt, " %s=", psterm);

if (!esDistrJunct || w == -1) goto newFmt;

@@ -3206,13 +3206,13 @@ int spcnAP(dterm, node, resClass, scale, asterm, psterm, m, outf, w)
{
if (asterm)
{
- fprintf(outf, afmt);
+ fputs(afmt, outf);
esSIvalue(outf, 1.0E-12 * node->efnode_pa[resClass].pa_area
* scale * scale * dsc);
}
if (psterm)
{
- fprintf(outf, pfmt);
+ fputs(pfmt, outf);
esSIvalue(outf, 1.0E-6 * node->efnode_pa[resClass].pa_perim * scale * dsc);
}
}
@@ -3220,13 +3220,13 @@ int spcnAP(dterm, node, resClass, scale, asterm, psterm, m, outf, w)
{
if (asterm)
{
- fprintf(outf, afmt);
+ fputs(afmt, outf);
esSIvalue(outf, 1.0E-12 * ((float)node->efnode_pa[resClass].pa_area
* scale * scale) * esScale * esScale * dsc);
}
if (psterm)
{
- fprintf(outf, pfmt);
+ fputs(pfmt, outf);
esSIvalue(outf, 1.0E-6 * ((float)node->efnode_pa[resClass].pa_perim
* scale) * esScale * dsc);
}
@@ -3274,12 +3274,12 @@ newFmt:
{
if (asterm)
{
- fprintf(outf, afmt);
+ fputs(afmt, outf);
esSIvalue(outf, 1.0E-12 * area * scale * scale / m);
}
if (psterm)
{
- fprintf(outf, pfmt);
+ fputs(pfmt, outf);
esSIvalue(outf, 1.0E-6 * perim * scale / m);
}
}
@@ -3287,12 +3287,12 @@ newFmt:
{
if (asterm)
{
- fprintf(outf, afmt);
+ fputs(afmt, outf);
esSIvalue(outf, 1.0E-12 * ((float)area * scale * scale) * esScale * esScale);
}
if (psterm)
{
- fprintf(outf, pfmt);
+ fputs(pfmt, outf);
esSIvalue(outf, 1.0E-6 * ((float)perim * scale) * esScale);
}
}
@@ -3357,16 +3357,16 @@ int spcnAPHier(dterm, hierName, resClass, scale, asterm, psterm, m, outf)

if (esScale < 0)
{
- fprintf(outf, afmt);
+ fputs(afmt, outf);
esSIvalue(outf, 1.0E-12 * area * scale * scale / m);
- fprintf(outf, pfmt);
+ fputs(pfmt, outf);
esSIvalue(outf, 1.0E-6 * perim * scale / m);
}
else
{
- fprintf(outf, afmt);
+ fputs(afmt, outf);
esSIvalue(outf, 1.0E-12 * ((float)area * scale) * esScale * esScale);
- fprintf(outf, pfmt);
+ fputs(pfmt, outf);
esSIvalue(outf, 1.0E-6 * ((float)perim * scale) * esScale);
}
return 0;
2 changes: 1 addition & 1 deletion openlane/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "2.0.0a7"
__version__ = "2.0.0a8"

if __name__ == "__main__":
print(__version__, end="")
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ click>=8.0.0,<9
pyyaml>=5,<7
rich>=12,<13
requests>=2.27.0,<3
volare>=0.6.2
volare>=0.7.1

0 comments on commit 71a6460

Please sign in to comment.