1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: LicenseRef-Ternlang-Commercial
// Ternlang — RFI-IRFOS Ternary Intelligence Stack
// Copyright (C) 2026 RFI-IRFOS. All rights reserved.
// Commercial tier. See LICENSE-COMMERCIAL in the repository root.
// Unauthorized use, copying, or distribution is prohibited.
//! ternlang-hdl — Phase 6: Hardware Description Language backend
//!
//! Maps ternlang/BET bytecode to synthesisable Verilog/VHDL.
//!
//! ## Trit → 2-bit wire pair encoding
//!
//! BET uses 2-bit balanced ternary encoding:
//!
//! 0b01 (-1) → wire pair: t1=0, t0=1 (conflict)
//! 0b10 (+1) → wire pair: t1=1, t0=0 (truth)
//! 0b11 ( 0) → wire pair: t1=1, t0=1 (hold)
//! 0b00 FAULT — invalid state
//!
//! Each ternary variable becomes a `[1:0]` bus in Verilog.
//!
//! ## Modules generated
//! - `trit_neg` — inversion
//! - `trit_cons` — consensus (ternary OR)
//! - `trit_mul` — ternary multiply
//! - `trit_add` — balanced ternary adder with carry
//! - `trit_reg` — ternary D-register (synchronous, reset to hold)
//! - `bet_alu` — full BET ALU
//! - Sparse matmul array (parameterised N×N)
pub use ;
pub use BetIsaEmitter;
pub use BetSimEmitter;
pub use ;