mirror of
https://github.com/YosysHQ/icestorm.git
synced 2026-08-22 05:47:39 +02:00
Bzlmodified.
This commit is contained in:
@@ -0,0 +1,93 @@
|
|||||||
|
# Copyright 2020 Google LLC
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# BUILD file for Project Icestorm.
|
||||||
|
#
|
||||||
|
# iceprog is not included in this BUILD file because it depends on libftdi which
|
||||||
|
# is not available at this time.
|
||||||
|
|
||||||
|
load("@rules_python//python:defs.bzl", "py_binary")
|
||||||
|
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||||
|
load("//:vars.bzl", "CHIPS", "ICE40_DEVICES")
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
exports_files([
|
||||||
|
"LICENSE",
|
||||||
|
"icefuzz/timings_hx1k.txt",
|
||||||
|
"icefuzz/timings_hx8k.txt",
|
||||||
|
"icefuzz/timings_lp1k.txt",
|
||||||
|
"icefuzz/timings_lp8k.txt",
|
||||||
|
"icefuzz/timings_lp384.txt",
|
||||||
|
"icefuzz/timings_u4k.txt",
|
||||||
|
"icefuzz/timings_up5k.txt",
|
||||||
|
])
|
||||||
|
|
||||||
|
py_binary(
|
||||||
|
name = "icebox_chipdb",
|
||||||
|
srcs = [
|
||||||
|
"icebox/icebox.py",
|
||||||
|
"icebox/icebox_chipdb.py",
|
||||||
|
"icebox/iceboxdb.py",
|
||||||
|
],
|
||||||
|
imports = [
|
||||||
|
"icebox",
|
||||||
|
],
|
||||||
|
python_version = "PY3",
|
||||||
|
)
|
||||||
|
|
||||||
|
[genrule(
|
||||||
|
name = "chipdb_%s_txt" % device,
|
||||||
|
srcs = [],
|
||||||
|
outs = ["chipdb-%s.txt" % device],
|
||||||
|
cmd = "$(location :icebox_chipdb) %s > $@" % ICE40_DEVICES[device],
|
||||||
|
tools = [":icebox_chipdb"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
) for device in ICE40_DEVICES.keys()]
|
||||||
|
|
||||||
|
cc_binary(
|
||||||
|
name = "icebram",
|
||||||
|
srcs = ["icebram/icebram.cc"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_binary(
|
||||||
|
name = "icemulti",
|
||||||
|
srcs = ["icemulti/icemulti.cc"],
|
||||||
|
copts = [
|
||||||
|
"-Wno-implicit-fallthrough",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_binary(
|
||||||
|
name = "icepack",
|
||||||
|
srcs = ["icepack/icepack.cc"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_binary(
|
||||||
|
name = "icepll",
|
||||||
|
srcs = ["icepll/icepll.cc"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
[genrule(
|
||||||
|
name = "timings_%s_cc" % chip,
|
||||||
|
srcs = ["icefuzz/timings_%s.txt" % chip],
|
||||||
|
outs = ["generated/timings_%s.cc" % chip],
|
||||||
|
cmd = "(dir=$$(pwd) && cd $$(dirname $(location :icefuzz/timings_%s.txt)) && $$dir/$(location //icetime:timings) %s) > $@" % (chip, chip),
|
||||||
|
tools = ["//icetime:timings"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
) for chip in CHIPS]
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
module(
|
||||||
|
name = "icestorm",
|
||||||
|
version = "0.0.1"
|
||||||
|
)
|
||||||
|
|
||||||
|
bazel_dep(name = "rules_python", version = "1.4.0")
|
||||||
|
bazel_dep(name = "rules_cc", version = "0.1.1")
|
||||||
|
bazel_dep(name = "abseil-cpp", version = "20250127.1")
|
||||||
|
|
||||||
|
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
|
||||||
|
python.toolchain(
|
||||||
|
python_version = "3.13",
|
||||||
|
)
|
||||||
Generated
+61
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1743583204,
|
||||||
|
"narHash": "sha256-F7n4+KOIfWrwoQjXrL2wD9RhFYLs2/GGe/MQY1sSdlE=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "2c8d3f48d33929642c1c12cd243df4cc7d2ce434",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "2c8d3f48d33929642c1c12cd243df4cc7d2ce434",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
load("//:vars.bzl", "CHIPS", "ICE40_DEVICES")
|
||||||
|
|
||||||
|
genrule(
|
||||||
|
name = "iceutil_renamed_find_chipdb",
|
||||||
|
srcs = ["iceutil.cc"],
|
||||||
|
outs = ["generated/iceutil_renamed_find_chipdb.cc"],
|
||||||
|
cmd = "cat $(SRCS) | sed 's/find_chipdb/find_chipdb_renamed_to_be_replaced/g' > $@",
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_binary(
|
||||||
|
name = "icetime",
|
||||||
|
srcs = [
|
||||||
|
"icetime.cc",
|
||||||
|
"generated/iceutil_renamed_find_chipdb.cc",
|
||||||
|
"bazel_find_chipdb.cc",
|
||||||
|
] + ["//:generated/timings_%s.cc" % chip for chip in CHIPS],
|
||||||
|
copts = [
|
||||||
|
"-Wno-string-plus-int",
|
||||||
|
],
|
||||||
|
data = ["//:chipdb-%s.txt" % device for device in ICE40_DEVICES],
|
||||||
|
defines = [
|
||||||
|
"PREFIX=\\\"unspecified\\\"",
|
||||||
|
"CHIPDB_SUBDIR=\\\"unspecified\\\"",
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = [
|
||||||
|
"@bazel_tools//tools/cpp/runfiles",
|
||||||
|
"@abseil-cpp//absl/strings",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
py_binary(
|
||||||
|
name = "timings",
|
||||||
|
srcs = ["timings.py"],
|
||||||
|
python_version = "PY3",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/// Copyright 2020 Google LLC
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
// This file has a replacement for find_chipdb in iceutil.cc that works with
|
||||||
|
// Bazel's paths.
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "absl/strings/str_cat.h"
|
||||||
|
#include "tools/cpp/runfiles/runfiles.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
using ::bazel::tools::cpp::runfiles::Runfiles;
|
||||||
|
|
||||||
|
std::string GetExePath() {
|
||||||
|
char result[PATH_MAX];
|
||||||
|
ssize_t count = readlink("/proc/self/exe", result, PATH_MAX);
|
||||||
|
return std::string(result, (count > 0) ? count : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
std::string find_chipdb(std::string config_device) {
|
||||||
|
std::string error;
|
||||||
|
auto runfiles =
|
||||||
|
std::unique_ptr<Runfiles>(Runfiles::Create(GetExePath(), BAZEL_CURRENT_REPOSITORY, &error));
|
||||||
|
if (runfiles == nullptr) {
|
||||||
|
fprintf(stderr, "Failed to create Runfiles object: %s\n", error.c_str());
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
return runfiles->Rlocation(
|
||||||
|
absl::StrCat("chipdb-", config_device, ".txt"));
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user