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_package_get_top(p: *mut CIrPackage) -> *mut CIrFunctionBase;
774    pub fn xls_package_set_top_by_name(
775        p: *mut CIrPackage,
776        name: *const std::os::raw::c_char,
777        error_out: *mut *mut std::os::raw::c_char,
778    ) -> bool;
779
780    pub fn xls_verify_package(
781        p: *mut CIrPackage,
782        error_out: *mut *mut std::os::raw::c_char,
783    ) -> bool;
784
785    pub fn xls_make_function_jit(
786        function: *const CIrFunction,
787        error_out: *mut *mut std::os::raw::c_char,
788        result_out: *mut *mut CIrFunctionJit,
789    ) -> bool;
790    pub fn xls_function_jit_free(jit: *mut CIrFunctionJit);
791    pub fn xls_function_jit_run(
792        jit: *const CIrFunctionJit,
793        argc: libc::size_t,
794        args: *const *const CIrValue,
795        error_out: *mut *mut std::os::raw::c_char,
796        trace_messages_out: *mut *mut CTraceMessage,
797        trace_messages_count_out: *mut libc::size_t,
798        assert_messages_out: *mut *mut *mut std::os::raw::c_char,
799        assert_messages_count_out: *mut libc::size_t,
800        result_out: *mut *mut CIrValue,
801    ) -> bool;
802    pub fn xls_trace_messages_free(trace_messages: *mut CTraceMessage, count: libc::size_t);
803
804    // -- VAST APIs
805
806    pub fn xls_vast_make_verilog_file(file_type: CVastFileType) -> *mut CVastFile;
807    pub fn xls_vast_verilog_file_free(f: *mut CVastFile);
808    pub fn xls_vast_verilog_file_add_module(
809        f: *mut CVastFile,
810        name: *const std::os::raw::c_char,
811    ) -> *mut CVastModule;
812
813    // - Node creation
814    pub fn xls_vast_verilog_file_make_scalar_type(f: *mut CVastFile) -> *mut CVastDataType;
815    pub fn xls_vast_verilog_file_make_bit_vector_type(
816        f: *mut CVastFile,
817        bit_count: i64,
818        is_signed: bool,
819    ) -> *mut CVastDataType;
820    pub fn xls_vast_verilog_file_make_bit_vector_type_with_expression(
821        f: *mut CVastFile,
822        width_expr: *mut CVastExpression,
823        is_signed: bool,
824    ) -> *mut CVastDataType;
825    pub fn xls_vast_verilog_file_make_integer_type(
826        f: *mut CVastFile,
827        is_signed: bool,
828    ) -> *mut CVastDataType;
829    pub fn xls_vast_verilog_file_make_int_type(
830        f: *mut CVastFile,
831        is_signed: bool,
832    ) -> *mut CVastDataType;
833    pub fn xls_vast_verilog_file_make_integer_def(
834        f: *mut CVastFile,
835        name: *const std::os::raw::c_char,
836        is_signed: bool,
837    ) -> *mut CVastDef;
838    pub fn xls_vast_verilog_file_make_int_def(
839        f: *mut CVastFile,
840        name: *const std::os::raw::c_char,
841        is_signed: bool,
842    ) -> *mut CVastDef;
843    pub fn xls_vast_verilog_file_make_extern_package_type(
844        f: *mut CVastFile,
845        package_name: *const std::os::raw::c_char,
846        type_name: *const std::os::raw::c_char,
847    ) -> *mut CVastDataType;
848    pub fn xls_vast_verilog_file_make_extern_type(
849        f: *mut CVastFile,
850        entity_name: *const std::os::raw::c_char,
851    ) -> *mut CVastDataType;
852    pub fn xls_vast_verilog_file_make_packed_array_type(
853        f: *mut CVastFile,
854        element_type: *mut CVastDataType,
855        dims: *const i64,
856        dim_count: libc::size_t,
857    ) -> *mut CVastDataType;
858
859    // -- Data type introspection
860    pub fn xls_vast_data_type_width_as_int64(
861        type_: *mut CVastDataType,
862        out_width: *mut i64,
863        error_out: *mut *mut std::os::raw::c_char,
864    ) -> bool;
865
866    pub fn xls_vast_data_type_flat_bit_count_as_int64(
867        type_: *mut CVastDataType,
868        out_flat_bit_count: *mut i64,
869        error_out: *mut *mut std::os::raw::c_char,
870    ) -> bool;
871
872    // Returns width expression; may return nullptr if none.
873    pub fn xls_vast_data_type_width(type_: *mut CVastDataType) -> *mut CVastExpression;
874
875    pub fn xls_vast_data_type_is_signed(type_: *mut CVastDataType) -> bool;
876
877    pub fn xls_vast_verilog_file_make_continuous_assignment(
878        f: *mut CVastFile,
879        lhs: *mut CVastExpression,
880        rhs: *mut CVastExpression,
881    ) -> *mut CVastContinuousAssignment;
882
883    pub fn xls_vast_verilog_file_make_concat(
884        f: *mut CVastFile,
885        expressions: *mut *mut CVastExpression,
886        expression_count: libc::size_t,
887    ) -> *mut CVastExpression;
888
889    pub fn xls_vast_verilog_file_make_replicated_concat(
890        f: *mut CVastFile,
891        replication: *mut CVastExpression,
892        elements: *mut *mut CVastExpression,
893        element_count: libc::size_t,
894    ) -> *mut CVastConcat;
895
896    pub fn xls_vast_verilog_file_make_replicated_concat_i64(
897        f: *mut CVastFile,
898        replication_count: i64,
899        elements: *mut *mut CVastExpression,
900        element_count: libc::size_t,
901    ) -> *mut CVastConcat;
902
903    pub fn xls_vast_verilog_file_make_slice_i64(
904        f: *mut CVastFile,
905        subject: *mut CVastIndexableExpression,
906        hi: i64,
907        lo: i64,
908    ) -> *mut CVastSlice;
909    pub fn xls_vast_verilog_file_make_slice(
910        f: *mut CVastFile,
911        subject: *mut CVastIndexableExpression,
912        hi: *mut CVastExpression,
913        lo: *mut CVastExpression,
914    ) -> *mut CVastSlice;
915
916    pub fn xls_vast_verilog_file_make_index(
917        f: *mut CVastFile,
918        subject: *mut CVastIndexableExpression,
919        index: *mut CVastExpression,
920    ) -> *mut CVastIndex;
921    pub fn xls_vast_verilog_file_make_index_i64(
922        f: *mut CVastFile,
923        subject: *mut CVastIndexableExpression,
924        index: i64,
925    ) -> *mut CVastIndex;
926
927    pub fn xls_vast_verilog_file_make_unary(
928        f: *mut CVastFile,
929        arg: *mut CVastExpression,
930        op: VastOperatorKind,
931    ) -> *mut CVastExpression;
932
933    pub fn xls_vast_verilog_file_make_binary(
934        f: *mut CVastFile,
935        lhs: *mut CVastExpression,
936        rhs: *mut CVastExpression,
937        op: VastOperatorKind,
938    ) -> *mut CVastExpression;
939
940    pub fn xls_vast_verilog_file_make_ternary(
941        f: *mut CVastFile,
942        cond: *mut CVastExpression,
943        then_expr: *mut CVastExpression,
944        else_expr: *mut CVastExpression,
945    ) -> *mut CVastExpression;
946
947    pub fn xls_vast_verilog_file_make_width_cast(
948        f: *mut CVastFile,
949        width: *mut CVastExpression,
950        value: *mut CVastExpression,
951    ) -> *mut CVastExpression;
952
953    // Cast a value to a specific type.
954    pub fn xls_vast_verilog_file_make_type_cast(
955        f: *mut CVastFile,
956        type_: *mut CVastDataType,
957        value: *mut CVastExpression,
958    ) -> *mut CVastExpression;
959
960    pub fn xls_vast_verilog_file_make_instantiation(
961        f: *mut CVastFile,
962        module_name: *const std::os::raw::c_char,
963        instance_name: *const std::os::raw::c_char,
964        parameter_port_names: *const *const std::os::raw::c_char,
965        parameter_expressions: *const *const CVastExpression,
966        parameter_count: libc::size_t,
967        connection_port_names: *const *const std::os::raw::c_char,
968        connection_expressions: *const *const CVastExpression,
969        connection_count: libc::size_t,
970    ) -> *mut CVastInstantiation;
971    pub fn xls_vast_verilog_file_make_comment(
972        f: *mut CVastFile,
973        text: *const std::os::raw::c_char,
974    ) -> *mut CVastComment;
975    pub fn xls_vast_verilog_file_make_blank_line(f: *mut CVastFile) -> *mut CVastBlankLine;
976    pub fn xls_vast_verilog_file_make_inline_verilog_statement(
977        f: *mut CVastFile,
978        text: *const std::os::raw::c_char,
979    ) -> *mut CVastInlineVerilogStatement;
980    pub fn xls_vast_verilog_file_make_literal(
981        f: *mut CVastFile,
982        bits: *const CIrBits,
983        format_preference: XlsFormatPreference,
984        emit_bit_count: bool,
985        error_out: *mut *mut std::os::raw::c_char,
986        literal_out: *mut *mut CVastLiteral,
987    ) -> bool;
988    pub fn xls_vast_verilog_file_make_plain_literal(
989        f: *mut CVastFile,
990        value: i32,
991    ) -> *mut CVastLiteral;
992
993    // - Module additions
994    pub fn xls_vast_verilog_module_add_parameter_port(
995        m: *mut CVastModule,
996        name: *const std::os::raw::c_char,
997        rhs: *mut CVastExpression,
998    ) -> *mut CVastLogicRef;
999    pub fn xls_vast_verilog_module_add_typed_parameter_port(
1000        m: *mut CVastModule,
1001        name: *const std::os::raw::c_char,
1002        type_: *mut CVastDataType,
1003        rhs: *mut CVastExpression,
1004    ) -> *mut CVastLogicRef;
1005    pub fn xls_vast_verilog_module_add_input(
1006        m: *mut CVastModule,
1007        name: *const std::os::raw::c_char,
1008        type_: *mut CVastDataType,
1009    ) -> *mut CVastLogicRef;
1010    pub fn xls_vast_verilog_module_add_output(
1011        m: *mut CVastModule,
1012        name: *const std::os::raw::c_char,
1013        type_: *mut CVastDataType,
1014    ) -> *mut CVastLogicRef;
1015    pub fn xls_vast_verilog_module_add_inout(
1016        m: *mut CVastModule,
1017        name: *const std::os::raw::c_char,
1018        type_: *mut CVastDataType,
1019    ) -> *mut CVastLogicRef;
1020    pub fn xls_vast_verilog_module_add_logic_input(
1021        m: *mut CVastModule,
1022        name: *const std::os::raw::c_char,
1023        type_: *mut CVastDataType,
1024    ) -> *mut CVastLogicRef;
1025    pub fn xls_vast_verilog_module_add_logic_output(
1026        m: *mut CVastModule,
1027        name: *const std::os::raw::c_char,
1028        type_: *mut CVastDataType,
1029    ) -> *mut CVastLogicRef;
1030    pub fn xls_vast_verilog_module_add_wire(
1031        m: *mut CVastModule,
1032        name: *const std::os::raw::c_char,
1033        type_: *mut CVastDataType,
1034    ) -> *mut CVastLogicRef;
1035    pub fn xls_vast_verilog_module_add_generate_loop(
1036        m: *mut CVastModule,
1037        genvar_name: *const std::os::raw::c_char,
1038        init: *mut CVastExpression,
1039        limit: *mut CVastExpression,
1040        label: *const std::os::raw::c_char,
1041    ) -> *mut CVastGenerateLoop;
1042    pub fn xls_vast_verilog_module_add_member_instantiation(
1043        m: *mut CVastModule,
1044        inst: *mut CVastInstantiation,
1045    );
1046    pub fn xls_vast_verilog_module_add_member_continuous_assignment(
1047        m: *mut CVastModule,
1048        ca: *mut CVastContinuousAssignment,
1049    );
1050    pub fn xls_vast_verilog_module_add_member_comment(
1051        m: *mut CVastModule,
1052        comment: *mut CVastComment,
1053    );
1054    pub fn xls_vast_verilog_module_add_member_blank_line(
1055        m: *mut CVastModule,
1056        blank: *mut CVastBlankLine,
1057    );
1058    pub fn xls_vast_verilog_module_add_member_inline_statement(
1059        m: *mut CVastModule,
1060        stmt: *mut CVastInlineVerilogStatement,
1061    );
1062    pub fn xls_vast_verilog_module_add_member_macro_statement(
1063        m: *mut CVastModule,
1064        statement: *mut CVastMacroStatement,
1065    );
1066
1067    pub fn xls_vast_verilog_module_add_parameter(
1068        m: *mut CVastModule,
1069        name: *const std::os::raw::c_char,
1070        rhs: *mut CVastExpression,
1071    ) -> *mut CVastParameterRef;
1072
1073    pub fn xls_vast_verilog_module_add_localparam(
1074        m: *mut CVastModule,
1075        name: *const std::os::raw::c_char,
1076        rhs: *mut CVastExpression,
1077    ) -> *mut CVastLocalparamRef;
1078
1079    pub fn xls_vast_verilog_file_make_def(
1080        f: *mut CVastFile,
1081        name: *const std::os::raw::c_char,
1082        kind: VastDataKind,
1083        type_: *mut CVastDataType,
1084    ) -> *mut CVastDef;
1085
1086    pub fn xls_vast_verilog_module_add_parameter_with_def(
1087        m: *mut CVastModule,
1088        def: *mut CVastDef,
1089        rhs: *mut CVastExpression,
1090    ) -> *mut CVastParameterRef;
1091
1092    pub fn xls_vast_verilog_module_add_localparam_with_def(
1093        m: *mut CVastModule,
1094        def: *mut CVastDef,
1095        rhs: *mut CVastExpression,
1096    ) -> *mut CVastLocalparamRef;
1097
1098    pub fn xls_vast_verilog_module_get_name(m: *mut CVastModule) -> *mut std::os::raw::c_char;
1099
1100    // - Expression conversions
1101    pub fn xls_vast_logic_ref_as_indexable_expression(
1102        v: *mut CVastLogicRef,
1103    ) -> *mut CVastIndexableExpression;
1104    pub fn xls_vast_index_as_indexable_expression(
1105        v: *mut CVastIndex,
1106    ) -> *mut CVastIndexableExpression;
1107
1108    pub fn xls_vast_literal_as_expression(v: *mut CVastLiteral) -> *mut CVastExpression;
1109    pub fn xls_vast_concat_as_expression(v: *mut CVastConcat) -> *mut CVastExpression;
1110    pub fn xls_vast_logic_ref_as_expression(v: *mut CVastLogicRef) -> *mut CVastExpression;
1111    pub fn xls_vast_slice_as_expression(v: *mut CVastSlice) -> *mut CVastExpression;
1112    pub fn xls_vast_index_as_expression(v: *mut CVastIndex) -> *mut CVastExpression;
1113    pub fn xls_vast_parameter_ref_as_expression(v: *mut CVastParameterRef) -> *mut CVastExpression;
1114    pub fn xls_vast_localparam_ref_as_expression(
1115        v: *mut CVastLocalparamRef,
1116    ) -> *mut CVastExpression;
1117    pub fn xls_vast_indexable_expression_as_expression(
1118        v: *mut CVastIndexableExpression,
1119    ) -> *mut CVastExpression;
1120    pub fn xls_vast_macro_ref_as_expression(v: *mut CVastMacroRef) -> *mut CVastExpression;
1121    pub fn xls_vast_verilog_file_make_unsized_one_literal(
1122        f: *mut CVastFile,
1123    ) -> *mut CVastExpression;
1124    pub fn xls_vast_verilog_file_make_unsized_zero_literal(
1125        f: *mut CVastFile,
1126    ) -> *mut CVastExpression;
1127    pub fn xls_vast_verilog_file_make_unsized_x_literal(f: *mut CVastFile) -> *mut CVastExpression;
1128    pub fn xls_vast_verilog_file_make_macro_ref(
1129        f: *mut CVastFile,
1130        name: *const std::os::raw::c_char,
1131    ) -> *mut CVastMacroRef;
1132    pub fn xls_vast_verilog_file_make_macro_ref_with_args(
1133        f: *mut CVastFile,
1134        name: *const std::os::raw::c_char,
1135        args: *mut *mut CVastExpression,
1136        arg_count: libc::size_t,
1137    ) -> *mut CVastMacroRef;
1138    pub fn xls_vast_verilog_file_make_macro_statement(
1139        f: *mut CVastFile,
1140        r#ref: *mut CVastMacroRef,
1141        emit_semicolon: bool,
1142    ) -> *mut CVastMacroStatement;
1143
1144    pub fn xls_vast_logic_ref_get_name(v: *mut CVastLogicRef) -> *mut std::os::raw::c_char;
1145
1146    pub fn xls_vast_verilog_file_add_include(f: *mut CVastFile, path: *const std::os::raw::c_char);
1147    pub fn xls_vast_verilog_file_add_blank_line(f: *mut CVastFile, blank_line: *mut CVastBlankLine);
1148    pub fn xls_vast_verilog_file_add_comment(
1149        f: *mut CVastFile,
1150        comment: *const std::os::raw::c_char,
1151    );
1152    pub fn xls_vast_verilog_file_emit(f: *const CVastFile) -> *mut std::os::raw::c_char;
1153    pub fn xls_vast_expression_emit(expr: *mut CVastExpression) -> *mut std::os::raw::c_char;
1154
1155    // -- DSLX
1156
1157    pub fn xls_dslx_import_data_create(
1158        dslx_stdlib_path: *const std::os::raw::c_char,
1159        additional_search_paths: *const *const std::os::raw::c_char,
1160        additional_search_paths_count: libc::size_t,
1161    ) -> *mut CDslxImportData;
1162    pub fn xls_dslx_import_data_free(data: *mut CDslxImportData);
1163
1164    pub fn xls_dslx_parse_and_typecheck(
1165        text: *const std::os::raw::c_char,
1166        path: *const std::os::raw::c_char,
1167        module_name: *const std::os::raw::c_char,
1168        import_data: *const CDslxImportData,
1169        error_out: *mut *mut std::os::raw::c_char,
1170        typechecked_module_out: *mut *mut CDslxTypecheckedModule,
1171    ) -> bool;
1172
1173    pub fn xls_dslx_typechecked_module_clone_removing_functions(
1174        tm: *mut CDslxTypecheckedModule,
1175        functions: *mut *mut CDslxFunction,
1176        function_count: libc::size_t,
1177        install_subject: *const std::os::raw::c_char,
1178        import_data: *mut CDslxImportData,
1179        error_out: *mut *mut std::os::raw::c_char,
1180        result_out: *mut *mut CDslxTypecheckedModule,
1181    ) -> bool;
1182
1183    pub fn xls_dslx_typechecked_module_clone_removing_members(
1184        tm: *mut CDslxTypecheckedModule,
1185        members: *mut *mut CDslxModuleMember,
1186        member_count: libc::size_t,
1187        install_subject: *const std::os::raw::c_char,
1188        import_data: *mut CDslxImportData,
1189        error_out: *mut *mut std::os::raw::c_char,
1190        result_out: *mut *mut CDslxTypecheckedModule,
1191    ) -> bool;
1192
1193    pub fn xls_dslx_replace_invocations_in_module(
1194        tm: *mut CDslxTypecheckedModule,
1195        callers: *const *mut CDslxFunction,
1196        callers_count: libc::size_t,
1197        rules: *const CDslxInvocationRewriteRule,
1198        rules_count: libc::size_t,
1199        import_data: *mut CDslxImportData,
1200        install_subject: *const std::os::raw::c_char,
1201        error_out: *mut *mut std::os::raw::c_char,
1202        result_out: *mut *mut CDslxTypecheckedModule,
1203    ) -> bool;
1204
1205    pub fn xls_dslx_typechecked_module_insert_function_specializations(
1206        typechecked_module: *mut CDslxTypecheckedModule,
1207        requests: *const XlsDslxFunctionSpecializationRequest,
1208        request_count: libc::size_t,
1209        import_data: *mut CDslxImportData,
1210        install_subject: *const std::os::raw::c_char,
1211        error_out: *mut *mut std::os::raw::c_char,
1212        result_out: *mut *mut CDslxTypecheckedModule,
1213    ) -> bool;
1214
1215    // bool xls_schedule_and_codegen_package(
1216    // struct xls_package* p, const char* scheduling_options_flags_proto,
1217    // const char* codegen_flags_proto, bool with_delay_model, char** error_out,
1218    // struct xls_schedule_and_codegen_result** result_out);
1219    pub fn xls_schedule_and_codegen_package(
1220        p: *mut CIrPackage,
1221        scheduling_options_flags_proto: *const std::os::raw::c_char,
1222        codegen_flags_proto: *const std::os::raw::c_char,
1223        with_delay_model: bool,
1224        error_out: *mut *mut std::os::raw::c_char,
1225        result_out: *mut *mut CScheduleAndCodegenResult,
1226    ) -> bool;
1227
1228    pub fn xls_schedule_and_codegen_result_get_verilog_text(
1229        result: *mut CScheduleAndCodegenResult,
1230    ) -> *mut std::os::raw::c_char;
1231
1232    pub fn xls_schedule_and_codegen_result_free(result: *mut CScheduleAndCodegenResult);
1233
1234    pub fn xls_dslx_typechecked_module_free(module: *mut CDslxTypecheckedModule);
1235
1236    pub fn xls_dslx_typechecked_module_get_module(
1237        module: *mut CDslxTypecheckedModule,
1238    ) -> *mut CDslxModule;
1239
1240    pub fn xls_dslx_typechecked_module_get_type_info(
1241        module: *mut CDslxTypecheckedModule,
1242    ) -> *mut CDslxTypeInfo;
1243
1244    pub fn xls_dslx_module_to_string(module: *mut CDslxModule) -> *mut std::os::raw::c_char;
1245
1246    pub fn xls_dslx_module_get_name(module: *const CDslxModule) -> *mut std::os::raw::c_char;
1247
1248    pub fn xls_dslx_module_get_type_definition_count(module: *const CDslxModule) -> i64;
1249
1250    pub fn xls_dslx_module_get_member_count(module: *const CDslxModule) -> i64;
1251
1252    pub fn xls_dslx_module_get_member(module: *const CDslxModule, i: i64)
1253        -> *mut CDslxModuleMember;
1254
1255    pub fn xls_dslx_module_get_type_definition_kind(
1256        module: *const CDslxModule,
1257        i: i64,
1258    ) -> DslxTypeDefinitionKind;
1259
1260    pub fn xls_dslx_module_get_type_definition_as_struct_def(
1261        module: *const CDslxModule,
1262        i: i64,
1263    ) -> *mut CDslxStructDef;
1264    pub fn xls_dslx_module_get_type_definition_as_enum_def(
1265        module: *const CDslxModule,
1266        i: i64,
1267    ) -> *mut CDslxEnumDef;
1268    pub fn xls_dslx_module_get_type_definition_as_type_alias(
1269        module: *const CDslxModule,
1270        i: i64,
1271    ) -> *mut CDslxTypeAlias;
1272
1273    // -- xls_dslx_module_member
1274    pub fn xls_dslx_module_member_get_kind(
1275        member: *const CDslxModuleMember,
1276    ) -> DslxModuleMemberKind;
1277    pub fn xls_dslx_module_member_get_constant_def(
1278        member: *const CDslxModuleMember,
1279    ) -> *mut CDslxConstantDef;
1280    pub fn xls_dslx_module_member_get_type_alias(
1281        member: *const CDslxModuleMember,
1282    ) -> *mut CDslxTypeAlias;
1283    pub fn xls_dslx_module_member_get_struct_def(
1284        member: *const CDslxModuleMember,
1285    ) -> *mut CDslxStructDef;
1286    pub fn xls_dslx_module_member_get_enum_def(
1287        member: *const CDslxModuleMember,
1288    ) -> *mut CDslxEnumDef;
1289    pub fn xls_dslx_module_member_get_function(
1290        member: *const CDslxModuleMember,
1291    ) -> *mut CDslxFunction;
1292    pub fn xls_dslx_module_member_get_quickcheck(
1293        member: *const CDslxModuleMember,
1294    ) -> *mut CDslxQuickcheck;
1295    pub fn xls_dslx_module_member_from_constant_def(
1296        constant_def: *mut CDslxConstantDef,
1297    ) -> *mut CDslxModuleMember;
1298    pub fn xls_dslx_module_member_from_struct_def(
1299        struct_def: *mut CDslxStructDef,
1300    ) -> *mut CDslxModuleMember;
1301    pub fn xls_dslx_module_member_from_enum_def(
1302        enum_def: *mut CDslxEnumDef,
1303    ) -> *mut CDslxModuleMember;
1304    pub fn xls_dslx_module_member_from_type_alias(
1305        type_alias: *mut CDslxTypeAlias,
1306    ) -> *mut CDslxModuleMember;
1307    pub fn xls_dslx_module_member_from_function(
1308        function: *mut CDslxFunction,
1309    ) -> *mut CDslxModuleMember;
1310    pub fn xls_dslx_module_member_from_quickcheck(
1311        quickcheck: *mut CDslxQuickcheck,
1312    ) -> *mut CDslxModuleMember;
1313
1314    pub fn xls_dslx_colon_ref_get_attr(
1315        colon_ref: *const CDslxColonRef,
1316    ) -> *mut std::os::raw::c_char;
1317
1318    pub fn xls_dslx_type_info_get_type_struct_def(
1319        type_info: *mut CDslxTypeInfo,
1320        node: *mut CDslxStructDef,
1321    ) -> *mut CDslxType;
1322    pub fn xls_dslx_type_info_get_type_enum_def(
1323        type_info: *mut CDslxTypeInfo,
1324        node: *mut CDslxEnumDef,
1325    ) -> *mut CDslxType;
1326    pub fn xls_dslx_type_info_get_type_struct_member(
1327        type_info: *mut CDslxTypeInfo,
1328        member: *mut CDslxStructMember,
1329    ) -> *mut CDslxType;
1330    pub fn xls_dslx_type_info_get_type_type_alias(
1331        type_info: *mut CDslxTypeInfo,
1332        node: *mut CDslxTypeAlias,
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    pub fn xls_vast_statement_block_add_generate_loop(
2177        block: *mut CVastStatementBlock,
2178        genvar_name: *const std::os::raw::c_char,
2179        init: *mut CVastExpression,
2180        limit: *mut CVastExpression,
2181        label: *const std::os::raw::c_char,
2182    ) -> *mut CVastGenerateLoop;
2183
2184    pub fn xls_vast_statement_block_add_continuous_assignment(
2185        block: *mut CVastStatementBlock,
2186        lhs: *mut CVastExpression,
2187        rhs: *mut CVastExpression,
2188    ) -> *mut CVastStatement;
2189
2190    // Conditional (if / else-if / else)
2191    pub fn xls_vast_statement_block_add_conditional(
2192        block: *mut CVastStatementBlock,
2193        cond: *mut CVastExpression,
2194    ) -> *mut CVastConditional;
2195    pub fn xls_vast_conditional_get_then_block(
2196        cond: *mut CVastConditional,
2197    ) -> *mut CVastStatementBlock;
2198    pub fn xls_vast_conditional_add_else_if(
2199        cond: *mut CVastConditional,
2200        expr_cond: *mut CVastExpression,
2201    ) -> *mut CVastStatementBlock;
2202    pub fn xls_vast_conditional_add_else(cond: *mut CVastConditional) -> *mut CVastStatementBlock;
2203
2204    // Case statement builders
2205    pub fn xls_vast_statement_block_add_case(
2206        block: *mut CVastStatementBlock,
2207        selector: *mut CVastExpression,
2208    ) -> *mut CVastCaseStatement;
2209    pub fn xls_vast_case_statement_add_item(
2210        case_stmt: *mut CVastCaseStatement,
2211        match_expr: *mut CVastExpression,
2212    ) -> *mut CVastStatementBlock;
2213    pub fn xls_vast_case_statement_add_default(
2214        case_stmt: *mut CVastCaseStatement,
2215    ) -> *mut CVastStatementBlock;
2216
2217    pub fn xls_vast_generate_loop_get_genvar(loop_: *mut CVastGenerateLoop) -> *mut CVastLogicRef;
2218
2219    pub fn xls_vast_generate_loop_add_statement(
2220        loop_: *mut CVastGenerateLoop,
2221        statement: *mut CVastStatement,
2222    );
2223    pub fn xls_vast_generate_loop_add_generate_loop(
2224        loop_: *mut CVastGenerateLoop,
2225        genvar_name: *const std::os::raw::c_char,
2226        init: *mut CVastExpression,
2227        limit: *mut CVastExpression,
2228        label: *const std::os::raw::c_char,
2229    ) -> *mut CVastGenerateLoop;
2230    pub fn xls_vast_generate_loop_add_always_comb(
2231        loop_: *mut CVastGenerateLoop,
2232        out_always_comb: *mut *mut CVastAlwaysBase,
2233        error_out: *mut *mut std::os::raw::c_char,
2234    ) -> bool;
2235    pub fn xls_vast_generate_loop_add_always_ff(
2236        loop_: *mut CVastGenerateLoop,
2237        sensitivity_list_elements: *mut *mut CVastExpression,
2238        sensitivity_list_count: usize,
2239        out_always_ff: *mut *mut CVastAlwaysBase,
2240        error_out: *mut *mut std::os::raw::c_char,
2241    ) -> bool;
2242    pub fn xls_vast_generate_loop_add_localparam(
2243        loop_: *mut CVastGenerateLoop,
2244        name: *const std::os::raw::c_char,
2245        rhs: *mut CVastExpression,
2246    ) -> *mut CVastLocalparamRef;
2247    pub fn xls_vast_generate_loop_add_localparam_with_def(
2248        loop_: *mut CVastGenerateLoop,
2249        def: *mut CVastDef,
2250        rhs: *mut CVastExpression,
2251    ) -> *mut CVastLocalparamRef;
2252    pub fn xls_vast_generate_loop_add_continuous_assignment(
2253        loop_: *mut CVastGenerateLoop,
2254        lhs: *mut CVastExpression,
2255        rhs: *mut CVastExpression,
2256    ) -> *mut CVastStatement;
2257    pub fn xls_vast_generate_loop_add_blank_line(loop_: *mut CVastGenerateLoop);
2258    pub fn xls_vast_generate_loop_add_comment(
2259        loop_: *mut CVastGenerateLoop,
2260        comment: *mut CVastComment,
2261    );
2262    pub fn xls_vast_generate_loop_add_instantiation(
2263        loop_: *mut CVastGenerateLoop,
2264        instantiation: *mut CVastInstantiation,
2265    );
2266    pub fn xls_vast_generate_loop_add_inline_verilog_statement(
2267        loop_: *mut CVastGenerateLoop,
2268        stmt: *mut CVastInlineVerilogStatement,
2269    );
2270    pub fn xls_vast_generate_loop_add_macro_statement(
2271        loop_: *mut CVastGenerateLoop,
2272        macro_statement: *mut CVastMacroStatement,
2273    );
2274
2275    pub fn xls_function_type_get_param_count(fty: *mut CIrFunctionType) -> i64;
2276
2277    pub fn xls_function_type_get_param_type(
2278        fty: *mut CIrFunctionType,
2279        index: libc::size_t,
2280        error_out: *mut *mut std::os::raw::c_char,
2281        param_type_out: *mut *mut CIrType,
2282    ) -> bool;
2283
2284    pub fn xls_function_type_get_return_type(fty: *mut CIrFunctionType) -> *mut CIrType;
2285
2286    pub fn xls_function_get_param_name(
2287        function: *mut CIrFunction,
2288        index: libc::size_t,
2289        error_out: *mut *mut std::os::raw::c_char,
2290        name_out: *mut *mut std::os::raw::c_char,
2291    ) -> bool;
2292
2293    pub fn xls_dslx_function_is_parametric(function: *const CDslxFunction) -> bool;
2294    pub fn xls_dslx_function_is_public(function: *const CDslxFunction) -> bool;
2295    pub fn xls_dslx_function_get_identifier(
2296        function: *const CDslxFunction,
2297    ) -> *mut std::os::raw::c_char;
2298
2299    pub fn xls_dslx_function_get_param_count(function: *const CDslxFunction) -> i64;
2300    pub fn xls_dslx_function_get_parametric_binding_count(function: *const CDslxFunction) -> i64;
2301    pub fn xls_dslx_function_get_param(
2302        function: *const CDslxFunction,
2303        index: i64,
2304    ) -> *mut CDslxParam;
2305    pub fn xls_dslx_function_get_parametric_binding(
2306        function: *const CDslxFunction,
2307        index: i64,
2308    ) -> *mut CDslxParametricBinding;
2309    pub fn xls_dslx_function_get_body(function: *const CDslxFunction) -> *mut CDslxExpr;
2310    pub fn xls_dslx_function_get_return_type(
2311        function: *const CDslxFunction,
2312    ) -> *mut CDslxTypeAnnotation;
2313    pub fn xls_dslx_function_get_attribute_count(function: *const CDslxFunction) -> i64;
2314    pub fn xls_dslx_function_get_attribute(
2315        function: *const CDslxFunction,
2316        index: i64,
2317    ) -> *mut CDslxAttribute;
2318    pub fn xls_dslx_param_get_name(param: *const CDslxParam) -> *mut std::os::raw::c_char;
2319    pub fn xls_dslx_param_get_type_annotation(param: *const CDslxParam)
2320        -> *mut CDslxTypeAnnotation;
2321    pub fn xls_dslx_attribute_get_kind(attribute: *const CDslxAttribute) -> DslxAttributeKind;
2322    pub fn xls_dslx_attribute_get_argument_count(attribute: *const CDslxAttribute) -> i64;
2323    pub fn xls_dslx_attribute_get_argument_kind(
2324        attribute: *const CDslxAttribute,
2325        index: i64,
2326    ) -> DslxAttributeArgumentKind;
2327    pub fn xls_dslx_attribute_get_string_argument(
2328        attribute: *const CDslxAttribute,
2329        index: i64,
2330    ) -> *mut std::os::raw::c_char;
2331    pub fn xls_dslx_attribute_get_string_literal_argument(
2332        attribute: *const CDslxAttribute,
2333        index: i64,
2334    ) -> *mut std::os::raw::c_char;
2335    pub fn xls_dslx_attribute_get_key_value_argument_key(
2336        attribute: *const CDslxAttribute,
2337        index: i64,
2338    ) -> *mut std::os::raw::c_char;
2339    pub fn xls_dslx_attribute_get_key_value_string_argument_value(
2340        attribute: *const CDslxAttribute,
2341        index: i64,
2342    ) -> *mut std::os::raw::c_char;
2343    pub fn xls_dslx_attribute_get_key_value_int_argument_value(
2344        attribute: *const CDslxAttribute,
2345        index: i64,
2346    ) -> i64;
2347    pub fn xls_dslx_attribute_to_string(
2348        attribute: *const CDslxAttribute,
2349    ) -> *mut std::os::raw::c_char;
2350    pub fn xls_dslx_parametric_binding_get_identifier(
2351        binding: *const CDslxParametricBinding,
2352    ) -> *mut std::os::raw::c_char;
2353    pub fn xls_dslx_parametric_binding_get_type_annotation(
2354        binding: *const CDslxParametricBinding,
2355    ) -> *mut CDslxTypeAnnotation;
2356    pub fn xls_dslx_parametric_binding_get_expr(
2357        binding: *const CDslxParametricBinding,
2358    ) -> *mut CDslxExpr;
2359
2360    // -- "requires implicit token?" determination for a DSLX function
2361    pub fn xls_dslx_type_info_get_requires_implicit_token(
2362        type_info: *mut CDslxTypeInfo,
2363        function: *mut CDslxFunction,
2364        error_out: *mut *mut std::os::raw::c_char,
2365        result_out: *mut bool,
2366    ) -> bool;
2367
2368    // -- Quickcheck APIs
2369    pub fn xls_dslx_quickcheck_get_function(qc: *const CDslxQuickcheck) -> *mut CDslxFunction;
2370
2371    /// Returns true iff the Quickcheck has the `exhaustive` test-cases
2372    /// specifier.
2373    pub fn xls_dslx_quickcheck_is_exhaustive(qc: *const CDslxQuickcheck) -> bool;
2374
2375    /// Retrieves the test-case count for the Quickcheck. Returns true and sets
2376    /// `*result_out` when the Quickcheck has a counted test-case specifier;
2377    /// returns false when the Quickcheck is marked exhaustive (in which case
2378    /// `*result_out` is not modified).
2379    pub fn xls_dslx_quickcheck_get_count(qc: *const CDslxQuickcheck, result_out: *mut i64) -> bool;
2380}
2381
2382pub const DSLX_STDLIB_PATH: &str = env!("DSLX_STDLIB_PATH");
2383
2384/// Directory containing the libxls DSO.
2385///
2386/// *** DO NOT USE THIS VARIABLE FROM WITHIN YOUR build.rs ***
2387///
2388/// You might be tempted to write the following in your build.rs:
2389///
2390/// ```ignore
2391/// // DO NOT DO THIS IN YOUR build.rs!!
2392/// let dylib_dirpath = xlsynth_sys::XLS_DSO_PATH;
2393/// // set rpath to dylib_dirpath or something.
2394/// ```
2395///
2396/// The problem is that build.rs is compiled for host, whereas if you're setting
2397/// an rpath (or something similar) you want to get the path from compiling
2398/// xlsynth_sys for *target*.  In other words, the above will break
2399/// cross-compilation.
2400///
2401/// Instead, your build.rs should get the path from an envvar which:
2402///
2403/// ```ignore
2404/// // Do this from your build.rs instead.
2405/// let dylib_path = std::env::var("DEP_XLSYNTH_DSO_PATH").unwrap();
2406/// ```
2407///
2408/// More details are available at
2409/// <https://doc.rust-lang.org/cargo/reference/build-script-examples.html#using-another-sys-crate>.
2410///
2411/// (If you use this envvar from your crate proper -- i.e. not from build.rs --
2412/// then it's perfectly fine.)
2413pub const XLS_DSO_PATH: &str = env!("XLS_DSO_PATH");
2414
2415// Add opaque types for module port and def.
2416#[repr(C)]
2417pub struct CVastModulePort {
2418    _private: [u8; 0], // Ensures the struct cannot be instantiated
2419}
2420
2421#[repr(C)]
2422pub struct CVastDef {
2423    _private: [u8; 0], // Ensures the struct cannot be instantiated
2424}
2425
2426// Direction enum for module ports.
2427pub type VastModulePortDirection = i32;
2428
2429// Constants that match the C enum definitions.
2430pub const XLS_VAST_MODULE_PORT_DIRECTION_INPUT: VastModulePortDirection = 0;
2431pub const XLS_VAST_MODULE_PORT_DIRECTION_OUTPUT: VastModulePortDirection = 1;
2432
2433extern "C" {
2434    // -- Module port inspection APIs
2435    pub fn xls_vast_verilog_module_get_ports(
2436        m: *mut CVastModule,
2437        out_count: *mut libc::size_t,
2438    ) -> *mut *mut CVastModulePort;
2439
2440    pub fn xls_vast_verilog_module_free_ports(
2441        ports: *mut *mut CVastModulePort,
2442        count: libc::size_t,
2443    );
2444
2445    pub fn xls_vast_verilog_module_port_get_direction(
2446        port: *mut CVastModulePort,
2447    ) -> VastModulePortDirection;
2448
2449    pub fn xls_vast_verilog_module_port_get_def(port: *mut CVastModulePort) -> *mut CVastDef;
2450
2451    pub fn xls_vast_def_get_name(def: *mut CVastDef) -> *mut std::os::raw::c_char;
2452
2453    pub fn xls_vast_def_get_data_type(def: *mut CVastDef) -> *mut CVastDataType;
2454}