Hardware design shouldn't require years of training and millions of dollars. TDLN-Chip proves it doesn't have to.
TDLN-Chip transforms text files into executable hardware — GPU shaders, FPGA configurations, even ASIC designs. Write your logic once, deploy it anywhere, from cloud servers to embedded devices to custom silicon.
What this means:
- Chip-as-Code: Hardware design in text files, versionable with git
- Instant prototyping: Test infinite variations before fabrication
- Cost revolution: $0 to design, cents to manufacture (at scale)
- Perfect auditability: Verilog/Metal code is text you can read
- LLM-native: Language models can generate chips via prompts
This isn't simulation. It's compilation to real, executable hardware.
Traditional hardware design is slow, expensive, and opaque:
- Years to learn Verilog/VHDL
- Months to design a chip
- Millions of dollars to fabricate
- Impossible to audit black-box binaries
TDLN-Chip flips this model:
Instead of thinking "how do I program this GPU?", think "how do I describe what I want the hardware to do?"
Your Intent (text) → TDLN Policy Graph → Hardware Code
Example workflow:
- Write policy: "Validate transactions over $10,000"
- Generate .tdln file (manually or via LLM)
- Compile to Metal (Apple GPU) or CUDA (NVIDIA) or Verilog (FPGA)
- Deploy to hardware
- Result: Purpose-built accelerator, generated from text
Real benchmarks on Apple M4 Pro (20-core GPU):
- 268 GFLOPS peak performance
- 0.47ms latency for complex policy graphs
- 7x energy efficiency vs general-purpose CPUs
- Linear scaling: 2.5x cores = 2.5x performance
- 20,000x cost advantage (text file vs custom ASIC)
NVIDIA comparison:
- H100: 5.9x faster (raw speed)
- M4 Pro: 21x cheaper (cost efficiency)
- RTX 4060: Similar performance to M4 Pro
The insight: For many workloads, cost-per-decision matters more than raw FLOPS.
- Integration Guide — Como usar specs TDLN + TDLN-Chip juntos
- Chip Format — Canonização de compilação
- Quick Start — Começar em 5 minutos
TDLN-Chip/
├── tdln_backends/ # Metal, CUDA, Verilog code generators
├── specs/ # Especificações de formato de chip
│ ├── TDLN_SPEC.md # Link para spec oficial TDLN
│ ├── CHIP_FORMAT.md # Canonização .tdln → hardware
│ └── tdln-chip-extensions.schema.json
├── examples/ # Exemplos de compilação
├── Cargo.toml # Workspace (importa tdln_core de ../TDLN)
└── README.md # Este arquivo
Nota: tdln_core e tdln_runtime residem em TDLN e são importados como dependências.
Especificações:
- Formato TDLN Core: specs/TDLN_SPEC.md (referencia TDLN)
- Formato de Chip: specs/CHIP_FORMAT.md
- Extensões: specs/tdln-chip-extensions.schema.json
cargo build --releasecd ../TDLN/tdln_runtime
cargo bench --bench matrix_opsResultado esperado: ~1.56ms para MatMul 512×512 (M1 GPU)
[dependencies]
tdln_core = { path = "path/to/tdln_core" }
tdln_backends = { path = "path/to/tdln_backends" }use tdln_core::{SemanticUnit, PolicyBit};
use tdln_backends::MetalGenerator;
// Carregar .tdln
let tdln_file = std::fs::read_to_string("arquivo.tdln")?;
let unit: SemanticUnit = serde_json::from_str(&tdln_file)?;
// Compilar para Metal
let generator = MetalGenerator::new();
let metal_code = generator.generate(&unit)?;
// Salvar shader
std::fs::write("output.metal", metal_code)?;Estruturas de dados do TDLN Core:
SemanticUnit— Raiz do arquivo .tdlnPolicyBit— Átomo de decisãoPolicyComposition— Composição de políticasExpression— AST recursivo (BinaryExpression, UnaryExpression, etc)
Geradores de código:
MetalGenerator— Apple Metal shadersCudaGenerator— NVIDIA CUDA kernelsVerilogGenerator— FPGA/ASIC HDL
Runtime de referência:
- Interpretador CPU para validação
- Benchmarks de baseline
- Testes de performance
| Componente | Latência |
|---|---|
| Execução Metal | 1.56ms |
| Integrity (CRC32) | ~20ns |
| Total | 1.56ms |
vs Python NumPy: ~17x mais rápido
vs Rust CPU: ~45x mais rápido
- ✅ Compila
policies[]do .tdln para hardware - ✅ Gera código Metal/CUDA/Verilog otimizado
- ✅ Valida integridade física (CRC32 ~20ns)
- ✅ Fornece runtime de referência (CPU)
- ❌ Define formato .tdln → TDLN Pure
- ❌ Auditoria de workflow (Blake3, Ed25519) → TDLN Pure
- ❌ Tradução LLM → TDLN API
- ❌ Auto-otimização com IA → TDLN API
TDLN Pure (MIT) → Define .tdln (protocolo)
TDLN Chip (MIT) ⭐ → Compila para hardware
TDLN API (Proprietary) → Serviço LLM + otimização
// tdln_core/src/lib.rs
pub struct SemanticUnit {
pub tdln_spec_version: String,
pub node_type: String, // "semantic_unit"
pub id: String,
pub hash: String,
pub policies: Vec<Policy>,
// ...
}
pub enum Policy {
Bit(PolicyBit),
Composition(PolicyComposition),
}
pub struct PolicyBit {
pub node_type: String, // "policy_bit"
pub id: String,
pub hash: String,
pub condition: Expression,
// ...
}- Crie arquivo em
tdln_backends/src/seu_backend.rs - Implemente trait
CodeGenerator:
pub trait CodeGenerator {
fn generate(&self, unit: &SemanticUnit) -> Result<String>;
}
pub struct SeuBackend;
impl CodeGenerator for SeuBackend {
fn generate(&self, unit: &SemanticUnit) -> Result<String> {
// Sua lógica aqui
Ok(codigo_gerado)
}
}- Adicione testes
- Atualize documentação
TDLN-Chip é extensível por design. A comunidade pode criar:
- ✅ Novos backends (WebGPU, ROCm, TPU, OpenCL, Vulkan, Quantum)
- ✅ Otimizações customizadas (loop unrolling, vectorization, etc.)
- ✅ Targets específicos (M4 Max, H100, MI300X, FPGAs customizados)
- ✅ Pipelines avançados (multi-GPU, heterogeneous, distributed)
Requisitos de backend:
- ✅ Compilação determinística
- ✅ Implementar TODAS políticas TDLN
- ✅ Código verificável e auditável
- ✅ Testes de regressão
➡️ Guia completo: CUSTOMIZATION.md
➡️ Exemplos categorizados: examples/
Categorias de exemplos:
- 01_basic_compilation/ - Metal, CUDA, Verilog básicos
- 02_custom_backends/ - WebGPU, ROCm, TPU, OpenCL
- 03_optimizations/ - Loop unrolling, vectorization
- 04_specific_hardware/ - M4 Pro, H100, MI300X
- 05_advanced/ - Multi-GPU, heterogeneous, streaming
# Rodar todos os testes
cargo test --workspace
# Rodar benchmarks
cd tdln_runtime
cargo bench
# Check sem compilar
cargo check --workspacePerformance validated on real hardware:
Apple M4 Pro (20-core GPU):
MatMul 512×512: 0.47ms (268 GFLOPS)
MatMul 1024×1024: 3.8ms (268 GFLOPS sustained)
NVIDIA RTX 4060:
MatMul 512×512: 0.50ms (~250 GFLOPS)
See detailed results:
- BENCHMARK_RESULTS.md - Complete methodology
- MAC_MINI_RESULTS.md - M4 Pro specific data
- NVIDIA_COMPARISON.md - Metal vs CUDA analysis
- PERFORMANCE_COMPARISON.md - Multi-platform comparison
TDLN-Chip é focado em "chips as code". A comunidade pode expandir backends e otimizações!
- Fork o repositório
- Crie uma branch (
git checkout -b feature/nova-feature) - Siga arquitetura: TDLN core + extensões de chip
- Preserve compatibilidade com TDLN
- Abra um Pull Request
- 🔧 Novos backends (WebGPU, ROCm, TPU, etc)
- ⚡ Otimizações de compilação e performance
- 🧪 Testes e benchmarks em novas plataformas
- 📝 Documentação de uso e integração
- 🐛 Bugs e melhorias
Importante: Sempre use specs TDLN core. Ver Integration Guide.
# Rodar todos os testes
cargo test --workspace
# Testes específicos
cargo test -p tdln_backends
# Com output detalhado
cargo test -- --nocaptureMIT License — veja LICENSE para detalhes.
- TDLN Core: https://github.com/logline-foundation/TDLN
- Integration Guide: docs/INTEGRATION_GUIDE.md
- Benchmarks: BENCHMARK_RESULTS.md
- Chip as Code: Chip as Code.md
TDLN Chip — Do SemanticUnit ao silício. 🚀