google / xls

XLS: Accelerated HW Synthesis
http://google.github.io/xls/
Apache License 2.0
1.15k stars 166 forks source link

Create FPGA LUT-to-Z3 translator #142

Open RobSpringer opened 3 years ago

RobSpringer commented 3 years ago

To enable LEC'ing FPGA designs, we need a means of translating, e.g., LUT4-based designs into AND/OR/NOT/etc.-defined netlists, since that's the language our LEC tools currently speak.

julianviera@ started on this work during his internship, and demonstrated some good proof-of-concept work, so it'd be good to fully flesh out the work. IIRC, the necessary steps are:

...that's really it. I don't know that it makes sense to define a Bazel macro to do this, since the LUT mapping is potentially per-target, unless we make some default option that can be overridden by a config flag...but I'm not actually sure if that's possible.

I'll initially assign the issue to me, to make sure it doesn't get lost, but this can be picked up by anyone. It's really a decent starter project.

felixzhuologist commented 3 years ago

An update on the status of this work and next steps:

219 adds support for iCE40 LUTs by hardcoding the netlist parser to handle cells called SB_LUT4. It handles the LUTs by creating a new CellLibraryEntry with a StateTable that matches the LUT mask (or retrieving it if it exists already), instead of looking it up in a provided CellLibrary which is the direction suggested in the description above.

The next steps could go in two (somewhat related) directions: