growly / bfg

An Open-Source Silicon Compiler for Reduced-Complexity Reconfigurable Fabrics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BFG

An Open-Source Silicon Compiler for Reduced-Complexity Reconfigurable Fabrics

Installation

Prerequisites

Libraries

Debian

  sudo apt install -y build-essential cmake autoconf automake libtool curl make g++ unzip
  sudo apt install -y clang ninja-build python3 pkg-config zlib1g-dev
  # for gRPC
  sudo apt install -y libre2-dev libc-ares-dev libssl-dev

Ubuntu

  sudo apt install -y build-essential cmake autoconf automake libtool curl \
    make g++ unzip clang ninja-build python libre2-dev libc-ares-dev libssl-dev

Red Hat

Red Hat 7 doesn't have a new enough cmake. Red Hat 9 doesn't have ninja in its yum repositories. Nor does it have re2, so you have to build it from source (below).

  sudo yum group install "Development Tools"
  sudo yum install cmake autoconf automake libtool curl make g++ unzip
  # there is no ninja package for yum :(
  sudo yum install clang python
  # for gRPC
  sudo yum install c-ares-devel

Also, very importantly, RHEL9 doesn't seem to include /usr/local/lib as a default linker path, so you have to add it (or set LD_LIBRARY_PATH). This breaks proto creation in particular.

cat <<EOF > /tmp/libc.conf
/usr/local/lib
EOF
sudo mv /tmp/libc.conf /etc/ld.so.conf.d/
sudo ldconfig

google/googletest

git clone git@github.com:google/googletest
pushd googletest
mkdir build && cd build
cmake ../
make -j $(nproc) && sudo make install
popd

gperftools/gperftools

git clone git@github.com:gperftools/gperftools
pushd gperftools
./autogen.sh
./configure
make -j $(nproc) && sudo make install
popd

gflags/gflags

git clone git@github.com:gflags/gflags.git
pushd gflags
mkdir build && cd build
cmake .. -DBUILD_SHARED_LIBS=ON
make -j $(nproc) && sudo make install
popd

glog/glog

git clone https://github.com/google/glog.git
pushd glog
cmake -S . -B build -G "Unix Makefiles"
cmake --build build
sudo cmake --build build --target install
popd

abseil/abseil-cpp

git clone git@github.com:abseil/abseil-cpp.git
pushd abseil-cpp
mkdir build && cd build
cmake -DABSL_RUN_TESTS=ON -DABSL_USE_GOOGLETEST_HEAD=ON -DCMAKE_CXX_STANDARD=17 -DABSL_PROPAGATE_CXX_STD=ON ../
make -j $(nproc)
sudo make install
popd

protocolbuffers/protobuf

wget https://github.com/protocolbuffers/protobuf/releases/download/v21.5/protobuf-all-21.5.tar.gz
tar xf protobuf-all-21.5.tar.gz
pushd protobuf-21.5
./autogen.sh
./configure
make -j $(nproc)
sudo make install
sudo ldconfig # refresh shared library cache.
popd

Note: when I compile and build protocol buffers from HEAD on GitHub, I get compilation errors because the file port_def.inc doesn't get installed. Compiling and installing from a release tarball, it seems fine.

google/re2 (for RHEL9)

git clone https://github.com/google/re2.git
pushd re2
mkdir build && cd build
cmake ../
make -j $(nproc)
sudo make install
popd

grpc/grpc

We have to use an old version of gRPC because we use an old version of protobuf. (Feel free to update both!) There are actually quite a few interesting gRPC build options which we do not explore because I need to graduate, including how modern cmakes handle dependencies and the use of a .local installation for the project instead of the entire system.

wget https://github.com/grpc/grpc/archive/refs/tags/v1.48.1.tar.gz -O grpc-1.48.1.tar.gz
tar xf grpc-1.48.1.tar.gz
cd grpc-1.48.1
mkdir -p cmake/build
pushd cmake/build
cmake \
  -DgRPC_INSTALL=ON \
  -DgRPC_BUILD_TESTS=OFF \
  -DgRPC_CARES_PROVIDER=package \
  -DgRPC_ABSL_PROVIDER=package \
  -DgRPC_PROTOBUF_PROVIDER=package \
  -DgRPC_RE2_PROVIDER=package \
  -DgRPC_SSL_PROVIDER=package \
  -DgRPC_ZLIB_PROVIDER=package \
  ../..
make -j $(nproc)
sudo make install
popd

Building

git clone git@github.com:growly/bfg
cd bfg
git submodule update --init --recursive
mkdir build && cd build
cmake ../
make

Making tech protos

protoc --proto_path=vlsir/ --encode vlsir.tech.Technology vlsir/tech.proto < gf180mcu.technology.pb.txt > gf180mcu.technology.pb

Testing the router service

Use grpcurl. jq makes the output pretty (and is optional):

go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
~/go/bin/grpcurl -plaintext localhost:8222 list
~/go/bin/grpcurl -plaintext localhost:8222 bfg.router_service.RouterService list
~/go/bin/grpcurl \
    -plaintext \
    -d '{ "predefined_technology": "TECHNOLOGY_SKY130", "grid_definition": { "layers": [{}, {}] } }' \
    localhost:8222 \
    bfg.router_service.RouterService/CreateRoutingGrid | jq

A full example of this is in the router_service_poke.sh script.

About

An Open-Source Silicon Compiler for Reduced-Complexity Reconfigurable Fabrics

License:Other


Languages

Language:PureBasic 54.7%Language:C++ 42.7%Language:Python 0.9%Language:SourcePawn 0.8%Language:CMake 0.7%Language:Shell 0.2%Language:Assembly 0.1%