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
1131    pub fn xls_vast_verilog_module_add_parameter(
1132        m: *mut CVastModule,
1133        name: *const std::os::raw::c_char,
1134        rhs: *mut CVastExpression,
1135    ) -> *mut CVastParameterRef;
1136
1137    pub fn xls_vast_verilog_module_add_localparam(
1138        m: *mut CVastModule,
1139        name: *const std::os::raw::c_char,
1140        rhs: *mut CVastExpression,
1141    ) -> *mut CVastLocalparamRef;
1142
1143    pub fn xls_vast_verilog_file_make_def(
1144        f: *mut CVastFile,
1145        name: *const std::os::raw::c_char,
1146        kind: VastDataKind,
1147        type_: *mut CVastDataType,
1148    ) -> *mut CVastDef;
1149
1150    pub fn xls_vast_verilog_module_add_parameter_with_def(
1151        m: *mut CVastModule,
1152        def: *mut CVastDef,
1153        rhs: *mut CVastExpression,
1154    ) -> *mut CVastParameterRef;
1155
1156    pub fn xls_vast_verilog_module_add_localparam_with_def(
1157        m: *mut CVastModule,
1158        def: *mut CVastDef,
1159        rhs: *mut CVastExpression,
1160    ) -> *mut CVastLocalparamRef;
1161
1162    pub fn xls_vast_verilog_module_get_name(m: *mut CVastModule) -> *mut std::os::raw::c_char;
1163
1164    // - Expression conversions
1165    pub fn xls_vast_logic_ref_as_indexable_expression(
1166        v: *mut CVastLogicRef,
1167    ) -> *mut CVastIndexableExpression;
1168    pub fn xls_vast_index_as_indexable_expression(
1169        v: *mut CVastIndex,
1170    ) -> *mut CVastIndexableExpression;
1171    pub fn xls_vast_parameter_ref_as_indexable_expression(
1172        v: *mut CVastParameterRef,
1173    ) -> *mut CVastIndexableExpression;
1174
1175    pub fn xls_vast_literal_as_expression(v: *mut CVastLiteral) -> *mut CVastExpression;
1176    pub fn xls_vast_concat_as_expression(v: *mut CVastConcat) -> *mut CVastExpression;
1177    pub fn xls_vast_logic_ref_as_expression(v: *mut CVastLogicRef) -> *mut CVastExpression;
1178    pub fn xls_vast_slice_as_expression(v: *mut CVastSlice) -> *mut CVastExpression;
1179    pub fn xls_vast_index_as_expression(v: *mut CVastIndex) -> *mut CVastExpression;
1180    pub fn xls_vast_parameter_ref_as_expression(v: *mut CVastParameterRef) -> *mut CVastExpression;
1181    pub fn xls_vast_localparam_ref_as_expression(
1182        v: *mut CVastLocalparamRef,
1183    ) -> *mut CVastExpression;
1184    pub fn xls_vast_indexable_expression_as_expression(
1185        v: *mut CVastIndexableExpression,
1186    ) -> *mut CVastExpression;
1187    pub fn xls_vast_macro_ref_as_expression(v: *mut CVastMacroRef) -> *mut CVastExpression;
1188    pub fn xls_vast_verilog_file_make_unsized_one_literal(
1189        f: *mut CVastFile,
1190    ) -> *mut CVastExpression;
1191    pub fn xls_vast_verilog_file_make_unsized_zero_literal(
1192        f: *mut CVastFile,
1193    ) -> *mut CVastExpression;
1194    pub fn xls_vast_verilog_file_make_unsized_x_literal(f: *mut CVastFile) -> *mut CVastExpression;
1195    pub fn xls_vast_verilog_file_make_macro_ref(
1196        f: *mut CVastFile,
1197        name: *const std::os::raw::c_char,
1198    ) -> *mut CVastMacroRef;
1199    pub fn xls_vast_verilog_file_make_macro_ref_with_args(
1200        f: *mut CVastFile,
1201        name: *const std::os::raw::c_char,
1202        args: *mut *mut CVastExpression,
1203        arg_count: libc::size_t,
1204    ) -> *mut CVastMacroRef;
1205    pub fn xls_vast_verilog_file_make_macro_statement(
1206        f: *mut CVastFile,
1207        r#ref: *mut CVastMacroRef,
1208        emit_semicolon: bool,
1209    ) -> *mut CVastMacroStatement;
1210
1211    pub fn xls_vast_logic_ref_get_name(v: *mut CVastLogicRef) -> *mut std::os::raw::c_char;
1212
1213    pub fn xls_vast_verilog_file_add_include(f: *mut CVastFile, path: *const std::os::raw::c_char);
1214    pub fn xls_vast_verilog_file_add_blank_line(f: *mut CVastFile, blank_line: *mut CVastBlankLine);
1215    pub fn xls_vast_verilog_file_add_comment(
1216        f: *mut CVastFile,
1217        comment: *const std::os::raw::c_char,
1218    );
1219    pub fn xls_vast_verilog_file_emit(f: *const CVastFile) -> *mut std::os::raw::c_char;
1220    pub fn xls_vast_expression_emit(expr: *mut CVastExpression) -> *mut std::os::raw::c_char;
1221
1222    // -- DSLX
1223
1224    pub fn xls_dslx_import_data_create(
1225        dslx_stdlib_path: *const std::os::raw::c_char,
1226        additional_search_paths: *const *const std::os::raw::c_char,
1227        additional_search_paths_count: libc::size_t,
1228    ) -> *mut CDslxImportData;
1229    pub fn xls_dslx_import_data_free(data: *mut CDslxImportData);
1230
1231    pub fn xls_dslx_parse_and_typecheck(
1232        text: *const std::os::raw::c_char,
1233        path: *const std::os::raw::c_char,
1234        module_name: *const std::os::raw::c_char,
1235        import_data: *const CDslxImportData,
1236        error_out: *mut *mut std::os::raw::c_char,
1237        typechecked_module_out: *mut *mut CDslxTypecheckedModule,
1238    ) -> bool;
1239
1240    pub fn xls_dslx_typechecked_module_clone_removing_functions(
1241        tm: *mut CDslxTypecheckedModule,
1242        functions: *mut *mut CDslxFunction,
1243        function_count: libc::size_t,
1244        install_subject: *const std::os::raw::c_char,
1245        import_data: *mut CDslxImportData,
1246        error_out: *mut *mut std::os::raw::c_char,
1247        result_out: *mut *mut CDslxTypecheckedModule,
1248    ) -> bool;
1249
1250    pub fn xls_dslx_typechecked_module_clone_removing_members(
1251        tm: *mut CDslxTypecheckedModule,
1252        members: *mut *mut CDslxModuleMember,
1253        member_count: libc::size_t,
1254        install_subject: *const std::os::raw::c_char,
1255        import_data: *mut CDslxImportData,
1256        error_out: *mut *mut std::os::raw::c_char,
1257        result_out: *mut *mut CDslxTypecheckedModule,
1258    ) -> bool;
1259
1260    pub fn xls_dslx_replace_invocations_in_module(
1261        tm: *mut CDslxTypecheckedModule,
1262        callers: *const *mut CDslxFunction,
1263        callers_count: libc::size_t,
1264        rules: *const CDslxInvocationRewriteRule,
1265        rules_count: libc::size_t,
1266        import_data: *mut CDslxImportData,
1267        install_subject: *const std::os::raw::c_char,
1268        error_out: *mut *mut std::os::raw::c_char,
1269        result_out: *mut *mut CDslxTypecheckedModule,
1270    ) -> bool;
1271
1272    pub fn xls_dslx_typechecked_module_insert_function_specializations(
1273        typechecked_module: *mut CDslxTypecheckedModule,
1274        requests: *const XlsDslxFunctionSpecializationRequest,
1275        request_count: libc::size_t,
1276        import_data: *mut CDslxImportData,
1277        install_subject: *const std::os::raw::c_char,
1278        error_out: *mut *mut std::os::raw::c_char,
1279        result_out: *mut *mut CDslxTypecheckedModule,
1280    ) -> bool;
1281
1282    // bool xls_schedule_and_codegen_package(
1283    // struct xls_package* p, const char* scheduling_options_flags_proto,
1284    // const char* codegen_flags_proto, bool with_delay_model, char** error_out,
1285    // struct xls_schedule_and_codegen_result** result_out);
1286    pub fn xls_schedule_and_codegen_package(
1287        p: *mut CIrPackage,
1288        scheduling_options_flags_proto: *const std::os::raw::c_char,
1289        codegen_flags_proto: *const std::os::raw::c_char,
1290        with_delay_model: bool,
1291        error_out: *mut *mut std::os::raw::c_char,
1292        result_out: *mut *mut CScheduleAndCodegenResult,
1293    ) -> bool;
1294
1295    pub fn xls_schedule_and_codegen_result_get_verilog_text(
1296        result: *mut CScheduleAndCodegenResult,
1297    ) -> *mut std::os::raw::c_char;
1298
1299    pub fn xls_schedule_and_codegen_result_free(result: *mut CScheduleAndCodegenResult);
1300
1301    pub fn xls_dslx_typechecked_module_free(module: *mut CDslxTypecheckedModule);
1302
1303    pub fn xls_dslx_typechecked_module_get_module(
1304        module: *mut CDslxTypecheckedModule,
1305    ) -> *mut CDslxModule;
1306
1307    pub fn xls_dslx_typechecked_module_get_type_info(
1308        module: *mut CDslxTypecheckedModule,
1309    ) -> *mut CDslxTypeInfo;
1310
1311    pub fn xls_dslx_module_to_string(module: *mut CDslxModule) -> *mut std::os::raw::c_char;
1312
1313    pub fn xls_dslx_module_get_name(module: *const CDslxModule) -> *mut std::os::raw::c_char;
1314
1315    pub fn xls_dslx_module_get_type_definition_count(module: *const CDslxModule) -> i64;
1316
1317    pub fn xls_dslx_module_get_member_count(module: *const CDslxModule) -> i64;
1318
1319    pub fn xls_dslx_module_get_member(module: *const CDslxModule, i: i64)
1320        -> *mut CDslxModuleMember;
1321
1322    pub fn xls_dslx_module_get_type_definition_kind(
1323        module: *const CDslxModule,
1324        i: i64,
1325    ) -> DslxTypeDefinitionKind;
1326
1327    pub fn xls_dslx_module_get_type_definition_as_struct_def(
1328        module: *const CDslxModule,
1329        i: i64,
1330    ) -> *mut CDslxStructDef;
1331    pub fn xls_dslx_module_get_type_definition_as_enum_def(
1332        module: *const CDslxModule,
1333        i: i64,
1334    ) -> *mut CDslxEnumDef;
1335    pub fn xls_dslx_module_get_type_definition_as_type_alias(
1336        module: *const CDslxModule,
1337        i: i64,
1338    ) -> *mut CDslxTypeAlias;
1339
1340    // -- xls_dslx_module_member
1341    pub fn xls_dslx_module_member_get_kind(
1342        member: *const CDslxModuleMember,
1343    ) -> DslxModuleMemberKind;
1344    pub fn xls_dslx_module_member_get_constant_def(
1345        member: *const CDslxModuleMember,
1346    ) -> *mut CDslxConstantDef;
1347    pub fn xls_dslx_module_member_get_type_alias(
1348        member: *const CDslxModuleMember,
1349    ) -> *mut CDslxTypeAlias;
1350    pub fn xls_dslx_module_member_get_struct_def(
1351        member: *const CDslxModuleMember,
1352    ) -> *mut CDslxStructDef;
1353    pub fn xls_dslx_module_member_get_enum_def(
1354        member: *const CDslxModuleMember,
1355    ) -> *mut CDslxEnumDef;
1356    pub fn xls_dslx_module_member_get_function(
1357        member: *const CDslxModuleMember,
1358    ) -> *mut CDslxFunction;
1359    pub fn xls_dslx_module_member_get_quickcheck(
1360        member: *const CDslxModuleMember,
1361    ) -> *mut CDslxQuickcheck;
1362    pub fn xls_dslx_module_member_from_constant_def(
1363        constant_def: *mut CDslxConstantDef,
1364    ) -> *mut CDslxModuleMember;
1365    pub fn xls_dslx_module_member_from_struct_def(
1366        struct_def: *mut CDslxStructDef,
1367    ) -> *mut CDslxModuleMember;
1368    pub fn xls_dslx_module_member_from_enum_def(
1369        enum_def: *mut CDslxEnumDef,
1370    ) -> *mut CDslxModuleMember;
1371    pub fn xls_dslx_module_member_from_type_alias(
1372        type_alias: *mut CDslxTypeAlias,
1373    ) -> *mut CDslxModuleMember;
1374    pub fn xls_dslx_module_member_from_function(
1375        function: *mut CDslxFunction,
1376    ) -> *mut CDslxModuleMember;
1377    pub fn xls_dslx_module_member_from_quickcheck(
1378        quickcheck: *mut CDslxQuickcheck,
1379    ) -> *mut CDslxModuleMember;
1380
1381    pub fn xls_dslx_colon_ref_get_attr(
1382        colon_ref: *const CDslxColonRef,
1383    ) -> *mut std::os::raw::c_char;
1384
1385    pub fn xls_dslx_type_info_get_type_struct_def(
1386        type_info: *mut CDslxTypeInfo,
1387        node: *mut CDslxStructDef,
1388    ) -> *mut CDslxType;
1389    pub fn xls_dslx_type_info_get_type_enum_def(
1390        type_info: *mut CDslxTypeInfo,
1391        node: *mut CDslxEnumDef,
1392    ) -> *mut CDslxType;
1393    pub fn xls_dslx_type_info_get_type_struct_member(
1394        type_info: *mut CDslxTypeInfo,
1395        member: *mut CDslxStructMember,
1396    ) -> *mut CDslxType;
1397    pub fn xls_dslx_type_info_get_type_constant_def(
1398        type_info: *mut CDslxTypeInfo,
1399        node: *mut CDslxConstantDef,
1400    ) -> *mut CDslxType;
1401
1402    /// Gets the concrete type for a TypeAnnotation AST node.
1403    pub fn xls_dslx_type_info_get_type_type_annotation(
1404        type_info: *mut CDslxTypeInfo,
1405        type_annotation: *mut CDslxTypeAnnotation,
1406    ) -> *mut CDslxType;
1407
1408    pub fn xls_dslx_type_info_get_imported_type_info(
1409        type_info: *mut CDslxTypeInfo,
1410        module: *mut CDslxModule,
1411    ) -> *mut CDslxTypeInfo;
1412
1413    pub fn xls_dslx_type_info_get_unique_invocation_callee_data(
1414        type_info: *mut CDslxTypeInfo,
1415        function: *mut CDslxFunction,
1416    ) -> *mut CDslxInvocationCalleeDataArray;
1417    pub fn xls_dslx_type_info_get_all_invocation_callee_data(
1418        type_info: *mut CDslxTypeInfo,
1419        function: *mut CDslxFunction,
1420    ) -> *mut CDslxInvocationCalleeDataArray;
1421    pub fn xls_dslx_type_info_get_root_invocation_data(
1422        type_info: *mut CDslxTypeInfo,
1423        invocation: *mut CDslxInvocation,
1424    ) -> *mut CDslxInvocationData;
1425
1426    // -- call_graph
1427    pub fn xls_dslx_type_info_build_function_call_graph(
1428        type_info: *mut CDslxTypeInfo,
1429        error_out: *mut *mut std::os::raw::c_char,
1430        result_out: *mut *mut CDslxCallGraph,
1431    ) -> bool;
1432
1433    pub fn xls_dslx_call_graph_free(call_graph: *mut CDslxCallGraph);
1434
1435    pub fn xls_dslx_call_graph_get_function_count(call_graph: *mut CDslxCallGraph) -> i64;
1436
1437    pub fn xls_dslx_call_graph_get_function(
1438        call_graph: *mut CDslxCallGraph,
1439        index: i64,
1440    ) -> *mut CDslxFunction;
1441
1442    pub fn xls_dslx_call_graph_get_callee_count(
1443        call_graph: *mut CDslxCallGraph,
1444        caller: *mut CDslxFunction,
1445    ) -> i64;
1446
1447    pub fn xls_dslx_call_graph_get_callee_function(
1448        call_graph: *mut CDslxCallGraph,
1449        caller: *mut CDslxFunction,
1450        callee_index: i64,
1451    ) -> *mut CDslxFunction;
1452
1453    pub fn xls_dslx_invocation_callee_data_array_free(array: *mut CDslxInvocationCalleeDataArray);
1454    pub fn xls_dslx_invocation_callee_data_array_get_count(
1455        array: *mut CDslxInvocationCalleeDataArray,
1456    ) -> i64;
1457    pub fn xls_dslx_invocation_callee_data_array_get(
1458        array: *mut CDslxInvocationCalleeDataArray,
1459        index: i64,
1460    ) -> *mut CDslxInvocationCalleeData;
1461
1462    pub fn xls_dslx_invocation_callee_data_clone(
1463        data: *mut CDslxInvocationCalleeData,
1464    ) -> *mut CDslxInvocationCalleeData;
1465    pub fn xls_dslx_invocation_callee_data_free(data: *mut CDslxInvocationCalleeData);
1466    pub fn xls_dslx_invocation_callee_data_get_callee_bindings(
1467        data: *mut CDslxInvocationCalleeData,
1468    ) -> *const CDslxParametricEnv;
1469    pub fn xls_dslx_invocation_callee_data_get_caller_bindings(
1470        data: *mut CDslxInvocationCalleeData,
1471    ) -> *const CDslxParametricEnv;
1472    pub fn xls_dslx_invocation_callee_data_get_derived_type_info(
1473        data: *mut CDslxInvocationCalleeData,
1474    ) -> *mut CDslxTypeInfo;
1475    pub fn xls_dslx_invocation_callee_data_get_invocation(
1476        data: *mut CDslxInvocationCalleeData,
1477    ) -> *mut CDslxInvocation;
1478
1479    pub fn xls_dslx_invocation_data_get_invocation(
1480        data: *mut CDslxInvocationData,
1481    ) -> *mut CDslxInvocation;
1482    pub fn xls_dslx_invocation_data_get_callee(
1483        data: *mut CDslxInvocationData,
1484    ) -> *mut CDslxFunction;
1485    pub fn xls_dslx_invocation_data_get_caller(
1486        data: *mut CDslxInvocationData,
1487    ) -> *mut CDslxFunction;
1488
1489    // -- ConstantDef
1490
1491    pub fn xls_dslx_constant_def_get_name(
1492        constant_def: *const CDslxConstantDef,
1493    ) -> *mut std::os::raw::c_char;
1494
1495    pub fn xls_dslx_constant_def_get_value(constant_def: *const CDslxConstantDef)
1496        -> *mut CDslxExpr;
1497
1498    // -- TypeAlias
1499
1500    pub fn xls_dslx_type_alias_get_identifier(
1501        type_alias: *const CDslxTypeAlias,
1502    ) -> *mut std::os::raw::c_char;
1503
1504    pub fn xls_dslx_type_alias_get_type_annotation(
1505        type_alias: *const CDslxTypeAlias,
1506    ) -> *mut CDslxTypeAnnotation;
1507
1508    // -- TypeAnnotation
1509
1510    pub fn xls_dslx_type_annotation_get_type_ref_type_annotation(
1511        type_annotation: *const CDslxTypeAnnotation,
1512    ) -> *mut CDslxTypeRefTypeAnnotation;
1513
1514    // -- TypeRef
1515
1516    pub fn xls_dslx_type_ref_get_type_definition(
1517        type_ref: *const CDslxTypeRef,
1518    ) -> *mut CDslxTypeDefinition;
1519
1520    // -- Import
1521
1522    pub fn xls_dslx_import_get_subject_count(import: *const CDslxImport) -> i64;
1523    pub fn xls_dslx_import_get_subject(
1524        import: *const CDslxImport,
1525        i: i64,
1526    ) -> *mut std::os::raw::c_char;
1527
1528    // -- ColonRef
1529
1530    pub fn xls_dslx_colon_ref_resolve_import_subject(
1531        colon_ref: *const CDslxColonRef,
1532    ) -> *mut CDslxImport;
1533
1534    // -- TypeDefinition
1535
1536    pub fn xls_dslx_type_definition_get_colon_ref(
1537        type_definition: *const CDslxTypeDefinition,
1538    ) -> *mut CDslxColonRef;
1539    pub fn xls_dslx_type_definition_get_type_alias(
1540        type_definition: *const CDslxTypeDefinition,
1541    ) -> *mut CDslxTypeAlias;
1542
1543    // -- TypeRefTypeAnnotation
1544
1545    pub fn xls_dslx_type_ref_type_annotation_get_type_ref(
1546        type_ref_type_annotation: *const CDslxTypeRefTypeAnnotation,
1547    ) -> *mut CDslxTypeRef;
1548
1549    // -- StructDef
1550
1551    pub fn xls_dslx_struct_def_get_identifier(
1552        struct_def: *const CDslxStructDef,
1553    ) -> *mut std::os::raw::c_char;
1554
1555    pub fn xls_dslx_struct_def_is_parametric(struct_def: *const CDslxStructDef) -> bool;
1556
1557    pub fn xls_dslx_struct_def_get_member_count(struct_def: *const CDslxStructDef) -> i64;
1558
1559    pub fn xls_dslx_struct_def_get_member(
1560        struct_def: *const CDslxStructDef,
1561        i: i64,
1562    ) -> *mut CDslxStructMember;
1563
1564    pub fn xls_dslx_struct_member_get_name(
1565        member: *const CDslxStructMember,
1566    ) -> *mut std::os::raw::c_char;
1567
1568    pub fn xls_dslx_struct_member_get_type(
1569        member: *const CDslxStructMember,
1570    ) -> *mut CDslxTypeAnnotation;
1571
1572    // -- EnumDef
1573
1574    pub fn xls_dslx_enum_def_get_identifier(
1575        enum_def: *const CDslxEnumDef,
1576    ) -> *mut std::os::raw::c_char;
1577
1578    pub fn xls_dslx_enum_def_get_member_count(enum_def: *const CDslxEnumDef) -> i64;
1579
1580    pub fn xls_dslx_enum_def_get_member(
1581        enum_def: *const CDslxEnumDef,
1582        i: i64,
1583    ) -> *mut CDslxEnumMember;
1584
1585    pub fn xls_dslx_enum_def_get_underlying(
1586        enum_def: *const CDslxEnumDef,
1587    ) -> *mut CDslxTypeAnnotation;
1588
1589    pub fn xls_dslx_enum_member_get_name(
1590        member: *const CDslxEnumMember,
1591    ) -> *mut std::os::raw::c_char;
1592
1593    pub fn xls_dslx_enum_member_get_value(member: *const CDslxEnumMember) -> *mut CDslxExpr;
1594
1595    pub fn xls_dslx_expr_get_owner_module(expr: *mut CDslxExpr) -> *mut CDslxModule;
1596
1597    // --
1598
1599    pub fn xls_dslx_interp_value_free(value: *mut CDslxInterpValue);
1600
1601    pub fn xls_dslx_interp_value_to_string(
1602        value: *mut CDslxInterpValue,
1603    ) -> *mut std::os::raw::c_char;
1604
1605    pub fn xls_dslx_interp_value_clone(value: *const CDslxInterpValue) -> *mut CDslxInterpValue;
1606
1607    // Parametric env construction and InterpValue helpers
1608    pub fn xls_dslx_parametric_env_create(
1609        items: *const XlsDslxParametricEnvItem,
1610        items_count: libc::size_t,
1611        error_out: *mut *mut std::os::raw::c_char,
1612        env_out: *mut *mut CDslxParametricEnv,
1613    ) -> bool;
1614    pub fn xls_dslx_parametric_env_free(env: *mut CDslxParametricEnv);
1615    pub fn xls_dslx_parametric_env_clone(env: *const CDslxParametricEnv)
1616        -> *mut CDslxParametricEnv;
1617    pub fn xls_dslx_parametric_env_equals(
1618        lhs: *const CDslxParametricEnv,
1619        rhs: *const CDslxParametricEnv,
1620    ) -> bool;
1621    pub fn xls_dslx_parametric_env_less_than(
1622        lhs: *const CDslxParametricEnv,
1623        rhs: *const CDslxParametricEnv,
1624    ) -> bool;
1625    pub fn xls_dslx_parametric_env_hash(env: *const CDslxParametricEnv) -> u64;
1626    pub fn xls_dslx_parametric_env_to_string(
1627        env: *const CDslxParametricEnv,
1628    ) -> *mut std::os::raw::c_char;
1629    pub fn xls_dslx_parametric_env_get_binding_count(env: *const CDslxParametricEnv) -> i64;
1630    pub fn xls_dslx_parametric_env_get_binding_identifier(
1631        env: *const CDslxParametricEnv,
1632        index: i64,
1633    ) -> *const std::os::raw::c_char;
1634    pub fn xls_dslx_parametric_env_get_binding_value(
1635        env: *const CDslxParametricEnv,
1636        index: i64,
1637    ) -> *mut CDslxInterpValue;
1638
1639    pub fn xls_dslx_interp_value_make_ubits(bit_count: i64, value: u64) -> *mut CDslxInterpValue;
1640    pub fn xls_dslx_interp_value_make_sbits(bit_count: i64, value: i64) -> *mut CDslxInterpValue;
1641    pub fn xls_dslx_interp_value_make_enum(
1642        def: *mut CDslxEnumDef,
1643        is_signed: bool,
1644        bits: *const CIrBits,
1645        error_out: *mut *mut std::os::raw::c_char,
1646        result_out: *mut *mut CDslxInterpValue,
1647    ) -> bool;
1648    pub fn xls_dslx_interp_value_make_tuple(
1649        element_count: libc::size_t,
1650        elements: *mut *mut CDslxInterpValue,
1651        error_out: *mut *mut std::os::raw::c_char,
1652        result_out: *mut *mut CDslxInterpValue,
1653    ) -> bool;
1654    pub fn xls_dslx_interp_value_make_array(
1655        element_count: libc::size_t,
1656        elements: *mut *mut CDslxInterpValue,
1657        error_out: *mut *mut std::os::raw::c_char,
1658        result_out: *mut *mut CDslxInterpValue,
1659    ) -> bool;
1660
1661    pub fn xls_dslx_interp_value_from_string(
1662        text: *const std::os::raw::c_char,
1663        dslx_stdlib_path: *const std::os::raw::c_char,
1664        error_out: *mut *mut std::os::raw::c_char,
1665        result_out: *mut *mut CDslxInterpValue,
1666    ) -> bool;
1667
1668    pub fn xls_dslx_interp_value_convert_to_ir(
1669        value: *const CDslxInterpValue,
1670        error_out: *mut *mut std::os::raw::c_char,
1671        result_out: *mut *mut CIrValue,
1672    ) -> bool;
1673
1674    pub fn xls_dslx_type_to_string(
1675        type_: *const CDslxType,
1676        error_out: *mut *mut std::os::raw::c_char,
1677        result_out: *mut *mut std::os::raw::c_char,
1678    ) -> bool;
1679
1680    // Stringification for DSLX AST nodes
1681    pub fn xls_dslx_function_to_string(function: *const CDslxFunction)
1682        -> *mut std::os::raw::c_char;
1683    pub fn xls_dslx_struct_def_to_string(
1684        struct_def: *const CDslxStructDef,
1685    ) -> *mut std::os::raw::c_char;
1686    pub fn xls_dslx_enum_def_to_string(enum_def: *const CDslxEnumDef) -> *mut std::os::raw::c_char;
1687    pub fn xls_dslx_type_alias_to_string(
1688        type_alias: *const CDslxTypeAlias,
1689    ) -> *mut std::os::raw::c_char;
1690    pub fn xls_dslx_constant_def_to_string(
1691        constant_def: *const CDslxConstantDef,
1692    ) -> *mut std::os::raw::c_char;
1693    pub fn xls_dslx_quickcheck_to_string(qc: *const CDslxQuickcheck) -> *mut std::os::raw::c_char;
1694    pub fn xls_dslx_expr_to_string(expr: *const CDslxExpr) -> *mut std::os::raw::c_char;
1695
1696    pub fn xls_dslx_type_info_get_const_expr(
1697        type_info: *mut CDslxTypeInfo,
1698        expr: *mut CDslxExpr,
1699        error_out: *mut *mut std::os::raw::c_char,
1700        result_out: *mut *mut CDslxInterpValue,
1701    ) -> bool;
1702
1703    pub fn xls_dslx_type_get_total_bit_count(
1704        type_: *const CDslxType,
1705        error_out: *mut *mut std::os::raw::c_char,
1706        result_out: *mut i64,
1707    ) -> bool;
1708
1709    pub fn xls_dslx_type_is_signed_bits(
1710        type_: *const CDslxType,
1711        error_out: *mut *mut std::os::raw::c_char,
1712        result_out: *mut bool,
1713    ) -> bool;
1714
1715    pub fn xls_dslx_type_is_bits_like(
1716        type_: *const CDslxType,
1717        is_signed: *mut *mut CDslxTypeDim,
1718        size: *mut *mut CDslxTypeDim,
1719    ) -> bool;
1720
1721    pub fn xls_dslx_type_is_enum(type_: *const CDslxType) -> bool;
1722    pub fn xls_dslx_type_is_struct(type_: *const CDslxType) -> bool;
1723    pub fn xls_dslx_type_is_array(type_: *const CDslxType) -> bool;
1724
1725    pub fn xls_dslx_type_dim_is_parametric(dim: *const CDslxTypeDim) -> bool;
1726    pub fn xls_dslx_type_dim_get_as_bool(
1727        dim: *const CDslxTypeDim,
1728        error_out: *mut *mut std::os::raw::c_char,
1729        result_out: *mut bool,
1730    ) -> bool;
1731    pub fn xls_dslx_type_dim_get_as_int64(
1732        dim: *const CDslxTypeDim,
1733        error_out: *mut *mut std::os::raw::c_char,
1734        result_out: *mut i64,
1735    ) -> bool;
1736    pub fn xls_dslx_type_dim_free(dim: *mut CDslxTypeDim);
1737
1738    pub fn xls_dslx_type_get_enum_def(ty: *const CDslxType) -> *mut CDslxEnumDef;
1739
1740    pub fn xls_dslx_type_get_struct_def(ty: *const CDslxType) -> *mut CDslxStructDef;
1741
1742    pub fn xls_dslx_type_array_get_element_type(ty: *const CDslxType) -> *mut CDslxType;
1743    pub fn xls_dslx_type_array_get_size(ty: *const CDslxType) -> *mut CDslxTypeDim;
1744
1745    // -- IR builder APIs
1746
1747    pub fn xls_package_create(name: *const std::os::raw::c_char) -> *mut CIrPackage;
1748    pub fn xls_package_get_bits_type(package: *mut CIrPackage, bit_count: i64) -> *mut CIrType;
1749
1750    pub fn xls_package_get_tuple_type(
1751        package: *mut CIrPackage,
1752        members: *mut *mut CIrType,
1753        member_count: i64,
1754    ) -> *mut CIrType;
1755
1756    pub fn xls_package_get_array_type(
1757        package: *mut CIrPackage,
1758        element_type: *mut CIrType,
1759        size: i64,
1760    ) -> *mut CIrType;
1761
1762    pub fn xls_package_get_token_type(package: *mut CIrPackage) -> *mut CIrType;
1763
1764    pub fn xls_function_builder_create(
1765        name: *const std::os::raw::c_char,
1766        package: *mut CIrPackage,
1767        should_verify: bool,
1768    ) -> *mut CIrFunctionBuilder;
1769    pub fn xls_function_builder_as_builder_base(
1770        builder: *mut CIrFunctionBuilder,
1771    ) -> *mut CIrBuilderBase;
1772    pub fn xls_function_builder_free(builder: *mut CIrFunctionBuilder);
1773    pub fn xls_bvalue_free(bvalue: *mut CIrBValue);
1774    pub fn xls_function_builder_add_parameter(
1775        builder: *mut CIrFunctionBuilder,
1776        name: *const std::os::raw::c_char,
1777        type_: *mut CIrType,
1778    ) -> *mut CIrBValue;
1779    pub fn xls_function_builder_build(
1780        builder: *mut CIrFunctionBuilder,
1781        error_out: *mut *mut std::os::raw::c_char,
1782        function_out: *mut *mut CIrFunction,
1783    ) -> bool;
1784    pub fn xls_function_builder_build_with_return_value(
1785        builder: *mut CIrFunctionBuilder,
1786        return_value: *mut CIrBValue,
1787        error_out: *mut *mut std::os::raw::c_char,
1788        function_out: *mut *mut CIrFunction,
1789    ) -> bool;
1790    pub fn xls_builder_base_add_and(
1791        builder: *mut CIrBuilderBase,
1792        lhs: *mut CIrBValue,
1793        rhs: *mut CIrBValue,
1794        name: *const std::os::raw::c_char,
1795    ) -> *mut CIrBValue;
1796    pub fn xls_builder_base_add_nand(
1797        builder: *mut CIrBuilderBase,
1798        lhs: *mut CIrBValue,
1799        rhs: *mut CIrBValue,
1800        name: *const std::os::raw::c_char,
1801    ) -> *mut CIrBValue;
1802    pub fn xls_builder_base_add_or(
1803        builder: *mut CIrBuilderBase,
1804        lhs: *mut CIrBValue,
1805        rhs: *mut CIrBValue,
1806        name: *const std::os::raw::c_char,
1807    ) -> *mut CIrBValue;
1808    pub fn xls_builder_base_add_xor(
1809        builder: *mut CIrBuilderBase,
1810        lhs: *mut CIrBValue,
1811        rhs: *mut CIrBValue,
1812        name: *const std::os::raw::c_char,
1813    ) -> *mut CIrBValue;
1814    pub fn xls_builder_base_add_not(
1815        builder: *mut CIrBuilderBase,
1816        value: *mut CIrBValue,
1817        name: *const std::os::raw::c_char,
1818    ) -> *mut CIrBValue;
1819    pub fn xls_builder_base_add_negate(
1820        builder: *mut CIrBuilderBase,
1821        value: *mut CIrBValue,
1822        name: *const std::os::raw::c_char,
1823    ) -> *mut CIrBValue;
1824    pub fn xls_builder_base_add_reverse(
1825        builder: *mut CIrBuilderBase,
1826        value: *mut CIrBValue,
1827        name: *const std::os::raw::c_char,
1828    ) -> *mut CIrBValue;
1829    pub fn xls_builder_base_add_or_reduce(
1830        builder: *mut CIrBuilderBase,
1831        value: *mut CIrBValue,
1832        name: *const std::os::raw::c_char,
1833    ) -> *mut CIrBValue;
1834    pub fn xls_builder_base_add_and_reduce(
1835        builder: *mut CIrBuilderBase,
1836        value: *mut CIrBValue,
1837        name: *const std::os::raw::c_char,
1838    ) -> *mut CIrBValue;
1839    pub fn xls_builder_base_add_xor_reduce(
1840        builder: *mut CIrBuilderBase,
1841        value: *mut CIrBValue,
1842        name: *const std::os::raw::c_char,
1843    ) -> *mut CIrBValue;
1844    pub fn xls_builder_base_add_literal(
1845        builder: *mut CIrBuilderBase,
1846        value: *mut CIrValue,
1847        name: *const std::os::raw::c_char,
1848    ) -> *mut CIrBValue;
1849    pub fn xls_builder_base_add_tuple(
1850        builder: *mut CIrBuilderBase,
1851        operands: *mut *mut CIrBValue,
1852        operand_count: i64,
1853        name: *const std::os::raw::c_char,
1854    ) -> *mut CIrBValue;
1855    pub fn xls_builder_base_add_tuple_index(
1856        builder: *mut CIrBuilderBase,
1857        tuple: *mut CIrBValue,
1858        index: i64,
1859        name: *const std::os::raw::c_char,
1860    ) -> *mut CIrBValue;
1861    pub fn xls_builder_base_add_array(
1862        builder: *mut CIrBuilderBase,
1863        element_type: *mut CIrType,
1864        elements: *const *mut CIrBValue,
1865        element_count: i64,
1866        name: *const std::os::raw::c_char,
1867    ) -> *mut CIrBValue;
1868    pub fn xls_builder_base_add_array_index(
1869        builder: *mut CIrBuilderBase,
1870        array: *mut CIrBValue,
1871        indices: *const *mut CIrBValue,
1872        index_count: i64,
1873        assumed_in_bounds: bool,
1874        name: *const std::os::raw::c_char,
1875    ) -> *mut CIrBValue;
1876    pub fn xls_builder_base_add_dynamic_bit_slice(
1877        builder: *mut CIrBuilderBase,
1878        value: *mut CIrBValue,
1879        start: *mut CIrBValue,
1880        width: i64,
1881        name: *const std::os::raw::c_char,
1882    ) -> *mut CIrBValue;
1883    pub fn xls_builder_base_add_bit_slice(
1884        builder: *mut CIrBuilderBase,
1885        value: *mut CIrBValue,
1886        start: i64,
1887        width: i64,
1888        name: *const std::os::raw::c_char,
1889    ) -> *mut CIrBValue;
1890    pub fn xls_builder_base_add_bit_slice_update(
1891        builder: *mut CIrBuilderBase,
1892        value: *mut CIrBValue,
1893        start: *mut CIrBValue,
1894        update: *mut CIrBValue,
1895        name: *const std::os::raw::c_char,
1896    ) -> *mut CIrBValue;
1897    pub fn xls_builder_base_add_concat(
1898        builder: *mut CIrBuilderBase,
1899        values: *const *mut CIrBValue,
1900        value_count: i64,
1901        name: *const std::os::raw::c_char,
1902    ) -> *mut CIrBValue;
1903    pub fn xls_builder_base_add_after_all(
1904        builder: *mut CIrBuilderBase,
1905        dependencies: *mut *mut CIrBValue,
1906        dependency_count: i64,
1907        name: *const std::os::raw::c_char,
1908    ) -> *mut CIrBValue;
1909    pub fn xls_builder_base_add_add(
1910        builder: *mut CIrBuilderBase,
1911        lhs: *mut CIrBValue,
1912        rhs: *mut CIrBValue,
1913        name: *const std::os::raw::c_char,
1914    ) -> *mut CIrBValue;
1915    pub fn xls_builder_base_add_sub(
1916        builder: *mut CIrBuilderBase,
1917        lhs: *mut CIrBValue,
1918        rhs: *mut CIrBValue,
1919        name: *const std::os::raw::c_char,
1920    ) -> *mut CIrBValue;
1921    pub fn xls_builder_base_add_umul(
1922        builder: *mut CIrBuilderBase,
1923        lhs: *mut CIrBValue,
1924        rhs: *mut CIrBValue,
1925        name: *const std::os::raw::c_char,
1926    ) -> *mut CIrBValue;
1927    pub fn xls_builder_base_add_smul(
1928        builder: *mut CIrBuilderBase,
1929        lhs: *mut CIrBValue,
1930        rhs: *mut CIrBValue,
1931        name: *const std::os::raw::c_char,
1932    ) -> *mut CIrBValue;
1933    pub fn xls_builder_base_add_umulp(
1934        builder: *mut CIrBuilderBase,
1935        lhs: *mut CIrBValue,
1936        rhs: *mut CIrBValue,
1937        name: *const std::os::raw::c_char,
1938    ) -> *mut CIrBValue;
1939    pub fn xls_builder_base_add_smulp(
1940        builder: *mut CIrBuilderBase,
1941        lhs: *mut CIrBValue,
1942        rhs: *mut CIrBValue,
1943        name: *const std::os::raw::c_char,
1944    ) -> *mut CIrBValue;
1945    pub fn xls_builder_base_add_udiv(
1946        builder: *mut CIrBuilderBase,
1947        lhs: *mut CIrBValue,
1948        rhs: *mut CIrBValue,
1949        name: *const std::os::raw::c_char,
1950    ) -> *mut CIrBValue;
1951    pub fn xls_builder_base_add_sdiv(
1952        builder: *mut CIrBuilderBase,
1953        lhs: *mut CIrBValue,
1954        rhs: *mut CIrBValue,
1955        name: *const std::os::raw::c_char,
1956    ) -> *mut CIrBValue;
1957    pub fn xls_builder_base_add_umod(
1958        builder: *mut CIrBuilderBase,
1959        lhs: *mut CIrBValue,
1960        rhs: *mut CIrBValue,
1961        name: *const std::os::raw::c_char,
1962    ) -> *mut CIrBValue;
1963    pub fn xls_builder_base_add_smod(
1964        builder: *mut CIrBuilderBase,
1965        lhs: *mut CIrBValue,
1966        rhs: *mut CIrBValue,
1967        name: *const std::os::raw::c_char,
1968    ) -> *mut CIrBValue;
1969    pub fn xls_builder_base_add_eq(
1970        builder: *mut CIrBuilderBase,
1971        lhs: *mut CIrBValue,
1972        rhs: *mut CIrBValue,
1973        name: *const std::os::raw::c_char,
1974    ) -> *mut CIrBValue;
1975    pub fn xls_builder_base_add_ne(
1976        builder: *mut CIrBuilderBase,
1977        lhs: *mut CIrBValue,
1978        rhs: *mut CIrBValue,
1979        name: *const std::os::raw::c_char,
1980    ) -> *mut CIrBValue;
1981
1982    // -- comparisons
1983    pub fn xls_builder_base_add_ule(
1984        builder: *mut CIrBuilderBase,
1985        lhs: *mut CIrBValue,
1986        rhs: *mut CIrBValue,
1987        name: *const std::os::raw::c_char,
1988    ) -> *mut CIrBValue;
1989    pub fn xls_builder_base_add_ult(
1990        builder: *mut CIrBuilderBase,
1991        lhs: *mut CIrBValue,
1992        rhs: *mut CIrBValue,
1993        name: *const std::os::raw::c_char,
1994    ) -> *mut CIrBValue;
1995    pub fn xls_builder_base_add_uge(
1996        builder: *mut CIrBuilderBase,
1997        lhs: *mut CIrBValue,
1998        rhs: *mut CIrBValue,
1999        name: *const std::os::raw::c_char,
2000    ) -> *mut CIrBValue;
2001    pub fn xls_builder_base_add_ugt(
2002        builder: *mut CIrBuilderBase,
2003        lhs: *mut CIrBValue,
2004        rhs: *mut CIrBValue,
2005        name: *const std::os::raw::c_char,
2006    ) -> *mut CIrBValue;
2007    pub fn xls_builder_base_add_sle(
2008        builder: *mut CIrBuilderBase,
2009        lhs: *mut CIrBValue,
2010        rhs: *mut CIrBValue,
2011        name: *const std::os::raw::c_char,
2012    ) -> *mut CIrBValue;
2013    pub fn xls_builder_base_add_slt(
2014        builder: *mut CIrBuilderBase,
2015        lhs: *mut CIrBValue,
2016        rhs: *mut CIrBValue,
2017        name: *const std::os::raw::c_char,
2018    ) -> *mut CIrBValue;
2019    pub fn xls_builder_base_add_sgt(
2020        builder: *mut CIrBuilderBase,
2021        lhs: *mut CIrBValue,
2022        rhs: *mut CIrBValue,
2023        name: *const std::os::raw::c_char,
2024    ) -> *mut CIrBValue;
2025    pub fn xls_builder_base_add_sge(
2026        builder: *mut CIrBuilderBase,
2027        lhs: *mut CIrBValue,
2028        rhs: *mut CIrBValue,
2029        name: *const std::os::raw::c_char,
2030    ) -> *mut CIrBValue;
2031
2032    pub fn xls_builder_base_add_shra(
2033        builder: *mut CIrBuilderBase,
2034        a: *mut CIrBValue,
2035        b: *mut CIrBValue,
2036        name: *const std::os::raw::c_char,
2037    ) -> *mut CIrBValue;
2038    pub fn xls_builder_base_add_shrl(
2039        builder: *mut CIrBuilderBase,
2040        a: *mut CIrBValue,
2041        b: *mut CIrBValue,
2042        name: *const std::os::raw::c_char,
2043    ) -> *mut CIrBValue;
2044    pub fn xls_builder_base_add_shll(
2045        builder: *mut CIrBuilderBase,
2046        a: *mut CIrBValue,
2047        b: *mut CIrBValue,
2048        name: *const std::os::raw::c_char,
2049    ) -> *mut CIrBValue;
2050    pub fn xls_builder_base_add_nor(
2051        builder: *mut CIrBuilderBase,
2052        a: *mut CIrBValue,
2053        b: *mut CIrBValue,
2054        name: *const std::os::raw::c_char,
2055    ) -> *mut CIrBValue;
2056    pub fn xls_builder_base_add_clz(
2057        builder: *mut CIrBuilderBase,
2058        a: *mut CIrBValue,
2059        name: *const std::os::raw::c_char,
2060    ) -> *mut CIrBValue;
2061    pub fn xls_builder_base_add_ctz(
2062        builder: *mut CIrBuilderBase,
2063        a: *mut CIrBValue,
2064        name: *const std::os::raw::c_char,
2065    ) -> *mut CIrBValue;
2066    pub fn xls_builder_base_add_encode(
2067        builder: *mut CIrBuilderBase,
2068        a: *mut CIrBValue,
2069        name: *const std::os::raw::c_char,
2070    ) -> *mut CIrBValue;
2071
2072    pub fn xls_builder_base_add_decode(
2073        builder: *mut CIrBuilderBase,
2074        a: *mut CIrBValue,
2075        width: *mut i64,
2076        name: *const std::os::raw::c_char,
2077    ) -> *mut CIrBValue;
2078    pub fn xls_builder_base_add_select(
2079        builder: *mut CIrBuilderBase,
2080        selector: *mut CIrBValue,
2081        cases: *const *mut CIrBValue,
2082        case_count: i64,
2083        default_value: *mut CIrBValue,
2084        name: *const std::os::raw::c_char,
2085    ) -> *mut CIrBValue;
2086    pub fn xls_builder_base_add_array_concat(
2087        builder: *mut CIrBuilderBase,
2088        arrays: *const *mut CIrBValue,
2089        array_count: i64,
2090        name: *const std::os::raw::c_char,
2091    ) -> *mut CIrBValue;
2092    pub fn xls_builder_base_add_array_slice(
2093        builder: *mut CIrBuilderBase,
2094        array: *mut CIrBValue,
2095        start: *mut CIrBValue,
2096        width: i64,
2097        name: *const std::os::raw::c_char,
2098    ) -> *mut CIrBValue;
2099    pub fn xls_builder_base_add_array_update(
2100        builder: *mut CIrBuilderBase,
2101        array: *mut CIrBValue,
2102        update_value: *mut CIrBValue,
2103        indices: *const *mut CIrBValue,
2104        index_count: i64,
2105        assumed_in_bounds: bool,
2106        name: *const std::os::raw::c_char,
2107    ) -> *mut CIrBValue;
2108    pub fn xls_builder_base_add_identity(
2109        builder: *mut CIrBuilderBase,
2110        value: *mut CIrBValue,
2111        name: *const std::os::raw::c_char,
2112    ) -> *mut CIrBValue;
2113
2114    pub fn xls_builder_base_add_sign_extend(
2115        builder: *mut CIrBuilderBase,
2116        value: *mut CIrBValue,
2117        new_bit_count: i64,
2118        name: *const std::os::raw::c_char,
2119    ) -> *mut CIrBValue;
2120    pub fn xls_builder_base_add_zero_extend(
2121        builder: *mut CIrBuilderBase,
2122        value: *mut CIrBValue,
2123        new_bit_count: i64,
2124        name: *const std::os::raw::c_char,
2125    ) -> *mut CIrBValue;
2126
2127    pub fn xls_builder_base_add_one_hot(
2128        builder: *mut CIrBuilderBase,
2129        input: *mut CIrBValue,
2130        lsb_is_priority: bool,
2131        name: *const std::os::raw::c_char,
2132    ) -> *mut CIrBValue;
2133
2134    pub fn xls_builder_base_add_one_hot_select(
2135        builder: *mut CIrBuilderBase,
2136        selector: *mut CIrBValue,
2137        cases: *const *mut CIrBValue,
2138        case_count: i64,
2139        name: *const std::os::raw::c_char,
2140    ) -> *mut CIrBValue;
2141
2142    pub fn xls_builder_base_add_priority_select(
2143        builder: *mut CIrBuilderBase,
2144        selector: *mut CIrBValue,
2145        cases: *const *mut CIrBValue,
2146        case_count: i64,
2147        default_value: *mut CIrBValue,
2148        name: *const std::os::raw::c_char,
2149    ) -> *mut CIrBValue;
2150
2151    pub fn xls_builder_base_get_last_value(
2152        builder: *mut CIrBuilderBase,
2153        error_out: *mut *mut std::os::raw::c_char,
2154        value_out: *mut *mut CIrBValue,
2155    ) -> bool;
2156
2157    pub fn xls_builder_base_get_type(
2158        builder: *mut CIrBuilderBase,
2159        value: *mut CIrBValue,
2160    ) -> *mut CIrType;
2161
2162    // New functions for sequential logic
2163    pub fn xls_vast_verilog_module_add_always_ff(
2164        m: *mut CVastModule,
2165        sensitivity_list_elements: *mut *mut CVastExpression,
2166        sensitivity_list_count: usize,
2167        out_always_ff: *mut *mut CVastAlwaysBase,
2168        error_out: *mut *mut ::std::os::raw::c_char,
2169    ) -> bool;
2170    pub fn xls_vast_verilog_module_add_always_at(
2171        m: *mut CVastModule,
2172        sensitivity_list_elements: *mut *mut CVastExpression,
2173        sensitivity_list_count: usize,
2174        out_always_at: *mut *mut CVastAlwaysBase,
2175        error_out: *mut *mut ::std::os::raw::c_char,
2176    ) -> bool;
2177    pub fn xls_vast_verilog_module_add_always_comb(
2178        m: *mut CVastModule,
2179        out_always_comb: *mut *mut CVastAlwaysBase,
2180        error_out: *mut *mut ::std::os::raw::c_char,
2181    ) -> bool;
2182    pub fn xls_vast_verilog_module_add_reg(
2183        m: *mut CVastModule,
2184        name: *const ::std::os::raw::c_char,
2185        type_: *mut CVastDataType,
2186        out_reg_ref: *mut *mut CVastLogicRef,
2187        error_out: *mut *mut ::std::os::raw::c_char,
2188    ) -> bool;
2189    pub fn xls_vast_verilog_module_add_logic(
2190        m: *mut CVastModule,
2191        name: *const std::os::raw::c_char,
2192        type_: *mut CVastDataType,
2193        out_logic_ref: *mut *mut CVastLogicRef,
2194        error_out: *mut *mut std::os::raw::c_char,
2195    ) -> bool;
2196    pub fn xls_vast_verilog_file_make_pos_edge(
2197        f: *mut CVastFile,
2198        signal_expr: *mut CVastExpression,
2199    ) -> *mut CVastExpression;
2200    pub fn xls_vast_verilog_file_make_nonblocking_assignment(
2201        f: *mut CVastFile,
2202        lhs: *mut CVastExpression,
2203        rhs: *mut CVastExpression,
2204    ) -> *mut CVastStatement;
2205    pub fn xls_vast_verilog_file_make_blocking_assignment(
2206        f: *mut CVastFile,
2207        lhs: *mut CVastExpression,
2208        rhs: *mut CVastExpression,
2209    ) -> *mut CVastStatement;
2210
2211    pub fn xls_vast_always_base_get_statement_block(
2212        always_base: *mut CVastAlwaysBase,
2213    ) -> *mut CVastStatementBlock;
2214
2215    pub fn xls_vast_statement_block_add_nonblocking_assignment(
2216        block: *mut CVastStatementBlock,
2217        lhs: *mut CVastExpression,
2218        rhs: *mut CVastExpression,
2219    ) -> *mut CVastStatement;
2220    pub fn xls_vast_statement_block_add_blocking_assignment(
2221        block: *mut CVastStatementBlock,
2222        lhs: *mut CVastExpression,
2223        rhs: *mut CVastExpression,
2224    ) -> *mut CVastStatement;
2225
2226    pub fn xls_vast_statement_block_add_comment_text(
2227        block: *mut CVastStatementBlock,
2228        text: *const std::os::raw::c_char,
2229    ) -> *mut CVastStatement;
2230
2231    pub fn xls_vast_statement_block_add_blank_line(
2232        block: *mut CVastStatementBlock,
2233    ) -> *mut CVastStatement;
2234
2235    pub fn xls_vast_statement_block_add_inline_text(
2236        block: *mut CVastStatementBlock,
2237        text: *const std::os::raw::c_char,
2238    ) -> *mut CVastStatement;
2239
2240    // Conditional (if / else-if / else)
2241    pub fn xls_vast_statement_block_add_conditional(
2242        block: *mut CVastStatementBlock,
2243        cond: *mut CVastExpression,
2244    ) -> *mut CVastConditional;
2245    pub fn xls_vast_conditional_get_then_block(
2246        cond: *mut CVastConditional,
2247    ) -> *mut CVastStatementBlock;
2248    pub fn xls_vast_conditional_add_else_if(
2249        cond: *mut CVastConditional,
2250        expr_cond: *mut CVastExpression,
2251    ) -> *mut CVastStatementBlock;
2252    pub fn xls_vast_conditional_add_else(cond: *mut CVastConditional) -> *mut CVastStatementBlock;
2253
2254    // Case statement builders
2255    pub fn xls_vast_statement_block_add_case(
2256        block: *mut CVastStatementBlock,
2257        selector: *mut CVastExpression,
2258    ) -> *mut CVastCaseStatement;
2259    pub fn xls_vast_case_statement_add_item(
2260        case_stmt: *mut CVastCaseStatement,
2261        match_expr: *mut CVastExpression,
2262    ) -> *mut CVastStatementBlock;
2263    pub fn xls_vast_case_statement_add_default(
2264        case_stmt: *mut CVastCaseStatement,
2265    ) -> *mut CVastStatementBlock;
2266
2267    pub fn xls_vast_generate_loop_get_genvar(loop_: *mut CVastGenerateLoop) -> *mut CVastLogicRef;
2268    pub fn xls_vast_generate_loop_add_generate_loop(
2269        loop_: *mut CVastGenerateLoop,
2270        genvar_name: *const std::os::raw::c_char,
2271        init: *mut CVastExpression,
2272        limit: *mut CVastExpression,
2273        label: *const std::os::raw::c_char,
2274    ) -> *mut CVastGenerateLoop;
2275    pub fn xls_vast_generate_loop_add_always_comb(
2276        loop_: *mut CVastGenerateLoop,
2277        out_always_comb: *mut *mut CVastAlwaysBase,
2278        error_out: *mut *mut std::os::raw::c_char,
2279    ) -> bool;
2280    pub fn xls_vast_generate_loop_add_always_ff(
2281        loop_: *mut CVastGenerateLoop,
2282        sensitivity_list_elements: *mut *mut CVastExpression,
2283        sensitivity_list_count: usize,
2284        out_always_ff: *mut *mut CVastAlwaysBase,
2285        error_out: *mut *mut std::os::raw::c_char,
2286    ) -> bool;
2287    pub fn xls_vast_generate_loop_add_localparam(
2288        loop_: *mut CVastGenerateLoop,
2289        name: *const std::os::raw::c_char,
2290        rhs: *mut CVastExpression,
2291    ) -> *mut CVastLocalparamRef;
2292    pub fn xls_vast_generate_loop_add_localparam_with_def(
2293        loop_: *mut CVastGenerateLoop,
2294        def: *mut CVastDef,
2295        rhs: *mut CVastExpression,
2296    ) -> *mut CVastLocalparamRef;
2297    pub fn xls_vast_generate_loop_add_continuous_assignment(
2298        loop_: *mut CVastGenerateLoop,
2299        lhs: *mut CVastExpression,
2300        rhs: *mut CVastExpression,
2301    ) -> *mut CVastStatement;
2302    pub fn xls_vast_generate_loop_add_blank_line(loop_: *mut CVastGenerateLoop);
2303    pub fn xls_vast_generate_loop_add_comment(
2304        loop_: *mut CVastGenerateLoop,
2305        comment: *mut CVastComment,
2306    );
2307    pub fn xls_vast_generate_loop_add_instantiation(
2308        loop_: *mut CVastGenerateLoop,
2309        instantiation: *mut CVastInstantiation,
2310    );
2311    pub fn xls_vast_generate_loop_add_inline_verilog_statement(
2312        loop_: *mut CVastGenerateLoop,
2313        stmt: *mut CVastInlineVerilogStatement,
2314    );
2315    pub fn xls_vast_generate_loop_add_macro_statement(
2316        loop_: *mut CVastGenerateLoop,
2317        macro_statement: *mut CVastMacroStatement,
2318    );
2319
2320    pub fn xls_function_type_get_param_count(fty: *mut CIrFunctionType) -> i64;
2321
2322    pub fn xls_function_type_get_param_type(
2323        fty: *mut CIrFunctionType,
2324        index: libc::size_t,
2325        error_out: *mut *mut std::os::raw::c_char,
2326        param_type_out: *mut *mut CIrType,
2327    ) -> bool;
2328
2329    pub fn xls_function_type_get_return_type(fty: *mut CIrFunctionType) -> *mut CIrType;
2330
2331    pub fn xls_function_get_param_name(
2332        function: *mut CIrFunction,
2333        index: libc::size_t,
2334        error_out: *mut *mut std::os::raw::c_char,
2335        name_out: *mut *mut std::os::raw::c_char,
2336    ) -> bool;
2337
2338    pub fn xls_dslx_function_is_parametric(function: *const CDslxFunction) -> bool;
2339    pub fn xls_dslx_function_is_public(function: *const CDslxFunction) -> bool;
2340    pub fn xls_dslx_function_get_identifier(
2341        function: *const CDslxFunction,
2342    ) -> *mut std::os::raw::c_char;
2343
2344    pub fn xls_dslx_function_get_param_count(function: *const CDslxFunction) -> i64;
2345    pub fn xls_dslx_function_get_parametric_binding_count(function: *const CDslxFunction) -> i64;
2346    pub fn xls_dslx_function_get_param(
2347        function: *const CDslxFunction,
2348        index: i64,
2349    ) -> *mut CDslxParam;
2350    pub fn xls_dslx_function_get_parametric_binding(
2351        function: *const CDslxFunction,
2352        index: i64,
2353    ) -> *mut CDslxParametricBinding;
2354    pub fn xls_dslx_function_get_body(function: *const CDslxFunction) -> *mut CDslxExpr;
2355    pub fn xls_dslx_function_get_return_type(
2356        function: *const CDslxFunction,
2357    ) -> *mut CDslxTypeAnnotation;
2358    pub fn xls_dslx_function_get_attribute_count(function: *const CDslxFunction) -> i64;
2359    pub fn xls_dslx_function_get_attribute(
2360        function: *const CDslxFunction,
2361        index: i64,
2362    ) -> *mut CDslxAttribute;
2363    pub fn xls_dslx_param_get_name(param: *const CDslxParam) -> *mut std::os::raw::c_char;
2364    pub fn xls_dslx_param_get_type_annotation(param: *const CDslxParam)
2365        -> *mut CDslxTypeAnnotation;
2366    pub fn xls_dslx_attribute_get_kind(attribute: *const CDslxAttribute) -> DslxAttributeKind;
2367    pub fn xls_dslx_attribute_get_argument_count(attribute: *const CDslxAttribute) -> i64;
2368    pub fn xls_dslx_attribute_get_argument_kind(
2369        attribute: *const CDslxAttribute,
2370        index: i64,
2371    ) -> DslxAttributeArgumentKind;
2372    pub fn xls_dslx_attribute_get_string_argument(
2373        attribute: *const CDslxAttribute,
2374        index: i64,
2375    ) -> *mut std::os::raw::c_char;
2376    pub fn xls_dslx_attribute_get_string_literal_argument(
2377        attribute: *const CDslxAttribute,
2378        index: i64,
2379    ) -> *mut std::os::raw::c_char;
2380    pub fn xls_dslx_attribute_get_key_value_argument_key(
2381        attribute: *const CDslxAttribute,
2382        index: i64,
2383    ) -> *mut std::os::raw::c_char;
2384    pub fn xls_dslx_attribute_get_key_value_string_argument_value(
2385        attribute: *const CDslxAttribute,
2386        index: i64,
2387    ) -> *mut std::os::raw::c_char;
2388    pub fn xls_dslx_attribute_get_key_value_int_argument_value(
2389        attribute: *const CDslxAttribute,
2390        index: i64,
2391    ) -> i64;
2392    pub fn xls_dslx_attribute_to_string(
2393        attribute: *const CDslxAttribute,
2394    ) -> *mut std::os::raw::c_char;
2395    pub fn xls_dslx_parametric_binding_get_identifier(
2396        binding: *const CDslxParametricBinding,
2397    ) -> *mut std::os::raw::c_char;
2398    pub fn xls_dslx_parametric_binding_get_type_annotation(
2399        binding: *const CDslxParametricBinding,
2400    ) -> *mut CDslxTypeAnnotation;
2401    pub fn xls_dslx_parametric_binding_get_expr(
2402        binding: *const CDslxParametricBinding,
2403    ) -> *mut CDslxExpr;
2404
2405    // -- "requires implicit token?" determination for a DSLX function
2406    pub fn xls_dslx_type_info_get_requires_implicit_token(
2407        type_info: *mut CDslxTypeInfo,
2408        function: *mut CDslxFunction,
2409        error_out: *mut *mut std::os::raw::c_char,
2410        result_out: *mut bool,
2411    ) -> bool;
2412
2413    // -- Quickcheck APIs
2414    pub fn xls_dslx_quickcheck_get_function(qc: *const CDslxQuickcheck) -> *mut CDslxFunction;
2415
2416    /// Returns true iff the Quickcheck has the `exhaustive` test-cases
2417    /// specifier.
2418    pub fn xls_dslx_quickcheck_is_exhaustive(qc: *const CDslxQuickcheck) -> bool;
2419
2420    /// Retrieves the test-case count for the Quickcheck. Returns true and sets
2421    /// `*result_out` when the Quickcheck has a counted test-case specifier;
2422    /// returns false when the Quickcheck is marked exhaustive (in which case
2423    /// `*result_out` is not modified).
2424    pub fn xls_dslx_quickcheck_get_count(qc: *const CDslxQuickcheck, result_out: *mut i64) -> bool;
2425}
2426
2427pub const DSLX_STDLIB_PATH: &str = env!("DSLX_STDLIB_PATH");
2428
2429/// Directory containing the libxls DSO.
2430///
2431/// *** DO NOT USE THIS VARIABLE FROM WITHIN YOUR build.rs ***
2432///
2433/// You might be tempted to write the following in your build.rs:
2434///
2435/// ```ignore
2436/// // DO NOT DO THIS IN YOUR build.rs!!
2437/// let dylib_dirpath = xlsynth_sys::XLS_DSO_PATH;
2438/// // set rpath to dylib_dirpath or something.
2439/// ```
2440///
2441/// The problem is that build.rs is compiled for host, whereas if you're setting
2442/// an rpath (or something similar) you want to get the path from compiling
2443/// xlsynth_sys for *target*.  In other words, the above will break
2444/// cross-compilation.
2445///
2446/// Instead, your build.rs should get the path from an envvar which:
2447///
2448/// ```ignore
2449/// // Do this from your build.rs instead.
2450/// let dylib_path = std::env::var("DEP_XLSYNTH_DSO_PATH").unwrap();
2451/// ```
2452///
2453/// More details are available at
2454/// <https://doc.rust-lang.org/cargo/reference/build-script-examples.html#using-another-sys-crate>.
2455///
2456/// (If you use this envvar from your crate proper -- i.e. not from build.rs --
2457/// then it's perfectly fine.)
2458pub const XLS_DSO_PATH: &str = env!("XLS_DSO_PATH");
2459
2460// Add opaque types for module port and def.
2461#[repr(C)]
2462pub struct CVastModulePort {
2463    _private: [u8; 0], // Ensures the struct cannot be instantiated
2464}
2465
2466#[repr(C)]
2467pub struct CVastDef {
2468    _private: [u8; 0], // Ensures the struct cannot be instantiated
2469}
2470
2471// Direction enum for module ports.
2472pub type VastModulePortDirection = i32;
2473
2474// Constants that match the C enum definitions.
2475pub const XLS_VAST_MODULE_PORT_DIRECTION_INPUT: VastModulePortDirection = 0;
2476pub const XLS_VAST_MODULE_PORT_DIRECTION_OUTPUT: VastModulePortDirection = 1;
2477
2478extern "C" {
2479    // -- Module port inspection APIs
2480    pub fn xls_vast_verilog_module_get_ports(
2481        m: *mut CVastModule,
2482        out_count: *mut libc::size_t,
2483    ) -> *mut *mut CVastModulePort;
2484
2485    pub fn xls_vast_verilog_module_free_ports(
2486        ports: *mut *mut CVastModulePort,
2487        count: libc::size_t,
2488    );
2489
2490    pub fn xls_vast_verilog_module_port_get_direction(
2491        port: *mut CVastModulePort,
2492    ) -> VastModulePortDirection;
2493
2494    pub fn xls_vast_verilog_module_port_get_def(port: *mut CVastModulePort) -> *mut CVastDef;
2495
2496    pub fn xls_vast_def_get_name(def: *mut CVastDef) -> *mut std::os::raw::c_char;
2497
2498    pub fn xls_vast_def_get_data_type(def: *mut CVastDef) -> *mut CVastDataType;
2499}