Skip to content

Commit 7d4d8d4

Browse files
committed
opt and dbg compile in OSX
1 parent c841e7a commit 7d4d8d4

File tree

5 files changed

+31
-77
lines changed

5 files changed

+31
-77
lines changed

MODULE.bazel

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,21 @@
33
# Using bazel 7 or newer and pointing to https://registry.bazel.build/
44
#
55

6-
bazel_dep(name = "rules_foreign_cc", version = "0.11.1")
6+
bazel_dep(name = "rules_cc", version = "0.1.1")
7+
bazel_dep(name = "rules_foreign_cc", version = "0.14.0")
8+
9+
bazel_dep(name = "abseil-cpp", version = "20250127.0") # version = "20240722.1")
10+
bazel_dep(name = "google_benchmark", version = "1.9.1")
11+
bazel_dep(name = "googletest", version = "1.16.0")
12+
bazel_dep(name = "rules_proto_grpc_cpp", version = "5.0.1")
13+
bazel_dep(name = "rules_proto", version = "7.1.0")
14+
bazel_dep(name = "protobuf", version = "30.1")
715

816
#### M4/Flex/Bison
917
bazel_dep(name = "rules_m4", version = "0.2.4")
10-
1118
bazel_dep(name = "rules_flex", version = "0.2.1")
12-
1319
bazel_dep(name = "rules_bison", version = "0.3")
1420

15-
# google benchmark
16-
bazel_dep(name = "google_benchmark", version = "1.9.1")
17-
18-
# rapidjson
1921
bazel_dep(name = "rapidjson", version = "1.1.0.bcr.20241007")
20-
21-
# mimalloc (only seems to work in Linux)
2222
bazel_dep(name = "mimalloc", version = "2.1.7-bcr.alpha.1")
2323

24-
# abseil
25-
bazel_dep(name = "abseil-cpp", version = "20240722.1")
26-
27-
# googletest
28-
bazel_dep(name = "googletest", version = "1.15.2")

WORKSPACE

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ workspace(name = "livehd")
44

55
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
66
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
7-
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
87

98
new_git_repository(
109
name = "abc",
@@ -107,10 +106,10 @@ http_archive(
107106
# HIF
108107
http_archive(
109108
name = "hif",
110-
sha256 = "bf4d0d5e06b100b616c35b8fc1601de482ea0dfc7b8f0f75763f9b9020076626",
111-
strip_prefix = "hif-11b5dc3eda963fe5220345dac7fa2ccc68545182",
109+
sha256 = "9d65753cc06e02b7d8f795ed6f3286861879877f5928a793e1048f8b8433b9d7",
110+
strip_prefix = "hif-9b731a9feeba0faa268fbc59b722f6f7ce5f387a",
112111
urls = [
113-
"https://github.com/masc-ucsc/hif/archive/11b5dc3eda963fe5220345dac7fa2ccc68545182.zip",
112+
"https://github.com/masc-ucsc/hif/archive/9b731a9feeba0faa268fbc59b722f6f7ce5f387a.zip",
114113
],
115114
)
116115

@@ -196,49 +195,6 @@ http_archive(
196195
],
197196
)
198197

199-
# Protobuf
200-
http_archive(
201-
name = "rules_proto_grpc",
202-
sha256 = "9ba7299c5eb6ec45b6b9a0ceb9916d0ab96789ac8218269322f0124c0c0d24e2",
203-
strip_prefix = "rules_proto_grpc-4.5.0",
204-
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/releases/download/4.5.0/rules_proto_grpc-4.5.0.tar.gz"],
205-
)
206-
207-
load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")
208-
209-
rules_proto_grpc_toolchains()
210-
211-
rules_proto_grpc_repos()
212-
213-
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
214-
215-
rules_proto_dependencies()
216-
217-
rules_proto_toolchains()
218-
# http_archive(
219-
# name = "rules_proto",
220-
# sha256 = "fea00227e78467fc8ab6a17f7de26489b7dcb3b773659cf6d9906251e521cfe9",
221-
# strip_prefix = "rules_proto-aaa54ca64e87699276b6f64e22ce800fae3637b5",
222-
# urls = [
223-
# "https://github.com/bazelbuild/rules_proto/archive/aaa54ca64e87699276b6f64e22ce800fae3637b5.zip",
224-
# ],
225-
# )
226-
# load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
227-
# rules_proto_dependencies()
228-
# rules_proto_toolchains()
229-
230-
# http_archive(
231-
# name = "rules_proto",
232-
# sha256 = "e017528fd1c91c5a33f15493e3a398181a9e821a804eb7ff5acdd1d2d6c2b18d",
233-
# strip_prefix = "rules_proto-4.0.0-3.20.0",
234-
# urls = [
235-
# "https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0-3.20.0.tar.gz",
236-
# ],
237-
# )
238-
# load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
239-
# rules_proto_dependencies()
240-
# rules_proto_toolchains()
241-
242198
# Perfetto
243199
http_archive(
244200
name = "com_google_perfetto",

inou/firrtl/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ FIRRTL_TESTS = glob([
1010
proto_library(
1111
name = "firrtl_proto",
1212
srcs = ["firrtl.proto"],
13-
deps = ["@com_google_protobuf//:any_proto"],
13+
deps = ["@protobuf//:any_proto"],
1414
)
1515

1616
cc_proto_library(

inou/firrtl/fir_tolnast.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
#include "absl/strings/match.h"
1313
#include "firrtl.pb.h"
14-
#include "google/protobuf/util/time_util.h"
14+
// #include "google/protobuf/util/time_util.h"
1515
#include "inou_firrtl.hpp"
1616
#include "perf_tracing.hpp"
1717
#include "thread_pool.hpp"
1818

19-
using google::protobuf::util::TimeUtil;
19+
// using google::protobuf::util::TimeUtil;
2020

2121
/* For help understanding FIRRTL/Protobuf:
2222
* 1) Semantics regarding FIRRTL language:
@@ -246,9 +246,11 @@ uint16_t Inou_firrtl_module::get_vector_size(const Lnast& lnast, std::string_vie
246246
if (var2vec_size.find(vec_name) == var2vec_size.end()) {
247247
auto module_name = lnast.get_top_module_name();
248248
#ifndef NDEBUG
249-
Pass::warn("Warning: the \"if\" statement below is to enable RocketTile LG generation. Remove the if block and use the assertion above it instead.\n");
249+
Pass::warn(
250+
"Warning: the \"if\" statement below is to enable RocketTile LG generation. Remove the if block and use the assertion "
251+
"above it instead.\n");
250252
#endif
251-
//I(Inou_firrtl::glob_info.module_var2vec_size.find(module_name) != Inou_firrtl::glob_info.module_var2vec_size.end());
253+
// I(Inou_firrtl::glob_info.module_var2vec_size.find(module_name) != Inou_firrtl::glob_info.module_var2vec_size.end());
252254
if (Inou_firrtl::glob_info.module_var2vec_size.find(module_name) == Inou_firrtl::glob_info.module_var2vec_size.end()) {
253255
return 1;
254256
}
@@ -329,7 +331,7 @@ void Inou_firrtl_module::handle_register(Lnast& lnast, const firrtl::FirrtlPB_Ty
329331
= reg_bits > 0 ? true
330332
: false; // some chirrtl code don't have bits set on register, but must have bits set on init expression
331333
auto diff_type = type.type_case() != firrtl::FirrtlPB_Type::kUintType;
332-
//setup_scalar_bits(lnast, absl::StrCat("#", id), reg_bits, parent_node, diff_type, stmt);
334+
// setup_scalar_bits(lnast, absl::StrCat("#", id), reg_bits, parent_node, diff_type, stmt);
333335
setup_scalar_bits(lnast, id, reg_bits, parent_node, diff_type, stmt);
334336

335337
setup_register_reset_init(lnast,
@@ -2276,7 +2278,7 @@ void Inou_firrtl_module::setup_register_q_pin(Lnast& lnast, Lnast_nid& parent_no
22762278
fname = subtrngs[0];
22772279
}
22782280

2279-
//auto flop_qpin_var = absl::StrCat("_#_", reg_name, "_q");
2281+
// auto flop_qpin_var = absl::StrCat("_#_", reg_name, "_q");
22802282
auto flop_qpin_var = absl::StrCat("_#_", reg_name, "_q");
22812283
auto idx_asg2 = lnast.add_child(parent_node, Lnast_node::create_assign("", 0, line_pos, col_pos, fname));
22822284
lnast.add_child(idx_asg2, Lnast_node::create_ref(flop_qpin_var, 0, line_pos, col_pos, fname));
@@ -2299,8 +2301,8 @@ void Inou_firrtl_module::declare_register(Lnast& lnast, Lnast_nid& parent_node,
22992301
fname = subtrngs[0];
23002302
}
23012303

2302-
auto idx_attget = lnast.add_child(parent_node, Lnast_node::create_attr_get("", 0, line_pos, col_pos, fname));
2303-
//auto full_register_name = absl::StrCat("#", reg_name);
2304+
auto idx_attget = lnast.add_child(parent_node, Lnast_node::create_attr_get("", 0, line_pos, col_pos, fname));
2305+
// auto full_register_name = absl::StrCat("#", reg_name);
23042306
auto full_register_name = reg_name;
23052307
auto tmp_var_str = create_tmp_var();
23062308
lnast.add_child(idx_attget, Lnast_node::create_ref(tmp_var_str, 0, line_pos, col_pos, fname));
@@ -2346,7 +2348,7 @@ void Inou_firrtl_module::setup_register_reset_init(Lnast& lnast, Lnast_nid& pare
23462348
}
23472349

23482350
if (!value_node.is_invalid()) {
2349-
//create_tuple_add_from_str(lnast, parent_node, absl::StrCat("#", reg_raw_name, ".__reset_pin"), value_node, stmt);
2351+
// create_tuple_add_from_str(lnast, parent_node, absl::StrCat("#", reg_raw_name, ".__reset_pin"), value_node, stmt);
23502352
create_tuple_add_from_str(lnast, parent_node, absl::StrCat(reg_raw_name, ".__reset_pin"), value_node, stmt);
23512353
}
23522354

@@ -2363,7 +2365,7 @@ void Inou_firrtl_module::setup_register_reset_init(Lnast& lnast, Lnast_nid& pare
23632365

23642366
if (!bits_set_done) {
23652367
auto bits = inite.uint_literal().width().value();
2366-
//setup_scalar_bits(lnast, absl::StrCat("#", reg_raw_name), bits, parent_node, false, stmt);
2368+
// setup_scalar_bits(lnast, absl::StrCat("#", reg_raw_name), bits, parent_node, false, stmt);
23672369
setup_scalar_bits(lnast, reg_raw_name, bits, parent_node, false, stmt);
23682370
}
23692371
} else if (inite_case == firrtl::FirrtlPB_Expression::kSintLiteral) {
@@ -2372,7 +2374,7 @@ void Inou_firrtl_module::setup_register_reset_init(Lnast& lnast, Lnast_nid& pare
23722374

23732375
if (!bits_set_done) {
23742376
auto bits = inite.uint_literal().width().value();
2375-
//setup_scalar_bits(lnast, absl::StrCat("#", reg_raw_name), bits, parent_node, true, stmt);
2377+
// setup_scalar_bits(lnast, absl::StrCat("#", reg_raw_name), bits, parent_node, true, stmt);
23762378
setup_scalar_bits(lnast, reg_raw_name, bits, parent_node, true, stmt);
23772379
}
23782380
} else if (inite_case == firrtl::FirrtlPB_Expression::kReference) {
@@ -2390,7 +2392,7 @@ void Inou_firrtl_module::setup_register_reset_init(Lnast& lnast, Lnast_nid& pare
23902392
}
23912393

23922394
if (!initial_node.is_invalid()) {
2393-
//create_tuple_add_from_str(lnast, parent_node, absl::StrCat("#", reg_raw_name, ".__initial"), initial_node, stmt);
2395+
// create_tuple_add_from_str(lnast, parent_node, absl::StrCat("#", reg_raw_name, ".__initial"), initial_node, stmt);
23942396
create_tuple_add_from_str(lnast, parent_node, absl::StrCat(reg_raw_name, ".__initial"), initial_node, stmt);
23952397
}
23962398
}
@@ -2795,7 +2797,7 @@ void Inou_firrtl_module::list_statement_info(Lnast& lnast, const firrtl::FirrtlP
27952797
Pass::warn("Warning: commented \"I(false)\" to enable RocketTile LG generation.");
27962798
#endif
27972799
Pass::warn("Unknown statement type: {}, at line {} in file {}", (int)stmt.statement_case(), line_pos, fname);
2798-
//I(false);
2800+
// I(false);
27992801
return;
28002802
}
28012803
// TODO: Attach source info into node creation (line #, col #).

inou/firrtl/inou_firrtl.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "absl/container/flat_hash_set.h"
1616
#include "absl/container/node_hash_map.h"
1717
#include "firrtl.pb.h"
18-
#include "google/protobuf/util/time_util.h"
18+
// #include "google/protobuf/util/time_util.h"
1919

2020
#pragma GCC diagnostic pop
2121
// LiveHD includes
@@ -25,7 +25,8 @@
2525
#include "lnast.hpp"
2626
#include "pass.hpp"
2727

28-
using google::protobuf::util::TimeUtil;
28+
// using google::protobuf::util::TimeUtil;
29+
2930
struct Global_module_info {
3031
absl::node_hash_map<std::string, absl::flat_hash_map<std::string, std::pair<uint16_t, bool>>>
3132
module2outputs; // <hier_name, bits, sign>

0 commit comments

Comments
 (0)