7-Series Bitstream Decompiler (7series-bitstream-decompiler)

AI-Powered Hardware Decompiler & Semantic Verilog RTL Lifter for AMD / Xilinx 7-Series FPGAs

License Target Hardware Base Corpus Size Iterations

7series-bitstream-decompiler is a hybrid Graph Neural Network (GNN) and Hardware-LLM reasoning engine engineered to decompile raw, anonymized Xilinx / AMD 7-Series FPGA gate netlists and physical CRAM frames (.bit / BOOT.bin) back into clean, synthesizable behavioral Verilog RTL (IEEE 1364-2001).


Architecture & Model Components

This repository contains the complete multimodal decompiler suite:

  1. LoRA Adapter (adapter_model.safetensors):
    • Fine-tuned on zhuyaoyu/CodeV-R1-RL-Qwen-7B across 44,698 7-Series netlists (134,094 steps).
    • Generates behavioral Verilog RTL directly from circuit graph prefix embeddings and prompt anchors.
  2. GNN Prefix Encoder (gnn_prefix_encoder.safetensors / .pt):
    • Encodes NetTAG 100-dimensional circuit node features (LUT6 truth tables, FDREs, CARRY4s, clock domains, and board pin anchors) into 8 virtual prompt prefix tokens (3584 dimensions).
  3. 12 Auxiliary Perception Heads (joint_auxiliary_heads.safetensors / production_12heads.pt):
    • Continuous Bitwidth Regression Head: Predicts bus bitwidths across 1 to 65,536 bits.
    • Clock & CDC Head: Discovers clock domains and asynchronous resets.
    • FSM Analysis Head: Extracts state count, one-hot vs gray encoding, and trap states.
    • Pin Role Classifier: Maps package-agnostic pins (UART TX/RX, HDMI, SPI, LEDs, Buttons).
  4. Homoscedastic Multi-Task Balancer (homoscedastic_loss.pt):
    • Learned Kendall & Gal task variances balancing LM loss with auxiliary hardware perception heads.

Release Versioning

  • v0.1.0-45k-baseline (Current):
    • Baseline production checkpoint trained on 44,698 netlists for 3 epochs (134,094 iterations) on NVIDIA GeForce RTX 4090.
    • Mean Kendall & Gal Multi-Task Loss: -1.8236.
    • LM Loss: 0.2830.

Quickstart & Inference

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_model_id = "zhuyaoyu/CodeV-R1-RL-Qwen-7B"
decompiler_adapter_id = "nhz-io/7series-bitstream-decompiler"

tokenizer = AutoTokenizer.from_pretrained(decompiler_adapter_id, trust_remote_code=True)
base = AutoModelForCausalLM.from_pretrained(base_model_id, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, decompiler_adapter_id)
model.eval()

prompt = "<|im_start|>system
You are a world-class hardware EDA engineer specializing in FPGA bitstream decompilation.<|im_end|>
<|im_start|>user
Recover behavioral Verilog for netlist sample_00000<|im_end|>
<|im_start|>thought
Verifying circuit topology...<|im_end|>
```verilog
"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512, temperature=0.1)
print(tokenizer.decode(out[0], skip_special_tokens=True))

Citation & License

Downloads last month
36
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for nhz-io/7series-bitstream-decompiler

Base model

Qwen/Qwen2.5-7B
Adapter
(1)
this model