33

GitHub - B-Lang-org/bsc: Bluespec Compiler (BSC)

 5 years ago
source link: https://github.com/B-Lang-org/bsc
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

README.md

BSC - Bluespec Compiler

See COPYING for copyright and license details.

This is a compiler, simulator, and associated tools for Bluespec High Level Hardware Design Language (HL-HDL), supporting the two optional syntaxes, BSV and BH. Language specifications and tutorials are available in the BSVlang repository.

This respository contains:

  • Source code for building the core compiler (bsc)
    • With front ends for BSV and BH syntax
    • With back ends for Verilog and Bluesim (C++ simulation)
  • Source code for a BSC-aware Tcl/Tk shell (bluetcl and bluewish)
    • With commands to load BSC databases, for querying source code and elaborated designs
    • With commands for loading and running Bluesim simulations
  • Standard Bluespec libraries
  • Smoke test
  • Utilities such as BSV-modes for emacs/gvim/jedit

More will be made available in the future (either here or in a sibling repo), such as:

  • Test suite
  • Documentation (User Guide)
  • Additional libraries

We welcome your feedback, issue reports, and pull requests.


Downloading pre-built BSC tools

Pre-built packages will be available for download under the Packages tab.


How to build the BSC tools

The source code for BSC supports building on Linux and MacOS. It may compile for other flavors of Unix, but likely will need additional if/else blocks in source code or Makefiles.

The core of BSC is written in Haskell, with some libraries in C/C++.

Install the Haskell compiler (GHC)

You will need the standard Haskell compiler ghc which is available for Linux, MacOS and Windows, along with some additional Haskell libraries. These are available as standard packages in most Linux distributions. For example, on Debian and Ubuntu systems, you can say:

    $ apt-get  install  ghc
    $ apt-get  install  libghc-regex-compat-dev  libghc-syb-dev  libghc-old-time-dev

The second command will install the Haskell libraries regex-compat, syb, and old-time, as well as some libraries that they depend on.

You can do the analogous package-install on other Linux distributions using their native package mechanisms, and use Macports on Apple OS X. Full details can be found at haskell.org. On some systems, you may need to use the cabal command to install Haskell libraries:

    $ apt-get  install  cabal-install
    $ cabal  install  regex-compat  syb  old-time

The version of GHC should not matter, since the source code has been written with extensive preprocessor macros, to support nearly every minor release since as far back as 6.12 and earlier. BSC builds with the latest version at the time of this writing, which is 8.8.2.

Additional requirements

For building the Bluespec Tcl/Tk shell, you will need the fontconfig and Xft libraries:

    $ apt-get  install  libfontconfig1-dev  libx11-dev  libxft-dev

Building BSC also requires standard Unix shell and Makefile utilities.

The repository for the Yices SMT Solver is cloned as a submodule of this repository. Building the BSC tools will recurse into this directory and build the Yices library for linking into BSC and Bluetcl. Yices may have its own requirements. Yices currently requires the gperf perfect hashing library to compile:

    $ apt-get  install  gperf

Building the BSC tools will also recurse into a directory for the STP SMT solver. This is currently an old snapshot of the STP source code, including the code for various libraries that it uses. In the future, this may be replaced with a submodule instantiation of the repository for the STP SMT solver. When that happens, additional requirements from that repository will be added. The current snapshot requires Perl, to generate two source files. It also needs flex and bison:

    $ apt-get  install  flex  bison

Get the repository

Clone this repository by running:

    $ git  clone  --recursive  https://github.com/B-Lang-org/bsc

That will clone this respository and all of the submodules that it depends on. If you have cloned the repository without the recursive flag, you can setup the submodules later with a separate command:

    $ git  clone  https://github.com/B-Lang-org/bsc
    $ git  submodule  update  --init  --recursive

Make the BSC tools

At the top directory of the repository, you can give the following command:

    $ make

This will create a directory called inst containing an installation of the BSC tools. This inst directory can later be moved to another location; the tools do not hard-code the install location.

If you wish, you can install into another location by assigning the variable PREFIX in the environment:

    $ make  PREFIX=/tools/bluespec

Smoke test

A cursory test is provided to ensure that the BSC tools are installed and can be run. The test runs BSC to compile a basic design into both Verilog and Bluesim simulations and then tests that those simulations run and produce the expected output. Use the following commands to execute the smoke test:

 $ cd examples/smoke_test/
 $ make smoke_test

For the Verilog simulation, by default it builds with IVERILOG (Icarus verilog compiler), a free and open-source Verilog simulator, which you can install with:

 $ apt-get  install  iverilog

Alternatively, the Makefile shows how you can point it at other Verilog simulators such as VCS and VCSI (Synopyss), NCVERILOG and NCSIM (Cadence) and MODELSIM (Mentor), and CVC.

Many people also routinely use VERILATOR to compile and simulate bsc-generated Verilog.


Running BSC

The installation contains a bin directory. To run the BSC tools, you only need to add the bin directory to your path (or provide that path on the command line). The executables in that directory will expect to find other files in sibling directories within that same parent installation directory.

Earlier versions of BSC required that the environment variable BLUESPECDIR be set to point into the installation directory; this is no longer necessary, as the executables will figure out their location and determine the installation location on their own.

Run the following to see command-line options on the executable:

    $ bsc -help

Additional flags of use to developers can be displayed with the following command:

    $ bsc -help-hidden

More details on using BSC, Bluesim, and Bluetcl can be found in the User Guide [forthcoming]. Training and tutorials can be found in the BSVlang repository.



Recommend

  • 44

    README.md Titan

  • 110

    币安链(BC)与币安智能链(BSC)简介 本文主要介绍的是中心化交易所币安(binance.com)在区块链上的一些工作,主要是介绍币安链(BC)和币安智能链(BSC),除了综述官方文档之外,也会加入一些个人的看法。

  • 15
    • blog.rust-lang.org 4 years ago
    • Cache

    A new look for rust-lang.org

    A new look for rust-lang.org Nov. 29, 2018 · The Rust Core Team Before 1.0, Rust had a reputation for changing the language on a near-daily basis. By contrast, the website has looked p...

  • 27

    币安区块 101|币安智能链 BSC 借贷专场长按识别关注公众号👆-这是#区块 101-S2#的第 32__个__对话-2021 年 3 月 22 日,币安新媒体营销经理七七对话对话 dForce 创始人杨民道、C.R.E.A.M. Finance Co-Founder Leo Cheng、ForTube…· 6...

  • 8
    • blog.hubwiz.com 4 years ago
    • Cache

    PancakeSwap对接JS开发包【BSC DEX】

    PancakeSwap.js 开发包适用于为Web前端或Node.js应用快速增加对币安智能链PancakeSwap协议的支持能力。 即支持使用自有部署BSC区块链节点的应用场景,也支持使用第三方节点的轻量级部署场景。官方下载地址:

  • 38

    波多野结衣将在BSC上发布NFT写真集  •  7 小时前 碳链价值APP讯,日本AV女优波多...

  • 7
    • news.huoxing24.com 4 years ago
    • Cache

    多链扩张成趋势,MDEX迈入BSC

    多链扩张成趋势,MDEX迈入BSC深潮CryptoFlow2021-04-08热度: 36428MDEX上线币安智能链BSC 5秒钟,TVL超5亿美元;截止21:00,TVL已超过10亿美...

  • 10
    • ubix.network 4 years ago
    • Cache

    Ethereum/BSC Network Bridge

    Ethereum/BSC Network Bridge Ethereum Binance Smart Chain Loading controller info... Fro...

  • 13

    Polkastarter上线多链IDO池,兼容以太坊和BSC 2021-04-14 21:21:00 官方...

  • 4
    • blog.oyanglul.us 2 years ago
    • Cache

    file:javascript/ru-lang-second-attampt.org

    入语言第二试: readtable 与 core.async Table of Contents Vote on Hacker News 俺的小公举淼淼最近各种 ...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK