How janestreet/hardcaml works
Main Components
a) Core Library Components:
• Circuit Generation Engine
• Simulation Engine (Cyclesim)
• RTL Generation Backend (Verilog/VHDL)
• Bits Operations System
• Interface System
• Always API (for sequential logic)
• Property/Assertion System
b) Integration Components:
• External Tools Interface
• Verification Systems
• Waveform Generation
• Test Infrastructure
┌─────────────────────────────────────────────────────────┐
• User Design Layer │
• (OCaml code using Hardcaml primitives and interfaces) │
• ┤
• Hardcaml Core │
• ┬──────────────┬───────────┬──────────────┤
• Circuit │ Simulation │ RTL │ Interface │
• Generation │ Engine │ Generation│ System │
• ┴──────────────┴───────────┴──────────────┤
• Backend Targets │
• (Verilog, VHDL, C, Verilator, etc.) │
• ┘
Key Relationships
• Bidirectional flow between User Design and Hardcaml Core
• Transformation paths from Circuit Generation to various backends
• Interaction between Simulation Engine and Waveform Generation
• How the Interface System connects with all major components
Specific Implementation Details
• Signal processing system (signal.ml)
• Combinational and sequential logic handling (comb.ml, sequential_logic.ml)
• Circuit optimization and deduplication (dedup.ml)
• Waveform generation (wave_*.ml files)
• Multiple clock domain support (shown in test/multi_clock_domain_examples)
External Tool Integration
Connections to:
• Verilator
• Yosys
• Xilinx tools
• Waveform viewers
Documentation Integration
• Reference key documentation files from docs/ directory
• Version information and compatibility notes
Remember to highlight the extensibility of the system, as shown by the numerous additional libraries in the ecosystem (Hardcaml_waveterm, Hardcaml_c, etc.).
This architecture should be drawn using a professional diagramming tool that supports UML notation and allows for clear representation of hierarchical relationships and data flows.