-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added yosys-abc and volare,fix syntax error ,end synthesys with genus
- Loading branch information
Showing
9 changed files
with
306 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set_db hdl_error_on_latch false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/src/base/main/mainUtils.c b/src/base/main/mainUtils.c | ||
index 245e936a..0a3cde72 100644 | ||
--- a/src/base/main/mainUtils.c | ||
+++ b/src/base/main/mainUtils.c | ||
@@ -22,8 +22,7 @@ | ||
#include "mainInt.h" | ||
|
||
#ifdef ABC_USE_READLINE | ||
-#include <readline/readline.h> | ||
-#include <readline/history.h> | ||
+#include <editline/readline.h> | ||
#endif | ||
|
||
ABC_NAMESPACE_IMPL_START |
13 changes: 13 additions & 0 deletions
13
submodules/LIB/scripts/patches/yosys/fix-clang-build.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/Makefile b/Makefile | ||
index 86abc6958..a72f7b792 100644 | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -187,7 +192,7 @@ endif | ||
endif | ||
|
||
ifeq ($(CONFIG),clang) | ||
-CXX = clang | ||
+CXX = clang++ | ||
LD = clang++ | ||
CXXFLAGS += -std=$(CXXSTD) -Os | ||
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H" |
46 changes: 46 additions & 0 deletions
46
submodules/LIB/scripts/patches/yosys/plugin-search-dirs.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
diff --git a/passes/cmds/plugin.cc b/passes/cmds/plugin.cc | ||
index 08b4aa8c4..1b7639bc9 100644 | ||
--- a/passes/cmds/plugin.cc | ||
+++ b/passes/cmds/plugin.cc | ||
@@ -87,15 +87,34 @@ void load_plugin(std::string filename, std::vector<std::string> aliases) | ||
|
||
// We were unable to open the file, try to do so from the plugin directory | ||
if (hdl == NULL && orig_filename.find('/') == std::string::npos) { | ||
- hdl = dlopen([orig_filename]() { | ||
- std::string new_path = proc_share_dirname() + "plugins/" + orig_filename; | ||
+ std::string install_dir = proc_share_dirname() + "plugins"; | ||
+ std::vector<std::string> all_dirs; | ||
+ all_dirs.push_back(install_dir); | ||
|
||
- // Check if we need to append .so | ||
- if (new_path.find(".so") == std::string::npos) | ||
- new_path.append(".so"); | ||
+ char* plugin_dirs = getenv("NIX_YOSYS_PLUGIN_DIRS"); | ||
|
||
- return new_path; | ||
- }().c_str(), RTLD_LAZY|RTLD_LOCAL); | ||
+ if (plugin_dirs != NULL) { | ||
+ std::string p(plugin_dirs), t; | ||
+ std::stringstream ss(p); | ||
+ | ||
+ while(std::getline(ss, t, ':')) { | ||
+ all_dirs.push_back(t); | ||
+ } | ||
+ } | ||
+ | ||
+ for (auto dir : all_dirs) { | ||
+ hdl = dlopen([&]() { | ||
+ std::string new_path = dir + "/" + orig_filename; | ||
+ | ||
+ // Check if we need to append .so | ||
+ if (new_path.find(".so") == std::string::npos) | ||
+ new_path.append(".so"); | ||
+ | ||
+ return new_path; | ||
+ }().c_str(), RTLD_LAZY|RTLD_LOCAL); | ||
+ if (hdl != NULL) | ||
+ break; | ||
+ } | ||
} | ||
|
||
if (hdl == NULL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Copyright 2023 Efabless Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# Copyright (c) 2003-2023 Eelco Dolstra and the Nixpkgs/NixOS contributors | ||
# Permission is hereby granted, free of charge, to any person obtaining | ||
# a copy of this software and associated documentation files (the | ||
# "Software"), to deal in the Software without restriction, including | ||
# without limitation the rights to use, copy, modify, merge, publish, | ||
# distribute, sublicense, and/or sell copies of the Software, and to | ||
# permit persons to whom the Software is furnished to do so, subject to | ||
# the following conditions: | ||
# The above copyright notice and this permission notice shall be | ||
# included in all copies or substantial portions of the Software. | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
{ pkgs ? import <nixpkgs> {} }: | ||
|
||
let | ||
lib = pkgs.lib; | ||
cmake = pkgs.cmake; | ||
libedit = pkgs.libedit; | ||
rev = "896e5e7dedf9b9b1459fa019f1fa8aa8101fdf43"; | ||
yosys_abc_src = pkgs.fetchFromGitHub { | ||
owner = "YosysHQ"; | ||
repo = "abc"; | ||
rev = rev; | ||
sha256 = "sha256-sMBCIV698TIvU/sgTwgPFWDC1kl2TeGv+3pQ06gs7aM="; | ||
}; | ||
yosys_abc = pkgs.clangStdenv.mkDerivation rec { | ||
name = "yosys-abc"; | ||
src = yosys_abc_src; | ||
patches = [ | ||
./patches/yosys/abc-editline.patch | ||
]; | ||
postPatch = '' | ||
sed -i "s@-lreadline@-ledit@" ./Makefile | ||
''; | ||
nativeBuildInputs = [ cmake ]; | ||
buildInputs = [ libedit ]; | ||
installPhase = "mkdir -p $out/bin && mv abc $out/bin"; | ||
passthru.rev = rev; | ||
meta = with lib; { | ||
description = "A tool for squential logic synthesis and formal verification (YosysHQ's Fork)"; | ||
homepage = "https://people.eecs.berkeley.edu/~alanmi/abc"; | ||
license = licenses.mit; | ||
mainProgram = "abc"; | ||
platforms = platforms.unix; | ||
}; | ||
}; | ||
in | ||
yosys_abc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
{ pkgs ? import <nixpkgs> {} }: | ||
|
||
let | ||
yosys_abc = import ./yosys-abc.nix { inherit pkgs; }; | ||
|
||
symlinkJoin = pkgs.symlinkJoin; | ||
python3 = pkgs.python3; | ||
lib = pkgs.lib; | ||
makeWrapper = pkgs.makeWrapper; | ||
clangStdenv = pkgs.clangStdenv; | ||
fetchFromGitHub = pkgs.fetchFromGitHub; | ||
pkg-config = pkgs.pkg-config; | ||
bison = pkgs.bison; | ||
flex = pkgs.flex; | ||
tcl = pkgs.tcl; | ||
libedit = pkgs.libedit; | ||
libbsd = pkgs.libbsd; | ||
libffi = pkgs.libffi; | ||
zlib = pkgs.zlib; | ||
|
||
py3env = python3.withPackages (pp: | ||
with pp; [ | ||
click | ||
xmlschema | ||
]); | ||
|
||
yosys = clangStdenv.mkDerivation rec { | ||
name = "yosys"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "YosysHQ"; | ||
repo = "yosys"; | ||
rev = "543faed9c8cd7c33bbb407577d56e4b7444ba61c"; | ||
sha256 = "sha256-mzMBhnIEgToez6mGFOvO7zBA+rNivZ9OnLQsjBBDamA="; | ||
}; | ||
|
||
nativeBuildInputs = [pkg-config bison flex]; | ||
propagatedBuildInputs = [yosys_abc]; | ||
|
||
buildInputs = [ | ||
tcl | ||
libedit | ||
libbsd | ||
libffi | ||
zlib | ||
py3env | ||
]; | ||
|
||
passthru = { | ||
inherit py3env; | ||
inherit withPlugins; | ||
}; | ||
|
||
patches = [ | ||
./patches/yosys/fix-clang-build.patch | ||
./patches/yosys/plugin-search-dirs.patch | ||
]; | ||
|
||
postPatch = '' | ||
substituteInPlace ./Makefile \ | ||
--replace 'echo UNKNOWN' 'echo ${builtins.substring 0 10 src.rev}' | ||
chmod +x ./misc/yosys-config.in | ||
patchShebangs tests ./misc/yosys-config.in | ||
sed -i 's@ENABLE_EDITLINE := 0@ENABLE_EDITLINE := 1@' Makefile | ||
sed -i 's@ENABLE_READLINE := 1@ENABLE_READLINE := 0@' Makefile | ||
sed -Ei 's@PRETTY = 1@PRETTY = 0@' ./Makefile | ||
''; | ||
|
||
preBuild = let | ||
shortAbcRev = builtins.substring 0 7 yosys_abc.rev; | ||
in '' | ||
chmod -R u+w . | ||
make config-clang | ||
echo 'ABCEXTERNAL = ${yosys_abc}/bin/abc' >> Makefile.conf | ||
if ! grep -q "ABCREV = ${shortAbcRev}" Makefile; then | ||
echo "ERROR: yosys isn't compatible with the provided abc (${yosys_abc}), failing." | ||
exit 1 | ||
fi | ||
''; | ||
|
||
postBuild = "ln -sfv ${yosys_abc}/bin/abc ./yosys-abc"; | ||
postInstall = "ln -sfv ${yosys_abc}/bin/abc $out/bin/yosys-abc"; | ||
|
||
makeFlags = ["PREFIX=${placeholder "out"}"]; | ||
doCheck = false; | ||
enableParallelBuilding = true; | ||
}; | ||
|
||
withPlugins = plugins: let | ||
paths = lib.closePropagation plugins; | ||
dylibs = lib.lists.flatten (map (n: n.dylibs) plugins); | ||
in let | ||
module_flags = with builtins; | ||
concatStringsSep " " | ||
(map (so: "--add-flags -m --add-flags ${so}") dylibs); | ||
in (symlinkJoin { | ||
name = "${yosys.name}-with-plugins"; | ||
paths = paths ++ [yosys]; | ||
nativeBuildInputs = [makeWrapper]; | ||
postBuild = '' | ||
wrapProgram $out/bin/yosys \ | ||
--set NIX_YOSYS_PLUGIN_DIRS $out/share/yosys/plugins \ | ||
${module_flags} | ||
''; | ||
}); | ||
in | ||
yosys |