// ============================================================================ // Q27 v2.7 Track-B Packed Ternary ML Datapaths (stdlib/tscl_trackb_pack5.q27) // Single Source of Truth (SSOT) for radix-243 pack5 (5 trits/byte = 1.60 b/w) // Compile-time guard [Q27-E105] proves weight alignment & overflow freedom. // ============================================================================ cell q27_PACK5_UNPACKER_SAFE(in packed_byte: trit, out trits_out: trit) { description = "Fault-checked radix-243 pack5 unpacker: bytes 243..255 assert fault_invalid_pack5=1 and clamp trits to safe 0"; datapath { kind = pack5_unpacker; weights = 5; safety = fault_checked; } contract { packing_density == "1.60_b_per_weight"; invalid_bytes_243_255 == "fault_clamped_zero"; } } cell q27_PACK5_UNPACKER(in packed_byte: trit, out trits_out: trit) { description = "Area-minimized radix-243 pack5 unpacker (dont_care default for apples-to-apples Yosys area benchmarking)"; datapath { kind = pack5_unpacker; weights = 5; safety = dont_care; } } cell q27_TMAC_10W_PACK5_SAFE(in packed_w: trit, in acts: trit, out acc_out: trit) { description = "Fault-checked 10-weight multiplier-free BitNet b1.58 pack5 dot-product (2 bytes -> 10 trits, Kleene-0 fault clamp)"; datapath { kind = pack5_tmac; weights = 10; act_bits = 8; acc_bits = 13; safety = fault_checked; } contract { hardware_multipliers == 0; overflow_free_signed_bits == 13; } } cell q27_TMAC_10W_PACK5(in packed_w: trit, in acts: trit, out acc_out: trit) { description = "10-weight multiplier-free BitNet b1.58 pack5 dot-product (dont_care unpacker baseline for EXP-09)"; datapath { kind = pack5_tmac; weights = 10; act_bits = 8; acc_bits = 13; safety = dont_care; } } cell q27_TMAC_10W_PACK5_SAFE_PIPE(in packed_w: trit, in acts: trit, out acc_out: trit) { description = "2-stage pipelined SKY130A-tapeout-ready 10-weight BitNet pack5 safe MAC (LibreLane P&R + 9-corner STA signoff)"; datapath { kind = pack5_tmac; weights = 10; act_bits = 8; acc_bits = 13; safety = fault_checked; clocked = true; clock_ns = 12ns; stages = 2; } contract { hardware_multipliers == 0; overflow_free_signed_bits == 13; } }