chipsalliance / fasm

FPGA Assembly (FASM) Parser and Generator
https://fasm.readthedocs.io
Apache License 2.0
90 stars 30 forks source link

Replace slow implementation with single-header, plain c++ version ? #92

Open hzeller opened 1 year ago

hzeller commented 1 year ago

I heard once that fasm-parsing was eating a significant amount of time in some projects and wanted to have a quick look.

But when attempting to look at it a while back I couldn't get it even to compile because of a forest of intertangled Python dependencies . Looks like the early days were centered around Python for interactive and debugging reasons. Given that fasm is used as an important part of actual flows these days, it is probably time to slim down the dependencies, and focus on it not being a bottleneck in production flows (Maybe still keep a Python implementation to focus for the interactive experiments.)

Since this project didn't compile but I still wanted to explore the format I ended up writing a parser in a header-only C++ implementation (including a C binding) to play with it. Content is parsed, values decoded and the feature names and bits are returned via callbacks. It parses FASM at about 1GiB/s per core.

Since I am not actively working in a project using fasm, I just leave it here in case you want to pick it up. https://github.com/hzeller/simple-fasm