How lamgianggg/tklls works
Spec2RTL & Prompt2Silicon turns a natural-language hardware specification into synthesizable Verilog, a self-checking testbench, verified simulation results, and Quartus design artifacts. The online workflow is orchestrated by run_spec2rtl.py: it analyzes and guards the spec, retrieves reference designs, generates RTL and a testbench, applies static checks, simulates, and may repair failures before packaging outputs. The repository also documents offline model distillation and Quartus waveform/project generation. Edges reflect the README and indexed caller references; unsampled implementations are represented by their supported paths, not assumed internal behavior.
Main entry points: run_spec2rtl.py Workflow orchestrator · simulator.py EDA simulator · distill_teacher_cot.py Teacher distillation · run_inference.py Local model inference
Components 24
Spec Analysis
- Workflow orchestrator
agent/run_spec2rtl.py - Spec analyzer
agent/spec_analyzer.py - Hybrid design retrieval
agent/knowledge_matcher.py - Reference designs
knowledge_base
RTL Generation
- Local model inference
models/run_inference.py - RTL generation
agent/rtl_generator.py - Self-checking testbench
agent/tb_generator.py - Generated Verilog
src - Generated testbench
sim
Verification Loop
- Hardware AST linter
agent/verilog_linter.py - Port auditor
agent/port_auditor.py - EDA simulator
agent/simulator.py - Repair loop
agent/reflection_loop.py - EDA tool discovery
agent/eda_finder.py - Synthesis profiler
agent/synthesis_profiler.py - Simulation result and VCD
sim
EDA Artifacts
- Quartus project and BDF
agent/bdf_generator.py - VWF waveform generator
agent/vwf_generator.py - Quartus design files
quartus
Offline Learning
- Teacher distillation
training/distill_teacher_cot.py - VerilogDB sampler
training/verilogdb_sampler.py - Distilled datasets
training
Other components
- Hardware designer
- ModelSim / Quartus
Connections 32
- Hardware designer → Workflow orchestrator: submits spec
README.md - Workflow orchestrator → Spec analyzer: analyzes spec
agent/run_spec2rtl.py - Workflow orchestrator → Hybrid design retrieval: retrieves examples
agent/run_spec2rtl.py - Hybrid design retrieval → Reference designs: searches
agent/knowledge_matcher.py - Workflow orchestrator → Local model inference: selects model
agent/run_spec2rtl.py - Local model inference → Hybrid design retrieval: adds RAG context
models/run_inference.py - Local model inference → RTL generation: falls back to
models/run_inference.py - Workflow orchestrator → RTL generation: generates RTL
agent/run_spec2rtl.py - RTL generation → Generated Verilog: writes RTL
- Workflow orchestrator → Self-checking testbench: generates tests
agent/run_spec2rtl.py - Self-checking testbench → Generated testbench: writes testbench
- Workflow orchestrator → Hardware AST linter: checks RTL
agent/run_spec2rtl.py - Workflow orchestrator → Port auditor: audits ports
agent/run_spec2rtl.py - Workflow orchestrator → EDA simulator: runs simulation
agent/run_spec2rtl.py - EDA simulator → EDA tool discovery: locates tools
agent/simulator.py - EDA simulator → ModelSim / Quartus: invokes simulator
- EDA simulator → Simulation result and VCD: produces log / VCD
- Workflow orchestrator → Repair loop: repairs failures
agent/run_spec2rtl.py - Repair loop → EDA simulator: reruns flow
agent/reflection_loop.py - Workflow orchestrator → Synthesis profiler: profiles synthesis
agent/run_spec2rtl.py - Workflow orchestrator → Quartus project and BDF: packages project
agent/run_spec2rtl.py - Workflow orchestrator → VWF waveform generator: generates waveform
agent/run_spec2rtl.py - VWF waveform generator → Simulation result and VCD: reads VCD
agent/vwf_generator.py - Quartus project and BDF → Quartus design files: writes artifacts
- Workflow orchestrator → Quartus design files: creates project files
agent/run_spec2rtl.py - ModelSim / Quartus → Workflow orchestrator: provides tool results
- VerilogDB sampler → Distilled datasets: curates samples
training/distill_teacher_cot.py - Teacher distillation → Distilled datasets: exports distilled data
training/distill_teacher_cot.py - Teacher distillation → Spec analyzer: validates specs
training/distill_teacher_cot.py - Teacher distillation → Self-checking testbench: uses testbench checks
training/distill_teacher_cot.py - Teacher distillation → Hardware AST linter: uses lint checks
training/distill_teacher_cot.py - VerilogDB sampler → Spec analyzer: checks port contract
training/verilogdb_sampler.py