Skip to main content

xlsynth_sys/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2
3//! Declarations for the C API for the XLS dynamic shared object.
4
5extern crate libc;
6
7#[repr(C)]
8pub struct CIrValue {
9    _private: [u8; 0], // Ensures the struct cannot be instantiated
10}
11
12#[repr(C)]
13pub struct CIrBits {
14    _private: [u8; 0], // Ensures the struct cannot be instantiated
15}
16
17#[repr(C)]
18pub struct CBitsRope {
19    _private: [u8; 0], // Ensures the struct cannot be instantiated
20}
21
22#[repr(C)]
23pub struct CIrPackage {
24    _private: [u8; 0], // Ensures the struct cannot be instantiated
25}
26
27#[repr(C)]
28pub struct CIrFunction {
29    _private: [u8; 0], // Ensures the struct cannot be instantiated
30}
31
32#[repr(C)]
33pub struct CIrFunctionBase {
34    _private: [u8; 0], // Ensures the struct cannot be instantiated
35}
36
37#[repr(C)]
38pub struct CIrFunctionJit {
39    _private: [u8; 0], // Ensures the struct cannot be instantiated
40}
41
42#[repr(C)]
43pub struct CTraceMessage {
44    pub message: *mut std::os::raw::c_char,
45    pub verbosity: i64,
46}
47
48#[repr(C)]
49pub struct CIrType {
50    _private: [u8; 0], // Ensures the struct cannot be instantiated
51}
52
53#[repr(C)]
54pub struct CIrFunctionType {
55    _private: [u8; 0], // Ensures the struct cannot be instantiated
56}
57
58// Protected C API for IR analysis.
59#[repr(C)]
60pub struct CIrAnalysis {
61    _private: [u8; 0], // Ensures the struct cannot be instantiated
62}
63
64#[repr(C)]
65pub struct CIrIntervalSet {
66    _private: [u8; 0], // Ensures the struct cannot be instantiated
67}
68
69// "VAST" is the "Verilog AST" API which
70#[repr(C)]
71pub struct CVastFile {
72    _private: [u8; 0], // Ensures the struct cannot be instantiated
73}
74
75#[repr(C)]
76pub struct CVastModule {
77    _private: [u8; 0], // Ensures the struct cannot be instantiated
78}
79
80#[repr(C)]
81pub struct CVastDataType {
82    _private: [u8; 0], // Ensures the struct cannot be instantiated
83}
84
85#[repr(C)]
86pub struct CVastExpression {
87    _private: [u8; 0], // Ensures the struct cannot be instantiated
88}
89
90#[repr(C)]
91pub struct CVastLiteral {
92    _private: [u8; 0], // Ensures the struct cannot be instantiated
93}
94
95#[repr(C)]
96pub struct CVastConcat {
97    _private: [u8; 0], // Ensures the struct cannot be instantiated
98}
99
100#[repr(C)]
101pub struct CVastMacroRef {
102    _private: [u8; 0], // Ensures the struct cannot be instantiated
103}
104
105#[repr(C)]
106pub struct CVastMacroStatement {
107    _private: [u8; 0], // Ensures the struct cannot be instantiated
108}
109
110#[repr(C)]
111pub struct CVastComment {
112    _private: [u8; 0], // Ensures the struct cannot be instantiated
113}
114
115#[repr(C)]
116pub struct CVastBlankLine {
117    _private: [u8; 0], // Ensures the struct cannot be instantiated
118}
119
120#[repr(C)]
121pub struct CVastInlineVerilogStatement {
122    _private: [u8; 0], // Ensures the struct cannot be instantiated
123}
124
125#[repr(C)]
126pub struct CVastLogicRef {
127    _private: [u8; 0], // Ensures the struct cannot be instantiated
128}
129
130#[repr(C)]
131pub struct CVastInstantiation {
132    _private: [u8; 0], // Ensures the struct cannot be instantiated
133}
134
135#[repr(C)]
136pub struct CVastContinuousAssignment {
137    _private: [u8; 0], // Ensures the struct cannot be instantiated
138}
139
140#[repr(C)]
141pub struct CVastSlice {
142    _private: [u8; 0], // Ensures the struct cannot be instantiated
143}
144
145#[repr(C)]
146pub struct CVastIndex {
147    _private: [u8; 0], // Ensures the struct cannot be instantiated
148}
149
150#[repr(C)]
151pub struct CVastIndexableExpression {
152    _private: [u8; 0], // Ensures the struct cannot be instantiated
153}
154
155#[repr(C)]
156pub struct CVastAlwaysBase {
157    _private: [u8; 0], // Ensures the struct cannot be instantiated
158}
159
160#[repr(C)]
161pub struct CVastStatementBlock {
162    _private: [u8; 0], // Ensures the struct cannot be instantiated
163}
164
165#[repr(C)]
166pub struct CVastStatement {
167    _private: [u8; 0], // Ensures the struct cannot be instantiated
168}
169
170#[repr(C)]
171pub struct CVastConditional {
172    _private: [u8; 0], // Ensures the struct cannot be instantiated
173}
174
175#[repr(C)]
176pub struct CVastCaseStatement {
177    _private: [u8; 0], // Ensures the struct cannot be instantiated
178}
179
180#[repr(C)]
181pub struct CVastParameterRef {
182    _private: [u8; 0], // Ensures the struct cannot be instantiated
183}
184
185#[repr(C)]
186pub struct CVastLocalparamRef {
187    _private: [u8; 0], // Ensures the struct cannot be instantiated
188}
189
190#[repr(C)]
191pub struct CVastGenerateLoop {
192    _private: [u8; 0], // Ensures the struct cannot be instantiated
193}
194
195// -- DSLX
196
197#[repr(C)]
198pub struct CDslxImportData {
199    _private: [u8; 0], // Ensures the struct cannot be instantiated
200}
201
202#[repr(C)]
203pub struct CDslxTypecheckedModule {
204    _private: [u8; 0], // Ensures the struct cannot be instantiated
205}
206
207#[repr(C)]
208pub struct CDslxModule {
209    _private: [u8; 0], // Ensures the struct cannot be instantiated
210}
211
212#[repr(C)]
213pub struct CDslxTypeInfo {
214    _private: [u8; 0], // Ensures the struct cannot be instantiated
215}
216
217#[repr(C)]
218pub struct CDslxStructDef {
219    _private: [u8; 0], // Ensures the struct cannot be instantiated
220}
221
222#[repr(C)]
223pub struct CDslxEnumDef {
224    _private: [u8; 0], // Ensures the struct cannot be instantiated
225}
226
227#[repr(C)]
228pub struct CDslxTypeAlias {
229    _private: [u8; 0], // Ensures the struct cannot be instantiated
230}
231
232#[repr(C)]
233pub struct CDslxType {
234    _private: [u8; 0], // Ensures the struct cannot be instantiated
235}
236
237#[repr(C)]
238pub struct CDslxTypeDim {
239    _private: [u8; 0], // Ensures the struct cannot be instantiated
240}
241
242#[repr(C)]
243pub struct CDslxExpr {
244    _private: [u8; 0], // Ensures the struct cannot be instantiated
245}
246
247#[repr(C)]
248pub struct CDslxInterpValue {
249    _private: [u8; 0], // Ensures the struct cannot be instantiated
250}
251
252#[repr(C)]
253pub struct CDslxParametricEnv {
254    _private: [u8; 0], // Ensures the struct cannot be instantiated
255}
256
257#[repr(C)]
258pub struct CDslxEnumMember {
259    _private: [u8; 0], // Ensures the struct cannot be instantiated
260}
261
262#[repr(C)]
263pub struct CDslxStructMember {
264    _private: [u8; 0], // Ensures the struct cannot be instantiated
265}
266
267#[repr(C)]
268pub struct CDslxTypeAnnotation {
269    _private: [u8; 0], // Ensures the struct cannot be instantiated
270}
271
272#[repr(C)]
273pub struct CDslxTypeRefTypeAnnotation {
274    _private: [u8; 0], // Ensures the struct cannot be instantiated
275}
276
277#[repr(C)]
278pub struct CDslxTypeRef {
279    _private: [u8; 0], // Ensures the struct cannot be instantiated
280}
281
282#[repr(C)]
283pub struct CDslxImport {
284    _private: [u8; 0], // Ensures the struct cannot be instantiated
285}
286
287#[repr(C)]
288pub struct CDslxColonRef {
289    _private: [u8; 0], // Ensures the struct cannot be instantiated
290}
291
292#[repr(C)]
293pub struct CDslxTypeDefinition {
294    _private: [u8; 0], // Ensures the struct cannot be instantiated
295}
296
297#[repr(C)]
298pub struct CDslxConstantDef {
299    _private: [u8; 0], // Ensures the struct cannot be instantiated
300}
301
302#[repr(C)]
303pub struct CDslxModuleMember {
304    _private: [u8; 0], // Ensures the struct cannot be instantiated
305}
306
307#[repr(C)]
308pub struct CDslxFunction {
309    _private: [u8; 0], // Ensures the struct cannot be instantiated
310}
311
312#[repr(C)]
313pub struct CDslxParam {
314    _private: [u8; 0], // Ensures the struct cannot be instantiated
315}
316
317#[repr(C)]
318pub struct CDslxAttribute {
319    _private: [u8; 0], // Ensures the struct cannot be instantiated
320}
321
322#[repr(C)]
323pub struct CDslxParametricBinding {
324    _private: [u8; 0], // Ensures the struct cannot be instantiated
325}
326
327#[repr(C)]
328pub struct CDslxCallGraph {
329    _private: [u8; 0], // Ensures the struct cannot be instantiated
330}
331
332#[repr(C)]
333pub struct CDslxQuickcheck {
334    _private: [u8; 0], // Ensures the struct cannot be instantiated
335}
336
337#[repr(C)]
338pub struct CDslxInvocationCalleeDataArray {
339    _private: [u8; 0],
340}
341
342#[repr(C)]
343pub struct CDslxInvocationCalleeData {
344    _private: [u8; 0],
345}
346
347#[repr(C)]
348pub struct CDslxInvocationData {
349    _private: [u8; 0],
350}
351
352#[repr(C)]
353pub struct CDslxInvocation {
354    _private: [u8; 0],
355}
356
357#[repr(C)]
358pub struct CScheduleAndCodegenResult {
359    _private: [u8; 0], // Ensures the struct cannot be instantiated
360}
361
362#[repr(C)]
363pub struct CIrBuilderBase {
364    _private: [u8; 0], // Ensures the struct cannot be instantiated
365}
366
367#[repr(C)]
368pub struct CIrBValue {
369    _private: [u8; 0], // Ensures the struct cannot be instantiated
370}
371
372#[repr(C)]
373pub struct CIrFunctionBuilder {
374    _private: [u8; 0], // Ensures the struct cannot be instantiated
375}
376
377pub type XlsFormatPreference = i32;
378pub type XlsValueKind = i32;
379
380// Calling convention used for DSLX mangling APIs.
381pub type XlsCallingConvention = i32;
382
383pub type CVastFileType = i32;
384
385pub type VastOperatorKind = i32;
386
387// Data kind for VAST Defs.
388pub type VastDataKind = i32;
389pub const XLS_VAST_DATA_KIND_REG: VastDataKind = 0;
390pub const XLS_VAST_DATA_KIND_WIRE: VastDataKind = 1;
391pub const XLS_VAST_DATA_KIND_LOGIC: VastDataKind = 2;
392pub const XLS_VAST_DATA_KIND_INTEGER: VastDataKind = 3;
393pub const XLS_VAST_DATA_KIND_INT: VastDataKind = 4;
394pub const XLS_VAST_DATA_KIND_USER: VastDataKind = 5;
395pub const XLS_VAST_DATA_KIND_UNTYPED_ENUM: VastDataKind = 6;
396pub const XLS_VAST_DATA_KIND_GENVAR: VastDataKind = 7;
397
398pub type DslxTypeDefinitionKind = i32;
399
400pub type DslxModuleMemberKind = i32;
401
402pub type DslxAttributeKind = i32;
403
404pub const XLS_DSLX_ATTRIBUTE_KIND_CFG: DslxAttributeKind = 0;
405pub const XLS_DSLX_ATTRIBUTE_KIND_DSLX_FORMAT_DISABLE: DslxAttributeKind = 1;
406pub const XLS_DSLX_ATTRIBUTE_KIND_EXTERN_VERILOG: DslxAttributeKind = 2;
407pub const XLS_DSLX_ATTRIBUTE_KIND_SV_TYPE: DslxAttributeKind = 3;
408pub const XLS_DSLX_ATTRIBUTE_KIND_TEST: DslxAttributeKind = 4;
409pub const XLS_DSLX_ATTRIBUTE_KIND_TEST_PROC: DslxAttributeKind = 5;
410pub const XLS_DSLX_ATTRIBUTE_KIND_QUICKCHECK: DslxAttributeKind = 6;
411
412pub type DslxAttributeArgumentKind = i32;
413
414pub const XLS_DSLX_ATTRIBUTE_ARGUMENT_KIND_STRING: DslxAttributeArgumentKind = 0;
415pub const XLS_DSLX_ATTRIBUTE_ARGUMENT_KIND_STRING_KEY_VALUE: DslxAttributeArgumentKind = 1;
416pub const XLS_DSLX_ATTRIBUTE_ARGUMENT_KIND_INT_KEY_VALUE: DslxAttributeArgumentKind = 2;
417pub const XLS_DSLX_ATTRIBUTE_ARGUMENT_KIND_STRING_LITERAL: DslxAttributeArgumentKind = 3;
418
419pub const XLS_CALLING_CONVENTION_TYPICAL: XlsCallingConvention = 0;
420pub const XLS_CALLING_CONVENTION_IMPLICIT_TOKEN: XlsCallingConvention = 1;
421pub const XLS_CALLING_CONVENTION_PROC_NEXT: XlsCallingConvention = 2;
422
423#[repr(C)]
424pub struct XlsDslxParametricEnvItem {
425    pub identifier: *const std::os::raw::c_char,
426    pub value: *const CDslxInterpValue,
427}
428
429#[repr(C)]
430pub struct XlsDslxFunctionSpecializationRequest {
431    pub function_name: *const std::os::raw::c_char,
432    pub specialized_name: *const std::os::raw::c_char,
433    pub env: *mut CDslxParametricEnv,
434}
435
436#[repr(C)]
437pub struct CDslxInvocationRewriteRule {
438    pub from_callee: *mut CDslxFunction,
439    pub to_callee: *mut CDslxFunction,
440    pub match_callee_env: *const CDslxParametricEnv,
441    pub to_callee_env: *const CDslxParametricEnv,
442}
443
444extern "C" {
445    pub fn xls_convert_dslx_to_ir(
446        dslx: *const std::os::raw::c_char,
447        path: *const std::os::raw::c_char,
448        module_name: *const std::os::raw::c_char,
449        dslx_stdlib_path: *const std::os::raw::c_char,
450        additional_search_paths: *const *const std::os::raw::c_char,
451        additional_search_paths_count: libc::size_t,
452        error_out: *mut *mut std::os::raw::c_char,
453        ir_out: *mut *mut std::os::raw::c_char,
454    ) -> bool;
455
456    pub fn xls_convert_dslx_to_ir_with_warnings(
457        dslx: *const std::os::raw::c_char,
458        path: *const std::os::raw::c_char,
459        module_name: *const std::os::raw::c_char,
460        dslx_stdlib_path: *const std::os::raw::c_char,
461        additional_search_paths: *const *const std::os::raw::c_char,
462        additional_search_paths_count: libc::size_t,
463        enable_warnings: *const *const std::os::raw::c_char,
464        enable_warnings_count: libc::size_t,
465        disable_warnings: *const *const std::os::raw::c_char,
466        disable_warnings_count: libc::size_t,
467        warnings_as_errors: bool,
468        force_implicit_token_calling_convention: bool,
469        warnings_out: *mut *mut *mut std::os::raw::c_char,
470        warnings_out_count: *mut libc::size_t,
471        error_out: *mut *mut std::os::raw::c_char,
472        ir_out: *mut *mut std::os::raw::c_char,
473    ) -> bool;
474
475    pub fn xls_convert_dslx_path_to_ir(
476        path: *const std::os::raw::c_char,
477        dslx_stdlib_path: *const std::os::raw::c_char,
478        additional_search_paths: *const *const std::os::raw::c_char,
479        additional_search_paths_count: libc::size_t,
480        error_out: *mut *mut std::os::raw::c_char,
481        ir_out: *mut *mut std::os::raw::c_char,
482    ) -> bool;
483
484    pub fn xls_convert_dslx_path_to_ir_with_warnings(
485        path: *const std::os::raw::c_char,
486        dslx_stdlib_path: *const std::os::raw::c_char,
487        additional_search_paths: *const *const std::os::raw::c_char,
488        additional_search_paths_count: libc::size_t,
489        enable_warnings: *const *const std::os::raw::c_char,
490        enable_warnings_count: libc::size_t,
491        disable_warnings: *const *const std::os::raw::c_char,
492        disable_warnings_count: libc::size_t,
493        warnings_as_errors: bool,
494        force_implicit_token_calling_convention: bool,
495        warnings_out: *mut *mut *mut std::os::raw::c_char,
496        warnings_out_count: *mut libc::size_t,
497        error_out: *mut *mut std::os::raw::c_char,
498        ir_out: *mut *mut std::os::raw::c_char,
499    ) -> bool;
500
501    pub fn xls_parse_typed_value(
502        text: *const std::os::raw::c_char,
503        error_out: *mut *mut std::os::raw::c_char,
504        value_out: *mut *mut CIrValue,
505    ) -> bool;
506    pub fn xls_value_free(value: *mut CIrValue);
507
508    pub fn xls_value_clone(value: *const CIrValue) -> *mut CIrValue;
509
510    // Extracts a bits value from a (boxed) value or gives an error.
511    pub fn xls_value_get_bits(
512        value: *const CIrValue,
513        error_out: *mut *mut std::os::raw::c_char,
514        bits_out: *mut *mut CIrBits,
515    ) -> bool;
516
517    // Turns a span of IR values into a tuple value.
518    pub fn xls_value_make_tuple(
519        value_count: libc::size_t,
520        values: *const *const CIrValue,
521    ) -> *mut CIrValue;
522
523    // Create a token value
524    pub fn xls_value_make_token() -> *mut CIrValue;
525
526    /// Returns an error:
527    /// * if the elements do not all have the same type, or
528    /// * if the array is empty (because then we cannot determine the element
529    ///   type)
530    pub fn xls_value_make_array(
531        element_count: libc::size_t,
532        elements: *const *const CIrValue,
533        error_out: *mut *mut std::os::raw::c_char,
534        result_out: *mut *mut CIrValue,
535    ) -> bool;
536
537    // Extracts an element from a tuple/array value or gives an error (e.g. if this
538    // value is not a tuple/array or the index is out of bounds).
539    pub fn xls_value_get_element(
540        tuple: *const CIrValue,
541        index: libc::size_t,
542        error_out: *mut *mut std::os::raw::c_char,
543        element_out: *mut *mut CIrValue,
544    ) -> bool;
545
546    pub fn xls_value_get_element_count(
547        value: *const CIrValue,
548        error_out: *mut *mut std::os::raw::c_char,
549        count_out: *mut i64,
550    ) -> bool;
551
552    // Creates a bits value (via an unsigned integer) that is boxed in an IrValue.
553    pub fn xls_value_make_ubits(
554        bit_count: i64,
555        value: u64,
556        error_out: *mut *mut std::os::raw::c_char,
557        result_out: *mut *mut CIrValue,
558    ) -> bool;
559
560    // Creates a bits value (via a signed integer) that is boxed in an IrValue.
561    pub fn xls_value_make_sbits(
562        bit_count: i64,
563        value: i64,
564        error_out: *mut *mut std::os::raw::c_char,
565        result_out: *mut *mut CIrValue,
566    ) -> bool;
567
568    // Boxes an IR bits object into an IR value.
569    pub fn xls_value_from_bits(bits: *const CIrBits) -> *mut CIrValue;
570
571    pub fn xls_bits_make_ubits(
572        bit_count: i64,
573        value: u64,
574        error_out: *mut *mut std::os::raw::c_char,
575        bits_out: *mut *mut CIrBits,
576    ) -> bool;
577
578    pub fn xls_bits_make_sbits(
579        bit_count: i64,
580        value: i64,
581        error_out: *mut *mut std::os::raw::c_char,
582        bits_out: *mut *mut CIrBits,
583    ) -> bool;
584
585    pub fn xls_bits_free(bits: *mut CIrBits);
586    pub fn xls_bits_get_bit_count(bits: *const CIrBits) -> i64;
587    pub fn xls_bits_get_bit(bits: *const CIrBits, index: i64) -> bool;
588    pub fn xls_bits_eq(bits: *const CIrBits, other: *const CIrBits) -> bool;
589    pub fn xls_bits_ne(a: *const CIrBits, b: *const CIrBits) -> bool;
590    pub fn xls_bits_ult(a: *const CIrBits, b: *const CIrBits) -> bool;
591    pub fn xls_bits_ule(a: *const CIrBits, b: *const CIrBits) -> bool;
592    pub fn xls_bits_ugt(a: *const CIrBits, b: *const CIrBits) -> bool;
593    pub fn xls_bits_uge(a: *const CIrBits, b: *const CIrBits) -> bool;
594    pub fn xls_bits_slt(a: *const CIrBits, b: *const CIrBits) -> bool;
595    pub fn xls_bits_sle(a: *const CIrBits, b: *const CIrBits) -> bool;
596    pub fn xls_bits_sgt(a: *const CIrBits, b: *const CIrBits) -> bool;
597    pub fn xls_bits_sge(a: *const CIrBits, b: *const CIrBits) -> bool;
598    pub fn xls_bits_to_debug_string(bits: *const CIrBits) -> *mut std::os::raw::c_char;
599    pub fn xls_bits_make_bits_from_bytes(
600        bit_count: libc::size_t,
601        bytes: *const u8,
602        byte_count: libc::size_t,
603        error_out: *mut *mut std::os::raw::c_char,
604        bits_out: *mut *mut CIrBits,
605    ) -> bool;
606    pub fn xls_mangle_dslx_name_full(
607        module_name: *const std::os::raw::c_char,
608        function_name: *const std::os::raw::c_char,
609        convention: XlsCallingConvention,
610        free_keys: *const *const std::os::raw::c_char,
611        free_keys_count: libc::size_t,
612        param_env: *const CDslxParametricEnv,
613        scope: *const std::os::raw::c_char,
614        error_out: *mut *mut std::os::raw::c_char,
615        mangled_out: *mut *mut std::os::raw::c_char,
616    ) -> bool;
617    pub fn xls_bits_add(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
618    pub fn xls_bits_sub(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
619    pub fn xls_bits_umul(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
620    pub fn xls_bits_smul(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
621    pub fn xls_bits_negate(bits: *const CIrBits) -> *mut CIrBits;
622    pub fn xls_bits_abs(bits: *const CIrBits) -> *mut CIrBits;
623    pub fn xls_bits_not(bits: *const CIrBits) -> *mut CIrBits;
624    pub fn xls_bits_and(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
625    pub fn xls_bits_or(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
626    pub fn xls_bits_xor(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
627
628    pub fn xls_bits_shift_left_logical(bits: *const CIrBits, shift_amount: i64) -> *mut CIrBits;
629    pub fn xls_bits_shift_right_logical(bits: *const CIrBits, shift_amount: i64) -> *mut CIrBits;
630    pub fn xls_bits_shift_right_arithmetic(bits: *const CIrBits, shift_amount: i64)
631        -> *mut CIrBits;
632
633    // struct xls_bits* xls_bits_width_slice(const struct xls_bits* bits, int64_t
634    // start, int64_t width);
635
636    pub fn xls_bits_width_slice(bits: *const CIrBits, start: i64, width: i64) -> *mut CIrBits;
637
638    pub fn xls_bits_to_bytes(
639        bits: *const CIrBits,
640        error_out: *mut *mut std::os::raw::c_char,
641        bytes_out: *mut *mut u8,
642        byte_count_out: *mut libc::size_t,
643    ) -> bool;
644    pub fn xls_bytes_free(bytes: *mut u8);
645    pub fn xls_bits_to_uint64(
646        bits: *const CIrBits,
647        error_out: *mut *mut std::os::raw::c_char,
648        value_out: *mut u64,
649    ) -> bool;
650    pub fn xls_bits_to_int64(
651        bits: *const CIrBits,
652        error_out: *mut *mut std::os::raw::c_char,
653        value_out: *mut i64,
654    ) -> bool;
655
656    pub fn xls_create_bits_rope(bit_count: i64) -> *mut CBitsRope;
657    pub fn xls_bits_rope_append_bits(bits_rope: *mut CBitsRope, bits: *const CIrBits);
658    pub fn xls_bits_rope_get_bits(bits_rope: *mut CBitsRope) -> *mut CIrBits;
659    pub fn xls_bits_rope_free(bits_rope: *mut CBitsRope);
660
661    pub fn xls_package_free(package: *mut CIrPackage);
662    pub fn xls_c_str_free(c_str: *mut std::os::raw::c_char);
663    pub fn xls_c_strs_free(c_strs: *mut *mut std::os::raw::c_char, count: libc::size_t);
664    pub fn xls_value_to_string(
665        value: *const CIrValue,
666        str_out: *mut *mut std::os::raw::c_char,
667    ) -> bool;
668    pub fn xls_format_preference_from_string(
669        s: *const std::os::raw::c_char,
670        error_out: *mut *mut std::os::raw::c_char,
671        result_out: *mut XlsFormatPreference,
672    ) -> bool;
673
674    pub fn xls_value_to_string_format_preference(
675        value: *const CIrValue,
676        fmt: XlsFormatPreference,
677        error_out: *mut *mut std::os::raw::c_char,
678        str_out: *mut *mut std::os::raw::c_char,
679    ) -> bool;
680    pub fn xls_bits_to_string(
681        bits: *const CIrBits,
682        fmt: XlsFormatPreference,
683        include_bit_count: bool,
684        error_out: *mut *mut std::os::raw::c_char,
685        str_out: *mut *mut std::os::raw::c_char,
686    ) -> bool;
687
688    pub fn xls_value_get_kind(
689        value: *const CIrValue,
690        error_out: *mut *mut std::os::raw::c_char,
691        kind_out: *mut XlsValueKind,
692    ) -> bool;
693    pub fn xls_value_make_true() -> *mut CIrValue;
694    pub fn xls_value_make_false() -> *mut CIrValue;
695    pub fn xls_value_from_bits_owned(bits: *mut CIrBits) -> *mut CIrValue;
696    pub fn xls_value_flatten_to_bits(value: *const CIrValue) -> *mut CIrBits;
697
698    pub fn xls_value_eq(value: *const CIrValue, value: *const CIrValue) -> bool;
699    pub fn xls_parse_ir_package(
700        ir: *const std::os::raw::c_char,
701        filename: *const std::os::raw::c_char,
702        error_out: *mut *mut std::os::raw::c_char,
703        xls_package_out: *mut *mut CIrPackage,
704    ) -> bool;
705
706    // -- IR analysis APIs
707
708    pub fn xls_ir_analysis_create_from_package(
709        p: *mut CIrPackage,
710        error_out: *mut *mut std::os::raw::c_char,
711        out: *mut *mut CIrAnalysis,
712    ) -> bool;
713
714    pub fn xls_ir_analysis_free(a: *mut CIrAnalysis);
715
716    pub fn xls_ir_analysis_get_known_bits_for_node_id(
717        a: *const CIrAnalysis,
718        node_id: i64,
719        error_out: *mut *mut std::os::raw::c_char,
720        known_mask_out: *mut *mut CIrBits,
721        known_value_out: *mut *mut CIrBits,
722    ) -> bool;
723
724    pub fn xls_ir_analysis_get_intervals_for_node_id(
725        a: *const CIrAnalysis,
726        node_id: i64,
727        error_out: *mut *mut std::os::raw::c_char,
728        intervals_out: *mut *mut CIrIntervalSet,
729    ) -> bool;
730
731    pub fn xls_interval_set_get_interval_count(s: *const CIrIntervalSet) -> i64;
732
733    pub fn xls_interval_set_get_interval_bounds(
734        s: *const CIrIntervalSet,
735        i: i64,
736        error_out: *mut *mut std::os::raw::c_char,
737        lo_out: *mut *mut CIrBits,
738        hi_out: *mut *mut CIrBits,
739    ) -> bool;
740
741    pub fn xls_interval_set_free(s: *mut CIrIntervalSet);
742
743    pub fn xls_type_to_string(
744        t: *const CIrType,
745        error_out: *mut *mut std::os::raw::c_char,
746        result_out: *mut *mut std::os::raw::c_char,
747    ) -> bool;
748    pub fn xls_type_get_kind(
749        t: *mut CIrType,
750        error_out: *mut *mut std::os::raw::c_char,
751        kind_out: *mut XlsValueKind,
752    ) -> bool;
753    pub fn xls_type_get_flat_bit_count(t: *const CIrType) -> i64;
754    pub fn xls_type_get_leaf_count(t: *mut CIrType) -> i64;
755    pub fn xls_package_get_type_for_value(
756        package: *const CIrPackage,
757        value: *const CIrValue,
758        error_out: *mut *mut std::os::raw::c_char,
759        result_out: *mut *mut CIrType,
760    ) -> bool;
761    pub fn xls_package_get_function(
762        package: *const CIrPackage,
763        function_name: *const std::os::raw::c_char,
764        error_out: *mut *mut std::os::raw::c_char,
765        result_out: *mut *mut CIrFunction,
766    ) -> bool;
767    pub fn xls_package_get_functions(
768        package: *mut CIrPackage,
769        error_out: *mut *mut std::os::raw::c_char,
770        result_out: *mut *mut *mut CIrFunction,
771        count_out: *mut libc::size_t,
772    ) -> bool;
773    pub fn xls_function_ptr_array_free(function_pointer_array: *mut *mut CIrFunction);
774    pub fn xls_function_get_type(
775        function: *const CIrFunction,
776        error_out: *mut *mut std::os::raw::c_char,
777        xls_fn_type_out: *mut *mut CIrFunctionType,
778    ) -> bool;
779    pub fn xls_function_type_to_string(
780        t: *const CIrFunctionType,
781        error_out: *mut *mut std::os::raw::c_char,
782        string_out: *mut *mut std::os::raw::c_char,
783    ) -> bool;
784    pub fn xls_function_get_name(
785        function: *const CIrFunction,
786        error_out: *mut *mut std::os::raw::c_char,
787        name_out: *mut *mut std::os::raw::c_char,
788    ) -> bool;
789    pub fn xls_function_to_z3_smtlib(
790        function: *mut CIrFunction,
791        error_out: *mut *mut std::os::raw::c_char,
792        string_out: *mut *mut std::os::raw::c_char,
793    ) -> bool;
794    pub fn xls_interpret_function(
795        function: *const CIrFunction,
796        argc: libc::size_t,
797        args: *const *const CIrValue,
798        error_out: *mut *mut std::os::raw::c_char,
799        result_out: *mut *mut CIrValue,
800    ) -> bool;
801    pub fn xls_optimize_ir(
802        ir: *const std::os::raw::c_char,
803        top: *const std::os::raw::c_char,
804        error_out: *mut *mut std::os::raw::c_char,
805        ir_out: *mut *mut std::os::raw::c_char,
806    ) -> bool;
807    pub fn xls_mangle_dslx_name(
808        module_name: *const std::os::raw::c_char,
809        function_name: *const std::os::raw::c_char,
810        error_out: *mut *mut std::os::raw::c_char,
811        mangled_out: *mut *mut std::os::raw::c_char,
812    ) -> bool;
813    pub fn xls_init_xls(
814        usage: *const std::os::raw::c_char,
815        argc: libc::c_int,
816        argv: *mut *mut std::os::raw::c_char,
817    );
818    pub fn xls_package_to_string(
819        p: *const CIrPackage,
820        string_out: *mut *mut std::os::raw::c_char,
821    ) -> bool;
822    pub fn xls_function_to_string(
823        f: *const CIrFunction,
824        string_out: *mut *mut std::os::raw::c_char,
825    ) -> bool;
826    pub fn xls_package_get_top(p: *mut CIrPackage) -> *mut CIrFunctionBase;
827    pub fn xls_package_set_top_by_name(
828        p: *mut CIrPackage,
829        name: *const std::os::raw::c_char,
830        error_out: *mut *mut std::os::raw::c_char,
831    ) -> bool;
832
833    pub fn xls_verify_package(
834        p: *mut CIrPackage,
835        error_out: *mut *mut std::os::raw::c_char,
836    ) -> bool;
837
838    pub fn xls_make_function_jit(
839        function: *const CIrFunction,
840        error_out: *mut *mut std::os::raw::c_char,
841        result_out: *mut *mut CIrFunctionJit,
842    ) -> bool;
843    pub fn xls_function_jit_free(jit: *mut CIrFunctionJit);
844    pub fn xls_function_jit_run(
845        jit: *const CIrFunctionJit,
846        argc: libc::size_t,
847        args: *const *const CIrValue,
848        error_out: *mut *mut std::os::raw::c_char,
849        trace_messages_out: *mut *mut CTraceMessage,
850        trace_messages_count_out: *mut libc::size_t,
851        assert_messages_out: *mut *mut *mut std::os::raw::c_char,
852        assert_messages_count_out: *mut libc::size_t,
853        result_out: *mut *mut CIrValue,
854    ) -> bool;
855    pub fn xls_trace_messages_free(trace_messages: *mut CTraceMessage, count: libc::size_t);
856
857    // -- VAST APIs
858
859    pub fn xls_vast_make_verilog_file(file_type: CVastFileType) -> *mut CVastFile;
860    pub fn xls_vast_verilog_file_free(f: *mut CVastFile);
861    pub fn xls_vast_verilog_file_add_module(
862        f: *mut CVastFile,
863        name: *const std::os::raw::c_char,
864    ) -> *mut CVastModule;
865
866    // - Node creation
867    pub fn xls_vast_verilog_file_make_scalar_type(f: *mut CVastFile) -> *mut CVastDataType;
868    pub fn xls_vast_verilog_file_make_bit_vector_type(
869        f: *mut CVastFile,
870        bit_count: i64,
871        is_signed: bool,
872    ) -> *mut CVastDataType;
873    pub fn xls_vast_verilog_file_make_bit_vector_type_with_expression(
874        f: *mut CVastFile,
875        width_expr: *mut CVastExpression,
876        is_signed: bool,
877    ) -> *mut CVastDataType;
878    pub fn xls_vast_verilog_file_make_integer_type(
879        f: *mut CVastFile,
880        is_signed: bool,
881    ) -> *mut CVastDataType;
882    pub fn xls_vast_verilog_file_make_int_type(
883        f: *mut CVastFile,
884        is_signed: bool,
885    ) -> *mut CVastDataType;
886    pub fn xls_vast_verilog_file_make_integer_def(
887        f: *mut CVastFile,
888        name: *const std::os::raw::c_char,
889        is_signed: bool,
890    ) -> *mut CVastDef;
891    pub fn xls_vast_verilog_file_make_int_def(
892        f: *mut CVastFile,
893        name: *const std::os::raw::c_char,
894        is_signed: bool,
895    ) -> *mut CVastDef;
896    pub fn xls_vast_verilog_file_make_extern_package_type(
897        f: *mut CVastFile,
898        package_name: *const std::os::raw::c_char,
899        type_name: *const std::os::raw::c_char,
900    ) -> *mut CVastDataType;
901    pub fn xls_vast_verilog_file_make_extern_type(
902        f: *mut CVastFile,
903        entity_name: *const std::os::raw::c_char,
904    ) -> *mut CVastDataType;
905    pub fn xls_vast_verilog_file_make_packed_array_type(
906        f: *mut CVastFile,
907        element_type: *mut CVastDataType,
908        dims: *const i64,
909        dim_count: libc::size_t,
910    ) -> *mut CVastDataType;
911    pub fn xls_vast_verilog_file_make_unpacked_array_type(
912        f: *mut CVastFile,
913        element_type: *mut CVastDataType,
914        dims: *const i64,
915        dim_count: libc::size_t,
916    ) -> *mut CVastDataType;
917
918    // -- Data type introspection
919    pub fn xls_vast_data_type_width_as_int64(
920        type_: *mut CVastDataType,
921        out_width: *mut i64,
922        error_out: *mut *mut std::os::raw::c_char,
923    ) -> bool;
924
925    pub fn xls_vast_data_type_flat_bit_count_as_int64(
926        type_: *mut CVastDataType,
927        out_flat_bit_count: *mut i64,
928        error_out: *mut *mut std::os::raw::c_char,
929    ) -> bool;
930
931    // Returns width expression; may return nullptr if none.
932    pub fn xls_vast_data_type_width(type_: *mut CVastDataType) -> *mut CVastExpression;
933
934    pub fn xls_vast_data_type_is_signed(type_: *mut CVastDataType) -> bool;
935
936    pub fn xls_vast_verilog_file_make_continuous_assignment(
937        f: *mut CVastFile,
938        lhs: *mut CVastExpression,
939        rhs: *mut CVastExpression,
940    ) -> *mut CVastContinuousAssignment;
941
942    pub fn xls_vast_verilog_file_make_concat(
943        f: *mut CVastFile,
944        expressions: *mut *mut CVastExpression,
945        expression_count: libc::size_t,
946    ) -> *mut CVastExpression;
947
948    pub fn xls_vast_verilog_file_make_replicated_concat(
949        f: *mut CVastFile,
950        replication: *mut CVastExpression,
951        elements: *mut *mut CVastExpression,
952        element_count: libc::size_t,
953    ) -> *mut CVastConcat;
954
955    pub fn xls_vast_verilog_file_make_replicated_concat_i64(
956        f: *mut CVastFile,
957        replication_count: i64,
958        elements: *mut *mut CVastExpression,
959        element_count: libc::size_t,
960    ) -> *mut CVastConcat;
961    pub fn xls_vast_verilog_file_make_array_assignment_pattern(
962        f: *mut CVastFile,
963        elements: *mut *mut CVastExpression,
964        element_count: libc::size_t,
965    ) -> *mut CVastExpression;
966
967    pub fn xls_vast_verilog_file_make_slice_i64(
968        f: *mut CVastFile,
969        subject: *mut CVastIndexableExpression,
970        hi: i64,
971        lo: i64,
972    ) -> *mut CVastSlice;
973    pub fn xls_vast_verilog_file_make_slice(
974        f: *mut CVastFile,
975        subject: *mut CVastIndexableExpression,
976        hi: *mut CVastExpression,
977        lo: *mut CVastExpression,
978    ) -> *mut CVastSlice;
979
980    pub fn xls_vast_verilog_file_make_index(
981        f: *mut CVastFile,
982        subject: *mut CVastIndexableExpression,
983        index: *mut CVastExpression,
984    ) -> *mut CVastIndex;
985    pub fn xls_vast_verilog_file_make_index_i64(
986        f: *mut CVastFile,
987        subject: *mut CVastIndexableExpression,
988        index: i64,
989    ) -> *mut CVastIndex;
990
991    pub fn xls_vast_verilog_file_make_unary(
992        f: *mut CVastFile,
993        arg: *mut CVastExpression,
994        op: VastOperatorKind,
995    ) -> *mut CVastExpression;
996
997    pub fn xls_vast_verilog_file_make_binary(
998        f: *mut CVastFile,
999        lhs: *mut CVastExpression,
1000        rhs: *mut CVastExpression,
1001        op: VastOperatorKind,
1002    ) -> *mut CVastExpression;
1003
1004    pub fn xls_vast_verilog_file_make_ternary(
1005        f: *mut CVastFile,
1006        cond: *mut CVastExpression,
1007        then_expr: *mut CVastExpression,
1008        else_expr: *mut CVastExpression,
1009    ) -> *mut CVastExpression;
1010
1011    pub fn xls_vast_verilog_file_make_width_cast(
1012        f: *mut CVastFile,
1013        width: *mut CVastExpression,
1014        value: *mut CVastExpression,
1015    ) -> *mut CVastExpression;
1016
1017    // Cast a value to a specific type.
1018    pub fn xls_vast_verilog_file_make_type_cast(
1019        f: *mut CVastFile,
1020        type_: *mut CVastDataType,
1021        value: *mut CVastExpression,
1022    ) -> *mut CVastExpression;
1023
1024    pub fn xls_vast_verilog_file_make_instantiation(
1025        f: *mut CVastFile,
1026        module_name: *const std::os::raw::c_char,
1027        instance_name: *const std::os::raw::c_char,
1028        parameter_port_names: *const *const std::os::raw::c_char,
1029        parameter_expressions: *const *const CVastExpression,
1030        parameter_count: libc::size_t,
1031        connection_port_names: *const *const std::os::raw::c_char,
1032        connection_expressions: *const *const CVastExpression,
1033        connection_count: libc::size_t,
1034    ) -> *mut CVastInstantiation;
1035    pub fn xls_vast_verilog_file_make_comment(
1036        f: *mut CVastFile,
1037        text: *const std::os::raw::c_char,
1038    ) -> *mut CVastComment;
1039    pub fn xls_vast_verilog_file_make_blank_line(f: *mut CVastFile) -> *mut CVastBlankLine;
1040    pub fn xls_vast_verilog_file_make_inline_verilog_statement(
1041        f: *mut CVastFile,
1042        text: *const std::os::raw::c_char,
1043    ) -> *mut CVastInlineVerilogStatement;
1044    pub fn xls_vast_verilog_file_make_literal(
1045        f: *mut CVastFile,
1046        bits: *const CIrBits,
1047        format_preference: XlsFormatPreference,
1048        emit_bit_count: bool,
1049        error_out: *mut *mut std::os::raw::c_char,
1050        literal_out: *mut *mut CVastLiteral,
1051    ) -> bool;
1052    pub fn xls_vast_verilog_file_make_plain_literal(
1053        f: *mut CVastFile,
1054        value: i32,
1055    ) -> *mut CVastLiteral;
1056
1057    // - Module additions
1058    pub fn xls_vast_verilog_module_add_parameter_port(
1059        m: *mut CVastModule,
1060        name: *const std::os::raw::c_char,
1061        rhs: *mut CVastExpression,
1062    ) -> *mut CVastLogicRef;
1063    pub fn xls_vast_verilog_module_add_typed_parameter_port(
1064        m: *mut CVastModule,
1065        name: *const std::os::raw::c_char,
1066        type_: *mut CVastDataType,
1067        rhs: *mut CVastExpression,
1068    ) -> *mut CVastLogicRef;
1069    pub fn xls_vast_verilog_module_add_input(
1070        m: *mut CVastModule,
1071        name: *const std::os::raw::c_char,
1072        type_: *mut CVastDataType,
1073    ) -> *mut CVastLogicRef;
1074    pub fn xls_vast_verilog_module_add_output(
1075        m: *mut CVastModule,
1076        name: *const std::os::raw::c_char,
1077        type_: *mut CVastDataType,
1078    ) -> *mut CVastLogicRef;
1079    pub fn xls_vast_verilog_module_add_inout(
1080        m: *mut CVastModule,
1081        name: *const std::os::raw::c_char,
1082        type_: *mut CVastDataType,
1083    ) -> *mut CVastLogicRef;
1084    pub fn xls_vast_verilog_module_add_logic_input(
1085        m: *mut CVastModule,
1086        name: *const std::os::raw::c_char,
1087        type_: *mut CVastDataType,
1088    ) -> *mut CVastLogicRef;
1089    pub fn xls_vast_verilog_module_add_logic_output(
1090        m: *mut CVastModule,
1091        name: *const std::os::raw::c_char,
1092        type_: *mut CVastDataType,
1093    ) -> *mut CVastLogicRef;
1094    pub fn xls_vast_verilog_module_add_wire(
1095        m: *mut CVastModule,
1096        name: *const std::os::raw::c_char,
1097        type_: *mut CVastDataType,
1098    ) -> *mut CVastLogicRef;
1099    pub fn xls_vast_verilog_module_add_generate_loop(
1100        m: *mut CVastModule,
1101        genvar_name: *const std::os::raw::c_char,
1102        init: *mut CVastExpression,
1103        limit: *mut CVastExpression,
1104        label: *const std::os::raw::c_char,
1105    ) -> *mut CVastGenerateLoop;
1106    pub fn xls_vast_verilog_module_add_member_instantiation(
1107        m: *mut CVastModule,
1108        inst: *mut CVastInstantiation,
1109    );
1110    pub fn xls_vast_verilog_module_add_member_continuous_assignment(
1111        m: *mut CVastModule,
1112        ca: *mut CVastContinuousAssignment,
1113    );
1114    pub fn xls_vast_verilog_module_add_member_comment(
1115        m: *mut CVastModule,
1116        comment: *mut CVastComment,
1117    );
1118    pub fn xls_vast_verilog_module_add_member_blank_line(
1119        m: *mut CVastModule,
1120        blank: *mut CVastBlankLine,
1121    );
1122    pub fn xls_vast_verilog_module_add_member_inline_statement(
1123        m: *mut CVastModule,
1124        stmt: *mut CVastInlineVerilogStatement,
1125    );
1126    pub fn xls_vast_verilog_module_add_member_macro_statement(
1127        m: *mut CVastModule,
1128        statement: *mut CVastMacroStatement,
1129    );
1130    pub fn xls_vast_verilog_module_add_conditional(
1131        m: *mut CVastModule,
1132        cond: *mut CVastExpression,
1133    ) -> *mut CVastConditional;
1134
1135    pub fn xls_vast_verilog_module_add_parameter(
1136        m: *mut CVastModule,
1137        name: *const std::os::raw::c_char,
1138        rhs: *mut CVastExpression,
1139    ) -> *mut CVastParameterRef;
1140
1141    pub fn xls_vast_verilog_module_add_localparam(
1142        m: *mut CVastModule,
1143        name: *const std::os::raw::c_char,
1144        rhs: *mut CVastExpression,
1145    ) -> *mut CVastLocalparamRef;
1146
1147    pub fn xls_vast_verilog_file_make_def(
1148        f: *mut CVastFile,
1149        name: *const std::os::raw::c_char,
1150        kind: VastDataKind,
1151        type_: *mut CVastDataType,
1152    ) -> *mut CVastDef;
1153
1154    pub fn xls_vast_verilog_module_add_parameter_with_def(
1155        m: *mut CVastModule,
1156        def: *mut CVastDef,
1157        rhs: *mut CVastExpression,
1158    ) -> *mut CVastParameterRef;
1159
1160    pub fn xls_vast_verilog_module_add_localparam_with_def(
1161        m: *mut CVastModule,
1162        def: *mut CVastDef,
1163        rhs: *mut CVastExpression,
1164    ) -> *mut CVastLocalparamRef;
1165
1166    pub fn xls_vast_verilog_module_get_name(m: *mut CVastModule) -> *mut std::os::raw::c_char;
1167
1168    // - Expression conversions
1169    pub fn xls_vast_logic_ref_as_indexable_expression(
1170        v: *mut CVastLogicRef,
1171    ) -> *mut CVastIndexableExpression;
1172    pub fn xls_vast_index_as_indexable_expression(
1173        v: *mut CVastIndex,
1174    ) -> *mut CVastIndexableExpression;
1175    pub fn xls_vast_parameter_ref_as_indexable_expression(
1176        v: *mut CVastParameterRef,
1177    ) -> *mut CVastIndexableExpression;
1178
1179    pub fn xls_vast_literal_as_expression(v: *mut CVastLiteral) -> *mut CVastExpression;
1180    pub fn xls_vast_concat_as_expression(v: *mut CVastConcat) -> *mut CVastExpression;
1181    pub fn xls_vast_logic_ref_as_expression(v: *mut CVastLogicRef) -> *mut CVastExpression;
1182    pub fn xls_vast_slice_as_expression(v: *mut CVastSlice) -> *mut CVastExpression;
1183    pub fn xls_vast_index_as_expression(v: *mut CVastIndex) -> *mut CVastExpression;
1184    pub fn xls_vast_parameter_ref_as_expression(v: *mut CVastParameterRef) -> *mut CVastExpression;
1185    pub fn xls_vast_localparam_ref_as_expression(
1186        v: *mut CVastLocalparamRef,
1187    ) -> *mut CVastExpression;
1188    pub fn xls_vast_indexable_expression_as_expression(
1189        v: *mut CVastIndexableExpression,
1190    ) -> *mut CVastExpression;
1191    pub fn xls_vast_macro_ref_as_expression(v: *mut CVastMacroRef) -> *mut CVastExpression;
1192    pub fn xls_vast_verilog_file_make_unsized_one_literal(
1193        f: *mut CVastFile,
1194    ) -> *mut CVastExpression;
1195    pub fn xls_vast_verilog_file_make_unsized_zero_literal(
1196        f: *mut CVastFile,
1197    ) -> *mut CVastExpression;
1198    pub fn xls_vast_verilog_file_make_unsized_x_literal(f: *mut CVastFile) -> *mut CVastExpression;
1199    pub fn xls_vast_verilog_file_make_macro_ref(
1200        f: *mut CVastFile,
1201        name: *const std::os::raw::c_char,
1202    ) -> *mut CVastMacroRef;
1203    pub fn xls_vast_verilog_file_make_macro_ref_with_args(
1204        f: *mut CVastFile,
1205        name: *const std::os::raw::c_char,
1206        args: *mut *mut CVastExpression,
1207        arg_count: libc::size_t,
1208    ) -> *mut CVastMacroRef;
1209    pub fn xls_vast_verilog_file_make_macro_statement(
1210        f: *mut CVastFile,
1211        r#ref: *mut CVastMacroRef,
1212        emit_semicolon: bool,
1213    ) -> *mut CVastMacroStatement;
1214
1215    pub fn xls_vast_logic_ref_get_name(v: *mut CVastLogicRef) -> *mut std::os::raw::c_char;
1216
1217    pub fn xls_vast_verilog_file_add_include(f: *mut CVastFile, path: *const std::os::raw::c_char);
1218    pub fn xls_vast_verilog_file_add_blank_line(f: *mut CVastFile, blank_line: *mut CVastBlankLine);
1219    pub fn xls_vast_verilog_file_add_comment(
1220        f: *mut CVastFile,
1221        comment: *const std::os::raw::c_char,
1222    );
1223    pub fn xls_vast_verilog_file_emit(f: *const CVastFile) -> *mut std::os::raw::c_char;
1224    pub fn xls_vast_expression_emit(expr: *mut CVastExpression) -> *mut std::os::raw::c_char;
1225
1226    // -- DSLX
1227
1228    pub fn xls_dslx_import_data_create(
1229        dslx_stdlib_path: *const std::os::raw::c_char,
1230        additional_search_paths: *const *const std::os::raw::c_char,
1231        additional_search_paths_count: libc::size_t,
1232    ) -> *mut CDslxImportData;
1233    pub fn xls_dslx_import_data_free(data: *mut CDslxImportData);
1234
1235    pub fn xls_dslx_parse_and_typecheck(
1236        text: *const std::os::raw::c_char,
1237        path: *const std::os::raw::c_char,
1238        module_name: *const std::os::raw::c_char,
1239        import_data: *const CDslxImportData,
1240        error_out: *mut *mut std::os::raw::c_char,
1241        typechecked_module_out: *mut *mut CDslxTypecheckedModule,
1242    ) -> bool;
1243
1244    pub fn xls_dslx_typechecked_module_clone_removing_functions(
1245        tm: *mut CDslxTypecheckedModule,
1246        functions: *mut *mut CDslxFunction,
1247        function_count: libc::size_t,
1248        install_subject: *const std::os::raw::c_char,
1249        import_data: *mut CDslxImportData,
1250        error_out: *mut *mut std::os::raw::c_char,
1251        result_out: *mut *mut CDslxTypecheckedModule,
1252    ) -> bool;
1253
1254    pub fn xls_dslx_typechecked_module_clone_removing_members(
1255        tm: *mut CDslxTypecheckedModule,
1256        members: *mut *mut CDslxModuleMember,
1257        member_count: libc::size_t,
1258        install_subject: *const std::os::raw::c_char,
1259        import_data: *mut CDslxImportData,
1260        error_out: *mut *mut std::os::raw::c_char,
1261        result_out: *mut *mut CDslxTypecheckedModule,
1262    ) -> bool;
1263
1264    pub fn xls_dslx_replace_invocations_in_module(
1265        tm: *mut CDslxTypecheckedModule,
1266        callers: *const *mut CDslxFunction,
1267        callers_count: libc::size_t,
1268        rules: *const CDslxInvocationRewriteRule,
1269        rules_count: libc::size_t,
1270        import_data: *mut CDslxImportData,
1271        install_subject: *const std::os::raw::c_char,
1272        error_out: *mut *mut std::os::raw::c_char,
1273        result_out: *mut *mut CDslxTypecheckedModule,
1274    ) -> bool;
1275
1276    pub fn xls_dslx_typechecked_module_insert_function_specializations(
1277        typechecked_module: *mut CDslxTypecheckedModule,
1278        requests: *const XlsDslxFunctionSpecializationRequest,
1279        request_count: libc::size_t,
1280        import_data: *mut CDslxImportData,
1281        install_subject: *const std::os::raw::c_char,
1282        error_out: *mut *mut std::os::raw::c_char,
1283        result_out: *mut *mut CDslxTypecheckedModule,
1284    ) -> bool;
1285
1286    // bool xls_schedule_and_codegen_package(
1287    // struct xls_package* p, const char* scheduling_options_flags_proto,
1288    // const char* codegen_flags_proto, bool with_delay_model, char** error_out,
1289    // struct xls_schedule_and_codegen_result** result_out);
1290    pub fn xls_schedule_and_codegen_package(
1291        p: *mut CIrPackage,
1292        scheduling_options_flags_proto: *const std::os::raw::c_char,
1293        codegen_flags_proto: *const std::os::raw::c_char,
1294        with_delay_model: bool,
1295        error_out: *mut *mut std::os::raw::c_char,
1296        result_out: *mut *mut CScheduleAndCodegenResult,
1297    ) -> bool;
1298
1299    pub fn xls_schedule_and_codegen_result_get_verilog_text(
1300        result: *mut CScheduleAndCodegenResult,
1301    ) -> *mut std::os::raw::c_char;
1302
1303    pub fn xls_schedule_and_codegen_result_free(result: *mut CScheduleAndCodegenResult);
1304
1305    pub fn xls_dslx_typechecked_module_free(module: *mut CDslxTypecheckedModule);
1306
1307    pub fn xls_dslx_typechecked_module_get_module(
1308        module: *mut CDslxTypecheckedModule,
1309    ) -> *mut CDslxModule;
1310
1311    pub fn xls_dslx_typechecked_module_get_type_info(
1312        module: *mut CDslxTypecheckedModule,
1313    ) -> *mut CDslxTypeInfo;
1314
1315    pub fn xls_dslx_module_to_string(module: *mut CDslxModule) -> *mut std::os::raw::c_char;
1316
1317    pub fn xls_dslx_module_get_name(module: *const CDslxModule) -> *mut std::os::raw::c_char;
1318
1319    pub fn xls_dslx_module_get_type_definition_count(module: *const CDslxModule) -> i64;
1320
1321    pub fn xls_dslx_module_get_member_count(module: *const CDslxModule) -> i64;
1322
1323    pub fn xls_dslx_module_get_member(module: *const CDslxModule, i: i64)
1324        -> *mut CDslxModuleMember;
1325
1326    pub fn xls_dslx_module_get_type_definition_kind(
1327        module: *const CDslxModule,
1328        i: i64,
1329    ) -> DslxTypeDefinitionKind;
1330
1331    pub fn xls_dslx_module_get_type_definition_as_struct_def(
1332        module: *const CDslxModule,
1333        i: i64,
1334    ) -> *mut CDslxStructDef;
1335    pub fn xls_dslx_module_get_type_definition_as_enum_def(
1336        module: *const CDslxModule,
1337        i: i64,
1338    ) -> *mut CDslxEnumDef;
1339    pub fn xls_dslx_module_get_type_definition_as_type_alias(
1340        module: *const CDslxModule,
1341        i: i64,
1342    ) -> *mut CDslxTypeAlias;
1343
1344    // -- xls_dslx_module_member
1345    pub fn xls_dslx_module_member_get_kind(
1346        member: *const CDslxModuleMember,
1347    ) -> DslxModuleMemberKind;
1348    pub fn xls_dslx_module_member_get_constant_def(
1349        member: *const CDslxModuleMember,
1350    ) -> *mut CDslxConstantDef;
1351    pub fn xls_dslx_module_member_get_type_alias(
1352        member: *const CDslxModuleMember,
1353    ) -> *mut CDslxTypeAlias;
1354    pub fn xls_dslx_module_member_get_struct_def(
1355        member: *const CDslxModuleMember,
1356    ) -> *mut CDslxStructDef;
1357    pub fn xls_dslx_module_member_get_enum_def(
1358        member: *const CDslxModuleMember,
1359    ) -> *mut CDslxEnumDef;
1360    pub fn xls_dslx_module_member_get_function(
1361        member: *const CDslxModuleMember,
1362    ) -> *mut CDslxFunction;
1363    pub fn xls_dslx_module_member_get_quickcheck(
1364        member: *const CDslxModuleMember,
1365    ) -> *mut CDslxQuickcheck;
1366    pub fn xls_dslx_module_member_from_constant_def(
1367        constant_def: *mut CDslxConstantDef,
1368    ) -> *mut CDslxModuleMember;
1369    pub fn xls_dslx_module_member_from_struct_def(
1370        struct_def: *mut CDslxStructDef,
1371    ) -> *mut CDslxModuleMember;
1372    pub fn xls_dslx_module_member_from_enum_def(
1373        enum_def: *mut CDslxEnumDef,
1374    ) -> *mut CDslxModuleMember;
1375    pub fn xls_dslx_module_member_from_type_alias(
1376        type_alias: *mut CDslxTypeAlias,
1377    ) -> *mut CDslxModuleMember;
1378    pub fn xls_dslx_module_member_from_function(
1379        function: *mut CDslxFunction,
1380    ) -> *mut CDslxModuleMember;
1381    pub fn xls_dslx_module_member_from_quickcheck(
1382        quickcheck: *mut CDslxQuickcheck,
1383    ) -> *mut CDslxModuleMember;
1384
1385    pub fn xls_dslx_colon_ref_get_attr(
1386        colon_ref: *const CDslxColonRef,
1387    ) -> *mut std::os::raw::c_char;
1388
1389    pub fn xls_dslx_type_info_get_type_struct_def(
1390        type_info: *mut CDslxTypeInfo,
1391        node: *mut CDslxStructDef,
1392    ) -> *mut CDslxType;
1393    pub fn xls_dslx_type_info_get_type_enum_def(
1394        type_info: *mut CDslxTypeInfo,
1395        node: *mut CDslxEnumDef,
1396    ) -> *mut CDslxType;
1397    pub fn xls_dslx_type_info_get_type_struct_member(
1398        type_info: *mut CDslxTypeInfo,
1399        member: *mut CDslxStructMember,
1400    ) -> *mut CDslxType;
1401    pub fn xls_dslx_type_info_get_type_constant_def(
1402        type_info: *mut CDslxTypeInfo,
1403        node: *mut CDslxConstantDef,
1404    ) -> *mut CDslxType;
1405
1406    /// Gets the concrete type for a TypeAnnotation AST node.
1407    pub fn xls_dslx_type_info_get_type_type_annotation(
1408        type_info: *mut CDslxTypeInfo,
1409        type_annotation: *mut CDslxTypeAnnotation,
1410    ) -> *mut CDslxType;
1411
1412    pub fn xls_dslx_type_info_get_imported_type_info(
1413        type_info: *mut CDslxTypeInfo,
1414        module: *mut CDslxModule,
1415    ) -> *mut CDslxTypeInfo;
1416
1417    pub fn xls_dslx_type_info_get_unique_invocation_callee_data(
1418        type_info: *mut CDslxTypeInfo,
1419        function: *mut CDslxFunction,
1420    ) -> *mut CDslxInvocationCalleeDataArray;
1421    pub fn xls_dslx_type_info_get_all_invocation_callee_data(
1422        type_info: *mut CDslxTypeInfo,
1423        function: *mut CDslxFunction,
1424    ) -> *mut CDslxInvocationCalleeDataArray;
1425    pub fn xls_dslx_type_info_get_root_invocation_data(
1426        type_info: *mut CDslxTypeInfo,
1427        invocation: *mut CDslxInvocation,
1428    ) -> *mut CDslxInvocationData;
1429
1430    // -- call_graph
1431    pub fn xls_dslx_type_info_build_function_call_graph(
1432        type_info: *mut CDslxTypeInfo,
1433        error_out: *mut *mut std::os::raw::c_char,
1434        result_out: *mut *mut CDslxCallGraph,
1435    ) -> bool;
1436
1437    pub fn xls_dslx_call_graph_free(call_graph: *mut CDslxCallGraph);
1438
1439    pub fn xls_dslx_call_graph_get_function_count(call_graph: *mut CDslxCallGraph) -> i64;
1440
1441    pub fn xls_dslx_call_graph_get_function(
1442        call_graph: *mut CDslxCallGraph,
1443        index: i64,
1444    ) -> *mut CDslxFunction;
1445
1446    pub fn xls_dslx_call_graph_get_callee_count(
1447        call_graph: *mut CDslxCallGraph,
1448        caller: *mut CDslxFunction,
1449    ) -> i64;
1450
1451    pub fn xls_dslx_call_graph_get_callee_function(
1452        call_graph: *mut CDslxCallGraph,
1453        caller: *mut CDslxFunction,
1454        callee_index: i64,
1455    ) -> *mut CDslxFunction;
1456
1457    pub fn xls_dslx_invocation_callee_data_array_free(array: *mut CDslxInvocationCalleeDataArray);
1458    pub fn xls_dslx_invocation_callee_data_array_get_count(
1459        array: *mut CDslxInvocationCalleeDataArray,
1460    ) -> i64;
1461    pub fn xls_dslx_invocation_callee_data_array_get(
1462        array: *mut CDslxInvocationCalleeDataArray,
1463        index: i64,
1464    ) -> *mut CDslxInvocationCalleeData;
1465
1466    pub fn xls_dslx_invocation_callee_data_clone(
1467        data: *mut CDslxInvocationCalleeData,
1468    ) -> *mut CDslxInvocationCalleeData;
1469    pub fn xls_dslx_invocation_callee_data_free(data: *mut CDslxInvocationCalleeData);
1470    pub fn xls_dslx_invocation_callee_data_get_callee_bindings(
1471        data: *mut CDslxInvocationCalleeData,
1472    ) -> *const CDslxParametricEnv;
1473    pub fn xls_dslx_invocation_callee_data_get_caller_bindings(
1474        data: *mut CDslxInvocationCalleeData,
1475    ) -> *const CDslxParametricEnv;
1476    pub fn xls_dslx_invocation_callee_data_get_derived_type_info(
1477        data: *mut CDslxInvocationCalleeData,
1478    ) -> *mut CDslxTypeInfo;
1479    pub fn xls_dslx_invocation_callee_data_get_invocation(
1480        data: *mut CDslxInvocationCalleeData,
1481    ) -> *mut CDslxInvocation;
1482
1483    pub fn xls_dslx_invocation_data_get_invocation(
1484        data: *mut CDslxInvocationData,
1485    ) -> *mut CDslxInvocation;
1486    pub fn xls_dslx_invocation_data_get_callee(
1487        data: *mut CDslxInvocationData,
1488    ) -> *mut CDslxFunction;
1489    pub fn xls_dslx_invocation_data_get_caller(
1490        data: *mut CDslxInvocationData,
1491    ) -> *mut CDslxFunction;
1492
1493    // -- ConstantDef
1494
1495    pub fn xls_dslx_constant_def_get_name(
1496        constant_def: *const CDslxConstantDef,
1497    ) -> *mut std::os::raw::c_char;
1498
1499    pub fn xls_dslx_constant_def_get_value(constant_def: *const CDslxConstantDef)
1500        -> *mut CDslxExpr;
1501
1502    // -- TypeAlias
1503
1504    pub fn xls_dslx_type_alias_get_identifier(
1505        type_alias: *const CDslxTypeAlias,
1506    ) -> *mut std::os::raw::c_char;
1507
1508    pub fn xls_dslx_type_alias_get_type_annotation(
1509        type_alias: *const CDslxTypeAlias,
1510    ) -> *mut CDslxTypeAnnotation;
1511
1512    // -- TypeAnnotation
1513
1514    pub fn xls_dslx_type_annotation_get_type_ref_type_annotation(
1515        type_annotation: *const CDslxTypeAnnotation,
1516    ) -> *mut CDslxTypeRefTypeAnnotation;
1517
1518    // -- TypeRef
1519
1520    pub fn xls_dslx_type_ref_get_type_definition(
1521        type_ref: *const CDslxTypeRef,
1522    ) -> *mut CDslxTypeDefinition;
1523
1524    // -- Import
1525
1526    pub fn xls_dslx_import_get_subject_count(import: *const CDslxImport) -> i64;
1527    pub fn xls_dslx_import_get_subject(
1528        import: *const CDslxImport,
1529        i: i64,
1530    ) -> *mut std::os::raw::c_char;
1531
1532    // -- ColonRef
1533
1534    pub fn xls_dslx_colon_ref_resolve_import_subject(
1535        colon_ref: *const CDslxColonRef,
1536    ) -> *mut CDslxImport;
1537
1538    // -- TypeDefinition
1539
1540    pub fn xls_dslx_type_definition_get_colon_ref(
1541        type_definition: *const CDslxTypeDefinition,
1542    ) -> *mut CDslxColonRef;
1543    pub fn xls_dslx_type_definition_get_type_alias(
1544        type_definition: *const CDslxTypeDefinition,
1545    ) -> *mut CDslxTypeAlias;
1546
1547    // -- TypeRefTypeAnnotation
1548
1549    pub fn xls_dslx_type_ref_type_annotation_get_type_ref(
1550        type_ref_type_annotation: *const CDslxTypeRefTypeAnnotation,
1551    ) -> *mut CDslxTypeRef;
1552
1553    // -- StructDef
1554
1555    pub fn xls_dslx_struct_def_get_identifier(
1556        struct_def: *const CDslxStructDef,
1557    ) -> *mut std::os::raw::c_char;
1558
1559    pub fn xls_dslx_struct_def_is_parametric(struct_def: *const CDslxStructDef) -> bool;
1560
1561    pub fn xls_dslx_struct_def_get_member_count(struct_def: *const CDslxStructDef) -> i64;
1562
1563    pub fn xls_dslx_struct_def_get_member(
1564        struct_def: *const CDslxStructDef,
1565        i: i64,
1566    ) -> *mut CDslxStructMember;
1567
1568    pub fn xls_dslx_struct_member_get_name(
1569        member: *const CDslxStructMember,
1570    ) -> *mut std::os::raw::c_char;
1571
1572    pub fn xls_dslx_struct_member_get_type(
1573        member: *const CDslxStructMember,
1574    ) -> *mut CDslxTypeAnnotation;
1575
1576    // -- EnumDef
1577
1578    pub fn xls_dslx_enum_def_get_identifier(
1579        enum_def: *const CDslxEnumDef,
1580    ) -> *mut std::os::raw::c_char;
1581
1582    pub fn xls_dslx_enum_def_get_member_count(enum_def: *const CDslxEnumDef) -> i64;
1583
1584    pub fn xls_dslx_enum_def_get_member(
1585        enum_def: *const CDslxEnumDef,
1586        i: i64,
1587    ) -> *mut CDslxEnumMember;
1588
1589    pub fn xls_dslx_enum_def_get_underlying(
1590        enum_def: *const CDslxEnumDef,
1591    ) -> *mut CDslxTypeAnnotation;
1592
1593    pub fn xls_dslx_enum_member_get_name(
1594        member: *const CDslxEnumMember,
1595    ) -> *mut std::os::raw::c_char;
1596
1597    pub fn xls_dslx_enum_member_get_value(member: *const CDslxEnumMember) -> *mut CDslxExpr;
1598
1599    pub fn xls_dslx_expr_get_owner_module(expr: *mut CDslxExpr) -> *mut CDslxModule;
1600
1601    // --
1602
1603    pub fn xls_dslx_interp_value_free(value: *mut CDslxInterpValue);
1604
1605    pub fn xls_dslx_interp_value_to_string(
1606        value: *mut CDslxInterpValue,
1607    ) -> *mut std::os::raw::c_char;
1608
1609    pub fn xls_dslx_interp_value_clone(value: *const CDslxInterpValue) -> *mut CDslxInterpValue;
1610
1611    // Parametric env construction and InterpValue helpers
1612    pub fn xls_dslx_parametric_env_create(
1613        items: *const XlsDslxParametricEnvItem,
1614        items_count: libc::size_t,
1615        error_out: *mut *mut std::os::raw::c_char,
1616        env_out: *mut *mut CDslxParametricEnv,
1617    ) -> bool;
1618    pub fn xls_dslx_parametric_env_free(env: *mut CDslxParametricEnv);
1619    pub fn xls_dslx_parametric_env_clone(env: *const CDslxParametricEnv)
1620        -> *mut CDslxParametricEnv;
1621    pub fn xls_dslx_parametric_env_equals(
1622        lhs: *const CDslxParametricEnv,
1623        rhs: *const CDslxParametricEnv,
1624    ) -> bool;
1625    pub fn xls_dslx_parametric_env_less_than(
1626        lhs: *const CDslxParametricEnv,
1627        rhs: *const CDslxParametricEnv,
1628    ) -> bool;
1629    pub fn xls_dslx_parametric_env_hash(env: *const CDslxParametricEnv) -> u64;
1630    pub fn xls_dslx_parametric_env_to_string(
1631        env: *const CDslxParametricEnv,
1632    ) -> *mut std::os::raw::c_char;
1633    pub fn xls_dslx_parametric_env_get_binding_count(env: *const CDslxParametricEnv) -> i64;
1634    pub fn xls_dslx_parametric_env_get_binding_identifier(
1635        env: *const CDslxParametricEnv,
1636        index: i64,
1637    ) -> *const std::os::raw::c_char;
1638    pub fn xls_dslx_parametric_env_get_binding_value(
1639        env: *const CDslxParametricEnv,
1640        index: i64,
1641    ) -> *mut CDslxInterpValue;
1642
1643    pub fn xls_dslx_interp_value_make_ubits(bit_count: i64, value: u64) -> *mut CDslxInterpValue;
1644    pub fn xls_dslx_interp_value_make_sbits(bit_count: i64, value: i64) -> *mut CDslxInterpValue;
1645    pub fn xls_dslx_interp_value_make_enum(
1646        def: *mut CDslxEnumDef,
1647        is_signed: bool,
1648        bits: *const CIrBits,
1649        error_out: *mut *mut std::os::raw::c_char,
1650        result_out: *mut *mut CDslxInterpValue,
1651    ) -> bool;
1652    pub fn xls_dslx_interp_value_make_tuple(
1653        element_count: libc::size_t,
1654        elements: *mut *mut CDslxInterpValue,
1655        error_out: *mut *mut std::os::raw::c_char,
1656        result_out: *mut *mut CDslxInterpValue,
1657    ) -> bool;
1658    pub fn xls_dslx_interp_value_make_array(
1659        element_count: libc::size_t,
1660        elements: *mut *mut CDslxInterpValue,
1661        error_out: *mut *mut std::os::raw::c_char,
1662        result_out: *mut *mut CDslxInterpValue,
1663    ) -> bool;
1664
1665    pub fn xls_dslx_interp_value_from_string(
1666        text: *const std::os::raw::c_char,
1667        dslx_stdlib_path: *const std::os::raw::c_char,
1668        error_out: *mut *mut std::os::raw::c_char,
1669        result_out: *mut *mut CDslxInterpValue,
1670    ) -> bool;
1671
1672    pub fn xls_dslx_interp_value_convert_to_ir(
1673        value: *const CDslxInterpValue,
1674        error_out: *mut *mut std::os::raw::c_char,
1675        result_out: *mut *mut CIrValue,
1676    ) -> bool;
1677
1678    pub fn xls_dslx_type_to_string(
1679        type_: *const CDslxType,
1680        error_out: *mut *mut std::os::raw::c_char,
1681        result_out: *mut *mut std::os::raw::c_char,
1682    ) -> bool;
1683
1684    // Stringification for DSLX AST nodes
1685    pub fn xls_dslx_function_to_string(function: *const CDslxFunction)
1686        -> *mut std::os::raw::c_char;
1687    pub fn xls_dslx_struct_def_to_string(
1688        struct_def: *const CDslxStructDef,
1689    ) -> *mut std::os::raw::c_char;
1690    pub fn xls_dslx_enum_def_to_string(enum_def: *const CDslxEnumDef) -> *mut std::os::raw::c_char;
1691    pub fn xls_dslx_type_alias_to_string(
1692        type_alias: *const CDslxTypeAlias,
1693    ) -> *mut std::os::raw::c_char;
1694    pub fn xls_dslx_constant_def_to_string(
1695        constant_def: *const CDslxConstantDef,
1696    ) -> *mut std::os::raw::c_char;
1697    pub fn xls_dslx_quickcheck_to_string(qc: *const CDslxQuickcheck) -> *mut std::os::raw::c_char;
1698    pub fn xls_dslx_expr_to_string(expr: *const CDslxExpr) -> *mut std::os::raw::c_char;
1699
1700    pub fn xls_dslx_type_info_get_const_expr(
1701        type_info: *mut CDslxTypeInfo,
1702        expr: *mut CDslxExpr,
1703        error_out: *mut *mut std::os::raw::c_char,
1704        result_out: *mut *mut CDslxInterpValue,
1705    ) -> bool;
1706
1707    pub fn xls_dslx_type_get_total_bit_count(
1708        type_: *const CDslxType,
1709        error_out: *mut *mut std::os::raw::c_char,
1710        result_out: *mut i64,
1711    ) -> bool;
1712
1713    pub fn xls_dslx_type_is_signed_bits(
1714        type_: *const CDslxType,
1715        error_out: *mut *mut std::os::raw::c_char,
1716        result_out: *mut bool,
1717    ) -> bool;
1718
1719    pub fn xls_dslx_type_is_bits_like(
1720        type_: *const CDslxType,
1721        is_signed: *mut *mut CDslxTypeDim,
1722        size: *mut *mut CDslxTypeDim,
1723    ) -> bool;
1724
1725    pub fn xls_dslx_type_is_enum(type_: *const CDslxType) -> bool;
1726    pub fn xls_dslx_type_is_struct(type_: *const CDslxType) -> bool;
1727    pub fn xls_dslx_type_is_array(type_: *const CDslxType) -> bool;
1728
1729    pub fn xls_dslx_type_dim_is_parametric(dim: *const CDslxTypeDim) -> bool;
1730    pub fn xls_dslx_type_dim_get_as_bool(
1731        dim: *const CDslxTypeDim,
1732        error_out: *mut *mut std::os::raw::c_char,
1733        result_out: *mut bool,
1734    ) -> bool;
1735    pub fn xls_dslx_type_dim_get_as_int64(
1736        dim: *const CDslxTypeDim,
1737        error_out: *mut *mut std::os::raw::c_char,
1738        result_out: *mut i64,
1739    ) -> bool;
1740    pub fn xls_dslx_type_dim_free(dim: *mut CDslxTypeDim);
1741
1742    pub fn xls_dslx_type_get_enum_def(ty: *const CDslxType) -> *mut CDslxEnumDef;
1743
1744    pub fn xls_dslx_type_get_struct_def(ty: *const CDslxType) -> *mut CDslxStructDef;
1745
1746    pub fn xls_dslx_type_array_get_element_type(ty: *const CDslxType) -> *mut CDslxType;
1747    pub fn xls_dslx_type_array_get_size(ty: *const CDslxType) -> *mut CDslxTypeDim;
1748
1749    // -- IR builder APIs
1750
1751    pub fn xls_package_create(name: *const std::os::raw::c_char) -> *mut CIrPackage;
1752    pub fn xls_package_get_bits_type(package: *mut CIrPackage, bit_count: i64) -> *mut CIrType;
1753
1754    pub fn xls_package_get_tuple_type(
1755        package: *mut CIrPackage,
1756        members: *mut *mut CIrType,
1757        member_count: i64,
1758    ) -> *mut CIrType;
1759
1760    pub fn xls_package_get_array_type(
1761        package: *mut CIrPackage,
1762        element_type: *mut CIrType,
1763        size: i64,
1764    ) -> *mut CIrType;
1765
1766    pub fn xls_package_get_token_type(package: *mut CIrPackage) -> *mut CIrType;
1767
1768    pub fn xls_function_builder_create(
1769        name: *const std::os::raw::c_char,
1770        package: *mut CIrPackage,
1771        should_verify: bool,
1772    ) -> *mut CIrFunctionBuilder;
1773    pub fn xls_function_builder_as_builder_base(
1774        builder: *mut CIrFunctionBuilder,
1775    ) -> *mut CIrBuilderBase;
1776    pub fn xls_function_builder_free(builder: *mut CIrFunctionBuilder);
1777    pub fn xls_bvalue_free(bvalue: *mut CIrBValue);
1778    pub fn xls_function_builder_add_parameter(
1779        builder: *mut CIrFunctionBuilder,
1780        name: *const std::os::raw::c_char,
1781        type_: *mut CIrType,
1782    ) -> *mut CIrBValue;
1783    pub fn xls_function_builder_build(
1784        builder: *mut CIrFunctionBuilder,
1785        error_out: *mut *mut std::os::raw::c_char,
1786        function_out: *mut *mut CIrFunction,
1787    ) -> bool;
1788    pub fn xls_function_builder_build_with_return_value(
1789        builder: *mut CIrFunctionBuilder,
1790        return_value: *mut CIrBValue,
1791        error_out: *mut *mut std::os::raw::c_char,
1792        function_out: *mut *mut CIrFunction,
1793    ) -> bool;
1794    pub fn xls_builder_base_add_and(
1795        builder: *mut CIrBuilderBase,
1796        lhs: *mut CIrBValue,
1797        rhs: *mut CIrBValue,
1798        name: *const std::os::raw::c_char,
1799    ) -> *mut CIrBValue;
1800    pub fn xls_builder_base_add_nand(
1801        builder: *mut CIrBuilderBase,
1802        lhs: *mut CIrBValue,
1803        rhs: *mut CIrBValue,
1804        name: *const std::os::raw::c_char,
1805    ) -> *mut CIrBValue;
1806    pub fn xls_builder_base_add_or(
1807        builder: *mut CIrBuilderBase,
1808        lhs: *mut CIrBValue,
1809        rhs: *mut CIrBValue,
1810        name: *const std::os::raw::c_char,
1811    ) -> *mut CIrBValue;
1812    pub fn xls_builder_base_add_xor(
1813        builder: *mut CIrBuilderBase,
1814        lhs: *mut CIrBValue,
1815        rhs: *mut CIrBValue,
1816        name: *const std::os::raw::c_char,
1817    ) -> *mut CIrBValue;
1818    pub fn xls_builder_base_add_not(
1819        builder: *mut CIrBuilderBase,
1820        value: *mut CIrBValue,
1821        name: *const std::os::raw::c_char,
1822    ) -> *mut CIrBValue;
1823    pub fn xls_builder_base_add_negate(
1824        builder: *mut CIrBuilderBase,
1825        value: *mut CIrBValue,
1826        name: *const std::os::raw::c_char,
1827    ) -> *mut CIrBValue;
1828    pub fn xls_builder_base_add_reverse(
1829        builder: *mut CIrBuilderBase,
1830        value: *mut CIrBValue,
1831        name: *const std::os::raw::c_char,
1832    ) -> *mut CIrBValue;
1833    pub fn xls_builder_base_add_or_reduce(
1834        builder: *mut CIrBuilderBase,
1835        value: *mut CIrBValue,
1836        name: *const std::os::raw::c_char,
1837    ) -> *mut CIrBValue;
1838    pub fn xls_builder_base_add_and_reduce(
1839        builder: *mut CIrBuilderBase,
1840        value: *mut CIrBValue,
1841        name: *const std::os::raw::c_char,
1842    ) -> *mut CIrBValue;
1843    pub fn xls_builder_base_add_xor_reduce(
1844        builder: *mut CIrBuilderBase,
1845        value: *mut CIrBValue,
1846        name: *const std::os::raw::c_char,
1847    ) -> *mut CIrBValue;
1848    pub fn xls_builder_base_add_literal(
1849        builder: *mut CIrBuilderBase,
1850        value: *mut CIrValue,
1851        name: *const std::os::raw::c_char,
1852    ) -> *mut CIrBValue;
1853    pub fn xls_builder_base_add_tuple(
1854        builder: *mut CIrBuilderBase,
1855        operands: *mut *mut CIrBValue,
1856        operand_count: i64,
1857        name: *const std::os::raw::c_char,
1858    ) -> *mut CIrBValue;
1859    pub fn xls_builder_base_add_tuple_index(
1860        builder: *mut CIrBuilderBase,
1861        tuple: *mut CIrBValue,
1862        index: i64,
1863        name: *const std::os::raw::c_char,
1864    ) -> *mut CIrBValue;
1865    pub fn xls_builder_base_add_array(
1866        builder: *mut CIrBuilderBase,
1867        element_type: *mut CIrType,
1868        elements: *const *mut CIrBValue,
1869        element_count: i64,
1870        name: *const std::os::raw::c_char,
1871    ) -> *mut CIrBValue;
1872    pub fn xls_builder_base_add_array_index(
1873        builder: *mut CIrBuilderBase,
1874        array: *mut CIrBValue,
1875        indices: *const *mut CIrBValue,
1876        index_count: i64,
1877        assumed_in_bounds: bool,
1878        name: *const std::os::raw::c_char,
1879    ) -> *mut CIrBValue;
1880    pub fn xls_builder_base_add_dynamic_bit_slice(
1881        builder: *mut CIrBuilderBase,
1882        value: *mut CIrBValue,
1883        start: *mut CIrBValue,
1884        width: i64,
1885        name: *const std::os::raw::c_char,
1886    ) -> *mut CIrBValue;
1887    pub fn xls_builder_base_add_bit_slice(
1888        builder: *mut CIrBuilderBase,
1889        value: *mut CIrBValue,
1890        start: i64,
1891        width: i64,
1892        name: *const std::os::raw::c_char,
1893    ) -> *mut CIrBValue;
1894    pub fn xls_builder_base_add_bit_slice_update(
1895        builder: *mut CIrBuilderBase,
1896        value: *mut CIrBValue,
1897        start: *mut CIrBValue,
1898        update: *mut CIrBValue,
1899        name: *const std::os::raw::c_char,
1900    ) -> *mut CIrBValue;
1901    pub fn xls_builder_base_add_concat(
1902        builder: *mut CIrBuilderBase,
1903        values: *const *mut CIrBValue,
1904        value_count: i64,
1905        name: *const std::os::raw::c_char,
1906    ) -> *mut CIrBValue;
1907    pub fn xls_builder_base_add_after_all(
1908        builder: *mut CIrBuilderBase,
1909        dependencies: *mut *mut CIrBValue,
1910        dependency_count: i64,
1911        name: *const std::os::raw::c_char,
1912    ) -> *mut CIrBValue;
1913    pub fn xls_builder_base_add_add(
1914        builder: *mut CIrBuilderBase,
1915        lhs: *mut CIrBValue,
1916        rhs: *mut CIrBValue,
1917        name: *const std::os::raw::c_char,
1918    ) -> *mut CIrBValue;
1919    pub fn xls_builder_base_add_sub(
1920        builder: *mut CIrBuilderBase,
1921        lhs: *mut CIrBValue,
1922        rhs: *mut CIrBValue,
1923        name: *const std::os::raw::c_char,
1924    ) -> *mut CIrBValue;
1925    pub fn xls_builder_base_add_umul(
1926        builder: *mut CIrBuilderBase,
1927        lhs: *mut CIrBValue,
1928        rhs: *mut CIrBValue,
1929        name: *const std::os::raw::c_char,
1930    ) -> *mut CIrBValue;
1931    pub fn xls_builder_base_add_smul(
1932        builder: *mut CIrBuilderBase,
1933        lhs: *mut CIrBValue,
1934        rhs: *mut CIrBValue,
1935        name: *const std::os::raw::c_char,
1936    ) -> *mut CIrBValue;
1937    pub fn xls_builder_base_add_umulp(
1938        builder: *mut CIrBuilderBase,
1939        lhs: *mut CIrBValue,
1940        rhs: *mut CIrBValue,
1941        name: *const std::os::raw::c_char,
1942    ) -> *mut CIrBValue;
1943    pub fn xls_builder_base_add_smulp(
1944        builder: *mut CIrBuilderBase,
1945        lhs: *mut CIrBValue,
1946        rhs: *mut CIrBValue,
1947        name: *const std::os::raw::c_char,
1948    ) -> *mut CIrBValue;
1949    pub fn xls_builder_base_add_udiv(
1950        builder: *mut CIrBuilderBase,
1951        lhs: *mut CIrBValue,
1952        rhs: *mut CIrBValue,
1953        name: *const std::os::raw::c_char,
1954    ) -> *mut CIrBValue;
1955    pub fn xls_builder_base_add_sdiv(
1956        builder: *mut CIrBuilderBase,
1957        lhs: *mut CIrBValue,
1958        rhs: *mut CIrBValue,
1959        name: *const std::os::raw::c_char,
1960    ) -> *mut CIrBValue;
1961    pub fn xls_builder_base_add_umod(
1962        builder: *mut CIrBuilderBase,
1963        lhs: *mut CIrBValue,
1964        rhs: *mut CIrBValue,
1965        name: *const std::os::raw::c_char,
1966    ) -> *mut CIrBValue;
1967    pub fn xls_builder_base_add_smod(
1968        builder: *mut CIrBuilderBase,
1969        lhs: *mut CIrBValue,
1970        rhs: *mut CIrBValue,
1971        name: *const std::os::raw::c_char,
1972    ) -> *mut CIrBValue;
1973    pub fn xls_builder_base_add_eq(
1974        builder: *mut CIrBuilderBase,
1975        lhs: *mut CIrBValue,
1976        rhs: *mut CIrBValue,
1977        name: *const std::os::raw::c_char,
1978    ) -> *mut CIrBValue;
1979    pub fn xls_builder_base_add_ne(
1980        builder: *mut CIrBuilderBase,
1981        lhs: *mut CIrBValue,
1982        rhs: *mut CIrBValue,
1983        name: *const std::os::raw::c_char,
1984    ) -> *mut CIrBValue;
1985
1986    // -- comparisons
1987    pub fn xls_builder_base_add_ule(
1988        builder: *mut CIrBuilderBase,
1989        lhs: *mut CIrBValue,
1990        rhs: *mut CIrBValue,
1991        name: *const std::os::raw::c_char,
1992    ) -> *mut CIrBValue;
1993    pub fn xls_builder_base_add_ult(
1994        builder: *mut CIrBuilderBase,
1995        lhs: *mut CIrBValue,
1996        rhs: *mut CIrBValue,
1997        name: *const std::os::raw::c_char,
1998    ) -> *mut CIrBValue;
1999    pub fn xls_builder_base_add_uge(
2000        builder: *mut CIrBuilderBase,
2001        lhs: *mut CIrBValue,
2002        rhs: *mut CIrBValue,
2003        name: *const std::os::raw::c_char,
2004    ) -> *mut CIrBValue;
2005    pub fn xls_builder_base_add_ugt(
2006        builder: *mut CIrBuilderBase,
2007        lhs: *mut CIrBValue,
2008        rhs: *mut CIrBValue,
2009        name: *const std::os::raw::c_char,
2010    ) -> *mut CIrBValue;
2011    pub fn xls_builder_base_add_sle(
2012        builder: *mut CIrBuilderBase,
2013        lhs: *mut CIrBValue,
2014        rhs: *mut CIrBValue,
2015        name: *const std::os::raw::c_char,
2016    ) -> *mut CIrBValue;
2017    pub fn xls_builder_base_add_slt(
2018        builder: *mut CIrBuilderBase,
2019        lhs: *mut CIrBValue,
2020        rhs: *mut CIrBValue,
2021        name: *const std::os::raw::c_char,
2022    ) -> *mut CIrBValue;
2023    pub fn xls_builder_base_add_sgt(
2024        builder: *mut CIrBuilderBase,
2025        lhs: *mut CIrBValue,
2026        rhs: *mut CIrBValue,
2027        name: *const std::os::raw::c_char,
2028    ) -> *mut CIrBValue;
2029    pub fn xls_builder_base_add_sge(
2030        builder: *mut CIrBuilderBase,
2031        lhs: *mut CIrBValue,
2032        rhs: *mut CIrBValue,
2033        name: *const std::os::raw::c_char,
2034    ) -> *mut CIrBValue;
2035
2036    pub fn xls_builder_base_add_shra(
2037        builder: *mut CIrBuilderBase,
2038        a: *mut CIrBValue,
2039        b: *mut CIrBValue,
2040        name: *const std::os::raw::c_char,
2041    ) -> *mut CIrBValue;
2042    pub fn xls_builder_base_add_shrl(
2043        builder: *mut CIrBuilderBase,
2044        a: *mut CIrBValue,
2045        b: *mut CIrBValue,
2046        name: *const std::os::raw::c_char,
2047    ) -> *mut CIrBValue;
2048    pub fn xls_builder_base_add_shll(
2049        builder: *mut CIrBuilderBase,
2050        a: *mut CIrBValue,
2051        b: *mut CIrBValue,
2052        name: *const std::os::raw::c_char,
2053    ) -> *mut CIrBValue;
2054    pub fn xls_builder_base_add_nor(
2055        builder: *mut CIrBuilderBase,
2056        a: *mut CIrBValue,
2057        b: *mut CIrBValue,
2058        name: *const std::os::raw::c_char,
2059    ) -> *mut CIrBValue;
2060    pub fn xls_builder_base_add_clz(
2061        builder: *mut CIrBuilderBase,
2062        a: *mut CIrBValue,
2063        name: *const std::os::raw::c_char,
2064    ) -> *mut CIrBValue;
2065    pub fn xls_builder_base_add_ctz(
2066        builder: *mut CIrBuilderBase,
2067        a: *mut CIrBValue,
2068        name: *const std::os::raw::c_char,
2069    ) -> *mut CIrBValue;
2070    pub fn xls_builder_base_add_encode(
2071        builder: *mut CIrBuilderBase,
2072        a: *mut CIrBValue,
2073        name: *const std::os::raw::c_char,
2074    ) -> *mut CIrBValue;
2075
2076    pub fn xls_builder_base_add_decode(
2077        builder: *mut CIrBuilderBase,
2078        a: *mut CIrBValue,
2079        width: *mut i64,
2080        name: *const std::os::raw::c_char,
2081    ) -> *mut CIrBValue;
2082    pub fn xls_builder_base_add_select(
2083        builder: *mut CIrBuilderBase,
2084        selector: *mut CIrBValue,
2085        cases: *const *mut CIrBValue,
2086        case_count: i64,
2087        default_value: *mut CIrBValue,
2088        name: *const std::os::raw::c_char,
2089    ) -> *mut CIrBValue;
2090    pub fn xls_builder_base_add_array_concat(
2091        builder: *mut CIrBuilderBase,
2092        arrays: *const *mut CIrBValue,
2093        array_count: i64,
2094        name: *const std::os::raw::c_char,
2095    ) -> *mut CIrBValue;
2096    pub fn xls_builder_base_add_array_slice(
2097        builder: *mut CIrBuilderBase,
2098        array: *mut CIrBValue,
2099        start: *mut CIrBValue,
2100        width: i64,
2101        name: *const std::os::raw::c_char,
2102    ) -> *mut CIrBValue;
2103    pub fn xls_builder_base_add_array_update(
2104        builder: *mut CIrBuilderBase,
2105        array: *mut CIrBValue,
2106        update_value: *mut CIrBValue,
2107        indices: *const *mut CIrBValue,
2108        index_count: i64,
2109        assumed_in_bounds: bool,
2110        name: *const std::os::raw::c_char,
2111    ) -> *mut CIrBValue;
2112    pub fn xls_builder_base_add_identity(
2113        builder: *mut CIrBuilderBase,
2114        value: *mut CIrBValue,
2115        name: *const std::os::raw::c_char,
2116    ) -> *mut CIrBValue;
2117
2118    pub fn xls_builder_base_add_sign_extend(
2119        builder: *mut CIrBuilderBase,
2120        value: *mut CIrBValue,
2121        new_bit_count: i64,
2122        name: *const std::os::raw::c_char,
2123    ) -> *mut CIrBValue;
2124    pub fn xls_builder_base_add_zero_extend(
2125        builder: *mut CIrBuilderBase,
2126        value: *mut CIrBValue,
2127        new_bit_count: i64,
2128        name: *const std::os::raw::c_char,
2129    ) -> *mut CIrBValue;
2130
2131    pub fn xls_builder_base_add_one_hot(
2132        builder: *mut CIrBuilderBase,
2133        input: *mut CIrBValue,
2134        lsb_is_priority: bool,
2135        name: *const std::os::raw::c_char,
2136    ) -> *mut CIrBValue;
2137
2138    pub fn xls_builder_base_add_one_hot_select(
2139        builder: *mut CIrBuilderBase,
2140        selector: *mut CIrBValue,
2141        cases: *const *mut CIrBValue,
2142        case_count: i64,
2143        name: *const std::os::raw::c_char,
2144    ) -> *mut CIrBValue;
2145
2146    pub fn xls_builder_base_add_priority_select(
2147        builder: *mut CIrBuilderBase,
2148        selector: *mut CIrBValue,
2149        cases: *const *mut CIrBValue,
2150        case_count: i64,
2151        default_value: *mut CIrBValue,
2152        name: *const std::os::raw::c_char,
2153    ) -> *mut CIrBValue;
2154
2155    pub fn xls_builder_base_get_last_value(
2156        builder: *mut CIrBuilderBase,
2157        error_out: *mut *mut std::os::raw::c_char,
2158        value_out: *mut *mut CIrBValue,
2159    ) -> bool;
2160
2161    pub fn xls_builder_base_get_type(
2162        builder: *mut CIrBuilderBase,
2163        value: *mut CIrBValue,
2164    ) -> *mut CIrType;
2165
2166    // New functions for sequential logic
2167    pub fn xls_vast_verilog_module_add_always_ff(
2168        m: *mut CVastModule,
2169        sensitivity_list_elements: *mut *mut CVastExpression,
2170        sensitivity_list_count: usize,
2171        out_always_ff: *mut *mut CVastAlwaysBase,
2172        error_out: *mut *mut ::std::os::raw::c_char,
2173    ) -> bool;
2174    pub fn xls_vast_verilog_module_add_always_at(
2175        m: *mut CVastModule,
2176        sensitivity_list_elements: *mut *mut CVastExpression,
2177        sensitivity_list_count: usize,
2178        out_always_at: *mut *mut CVastAlwaysBase,
2179        error_out: *mut *mut ::std::os::raw::c_char,
2180    ) -> bool;
2181    pub fn xls_vast_verilog_module_add_always_comb(
2182        m: *mut CVastModule,
2183        out_always_comb: *mut *mut CVastAlwaysBase,
2184        error_out: *mut *mut ::std::os::raw::c_char,
2185    ) -> bool;
2186    pub fn xls_vast_verilog_module_add_reg(
2187        m: *mut CVastModule,
2188        name: *const ::std::os::raw::c_char,
2189        type_: *mut CVastDataType,
2190        out_reg_ref: *mut *mut CVastLogicRef,
2191        error_out: *mut *mut ::std::os::raw::c_char,
2192    ) -> bool;
2193    pub fn xls_vast_verilog_module_add_logic(
2194        m: *mut CVastModule,
2195        name: *const std::os::raw::c_char,
2196        type_: *mut CVastDataType,
2197        out_logic_ref: *mut *mut CVastLogicRef,
2198        error_out: *mut *mut std::os::raw::c_char,
2199    ) -> bool;
2200    pub fn xls_vast_verilog_file_make_pos_edge(
2201        f: *mut CVastFile,
2202        signal_expr: *mut CVastExpression,
2203    ) -> *mut CVastExpression;
2204    pub fn xls_vast_verilog_file_make_nonblocking_assignment(
2205        f: *mut CVastFile,
2206        lhs: *mut CVastExpression,
2207        rhs: *mut CVastExpression,
2208    ) -> *mut CVastStatement;
2209    pub fn xls_vast_verilog_file_make_blocking_assignment(
2210        f: *mut CVastFile,
2211        lhs: *mut CVastExpression,
2212        rhs: *mut CVastExpression,
2213    ) -> *mut CVastStatement;
2214
2215    pub fn xls_vast_always_base_get_statement_block(
2216        always_base: *mut CVastAlwaysBase,
2217    ) -> *mut CVastStatementBlock;
2218
2219    pub fn xls_vast_statement_block_add_nonblocking_assignment(
2220        block: *mut CVastStatementBlock,
2221        lhs: *mut CVastExpression,
2222        rhs: *mut CVastExpression,
2223    ) -> *mut CVastStatement;
2224    pub fn xls_vast_statement_block_add_blocking_assignment(
2225        block: *mut CVastStatementBlock,
2226        lhs: *mut CVastExpression,
2227        rhs: *mut CVastExpression,
2228    ) -> *mut CVastStatement;
2229    pub fn xls_vast_statement_block_add_continuous_assignment(
2230        block: *mut CVastStatementBlock,
2231        lhs: *mut CVastExpression,
2232        rhs: *mut CVastExpression,
2233    ) -> *mut CVastStatement;
2234
2235    pub fn xls_vast_statement_block_add_comment_text(
2236        block: *mut CVastStatementBlock,
2237        text: *const std::os::raw::c_char,
2238    ) -> *mut CVastStatement;
2239
2240    pub fn xls_vast_statement_block_add_blank_line(
2241        block: *mut CVastStatementBlock,
2242    ) -> *mut CVastStatement;
2243
2244    pub fn xls_vast_statement_block_add_inline_text(
2245        block: *mut CVastStatementBlock,
2246        text: *const std::os::raw::c_char,
2247    ) -> *mut CVastStatement;
2248
2249    // Conditional (if / else-if / else)
2250    pub fn xls_vast_statement_block_add_conditional(
2251        block: *mut CVastStatementBlock,
2252        cond: *mut CVastExpression,
2253    ) -> *mut CVastConditional;
2254    pub fn xls_vast_conditional_get_then_block(
2255        cond: *mut CVastConditional,
2256    ) -> *mut CVastStatementBlock;
2257    pub fn xls_vast_conditional_add_else_if(
2258        cond: *mut CVastConditional,
2259        expr_cond: *mut CVastExpression,
2260    ) -> *mut CVastStatementBlock;
2261    pub fn xls_vast_conditional_add_else(cond: *mut CVastConditional) -> *mut CVastStatementBlock;
2262
2263    // Case statement builders
2264    pub fn xls_vast_statement_block_add_case(
2265        block: *mut CVastStatementBlock,
2266        selector: *mut CVastExpression,
2267    ) -> *mut CVastCaseStatement;
2268    pub fn xls_vast_case_statement_add_item(
2269        case_stmt: *mut CVastCaseStatement,
2270        match_expr: *mut CVastExpression,
2271    ) -> *mut CVastStatementBlock;
2272    pub fn xls_vast_case_statement_add_default(
2273        case_stmt: *mut CVastCaseStatement,
2274    ) -> *mut CVastStatementBlock;
2275
2276    pub fn xls_vast_generate_loop_get_genvar(loop_: *mut CVastGenerateLoop) -> *mut CVastLogicRef;
2277    pub fn xls_vast_generate_loop_add_generate_loop(
2278        loop_: *mut CVastGenerateLoop,
2279        genvar_name: *const std::os::raw::c_char,
2280        init: *mut CVastExpression,
2281        limit: *mut CVastExpression,
2282        label: *const std::os::raw::c_char,
2283    ) -> *mut CVastGenerateLoop;
2284    pub fn xls_vast_generate_loop_add_always_comb(
2285        loop_: *mut CVastGenerateLoop,
2286        out_always_comb: *mut *mut CVastAlwaysBase,
2287        error_out: *mut *mut std::os::raw::c_char,
2288    ) -> bool;
2289    pub fn xls_vast_generate_loop_add_always_ff(
2290        loop_: *mut CVastGenerateLoop,
2291        sensitivity_list_elements: *mut *mut CVastExpression,
2292        sensitivity_list_count: usize,
2293        out_always_ff: *mut *mut CVastAlwaysBase,
2294        error_out: *mut *mut std::os::raw::c_char,
2295    ) -> bool;
2296    pub fn xls_vast_generate_loop_add_localparam(
2297        loop_: *mut CVastGenerateLoop,
2298        name: *const std::os::raw::c_char,
2299        rhs: *mut CVastExpression,
2300    ) -> *mut CVastLocalparamRef;
2301    pub fn xls_vast_generate_loop_add_localparam_with_def(
2302        loop_: *mut CVastGenerateLoop,
2303        def: *mut CVastDef,
2304        rhs: *mut CVastExpression,
2305    ) -> *mut CVastLocalparamRef;
2306    pub fn xls_vast_generate_loop_add_continuous_assignment(
2307        loop_: *mut CVastGenerateLoop,
2308        lhs: *mut CVastExpression,
2309        rhs: *mut CVastExpression,
2310    ) -> *mut CVastStatement;
2311    pub fn xls_vast_generate_loop_add_conditional(
2312        loop_: *mut CVastGenerateLoop,
2313        cond: *mut CVastExpression,
2314    ) -> *mut CVastConditional;
2315    pub fn xls_vast_generate_loop_add_blank_line(loop_: *mut CVastGenerateLoop);
2316    pub fn xls_vast_generate_loop_add_comment(
2317        loop_: *mut CVastGenerateLoop,
2318        comment: *mut CVastComment,
2319    );
2320    pub fn xls_vast_generate_loop_add_instantiation(
2321        loop_: *mut CVastGenerateLoop,
2322        instantiation: *mut CVastInstantiation,
2323    );
2324    pub fn xls_vast_generate_loop_add_inline_verilog_statement(
2325        loop_: *mut CVastGenerateLoop,
2326        stmt: *mut CVastInlineVerilogStatement,
2327    );
2328    pub fn xls_vast_generate_loop_add_macro_statement(
2329        loop_: *mut CVastGenerateLoop,
2330        macro_statement: *mut CVastMacroStatement,
2331    );
2332
2333    pub fn xls_function_type_get_param_count(fty: *mut CIrFunctionType) -> i64;
2334
2335    pub fn xls_function_type_get_param_type(
2336        fty: *mut CIrFunctionType,
2337        index: libc::size_t,
2338        error_out: *mut *mut std::os::raw::c_char,
2339        param_type_out: *mut *mut CIrType,
2340    ) -> bool;
2341
2342    pub fn xls_function_type_get_return_type(fty: *mut CIrFunctionType) -> *mut CIrType;
2343
2344    pub fn xls_function_get_param_name(
2345        function: *mut CIrFunction,
2346        index: libc::size_t,
2347        error_out: *mut *mut std::os::raw::c_char,
2348        name_out: *mut *mut std::os::raw::c_char,
2349    ) -> bool;
2350
2351    pub fn xls_dslx_function_is_parametric(function: *const CDslxFunction) -> bool;
2352    pub fn xls_dslx_function_is_public(function: *const CDslxFunction) -> bool;
2353    pub fn xls_dslx_function_get_identifier(
2354        function: *const CDslxFunction,
2355    ) -> *mut std::os::raw::c_char;
2356
2357    pub fn xls_dslx_function_get_param_count(function: *const CDslxFunction) -> i64;
2358    pub fn xls_dslx_function_get_parametric_binding_count(function: *const CDslxFunction) -> i64;
2359    pub fn xls_dslx_function_get_param(
2360        function: *const CDslxFunction,
2361        index: i64,
2362    ) -> *mut CDslxParam;
2363    pub fn xls_dslx_function_get_parametric_binding(
2364        function: *const CDslxFunction,
2365        index: i64,
2366    ) -> *mut CDslxParametricBinding;
2367    pub fn xls_dslx_function_get_body(function: *const CDslxFunction) -> *mut CDslxExpr;
2368    pub fn xls_dslx_function_get_return_type(
2369        function: *const CDslxFunction,
2370    ) -> *mut CDslxTypeAnnotation;
2371    pub fn xls_dslx_function_get_attribute_count(function: *const CDslxFunction) -> i64;
2372    pub fn xls_dslx_function_get_attribute(
2373        function: *const CDslxFunction,
2374        index: i64,
2375    ) -> *mut CDslxAttribute;
2376    pub fn xls_dslx_param_get_name(param: *const CDslxParam) -> *mut std::os::raw::c_char;
2377    pub fn xls_dslx_param_get_type_annotation(param: *const CDslxParam)
2378        -> *mut CDslxTypeAnnotation;
2379    pub fn xls_dslx_attribute_get_kind(attribute: *const CDslxAttribute) -> DslxAttributeKind;
2380    pub fn xls_dslx_attribute_get_argument_count(attribute: *const CDslxAttribute) -> i64;
2381    pub fn xls_dslx_attribute_get_argument_kind(
2382        attribute: *const CDslxAttribute,
2383        index: i64,
2384    ) -> DslxAttributeArgumentKind;
2385    pub fn xls_dslx_attribute_get_string_argument(
2386        attribute: *const CDslxAttribute,
2387        index: i64,
2388    ) -> *mut std::os::raw::c_char;
2389    pub fn xls_dslx_attribute_get_string_literal_argument(
2390        attribute: *const CDslxAttribute,
2391        index: i64,
2392    ) -> *mut std::os::raw::c_char;
2393    pub fn xls_dslx_attribute_get_key_value_argument_key(
2394        attribute: *const CDslxAttribute,
2395        index: i64,
2396    ) -> *mut std::os::raw::c_char;
2397    pub fn xls_dslx_attribute_get_key_value_string_argument_value(
2398        attribute: *const CDslxAttribute,
2399        index: i64,
2400    ) -> *mut std::os::raw::c_char;
2401    pub fn xls_dslx_attribute_get_key_value_int_argument_value(
2402        attribute: *const CDslxAttribute,
2403        index: i64,
2404    ) -> i64;
2405    pub fn xls_dslx_attribute_to_string(
2406        attribute: *const CDslxAttribute,
2407    ) -> *mut std::os::raw::c_char;
2408    pub fn xls_dslx_parametric_binding_get_identifier(
2409        binding: *const CDslxParametricBinding,
2410    ) -> *mut std::os::raw::c_char;
2411    pub fn xls_dslx_parametric_binding_get_type_annotation(
2412        binding: *const CDslxParametricBinding,
2413    ) -> *mut CDslxTypeAnnotation;
2414    pub fn xls_dslx_parametric_binding_get_expr(
2415        binding: *const CDslxParametricBinding,
2416    ) -> *mut CDslxExpr;
2417
2418    // -- "requires implicit token?" determination for a DSLX function
2419    pub fn xls_dslx_type_info_get_requires_implicit_token(
2420        type_info: *mut CDslxTypeInfo,
2421        function: *mut CDslxFunction,
2422        error_out: *mut *mut std::os::raw::c_char,
2423        result_out: *mut bool,
2424    ) -> bool;
2425
2426    // -- Quickcheck APIs
2427    pub fn xls_dslx_quickcheck_get_function(qc: *const CDslxQuickcheck) -> *mut CDslxFunction;
2428
2429    /// Returns true iff the Quickcheck has the `exhaustive` test-cases
2430    /// specifier.
2431    pub fn xls_dslx_quickcheck_is_exhaustive(qc: *const CDslxQuickcheck) -> bool;
2432
2433    /// Retrieves the test-case count for the Quickcheck. Returns true and sets
2434    /// `*result_out` when the Quickcheck has a counted test-case specifier;
2435    /// returns false when the Quickcheck is marked exhaustive (in which case
2436    /// `*result_out` is not modified).
2437    pub fn xls_dslx_quickcheck_get_count(qc: *const CDslxQuickcheck, result_out: *mut i64) -> bool;
2438}
2439
2440pub const DSLX_STDLIB_PATH: &str = env!("DSLX_STDLIB_PATH");
2441
2442/// Directory containing the libxls DSO.
2443///
2444/// *** DO NOT USE THIS VARIABLE FROM WITHIN YOUR build.rs ***
2445///
2446/// You might be tempted to write the following in your build.rs:
2447///
2448/// ```ignore
2449/// // DO NOT DO THIS IN YOUR build.rs!!
2450/// let dylib_dirpath = xlsynth_sys::XLS_DSO_PATH;
2451/// // set rpath to dylib_dirpath or something.
2452/// ```
2453///
2454/// The problem is that build.rs is compiled for host, whereas if you're setting
2455/// an rpath (or something similar) you want to get the path from compiling
2456/// xlsynth_sys for *target*.  In other words, the above will break
2457/// cross-compilation.
2458///
2459/// Instead, your build.rs should get the path from an envvar which:
2460///
2461/// ```ignore
2462/// // Do this from your build.rs instead.
2463/// let dylib_path = std::env::var("DEP_XLSYNTH_DSO_PATH").unwrap();
2464/// ```
2465///
2466/// More details are available at
2467/// <https://doc.rust-lang.org/cargo/reference/build-script-examples.html#using-another-sys-crate>.
2468///
2469/// (If you use this envvar from your crate proper -- i.e. not from build.rs --
2470/// then it's perfectly fine.)
2471pub const XLS_DSO_PATH: &str = env!("XLS_DSO_PATH");
2472
2473// Add opaque types for module port and def.
2474#[repr(C)]
2475pub struct CVastModulePort {
2476    _private: [u8; 0], // Ensures the struct cannot be instantiated
2477}
2478
2479#[repr(C)]
2480pub struct CVastDef {
2481    _private: [u8; 0], // Ensures the struct cannot be instantiated
2482}
2483
2484// Direction enum for module ports.
2485pub type VastModulePortDirection = i32;
2486
2487// Constants that match the C enum definitions.
2488pub const XLS_VAST_MODULE_PORT_DIRECTION_INPUT: VastModulePortDirection = 0;
2489pub const XLS_VAST_MODULE_PORT_DIRECTION_OUTPUT: VastModulePortDirection = 1;
2490
2491extern "C" {
2492    // -- Module port inspection APIs
2493    pub fn xls_vast_verilog_module_get_ports(
2494        m: *mut CVastModule,
2495        out_count: *mut libc::size_t,
2496    ) -> *mut *mut CVastModulePort;
2497
2498    pub fn xls_vast_verilog_module_free_ports(
2499        ports: *mut *mut CVastModulePort,
2500        count: libc::size_t,
2501    );
2502
2503    pub fn xls_vast_verilog_module_port_get_direction(
2504        port: *mut CVastModulePort,
2505    ) -> VastModulePortDirection;
2506
2507    pub fn xls_vast_verilog_module_port_get_def(port: *mut CVastModulePort) -> *mut CVastDef;
2508
2509    pub fn xls_vast_def_get_name(def: *mut CVastDef) -> *mut std::os::raw::c_char;
2510
2511    pub fn xls_vast_def_get_data_type(def: *mut CVastDef) -> *mut CVastDataType;
2512}