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 CIrPackage {
19    _private: [u8; 0], // Ensures the struct cannot be instantiated
20}
21
22#[repr(C)]
23pub struct CIrFunction {
24    _private: [u8; 0], // Ensures the struct cannot be instantiated
25}
26
27#[repr(C)]
28pub struct CIrFunctionJit {
29    _private: [u8; 0], // Ensures the struct cannot be instantiated
30}
31
32#[repr(C)]
33pub struct CTraceMessage {
34    pub message: *mut std::os::raw::c_char,
35    pub verbosity: i64,
36}
37
38#[repr(C)]
39pub struct CIrType {
40    _private: [u8; 0], // Ensures the struct cannot be instantiated
41}
42
43#[repr(C)]
44pub struct CIrFunctionType {
45    _private: [u8; 0], // Ensures the struct cannot be instantiated
46}
47
48// "VAST" is the "Verilog AST" API which
49#[repr(C)]
50pub struct CVastFile {
51    _private: [u8; 0], // Ensures the struct cannot be instantiated
52}
53
54#[repr(C)]
55pub struct CVastModule {
56    _private: [u8; 0], // Ensures the struct cannot be instantiated
57}
58
59#[repr(C)]
60pub struct CVastDataType {
61    _private: [u8; 0], // Ensures the struct cannot be instantiated
62}
63
64#[repr(C)]
65pub struct CVastExpression {
66    _private: [u8; 0], // Ensures the struct cannot be instantiated
67}
68
69#[repr(C)]
70pub struct CVastLiteral {
71    _private: [u8; 0], // Ensures the struct cannot be instantiated
72}
73
74#[repr(C)]
75pub struct CVastLogicRef {
76    _private: [u8; 0], // Ensures the struct cannot be instantiated
77}
78
79#[repr(C)]
80pub struct CVastInstantiation {
81    _private: [u8; 0], // Ensures the struct cannot be instantiated
82}
83
84#[repr(C)]
85pub struct CVastContinuousAssignment {
86    _private: [u8; 0], // Ensures the struct cannot be instantiated
87}
88
89#[repr(C)]
90pub struct CVastSlice {
91    _private: [u8; 0], // Ensures the struct cannot be instantiated
92}
93
94#[repr(C)]
95pub struct CVastIndex {
96    _private: [u8; 0], // Ensures the struct cannot be instantiated
97}
98
99#[repr(C)]
100pub struct CVastIndexableExpression {
101    _private: [u8; 0], // Ensures the struct cannot be instantiated
102}
103
104// -- DSLX
105
106#[repr(C)]
107pub struct CDslxImportData {
108    _private: [u8; 0], // Ensures the struct cannot be instantiated
109}
110
111#[repr(C)]
112pub struct CDslxTypecheckedModule {
113    _private: [u8; 0], // Ensures the struct cannot be instantiated
114}
115
116#[repr(C)]
117pub struct CDslxModule {
118    _private: [u8; 0], // Ensures the struct cannot be instantiated
119}
120
121#[repr(C)]
122pub struct CDslxTypeInfo {
123    _private: [u8; 0], // Ensures the struct cannot be instantiated
124}
125
126#[repr(C)]
127pub struct CDslxStructDef {
128    _private: [u8; 0], // Ensures the struct cannot be instantiated
129}
130
131#[repr(C)]
132pub struct CDslxEnumDef {
133    _private: [u8; 0], // Ensures the struct cannot be instantiated
134}
135
136#[repr(C)]
137pub struct CDslxTypeAlias {
138    _private: [u8; 0], // Ensures the struct cannot be instantiated
139}
140
141#[repr(C)]
142pub struct CDslxType {
143    _private: [u8; 0], // Ensures the struct cannot be instantiated
144}
145
146#[repr(C)]
147pub struct CDslxTypeDim {
148    _private: [u8; 0], // Ensures the struct cannot be instantiated
149}
150
151#[repr(C)]
152pub struct CDslxExpr {
153    _private: [u8; 0], // Ensures the struct cannot be instantiated
154}
155
156#[repr(C)]
157pub struct CDslxInterpValue {
158    _private: [u8; 0], // Ensures the struct cannot be instantiated
159}
160
161#[repr(C)]
162pub struct CDslxEnumMember {
163    _private: [u8; 0], // Ensures the struct cannot be instantiated
164}
165
166#[repr(C)]
167pub struct CDslxStructMember {
168    _private: [u8; 0], // Ensures the struct cannot be instantiated
169}
170
171#[repr(C)]
172pub struct CDslxTypeAnnotation {
173    _private: [u8; 0], // Ensures the struct cannot be instantiated
174}
175
176#[repr(C)]
177pub struct CDslxTypeRefTypeAnnotation {
178    _private: [u8; 0], // Ensures the struct cannot be instantiated
179}
180
181#[repr(C)]
182pub struct CDslxTypeRef {
183    _private: [u8; 0], // Ensures the struct cannot be instantiated
184}
185
186#[repr(C)]
187pub struct CDslxImport {
188    _private: [u8; 0], // Ensures the struct cannot be instantiated
189}
190
191#[repr(C)]
192pub struct CDslxColonRef {
193    _private: [u8; 0], // Ensures the struct cannot be instantiated
194}
195
196#[repr(C)]
197pub struct CDslxTypeDefinition {
198    _private: [u8; 0], // Ensures the struct cannot be instantiated
199}
200
201#[repr(C)]
202pub struct CDslxConstantDef {
203    _private: [u8; 0], // Ensures the struct cannot be instantiated
204}
205
206#[repr(C)]
207pub struct CDslxModuleMember {
208    _private: [u8; 0], // Ensures the struct cannot be instantiated
209}
210
211#[repr(C)]
212pub struct CScheduleAndCodegenResult {
213    _private: [u8; 0], // Ensures the struct cannot be instantiated
214}
215
216#[repr(C)]
217pub struct CIrBuilderBase {
218    _private: [u8; 0], // Ensures the struct cannot be instantiated
219}
220
221#[repr(C)]
222pub struct CIrBValue {
223    _private: [u8; 0], // Ensures the struct cannot be instantiated
224}
225
226#[repr(C)]
227pub struct CIrFunctionBuilder {
228    _private: [u8; 0], // Ensures the struct cannot be instantiated
229}
230
231pub type XlsFormatPreference = i32;
232
233pub type VastFileType = i32;
234
235pub type VastOperatorKind = i32;
236
237pub type DslxTypeDefinitionKind = i32;
238
239pub type DslxModuleMemberKind = i32;
240
241extern "C" {
242    pub fn xls_convert_dslx_to_ir(
243        dslx: *const std::os::raw::c_char,
244        path: *const std::os::raw::c_char,
245        module_name: *const std::os::raw::c_char,
246        dslx_stdlib_path: *const std::os::raw::c_char,
247        additional_search_paths: *const *const std::os::raw::c_char,
248        additional_search_paths_count: libc::size_t,
249        error_out: *mut *mut std::os::raw::c_char,
250        ir_out: *mut *mut std::os::raw::c_char,
251    ) -> bool;
252
253    pub fn xls_convert_dslx_to_ir_with_warnings(
254        dslx: *const std::os::raw::c_char,
255        path: *const std::os::raw::c_char,
256        module_name: *const std::os::raw::c_char,
257        dslx_stdlib_path: *const std::os::raw::c_char,
258        additional_search_paths: *const *const std::os::raw::c_char,
259        additional_search_paths_count: libc::size_t,
260        enable_warnings: *const *const std::os::raw::c_char,
261        enable_warnings_count: libc::size_t,
262        disable_warnings: *const *const std::os::raw::c_char,
263        disable_warnings_count: libc::size_t,
264        warnings_as_errors: bool,
265        warnings_out: *mut *mut *mut std::os::raw::c_char,
266        warnings_out_count: *mut libc::size_t,
267        error_out: *mut *mut std::os::raw::c_char,
268        ir_out: *mut *mut std::os::raw::c_char,
269    ) -> bool;
270
271    pub fn xls_parse_typed_value(
272        text: *const std::os::raw::c_char,
273        error_out: *mut *mut std::os::raw::c_char,
274        value_out: *mut *mut CIrValue,
275    ) -> bool;
276    pub fn xls_value_free(value: *mut CIrValue);
277
278    pub fn xls_value_clone(value: *const CIrValue) -> *mut CIrValue;
279
280    // Extracts a bits value from a (boxed) value or gives an error.
281    pub fn xls_value_get_bits(
282        value: *const CIrValue,
283        error_out: *mut *mut std::os::raw::c_char,
284        bits_out: *mut *mut CIrBits,
285    ) -> bool;
286
287    // Turns a span of IR values into a tuple value.
288    pub fn xls_value_make_tuple(
289        value_count: libc::size_t,
290        values: *const *const CIrValue,
291    ) -> *mut CIrValue;
292
293    /// Returns an error:
294    /// * if the elements do not all have the same type, or
295    /// * if the array is empty (because then we cannot determine the element
296    ///   type)
297    pub fn xls_value_make_array(
298        element_count: libc::size_t,
299        elements: *const *const CIrValue,
300        error_out: *mut *mut std::os::raw::c_char,
301        result_out: *mut *mut CIrValue,
302    ) -> bool;
303
304    // Extracts an element from a tuple/array value or gives an error (e.g. if this
305    // value is not a tuple/array or the index is out of bounds).
306    pub fn xls_value_get_element(
307        tuple: *const CIrValue,
308        index: libc::size_t,
309        error_out: *mut *mut std::os::raw::c_char,
310        element_out: *mut *mut CIrValue,
311    ) -> bool;
312
313    pub fn xls_value_get_element_count(
314        value: *const CIrValue,
315        error_out: *mut *mut std::os::raw::c_char,
316        count_out: *mut i64,
317    ) -> bool;
318
319    // Creates a bits value (via an unsigned integer) that is boxed in an IrValue.
320    pub fn xls_value_make_ubits(
321        bit_count: i64,
322        value: u64,
323        error_out: *mut *mut std::os::raw::c_char,
324        result_out: *mut *mut CIrValue,
325    ) -> bool;
326
327    // Creates a bits value (via a signed integer) that is boxed in an IrValue.
328    pub fn xls_value_make_sbits(
329        bit_count: i64,
330        value: i64,
331        error_out: *mut *mut std::os::raw::c_char,
332        result_out: *mut *mut CIrValue,
333    ) -> bool;
334
335    // Boxes an IR bits object into an IR value.
336    pub fn xls_value_from_bits(bits: *const CIrBits) -> *mut CIrValue;
337
338    pub fn xls_bits_make_ubits(
339        bit_count: i64,
340        value: u64,
341        error_out: *mut *mut std::os::raw::c_char,
342        bits_out: *mut *mut CIrBits,
343    ) -> bool;
344
345    pub fn xls_bits_make_sbits(
346        bit_count: i64,
347        value: i64,
348        error_out: *mut *mut std::os::raw::c_char,
349        bits_out: *mut *mut CIrBits,
350    ) -> bool;
351
352    pub fn xls_bits_free(bits: *mut CIrBits);
353    pub fn xls_bits_get_bit_count(bits: *const CIrBits) -> i64;
354    pub fn xls_bits_get_bit(bits: *const CIrBits, index: i64) -> bool;
355    pub fn xls_bits_eq(bits: *const CIrBits, other: *const CIrBits) -> bool;
356    pub fn xls_bits_to_debug_string(bits: *const CIrBits) -> *mut std::os::raw::c_char;
357    pub fn xls_bits_add(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
358    pub fn xls_bits_umul(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
359    pub fn xls_bits_smul(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
360    pub fn xls_bits_negate(bits: *const CIrBits) -> *mut CIrBits;
361    pub fn xls_bits_abs(bits: *const CIrBits) -> *mut CIrBits;
362    pub fn xls_bits_not(bits: *const CIrBits) -> *mut CIrBits;
363    pub fn xls_bits_and(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
364    pub fn xls_bits_or(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
365    pub fn xls_bits_xor(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
366
367    pub fn xls_bits_shift_left_logical(bits: *const CIrBits, shift_amount: i64) -> *mut CIrBits;
368    pub fn xls_bits_shift_right_logical(bits: *const CIrBits, shift_amount: i64) -> *mut CIrBits;
369    pub fn xls_bits_shift_right_arithmetic(bits: *const CIrBits, shift_amount: i64)
370        -> *mut CIrBits;
371
372    // struct xls_bits* xls_bits_width_slice(const struct xls_bits* bits, int64_t
373    // start, int64_t width);
374
375    pub fn xls_bits_width_slice(bits: *const CIrBits, start: i64, width: i64) -> *mut CIrBits;
376
377    pub fn xls_package_free(package: *mut CIrPackage);
378    pub fn xls_c_str_free(c_str: *mut std::os::raw::c_char);
379    pub fn xls_c_strs_free(c_strs: *mut *mut std::os::raw::c_char, count: libc::size_t);
380    pub fn xls_value_to_string(
381        value: *const CIrValue,
382        str_out: *mut *mut std::os::raw::c_char,
383    ) -> bool;
384    pub fn xls_format_preference_from_string(
385        s: *const std::os::raw::c_char,
386        error_out: *mut *mut std::os::raw::c_char,
387        result_out: *mut XlsFormatPreference,
388    ) -> bool;
389
390    pub fn xls_value_to_string_format_preference(
391        value: *const CIrValue,
392        fmt: XlsFormatPreference,
393        error_out: *mut *mut std::os::raw::c_char,
394        str_out: *mut *mut std::os::raw::c_char,
395    ) -> bool;
396    pub fn xls_bits_to_string(
397        bits: *const CIrBits,
398        fmt: XlsFormatPreference,
399        include_bit_count: bool,
400        error_out: *mut *mut std::os::raw::c_char,
401        str_out: *mut *mut std::os::raw::c_char,
402    ) -> bool;
403
404    pub fn xls_value_eq(value: *const CIrValue, value: *const CIrValue) -> bool;
405    pub fn xls_parse_ir_package(
406        ir: *const std::os::raw::c_char,
407        filename: *const std::os::raw::c_char,
408        error_out: *mut *mut std::os::raw::c_char,
409        xls_package_out: *mut *mut CIrPackage,
410    ) -> bool;
411    pub fn xls_type_to_string(
412        t: *const CIrType,
413        error_out: *mut *mut std::os::raw::c_char,
414        result_out: *mut *mut std::os::raw::c_char,
415    ) -> bool;
416    pub fn xls_package_get_type_for_value(
417        package: *const CIrPackage,
418        value: *const CIrValue,
419        error_out: *mut *mut std::os::raw::c_char,
420        result_out: *mut *mut CIrType,
421    ) -> bool;
422    pub fn xls_package_get_function(
423        package: *const CIrPackage,
424        function_name: *const std::os::raw::c_char,
425        error_out: *mut *mut std::os::raw::c_char,
426        result_out: *mut *mut CIrFunction,
427    ) -> bool;
428    pub fn xls_function_get_type(
429        function: *const CIrFunction,
430        error_out: *mut *mut std::os::raw::c_char,
431        xls_fn_type_out: *mut *mut CIrFunctionType,
432    ) -> bool;
433    pub fn xls_function_type_to_string(
434        t: *const CIrFunctionType,
435        error_out: *mut *mut std::os::raw::c_char,
436        string_out: *mut *mut std::os::raw::c_char,
437    ) -> bool;
438    pub fn xls_function_get_name(
439        function: *const CIrFunction,
440        error_out: *mut *mut std::os::raw::c_char,
441        name_out: *mut *mut std::os::raw::c_char,
442    ) -> bool;
443    pub fn xls_interpret_function(
444        function: *const CIrFunction,
445        argc: libc::size_t,
446        args: *const *const CIrValue,
447        error_out: *mut *mut std::os::raw::c_char,
448        result_out: *mut *mut CIrValue,
449    ) -> bool;
450    pub fn xls_optimize_ir(
451        ir: *const std::os::raw::c_char,
452        top: *const std::os::raw::c_char,
453        error_out: *mut *mut std::os::raw::c_char,
454        ir_out: *mut *mut std::os::raw::c_char,
455    ) -> bool;
456    pub fn xls_mangle_dslx_name(
457        module_name: *const std::os::raw::c_char,
458        function_name: *const std::os::raw::c_char,
459        error_out: *mut *mut std::os::raw::c_char,
460        mangled_out: *mut *mut std::os::raw::c_char,
461    ) -> bool;
462    pub fn xls_package_to_string(
463        p: *const CIrPackage,
464        string_out: *mut *mut std::os::raw::c_char,
465    ) -> bool;
466    pub fn xls_package_set_top_by_name(
467        p: *mut CIrPackage,
468        name: *const std::os::raw::c_char,
469        error_out: *mut *mut std::os::raw::c_char,
470    ) -> bool;
471
472    pub fn xls_make_function_jit(
473        function: *const CIrFunction,
474        error_out: *mut *mut std::os::raw::c_char,
475        result_out: *mut *mut CIrFunctionJit,
476    ) -> bool;
477    pub fn xls_function_jit_free(jit: *mut CIrFunctionJit);
478    pub fn xls_function_jit_run(
479        jit: *const CIrFunctionJit,
480        argc: libc::size_t,
481        args: *const *const CIrValue,
482        error_out: *mut *mut std::os::raw::c_char,
483        trace_messages_out: *mut *mut CTraceMessage,
484        trace_messages_count_out: *mut libc::size_t,
485        assert_messages_out: *mut *mut *mut std::os::raw::c_char,
486        assert_messages_count_out: *mut libc::size_t,
487        result_out: *mut *mut CIrValue,
488    ) -> bool;
489    pub fn xls_trace_messages_free(trace_messages: *mut CTraceMessage, count: libc::size_t);
490
491    // -- VAST APIs
492
493    pub fn xls_vast_make_verilog_file(file_type: VastFileType) -> *mut CVastFile;
494    pub fn xls_vast_verilog_file_free(f: *mut CVastFile);
495    pub fn xls_vast_verilog_file_add_module(
496        f: *mut CVastFile,
497        name: *const std::os::raw::c_char,
498    ) -> *mut CVastModule;
499
500    // - Node creation
501    pub fn xls_vast_verilog_file_make_scalar_type(f: *mut CVastFile) -> *mut CVastDataType;
502    pub fn xls_vast_verilog_file_make_bit_vector_type(
503        f: *mut CVastFile,
504        bit_count: i64,
505        is_signed: bool,
506    ) -> *mut CVastDataType;
507    pub fn xls_vast_verilog_file_make_extern_package_type(
508        f: *mut CVastFile,
509        package_name: *const std::os::raw::c_char,
510        type_name: *const std::os::raw::c_char,
511    ) -> *mut CVastDataType;
512    pub fn xls_vast_verilog_file_make_packed_array_type(
513        f: *mut CVastFile,
514        element_type: *mut CVastDataType,
515        dims: *const i64,
516        dim_count: libc::size_t,
517    ) -> *mut CVastDataType;
518
519    pub fn xls_vast_verilog_file_make_continuous_assignment(
520        f: *mut CVastFile,
521        lhs: *mut CVastExpression,
522        rhs: *mut CVastExpression,
523    ) -> *mut CVastContinuousAssignment;
524
525    pub fn xls_vast_verilog_file_make_concat(
526        f: *mut CVastFile,
527        expressions: *mut *mut CVastExpression,
528        expression_count: libc::size_t,
529    ) -> *mut CVastExpression;
530
531    pub fn xls_vast_verilog_file_make_slice_i64(
532        f: *mut CVastFile,
533        subject: *mut CVastIndexableExpression,
534        hi: i64,
535        lo: i64,
536    ) -> *mut CVastSlice;
537
538    pub fn xls_vast_verilog_file_make_index(
539        f: *mut CVastFile,
540        subject: *mut CVastIndexableExpression,
541        index: *mut CVastExpression,
542    ) -> *mut CVastIndex;
543    pub fn xls_vast_verilog_file_make_index_i64(
544        f: *mut CVastFile,
545        subject: *mut CVastIndexableExpression,
546        index: i64,
547    ) -> *mut CVastIndex;
548
549    pub fn xls_vast_verilog_file_make_unary(
550        f: *mut CVastFile,
551        arg: *mut CVastExpression,
552        op: VastOperatorKind,
553    ) -> *mut CVastExpression;
554
555    pub fn xls_vast_verilog_file_make_binary(
556        f: *mut CVastFile,
557        lhs: *mut CVastExpression,
558        rhs: *mut CVastExpression,
559        op: VastOperatorKind,
560    ) -> *mut CVastExpression;
561
562    pub fn xls_vast_verilog_file_make_ternary(
563        f: *mut CVastFile,
564        cond: *mut CVastExpression,
565        consequent: *mut CVastExpression,
566        alternate: *mut CVastExpression,
567    ) -> *mut CVastExpression;
568
569    pub fn xls_vast_verilog_file_make_instantiation(
570        f: *mut CVastFile,
571        module_name: *const std::os::raw::c_char,
572        instance_name: *const std::os::raw::c_char,
573        parameter_port_names: *const *const std::os::raw::c_char,
574        parameter_expressions: *const *const CVastExpression,
575        parameter_count: libc::size_t,
576        connection_port_names: *const *const std::os::raw::c_char,
577        connection_expressions: *const *const CVastExpression,
578        connection_count: libc::size_t,
579    ) -> *mut CVastInstantiation;
580    pub fn xls_vast_verilog_file_make_literal(
581        f: *mut CVastFile,
582        bits: *const CIrBits,
583        format_preference: XlsFormatPreference,
584        emit_bit_count: bool,
585        error_out: *mut *mut std::os::raw::c_char,
586        literal_out: *mut *mut CVastLiteral,
587    ) -> bool;
588
589    // - Module additions
590    pub fn xls_vast_verilog_module_add_input(
591        m: *mut CVastModule,
592        name: *const std::os::raw::c_char,
593        type_: *mut CVastDataType,
594    ) -> *mut CVastLogicRef;
595    pub fn xls_vast_verilog_module_add_output(
596        m: *mut CVastModule,
597        name: *const std::os::raw::c_char,
598        type_: *mut CVastDataType,
599    ) -> *mut CVastLogicRef;
600    pub fn xls_vast_verilog_module_add_wire(
601        m: *mut CVastModule,
602        name: *const std::os::raw::c_char,
603        type_: *mut CVastDataType,
604    ) -> *mut CVastLogicRef;
605    pub fn xls_vast_verilog_module_add_member_instantiation(
606        m: *mut CVastModule,
607        inst: *mut CVastInstantiation,
608    );
609    pub fn xls_vast_verilog_module_add_member_continuous_assignment(
610        m: *mut CVastModule,
611        ca: *mut CVastContinuousAssignment,
612    );
613
614    // - Expression conversions
615    pub fn xls_vast_logic_ref_as_indexable_expression(
616        v: *mut CVastLogicRef,
617    ) -> *mut CVastIndexableExpression;
618    pub fn xls_vast_index_as_indexable_expression(
619        v: *mut CVastIndex,
620    ) -> *mut CVastIndexableExpression;
621
622    pub fn xls_vast_literal_as_expression(v: *mut CVastLiteral) -> *mut CVastExpression;
623    pub fn xls_vast_logic_ref_as_expression(v: *mut CVastLogicRef) -> *mut CVastExpression;
624    pub fn xls_vast_slice_as_expression(v: *mut CVastSlice) -> *mut CVastExpression;
625    pub fn xls_vast_index_as_expression(v: *mut CVastIndex) -> *mut CVastExpression;
626
627    pub fn xls_vast_verilog_file_add_include(f: *mut CVastFile, path: *const std::os::raw::c_char);
628    pub fn xls_vast_verilog_file_emit(f: *const CVastFile) -> *mut std::os::raw::c_char;
629
630    // -- DSLX
631
632    pub fn xls_dslx_import_data_create(
633        dslx_stdlib_path: *const std::os::raw::c_char,
634        additional_search_paths: *const *const std::os::raw::c_char,
635        additional_search_paths_count: libc::size_t,
636    ) -> *mut CDslxImportData;
637    pub fn xls_dslx_import_data_free(data: *mut CDslxImportData);
638
639    pub fn xls_dslx_parse_and_typecheck(
640        text: *const std::os::raw::c_char,
641        path: *const std::os::raw::c_char,
642        module_name: *const std::os::raw::c_char,
643        import_data: *const CDslxImportData,
644        error_out: *mut *mut std::os::raw::c_char,
645        typechecked_module_out: *mut *mut CDslxTypecheckedModule,
646    ) -> bool;
647
648    // bool xls_schedule_and_codegen_package(
649    // struct xls_package* p, const char* scheduling_options_flags_proto,
650    // const char* codegen_flags_proto, bool with_delay_model, char** error_out,
651    // struct xls_schedule_and_codegen_result** result_out);
652    pub fn xls_schedule_and_codegen_package(
653        p: *mut CIrPackage,
654        scheduling_options_flags_proto: *const std::os::raw::c_char,
655        codegen_flags_proto: *const std::os::raw::c_char,
656        with_delay_model: bool,
657        error_out: *mut *mut std::os::raw::c_char,
658        result_out: *mut *mut CScheduleAndCodegenResult,
659    ) -> bool;
660
661    pub fn xls_schedule_and_codegen_result_get_verilog_text(
662        result: *mut CScheduleAndCodegenResult,
663    ) -> *mut std::os::raw::c_char;
664
665    pub fn xls_schedule_and_codegen_result_free(result: *mut CScheduleAndCodegenResult);
666
667    pub fn xls_dslx_typechecked_module_free(module: *mut CDslxTypecheckedModule);
668
669    pub fn xls_dslx_typechecked_module_get_module(
670        module: *mut CDslxTypecheckedModule,
671    ) -> *mut CDslxModule;
672
673    pub fn xls_dslx_typechecked_module_get_type_info(
674        module: *mut CDslxTypecheckedModule,
675    ) -> *mut CDslxTypeInfo;
676
677    pub fn xls_dslx_module_get_name(module: *const CDslxModule) -> *mut std::os::raw::c_char;
678
679    pub fn xls_dslx_module_get_type_definition_count(module: *const CDslxModule) -> i64;
680
681    pub fn xls_dslx_module_get_member_count(module: *const CDslxModule) -> i64;
682
683    pub fn xls_dslx_module_get_member(module: *const CDslxModule, i: i64)
684        -> *mut CDslxModuleMember;
685
686    pub fn xls_dslx_module_get_type_definition_kind(
687        module: *const CDslxModule,
688        i: i64,
689    ) -> DslxTypeDefinitionKind;
690
691    pub fn xls_dslx_module_get_type_definition_as_struct_def(
692        module: *const CDslxModule,
693        i: i64,
694    ) -> *mut CDslxStructDef;
695    pub fn xls_dslx_module_get_type_definition_as_enum_def(
696        module: *const CDslxModule,
697        i: i64,
698    ) -> *mut CDslxEnumDef;
699    pub fn xls_dslx_module_get_type_definition_as_type_alias(
700        module: *const CDslxModule,
701        i: i64,
702    ) -> *mut CDslxTypeAlias;
703
704    // -- xls_dslx_module_member
705    pub fn xls_dslx_module_member_get_kind(
706        member: *const CDslxModuleMember,
707    ) -> DslxModuleMemberKind;
708    pub fn xls_dslx_module_member_get_constant_def(
709        member: *const CDslxModuleMember,
710    ) -> *mut CDslxConstantDef;
711    pub fn xls_dslx_module_member_get_type_alias(
712        member: *const CDslxModuleMember,
713    ) -> *mut CDslxTypeAlias;
714    pub fn xls_dslx_module_member_get_struct_def(
715        member: *const CDslxModuleMember,
716    ) -> *mut CDslxStructDef;
717    pub fn xls_dslx_module_member_get_enum_def(
718        member: *const CDslxModuleMember,
719    ) -> *mut CDslxEnumDef;
720
721    pub fn xls_dslx_colon_ref_get_attr(
722        colon_ref: *const CDslxColonRef,
723    ) -> *mut std::os::raw::c_char;
724
725    pub fn xls_dslx_type_info_get_type_struct_def(
726        type_info: *mut CDslxTypeInfo,
727        node: *mut CDslxStructDef,
728    ) -> *mut CDslxType;
729    pub fn xls_dslx_type_info_get_type_enum_def(
730        type_info: *mut CDslxTypeInfo,
731        node: *mut CDslxEnumDef,
732    ) -> *mut CDslxType;
733    pub fn xls_dslx_type_info_get_type_struct_member(
734        type_info: *mut CDslxTypeInfo,
735        member: *mut CDslxStructMember,
736    ) -> *mut CDslxType;
737    pub fn xls_dslx_type_info_get_type_type_alias(
738        type_info: *mut CDslxTypeInfo,
739        node: *mut CDslxTypeAlias,
740    ) -> *mut CDslxType;
741    pub fn xls_dslx_type_info_get_type_constant_def(
742        type_info: *mut CDslxTypeInfo,
743        node: *mut CDslxConstantDef,
744    ) -> *mut CDslxType;
745
746    /// Gets the concrete type for a TypeAnnotation AST node.
747    pub fn xls_dslx_type_info_get_type_type_annotation(
748        type_info: *mut CDslxTypeInfo,
749        type_annotation: *mut CDslxTypeAnnotation,
750    ) -> *mut CDslxType;
751
752    // -- ConstantDef
753
754    pub fn xls_dslx_constant_def_get_name(
755        constant_def: *const CDslxConstantDef,
756    ) -> *mut std::os::raw::c_char;
757
758    pub fn xls_dslx_constant_def_get_value(constant_def: *const CDslxConstantDef)
759        -> *mut CDslxExpr;
760
761    // -- TypeAlias
762
763    pub fn xls_dslx_type_alias_get_identifier(
764        type_alias: *const CDslxTypeAlias,
765    ) -> *mut std::os::raw::c_char;
766
767    pub fn xls_dslx_type_alias_get_type_annotation(
768        type_alias: *const CDslxTypeAlias,
769    ) -> *mut CDslxTypeAnnotation;
770
771    // -- TypeAnnotation
772
773    pub fn xls_dslx_type_annotation_get_type_ref_type_annotation(
774        type_annotation: *const CDslxTypeAnnotation,
775    ) -> *mut CDslxTypeRefTypeAnnotation;
776
777    // -- TypeRef
778
779    pub fn xls_dslx_type_ref_get_type_definition(
780        type_ref: *const CDslxTypeRef,
781    ) -> *mut CDslxTypeDefinition;
782
783    // -- Import
784
785    pub fn xls_dslx_import_get_subject_count(import: *const CDslxImport) -> i64;
786    pub fn xls_dslx_import_get_subject(
787        import: *const CDslxImport,
788        i: i64,
789    ) -> *mut std::os::raw::c_char;
790
791    // -- ColonRef
792
793    pub fn xls_dslx_colon_ref_resolve_import_subject(
794        colon_ref: *const CDslxColonRef,
795    ) -> *mut CDslxImport;
796
797    // -- TypeDefinition
798
799    pub fn xls_dslx_type_definition_get_colon_ref(
800        type_definition: *const CDslxTypeDefinition,
801    ) -> *mut CDslxColonRef;
802    pub fn xls_dslx_type_definition_get_type_alias(
803        type_definition: *const CDslxTypeDefinition,
804    ) -> *mut CDslxTypeAlias;
805
806    // -- TypeRefTypeAnnotation
807
808    pub fn xls_dslx_type_ref_type_annotation_get_type_ref(
809        type_ref_type_annotation: *const CDslxTypeRefTypeAnnotation,
810    ) -> *mut CDslxTypeRef;
811
812    // -- StructDef
813
814    pub fn xls_dslx_struct_def_get_identifier(
815        struct_def: *const CDslxStructDef,
816    ) -> *mut std::os::raw::c_char;
817
818    pub fn xls_dslx_struct_def_is_parametric(struct_def: *const CDslxStructDef) -> bool;
819
820    pub fn xls_dslx_struct_def_get_member_count(struct_def: *const CDslxStructDef) -> i64;
821
822    pub fn xls_dslx_struct_def_get_member(
823        struct_def: *const CDslxStructDef,
824        i: i64,
825    ) -> *mut CDslxStructMember;
826
827    pub fn xls_dslx_struct_member_get_name(
828        member: *const CDslxStructMember,
829    ) -> *mut std::os::raw::c_char;
830
831    pub fn xls_dslx_struct_member_get_type(
832        member: *const CDslxStructMember,
833    ) -> *mut CDslxTypeAnnotation;
834
835    // -- EnumDef
836
837    pub fn xls_dslx_enum_def_get_identifier(
838        enum_def: *const CDslxEnumDef,
839    ) -> *mut std::os::raw::c_char;
840
841    pub fn xls_dslx_enum_def_get_member_count(enum_def: *const CDslxEnumDef) -> i64;
842
843    pub fn xls_dslx_enum_def_get_member(
844        enum_def: *const CDslxEnumDef,
845        i: i64,
846    ) -> *mut CDslxEnumMember;
847
848    pub fn xls_dslx_enum_def_get_underlying(
849        enum_def: *const CDslxEnumDef,
850    ) -> *mut CDslxTypeAnnotation;
851
852    pub fn xls_dslx_enum_member_get_name(
853        member: *const CDslxEnumMember,
854    ) -> *mut std::os::raw::c_char;
855
856    pub fn xls_dslx_enum_member_get_value(member: *const CDslxEnumMember) -> *mut CDslxExpr;
857
858    // --
859
860    pub fn xls_dslx_interp_value_free(value: *mut CDslxInterpValue);
861
862    pub fn xls_dslx_interp_value_convert_to_ir(
863        value: *mut CDslxInterpValue,
864        error_out: *mut *mut std::os::raw::c_char,
865        result_out: *mut *mut CIrValue,
866    ) -> bool;
867
868    pub fn xls_dslx_type_to_string(
869        type_: *const CDslxType,
870        error_out: *mut *mut std::os::raw::c_char,
871        result_out: *mut *mut std::os::raw::c_char,
872    ) -> bool;
873
874    pub fn xls_dslx_type_info_get_const_expr(
875        type_info: *mut CDslxTypeInfo,
876        expr: *mut CDslxExpr,
877        error_out: *mut *mut std::os::raw::c_char,
878        result_out: *mut *mut CDslxInterpValue,
879    ) -> bool;
880
881    pub fn xls_dslx_type_get_total_bit_count(
882        type_: *const CDslxType,
883        error_out: *mut *mut std::os::raw::c_char,
884        result_out: *mut i64,
885    ) -> bool;
886
887    pub fn xls_dslx_type_is_signed_bits(
888        type_: *const CDslxType,
889        error_out: *mut *mut std::os::raw::c_char,
890        result_out: *mut bool,
891    ) -> bool;
892
893    pub fn xls_dslx_type_is_bits_like(
894        type_: *const CDslxType,
895        is_signed: *mut *mut CDslxTypeDim,
896        size: *mut *mut CDslxTypeDim,
897    ) -> bool;
898
899    pub fn xls_dslx_type_is_enum(type_: *const CDslxType) -> bool;
900    pub fn xls_dslx_type_is_struct(type_: *const CDslxType) -> bool;
901    pub fn xls_dslx_type_is_array(type_: *const CDslxType) -> bool;
902
903    pub fn xls_dslx_type_dim_is_parametric(dim: *const CDslxTypeDim) -> bool;
904    pub fn xls_dslx_type_dim_get_as_bool(
905        dim: *const CDslxTypeDim,
906        error_out: *mut *mut std::os::raw::c_char,
907        result_out: *mut bool,
908    ) -> bool;
909    pub fn xls_dslx_type_dim_get_as_int64(
910        dim: *const CDslxTypeDim,
911        error_out: *mut *mut std::os::raw::c_char,
912        result_out: *mut i64,
913    ) -> bool;
914    pub fn xls_dslx_type_dim_free(dim: *mut CDslxTypeDim);
915
916    pub fn xls_dslx_type_get_enum_def(ty: *const CDslxType) -> *mut CDslxEnumDef;
917
918    pub fn xls_dslx_type_get_struct_def(ty: *const CDslxType) -> *mut CDslxStructDef;
919
920    pub fn xls_dslx_type_array_get_element_type(ty: *const CDslxType) -> *mut CDslxType;
921    pub fn xls_dslx_type_array_get_size(ty: *const CDslxType) -> *mut CDslxTypeDim;
922
923    // -- IR builder APIs
924
925    pub fn xls_package_create(name: *const std::os::raw::c_char) -> *mut CIrPackage;
926    pub fn xls_package_get_bits_type(package: *mut CIrPackage, bit_count: i64) -> *mut CIrType;
927
928    pub fn xls_package_get_tuple_type(
929        package: *mut CIrPackage,
930        members: *mut *mut CIrType,
931        member_count: i64,
932    ) -> *mut CIrType;
933
934    pub fn xls_package_get_array_type(
935        package: *mut CIrPackage,
936        element_type: *mut CIrType,
937        size: i64,
938    ) -> *mut CIrType;
939
940    pub fn xls_package_get_token_type(package: *mut CIrPackage) -> *mut CIrType;
941
942    pub fn xls_function_builder_create(
943        name: *const std::os::raw::c_char,
944        package: *mut CIrPackage,
945        should_verify: bool,
946    ) -> *mut CIrFunctionBuilder;
947    pub fn xls_function_builder_as_builder_base(
948        builder: *mut CIrFunctionBuilder,
949    ) -> *mut CIrBuilderBase;
950    pub fn xls_function_builder_free(builder: *mut CIrFunctionBuilder);
951    pub fn xls_bvalue_free(bvalue: *mut CIrBValue);
952    pub fn xls_function_builder_add_parameter(
953        builder: *mut CIrFunctionBuilder,
954        name: *const std::os::raw::c_char,
955        type_: *mut CIrType,
956    ) -> *mut CIrBValue;
957    pub fn xls_function_builder_build(
958        builder: *mut CIrFunctionBuilder,
959        error_out: *mut *mut std::os::raw::c_char,
960        function_out: *mut *mut CIrFunction,
961    ) -> bool;
962    pub fn xls_function_builder_build_with_return_value(
963        builder: *mut CIrFunctionBuilder,
964        return_value: *mut CIrBValue,
965        error_out: *mut *mut std::os::raw::c_char,
966        function_out: *mut *mut CIrFunction,
967    ) -> bool;
968    pub fn xls_builder_base_add_and(
969        builder: *mut CIrBuilderBase,
970        lhs: *mut CIrBValue,
971        rhs: *mut CIrBValue,
972        name: *const std::os::raw::c_char,
973    ) -> *mut CIrBValue;
974    pub fn xls_builder_base_add_nand(
975        builder: *mut CIrBuilderBase,
976        lhs: *mut CIrBValue,
977        rhs: *mut CIrBValue,
978        name: *const std::os::raw::c_char,
979    ) -> *mut CIrBValue;
980    pub fn xls_builder_base_add_or(
981        builder: *mut CIrBuilderBase,
982        lhs: *mut CIrBValue,
983        rhs: *mut CIrBValue,
984        name: *const std::os::raw::c_char,
985    ) -> *mut CIrBValue;
986    pub fn xls_builder_base_add_xor(
987        builder: *mut CIrBuilderBase,
988        lhs: *mut CIrBValue,
989        rhs: *mut CIrBValue,
990        name: *const std::os::raw::c_char,
991    ) -> *mut CIrBValue;
992    pub fn xls_builder_base_add_not(
993        builder: *mut CIrBuilderBase,
994        value: *mut CIrBValue,
995        name: *const std::os::raw::c_char,
996    ) -> *mut CIrBValue;
997    pub fn xls_builder_base_add_negate(
998        builder: *mut CIrBuilderBase,
999        value: *mut CIrBValue,
1000        name: *const std::os::raw::c_char,
1001    ) -> *mut CIrBValue;
1002    pub fn xls_builder_base_add_reverse(
1003        builder: *mut CIrBuilderBase,
1004        value: *mut CIrBValue,
1005        name: *const std::os::raw::c_char,
1006    ) -> *mut CIrBValue;
1007    pub fn xls_builder_base_add_or_reduce(
1008        builder: *mut CIrBuilderBase,
1009        value: *mut CIrBValue,
1010        name: *const std::os::raw::c_char,
1011    ) -> *mut CIrBValue;
1012    pub fn xls_builder_base_add_and_reduce(
1013        builder: *mut CIrBuilderBase,
1014        value: *mut CIrBValue,
1015        name: *const std::os::raw::c_char,
1016    ) -> *mut CIrBValue;
1017    pub fn xls_builder_base_add_xor_reduce(
1018        builder: *mut CIrBuilderBase,
1019        value: *mut CIrBValue,
1020        name: *const std::os::raw::c_char,
1021    ) -> *mut CIrBValue;
1022    pub fn xls_builder_base_add_literal(
1023        builder: *mut CIrBuilderBase,
1024        value: *mut CIrValue,
1025        name: *const std::os::raw::c_char,
1026    ) -> *mut CIrBValue;
1027    pub fn xls_builder_base_add_tuple(
1028        builder: *mut CIrBuilderBase,
1029        operands: *mut *mut CIrBValue,
1030        operand_count: i64,
1031        name: *const std::os::raw::c_char,
1032    ) -> *mut CIrBValue;
1033    pub fn xls_builder_base_add_tuple_index(
1034        builder: *mut CIrBuilderBase,
1035        tuple: *mut CIrBValue,
1036        index: i64,
1037        name: *const std::os::raw::c_char,
1038    ) -> *mut CIrBValue;
1039    pub fn xls_builder_base_add_array(
1040        builder: *mut CIrBuilderBase,
1041        element_type: *mut CIrType,
1042        elements: *const *mut CIrBValue,
1043        element_count: i64,
1044        name: *const std::os::raw::c_char,
1045    ) -> *mut CIrBValue;
1046    pub fn xls_builder_base_add_array_index(
1047        builder: *mut CIrBuilderBase,
1048        array: *mut CIrBValue,
1049        indices: *const *mut CIrBValue,
1050        index_count: i64,
1051        assumed_in_bounds: bool,
1052        name: *const std::os::raw::c_char,
1053    ) -> *mut CIrBValue;
1054    pub fn xls_builder_base_add_dynamic_bit_slice(
1055        builder: *mut CIrBuilderBase,
1056        value: *mut CIrBValue,
1057        start: *mut CIrBValue,
1058        width: i64,
1059        name: *const std::os::raw::c_char,
1060    ) -> *mut CIrBValue;
1061    pub fn xls_builder_base_add_bit_slice(
1062        builder: *mut CIrBuilderBase,
1063        value: *mut CIrBValue,
1064        start: i64,
1065        width: i64,
1066        name: *const std::os::raw::c_char,
1067    ) -> *mut CIrBValue;
1068    pub fn xls_builder_base_add_bit_slice_update(
1069        builder: *mut CIrBuilderBase,
1070        value: *mut CIrBValue,
1071        start: *mut CIrBValue,
1072        update: *mut CIrBValue,
1073        name: *const std::os::raw::c_char,
1074    ) -> *mut CIrBValue;
1075    pub fn xls_builder_base_add_concat(
1076        builder: *mut CIrBuilderBase,
1077        values: *const *mut CIrBValue,
1078        value_count: i64,
1079        name: *const std::os::raw::c_char,
1080    ) -> *mut CIrBValue;
1081    pub fn xls_builder_base_add_add(
1082        builder: *mut CIrBuilderBase,
1083        lhs: *mut CIrBValue,
1084        rhs: *mut CIrBValue,
1085        name: *const std::os::raw::c_char,
1086    ) -> *mut CIrBValue;
1087    pub fn xls_builder_base_add_sub(
1088        builder: *mut CIrBuilderBase,
1089        lhs: *mut CIrBValue,
1090        rhs: *mut CIrBValue,
1091        name: *const std::os::raw::c_char,
1092    ) -> *mut CIrBValue;
1093    pub fn xls_builder_base_add_umul(
1094        builder: *mut CIrBuilderBase,
1095        lhs: *mut CIrBValue,
1096        rhs: *mut CIrBValue,
1097        name: *const std::os::raw::c_char,
1098    ) -> *mut CIrBValue;
1099    pub fn xls_builder_base_add_smul(
1100        builder: *mut CIrBuilderBase,
1101        lhs: *mut CIrBValue,
1102        rhs: *mut CIrBValue,
1103        name: *const std::os::raw::c_char,
1104    ) -> *mut CIrBValue;
1105    pub fn xls_builder_base_add_eq(
1106        builder: *mut CIrBuilderBase,
1107        lhs: *mut CIrBValue,
1108        rhs: *mut CIrBValue,
1109        name: *const std::os::raw::c_char,
1110    ) -> *mut CIrBValue;
1111    pub fn xls_builder_base_add_ne(
1112        builder: *mut CIrBuilderBase,
1113        lhs: *mut CIrBValue,
1114        rhs: *mut CIrBValue,
1115        name: *const std::os::raw::c_char,
1116    ) -> *mut CIrBValue;
1117
1118    // -- comparisons
1119    pub fn xls_builder_base_add_ule(
1120        builder: *mut CIrBuilderBase,
1121        lhs: *mut CIrBValue,
1122        rhs: *mut CIrBValue,
1123        name: *const std::os::raw::c_char,
1124    ) -> *mut CIrBValue;
1125    pub fn xls_builder_base_add_ult(
1126        builder: *mut CIrBuilderBase,
1127        lhs: *mut CIrBValue,
1128        rhs: *mut CIrBValue,
1129        name: *const std::os::raw::c_char,
1130    ) -> *mut CIrBValue;
1131    pub fn xls_builder_base_add_uge(
1132        builder: *mut CIrBuilderBase,
1133        lhs: *mut CIrBValue,
1134        rhs: *mut CIrBValue,
1135        name: *const std::os::raw::c_char,
1136    ) -> *mut CIrBValue;
1137    pub fn xls_builder_base_add_ugt(
1138        builder: *mut CIrBuilderBase,
1139        lhs: *mut CIrBValue,
1140        rhs: *mut CIrBValue,
1141        name: *const std::os::raw::c_char,
1142    ) -> *mut CIrBValue;
1143    pub fn xls_builder_base_add_sle(
1144        builder: *mut CIrBuilderBase,
1145        lhs: *mut CIrBValue,
1146        rhs: *mut CIrBValue,
1147        name: *const std::os::raw::c_char,
1148    ) -> *mut CIrBValue;
1149    pub fn xls_builder_base_add_slt(
1150        builder: *mut CIrBuilderBase,
1151        lhs: *mut CIrBValue,
1152        rhs: *mut CIrBValue,
1153        name: *const std::os::raw::c_char,
1154    ) -> *mut CIrBValue;
1155    pub fn xls_builder_base_add_sgt(
1156        builder: *mut CIrBuilderBase,
1157        lhs: *mut CIrBValue,
1158        rhs: *mut CIrBValue,
1159        name: *const std::os::raw::c_char,
1160    ) -> *mut CIrBValue;
1161    pub fn xls_builder_base_add_sge(
1162        builder: *mut CIrBuilderBase,
1163        lhs: *mut CIrBValue,
1164        rhs: *mut CIrBValue,
1165        name: *const std::os::raw::c_char,
1166    ) -> *mut CIrBValue;
1167
1168    pub fn xls_builder_base_add_shra(
1169        builder: *mut CIrBuilderBase,
1170        a: *mut CIrBValue,
1171        b: *mut CIrBValue,
1172        name: *const std::os::raw::c_char,
1173    ) -> *mut CIrBValue;
1174    pub fn xls_builder_base_add_shrl(
1175        builder: *mut CIrBuilderBase,
1176        a: *mut CIrBValue,
1177        b: *mut CIrBValue,
1178        name: *const std::os::raw::c_char,
1179    ) -> *mut CIrBValue;
1180    pub fn xls_builder_base_add_shll(
1181        builder: *mut CIrBuilderBase,
1182        a: *mut CIrBValue,
1183        b: *mut CIrBValue,
1184        name: *const std::os::raw::c_char,
1185    ) -> *mut CIrBValue;
1186    pub fn xls_builder_base_add_nor(
1187        builder: *mut CIrBuilderBase,
1188        a: *mut CIrBValue,
1189        b: *mut CIrBValue,
1190        name: *const std::os::raw::c_char,
1191    ) -> *mut CIrBValue;
1192    pub fn xls_builder_base_add_clz(
1193        builder: *mut CIrBuilderBase,
1194        a: *mut CIrBValue,
1195        name: *const std::os::raw::c_char,
1196    ) -> *mut CIrBValue;
1197    pub fn xls_builder_base_add_ctz(
1198        builder: *mut CIrBuilderBase,
1199        a: *mut CIrBValue,
1200        name: *const std::os::raw::c_char,
1201    ) -> *mut CIrBValue;
1202    pub fn xls_builder_base_add_encode(
1203        builder: *mut CIrBuilderBase,
1204        a: *mut CIrBValue,
1205        name: *const std::os::raw::c_char,
1206    ) -> *mut CIrBValue;
1207
1208    pub fn xls_builder_base_add_decode(
1209        builder: *mut CIrBuilderBase,
1210        a: *mut CIrBValue,
1211        width: *mut i64,
1212        name: *const std::os::raw::c_char,
1213    ) -> *mut CIrBValue;
1214    pub fn xls_builder_base_add_select(
1215        builder: *mut CIrBuilderBase,
1216        selector: *mut CIrBValue,
1217        cases: *const *mut CIrBValue,
1218        case_count: i64,
1219        default_value: *mut CIrBValue,
1220        name: *const std::os::raw::c_char,
1221    ) -> *mut CIrBValue;
1222    pub fn xls_builder_base_add_array_concat(
1223        builder: *mut CIrBuilderBase,
1224        arrays: *const *mut CIrBValue,
1225        array_count: i64,
1226        name: *const std::os::raw::c_char,
1227    ) -> *mut CIrBValue;
1228    pub fn xls_builder_base_add_array_slice(
1229        builder: *mut CIrBuilderBase,
1230        array: *mut CIrBValue,
1231        start: *mut CIrBValue,
1232        width: i64,
1233        name: *const std::os::raw::c_char,
1234    ) -> *mut CIrBValue;
1235    pub fn xls_builder_base_add_array_update(
1236        builder: *mut CIrBuilderBase,
1237        array: *mut CIrBValue,
1238        update_value: *mut CIrBValue,
1239        indices: *const *mut CIrBValue,
1240        index_count: i64,
1241        assumed_in_bounds: bool,
1242        name: *const std::os::raw::c_char,
1243    ) -> *mut CIrBValue;
1244    pub fn xls_builder_base_add_identity(
1245        builder: *mut CIrBuilderBase,
1246        value: *mut CIrBValue,
1247        name: *const std::os::raw::c_char,
1248    ) -> *mut CIrBValue;
1249
1250    pub fn xls_builder_base_add_sign_extend(
1251        builder: *mut CIrBuilderBase,
1252        value: *mut CIrBValue,
1253        new_bit_count: i64,
1254        name: *const std::os::raw::c_char,
1255    ) -> *mut CIrBValue;
1256    pub fn xls_builder_base_add_zero_extend(
1257        builder: *mut CIrBuilderBase,
1258        value: *mut CIrBValue,
1259        new_bit_count: i64,
1260        name: *const std::os::raw::c_char,
1261    ) -> *mut CIrBValue;
1262
1263    pub fn xls_builder_base_add_one_hot(
1264        builder: *mut CIrBuilderBase,
1265        input: *mut CIrBValue,
1266        lsb_is_priority: bool,
1267        name: *const std::os::raw::c_char,
1268    ) -> *mut CIrBValue;
1269
1270    pub fn xls_builder_base_add_one_hot_select(
1271        builder: *mut CIrBuilderBase,
1272        selector: *mut CIrBValue,
1273        cases: *const *mut CIrBValue,
1274        case_count: i64,
1275        name: *const std::os::raw::c_char,
1276    ) -> *mut CIrBValue;
1277
1278    pub fn xls_builder_base_add_priority_select(
1279        builder: *mut CIrBuilderBase,
1280        selector: *mut CIrBValue,
1281        cases: *const *mut CIrBValue,
1282        case_count: i64,
1283        default_value: *mut CIrBValue,
1284        name: *const std::os::raw::c_char,
1285    ) -> *mut CIrBValue;
1286
1287    pub fn xls_builder_base_get_last_value(
1288        builder: *mut CIrBuilderBase,
1289        error_out: *mut *mut std::os::raw::c_char,
1290        value_out: *mut *mut CIrBValue,
1291    ) -> bool;
1292
1293    pub fn xls_builder_base_get_type(
1294        builder: *mut CIrBuilderBase,
1295        value: *mut CIrBValue,
1296    ) -> *mut CIrType;
1297}
1298
1299pub const DSLX_STDLIB_PATH: &str = env!("DSLX_STDLIB_PATH");
1300pub const XLS_DSO_PATH: &str = env!("XLS_DSO_PATH");