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