ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Create Python library for parsing / producing BLIF (and eBLIF) files

Open mithro opened this issue 6 years ago • 7 comments

Create a Python library for parsing / producing BLIF (and eBLIF) files

BLIF is the preferred method of design entry for many designers. The Berkeley Logic Interchange Format (BLIF) is a simple file format for exchanging sequential logic between programs.

eBLIF is an extension of the BLIF format to add features needed for using BLIF as part of an FPGA PnR flow created by Clifford Wolf. The best format is the Verilog to Routing docs here.

BLIF is used by Yosys, Arachne-pnr and Verilog to Routing.

There might be a starting library here.

Expected results

A Python library published on PyPi which makes it easy to read and write BLIF files.

Knowledge Prerequisites

  • Python

mithro avatar Jun 24 '18 00:06 mithro

I can work on this. I'm a little busy at the moment so my progress would be steady but slow.

Do we have a corpus of BLIF files to test against?

nturley avatar Jul 15 '18 02:07 nturley

@nturley

We don't really have a good corpus but some sources of BLIF files are;

  • https://github.com/verilog-to-routing/vtr-verilog-to-routing/tree/master/vtr_flow/benchmarks
  • https://github.com/cseed/arachne-pnr/tree/master/tests/blif

You can also easily generate them with Yosys and the write_blif command.

GitHub
vtr-verilog-to-routing - Verilog to Routing -- Open Source CAD Flow for FPGA Research
GitHub
arachne-pnr - Place and route tool for FPGAs

mithro avatar Jul 15 '18 02:07 mithro

I've been making BLIFs to exercise different parts of the grammar for my Rust BLIF parser at https://github.com/gaffe-logic/blif/tree/master/examples . Feel free to use them.

mx-shift avatar Jul 15 '18 04:07 mx-shift

any objections to a parser generator like antlr4? The grammar would then be reusable for other languages.

nturley avatar Jul 18 '18 01:07 nturley

@nturley Only requirement is we need a pure Python library. Looks like antlr4 might support that? https://github.com/antlr/antlr4/blob/master/doc/python-target.md

GitHub
antlr4 - ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.

mithro avatar Jul 18 '18 01:07 mithro

I started on a new BLIF parser using GitHub's recently released Tree Sitter incremental parser framework.

mx-shift avatar Nov 05 '18 03:11 mx-shift

Nice! Not sure where our BLIF roadmap is, but we'll take a look if we start poking around there

JohnDMcMaster avatar Nov 11 '18 19:11 JohnDMcMaster