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_type_get_flat_bit_count(t: *const CIrType) -> i64;
417    pub fn xls_package_get_type_for_value(
418        package: *const CIrPackage,
419        value: *const CIrValue,
420        error_out: *mut *mut std::os::raw::c_char,
421        result_out: *mut *mut CIrType,
422    ) -> bool;
423    pub fn xls_package_get_function(
424        package: *const CIrPackage,
425        function_name: *const std::os::raw::c_char,
426        error_out: *mut *mut std::os::raw::c_char,
427        result_out: *mut *mut CIrFunction,
428    ) -> bool;
429    pub fn xls_function_get_type(
430        function: *const CIrFunction,
431        error_out: *mut *mut std::os::raw::c_char,
432        xls_fn_type_out: *mut *mut CIrFunctionType,
433    ) -> bool;
434    pub fn xls_function_type_to_string(
435        t: *const CIrFunctionType,
436        error_out: *mut *mut std::os::raw::c_char,
437        string_out: *mut *mut std::os::raw::c_char,
438    ) -> bool;
439    pub fn xls_function_get_name(
440        function: *const CIrFunction,
441        error_out: *mut *mut std::os::raw::c_char,
442        name_out: *mut *mut std::os::raw::c_char,
443    ) -> bool;
444    pub fn xls_interpret_function(
445        function: *const CIrFunction,
446        argc: libc::size_t,
447        args: *const *const CIrValue,
448        error_out: *mut *mut std::os::raw::c_char,
449        result_out: *mut *mut CIrValue,
450    ) -> bool;
451    pub fn xls_optimize_ir(
452        ir: *const std::os::raw::c_char,
453        top: *const std::os::raw::c_char,
454        error_out: *mut *mut std::os::raw::c_char,
455        ir_out: *mut *mut std::os::raw::c_char,
456    ) -> bool;
457    pub fn xls_mangle_dslx_name(
458        module_name: *const std::os::raw::c_char,
459        function_name: *const std::os::raw::c_char,
460        error_out: *mut *mut std::os::raw::c_char,
461        mangled_out: *mut *mut std::os::raw::c_char,
462    ) -> bool;
463    pub fn xls_package_to_string(
464        p: *const CIrPackage,
465        string_out: *mut *mut std::os::raw::c_char,
466    ) -> bool;
467    pub fn xls_package_set_top_by_name(
468        p: *mut CIrPackage,
469        name: *const std::os::raw::c_char,
470        error_out: *mut *mut std::os::raw::c_char,
471    ) -> bool;
472
473    pub fn xls_make_function_jit(
474        function: *const CIrFunction,
475        error_out: *mut *mut std::os::raw::c_char,
476        result_out: *mut *mut CIrFunctionJit,
477    ) -> bool;
478    pub fn xls_function_jit_free(jit: *mut CIrFunctionJit);
479    pub fn xls_function_jit_run(
480        jit: *const CIrFunctionJit,
481        argc: libc::size_t,
482        args: *const *const CIrValue,
483        error_out: *mut *mut std::os::raw::c_char,
484        trace_messages_out: *mut *mut CTraceMessage,
485        trace_messages_count_out: *mut libc::size_t,
486        assert_messages_out: *mut *mut *mut std::os::raw::c_char,
487        assert_messages_count_out: *mut libc::size_t,
488        result_out: *mut *mut CIrValue,
489    ) -> bool;
490    pub fn xls_trace_messages_free(trace_messages: *mut CTraceMessage, count: libc::size_t);
491
492    // -- VAST APIs
493
494    pub fn xls_vast_make_verilog_file(file_type: VastFileType) -> *mut CVastFile;
495    pub fn xls_vast_verilog_file_free(f: *mut CVastFile);
496    pub fn xls_vast_verilog_file_add_module(
497        f: *mut CVastFile,
498        name: *const std::os::raw::c_char,
499    ) -> *mut CVastModule;
500
501    // - Node creation
502    pub fn xls_vast_verilog_file_make_scalar_type(f: *mut CVastFile) -> *mut CVastDataType;
503    pub fn xls_vast_verilog_file_make_bit_vector_type(
504        f: *mut CVastFile,
505        bit_count: i64,
506        is_signed: bool,
507    ) -> *mut CVastDataType;
508    pub fn xls_vast_verilog_file_make_extern_package_type(
509        f: *mut CVastFile,
510        package_name: *const std::os::raw::c_char,
511        type_name: *const std::os::raw::c_char,
512    ) -> *mut CVastDataType;
513    pub fn xls_vast_verilog_file_make_packed_array_type(
514        f: *mut CVastFile,
515        element_type: *mut CVastDataType,
516        dims: *const i64,
517        dim_count: libc::size_t,
518    ) -> *mut CVastDataType;
519
520    pub fn xls_vast_verilog_file_make_continuous_assignment(
521        f: *mut CVastFile,
522        lhs: *mut CVastExpression,
523        rhs: *mut CVastExpression,
524    ) -> *mut CVastContinuousAssignment;
525
526    pub fn xls_vast_verilog_file_make_concat(
527        f: *mut CVastFile,
528        expressions: *mut *mut CVastExpression,
529        expression_count: libc::size_t,
530    ) -> *mut CVastExpression;
531
532    pub fn xls_vast_verilog_file_make_slice_i64(
533        f: *mut CVastFile,
534        subject: *mut CVastIndexableExpression,
535        hi: i64,
536        lo: i64,
537    ) -> *mut CVastSlice;
538
539    pub fn xls_vast_verilog_file_make_index(
540        f: *mut CVastFile,
541        subject: *mut CVastIndexableExpression,
542        index: *mut CVastExpression,
543    ) -> *mut CVastIndex;
544    pub fn xls_vast_verilog_file_make_index_i64(
545        f: *mut CVastFile,
546        subject: *mut CVastIndexableExpression,
547        index: i64,
548    ) -> *mut CVastIndex;
549
550    pub fn xls_vast_verilog_file_make_unary(
551        f: *mut CVastFile,
552        arg: *mut CVastExpression,
553        op: VastOperatorKind,
554    ) -> *mut CVastExpression;
555
556    pub fn xls_vast_verilog_file_make_binary(
557        f: *mut CVastFile,
558        lhs: *mut CVastExpression,
559        rhs: *mut CVastExpression,
560        op: VastOperatorKind,
561    ) -> *mut CVastExpression;
562
563    pub fn xls_vast_verilog_file_make_ternary(
564        f: *mut CVastFile,
565        cond: *mut CVastExpression,
566        consequent: *mut CVastExpression,
567        alternate: *mut CVastExpression,
568    ) -> *mut CVastExpression;
569
570    pub fn xls_vast_verilog_file_make_instantiation(
571        f: *mut CVastFile,
572        module_name: *const std::os::raw::c_char,
573        instance_name: *const std::os::raw::c_char,
574        parameter_port_names: *const *const std::os::raw::c_char,
575        parameter_expressions: *const *const CVastExpression,
576        parameter_count: libc::size_t,
577        connection_port_names: *const *const std::os::raw::c_char,
578        connection_expressions: *const *const CVastExpression,
579        connection_count: libc::size_t,
580    ) -> *mut CVastInstantiation;
581    pub fn xls_vast_verilog_file_make_literal(
582        f: *mut CVastFile,
583        bits: *const CIrBits,
584        format_preference: XlsFormatPreference,
585        emit_bit_count: bool,
586        error_out: *mut *mut std::os::raw::c_char,
587        literal_out: *mut *mut CVastLiteral,
588    ) -> bool;
589
590    // - Module additions
591    pub fn xls_vast_verilog_module_add_input(
592        m: *mut CVastModule,
593        name: *const std::os::raw::c_char,
594        type_: *mut CVastDataType,
595    ) -> *mut CVastLogicRef;
596    pub fn xls_vast_verilog_module_add_output(
597        m: *mut CVastModule,
598        name: *const std::os::raw::c_char,
599        type_: *mut CVastDataType,
600    ) -> *mut CVastLogicRef;
601    pub fn xls_vast_verilog_module_add_wire(
602        m: *mut CVastModule,
603        name: *const std::os::raw::c_char,
604        type_: *mut CVastDataType,
605    ) -> *mut CVastLogicRef;
606    pub fn xls_vast_verilog_module_add_member_instantiation(
607        m: *mut CVastModule,
608        inst: *mut CVastInstantiation,
609    );
610    pub fn xls_vast_verilog_module_add_member_continuous_assignment(
611        m: *mut CVastModule,
612        ca: *mut CVastContinuousAssignment,
613    );
614
615    // - Expression conversions
616    pub fn xls_vast_logic_ref_as_indexable_expression(
617        v: *mut CVastLogicRef,
618    ) -> *mut CVastIndexableExpression;
619    pub fn xls_vast_index_as_indexable_expression(
620        v: *mut CVastIndex,
621    ) -> *mut CVastIndexableExpression;
622
623    pub fn xls_vast_literal_as_expression(v: *mut CVastLiteral) -> *mut CVastExpression;
624    pub fn xls_vast_logic_ref_as_expression(v: *mut CVastLogicRef) -> *mut CVastExpression;
625    pub fn xls_vast_slice_as_expression(v: *mut CVastSlice) -> *mut CVastExpression;
626    pub fn xls_vast_index_as_expression(v: *mut CVastIndex) -> *mut CVastExpression;
627
628    pub fn xls_vast_verilog_file_add_include(f: *mut CVastFile, path: *const std::os::raw::c_char);
629    pub fn xls_vast_verilog_file_emit(f: *const CVastFile) -> *mut std::os::raw::c_char;
630
631    // -- DSLX
632
633    pub fn xls_dslx_import_data_create(
634        dslx_stdlib_path: *const std::os::raw::c_char,
635        additional_search_paths: *const *const std::os::raw::c_char,
636        additional_search_paths_count: libc::size_t,
637    ) -> *mut CDslxImportData;
638    pub fn xls_dslx_import_data_free(data: *mut CDslxImportData);
639
640    pub fn xls_dslx_parse_and_typecheck(
641        text: *const std::os::raw::c_char,
642        path: *const std::os::raw::c_char,
643        module_name: *const std::os::raw::c_char,
644        import_data: *const CDslxImportData,
645        error_out: *mut *mut std::os::raw::c_char,
646        typechecked_module_out: *mut *mut CDslxTypecheckedModule,
647    ) -> bool;
648
649    // bool xls_schedule_and_codegen_package(
650    // struct xls_package* p, const char* scheduling_options_flags_proto,
651    // const char* codegen_flags_proto, bool with_delay_model, char** error_out,
652    // struct xls_schedule_and_codegen_result** result_out);
653    pub fn xls_schedule_and_codegen_package(
654        p: *mut CIrPackage,
655        scheduling_options_flags_proto: *const std::os::raw::c_char,
656        codegen_flags_proto: *const std::os::raw::c_char,
657        with_delay_model: bool,
658        error_out: *mut *mut std::os::raw::c_char,
659        result_out: *mut *mut CScheduleAndCodegenResult,
660    ) -> bool;
661
662    pub fn xls_schedule_and_codegen_result_get_verilog_text(
663        result: *mut CScheduleAndCodegenResult,
664    ) -> *mut std::os::raw::c_char;
665
666    pub fn xls_schedule_and_codegen_result_free(result: *mut CScheduleAndCodegenResult);
667
668    pub fn xls_dslx_typechecked_module_free(module: *mut CDslxTypecheckedModule);
669
670    pub fn xls_dslx_typechecked_module_get_module(
671        module: *mut CDslxTypecheckedModule,
672    ) -> *mut CDslxModule;
673
674    pub fn xls_dslx_typechecked_module_get_type_info(
675        module: *mut CDslxTypecheckedModule,
676    ) -> *mut CDslxTypeInfo;
677
678    pub fn xls_dslx_module_get_name(module: *const CDslxModule) -> *mut std::os::raw::c_char;
679
680    pub fn xls_dslx_module_get_type_definition_count(module: *const CDslxModule) -> i64;
681
682    pub fn xls_dslx_module_get_member_count(module: *const CDslxModule) -> i64;
683
684    pub fn xls_dslx_module_get_member(module: *const CDslxModule, i: i64)
685        -> *mut CDslxModuleMember;
686
687    pub fn xls_dslx_module_get_type_definition_kind(
688        module: *const CDslxModule,
689        i: i64,
690    ) -> DslxTypeDefinitionKind;
691
692    pub fn xls_dslx_module_get_type_definition_as_struct_def(
693        module: *const CDslxModule,
694        i: i64,
695    ) -> *mut CDslxStructDef;
696    pub fn xls_dslx_module_get_type_definition_as_enum_def(
697        module: *const CDslxModule,
698        i: i64,
699    ) -> *mut CDslxEnumDef;
700    pub fn xls_dslx_module_get_type_definition_as_type_alias(
701        module: *const CDslxModule,
702        i: i64,
703    ) -> *mut CDslxTypeAlias;
704
705    // -- xls_dslx_module_member
706    pub fn xls_dslx_module_member_get_kind(
707        member: *const CDslxModuleMember,
708    ) -> DslxModuleMemberKind;
709    pub fn xls_dslx_module_member_get_constant_def(
710        member: *const CDslxModuleMember,
711    ) -> *mut CDslxConstantDef;
712    pub fn xls_dslx_module_member_get_type_alias(
713        member: *const CDslxModuleMember,
714    ) -> *mut CDslxTypeAlias;
715    pub fn xls_dslx_module_member_get_struct_def(
716        member: *const CDslxModuleMember,
717    ) -> *mut CDslxStructDef;
718    pub fn xls_dslx_module_member_get_enum_def(
719        member: *const CDslxModuleMember,
720    ) -> *mut CDslxEnumDef;
721
722    pub fn xls_dslx_colon_ref_get_attr(
723        colon_ref: *const CDslxColonRef,
724    ) -> *mut std::os::raw::c_char;
725
726    pub fn xls_dslx_type_info_get_type_struct_def(
727        type_info: *mut CDslxTypeInfo,
728        node: *mut CDslxStructDef,
729    ) -> *mut CDslxType;
730    pub fn xls_dslx_type_info_get_type_enum_def(
731        type_info: *mut CDslxTypeInfo,
732        node: *mut CDslxEnumDef,
733    ) -> *mut CDslxType;
734    pub fn xls_dslx_type_info_get_type_struct_member(
735        type_info: *mut CDslxTypeInfo,
736        member: *mut CDslxStructMember,
737    ) -> *mut CDslxType;
738    pub fn xls_dslx_type_info_get_type_type_alias(
739        type_info: *mut CDslxTypeInfo,
740        node: *mut CDslxTypeAlias,
741    ) -> *mut CDslxType;
742    pub fn xls_dslx_type_info_get_type_constant_def(
743        type_info: *mut CDslxTypeInfo,
744        node: *mut CDslxConstantDef,
745    ) -> *mut CDslxType;
746
747    /// Gets the concrete type for a TypeAnnotation AST node.
748    pub fn xls_dslx_type_info_get_type_type_annotation(
749        type_info: *mut CDslxTypeInfo,
750        type_annotation: *mut CDslxTypeAnnotation,
751    ) -> *mut CDslxType;
752
753    // -- ConstantDef
754
755    pub fn xls_dslx_constant_def_get_name(
756        constant_def: *const CDslxConstantDef,
757    ) -> *mut std::os::raw::c_char;
758
759    pub fn xls_dslx_constant_def_get_value(constant_def: *const CDslxConstantDef)
760        -> *mut CDslxExpr;
761
762    // -- TypeAlias
763
764    pub fn xls_dslx_type_alias_get_identifier(
765        type_alias: *const CDslxTypeAlias,
766    ) -> *mut std::os::raw::c_char;
767
768    pub fn xls_dslx_type_alias_get_type_annotation(
769        type_alias: *const CDslxTypeAlias,
770    ) -> *mut CDslxTypeAnnotation;
771
772    // -- TypeAnnotation
773
774    pub fn xls_dslx_type_annotation_get_type_ref_type_annotation(
775        type_annotation: *const CDslxTypeAnnotation,
776    ) -> *mut CDslxTypeRefTypeAnnotation;
777
778    // -- TypeRef
779
780    pub fn xls_dslx_type_ref_get_type_definition(
781        type_ref: *const CDslxTypeRef,
782    ) -> *mut CDslxTypeDefinition;
783
784    // -- Import
785
786    pub fn xls_dslx_import_get_subject_count(import: *const CDslxImport) -> i64;
787    pub fn xls_dslx_import_get_subject(
788        import: *const CDslxImport,
789        i: i64,
790    ) -> *mut std::os::raw::c_char;
791
792    // -- ColonRef
793
794    pub fn xls_dslx_colon_ref_resolve_import_subject(
795        colon_ref: *const CDslxColonRef,
796    ) -> *mut CDslxImport;
797
798    // -- TypeDefinition
799
800    pub fn xls_dslx_type_definition_get_colon_ref(
801        type_definition: *const CDslxTypeDefinition,
802    ) -> *mut CDslxColonRef;
803    pub fn xls_dslx_type_definition_get_type_alias(
804        type_definition: *const CDslxTypeDefinition,
805    ) -> *mut CDslxTypeAlias;
806
807    // -- TypeRefTypeAnnotation
808
809    pub fn xls_dslx_type_ref_type_annotation_get_type_ref(
810        type_ref_type_annotation: *const CDslxTypeRefTypeAnnotation,
811    ) -> *mut CDslxTypeRef;
812
813    // -- StructDef
814
815    pub fn xls_dslx_struct_def_get_identifier(
816        struct_def: *const CDslxStructDef,
817    ) -> *mut std::os::raw::c_char;
818
819    pub fn xls_dslx_struct_def_is_parametric(struct_def: *const CDslxStructDef) -> bool;
820
821    pub fn xls_dslx_struct_def_get_member_count(struct_def: *const CDslxStructDef) -> i64;
822
823    pub fn xls_dslx_struct_def_get_member(
824        struct_def: *const CDslxStructDef,
825        i: i64,
826    ) -> *mut CDslxStructMember;
827
828    pub fn xls_dslx_struct_member_get_name(
829        member: *const CDslxStructMember,
830    ) -> *mut std::os::raw::c_char;
831
832    pub fn xls_dslx_struct_member_get_type(
833        member: *const CDslxStructMember,
834    ) -> *mut CDslxTypeAnnotation;
835
836    // -- EnumDef
837
838    pub fn xls_dslx_enum_def_get_identifier(
839        enum_def: *const CDslxEnumDef,
840    ) -> *mut std::os::raw::c_char;
841
842    pub fn xls_dslx_enum_def_get_member_count(enum_def: *const CDslxEnumDef) -> i64;
843
844    pub fn xls_dslx_enum_def_get_member(
845        enum_def: *const CDslxEnumDef,
846        i: i64,
847    ) -> *mut CDslxEnumMember;
848
849    pub fn xls_dslx_enum_def_get_underlying(
850        enum_def: *const CDslxEnumDef,
851    ) -> *mut CDslxTypeAnnotation;
852
853    pub fn xls_dslx_enum_member_get_name(
854        member: *const CDslxEnumMember,
855    ) -> *mut std::os::raw::c_char;
856
857    pub fn xls_dslx_enum_member_get_value(member: *const CDslxEnumMember) -> *mut CDslxExpr;
858
859    // --
860
861    pub fn xls_dslx_interp_value_free(value: *mut CDslxInterpValue);
862
863    pub fn xls_dslx_interp_value_convert_to_ir(
864        value: *mut CDslxInterpValue,
865        error_out: *mut *mut std::os::raw::c_char,
866        result_out: *mut *mut CIrValue,
867    ) -> bool;
868
869    pub fn xls_dslx_type_to_string(
870        type_: *const CDslxType,
871        error_out: *mut *mut std::os::raw::c_char,
872        result_out: *mut *mut std::os::raw::c_char,
873    ) -> bool;
874
875    pub fn xls_dslx_type_info_get_const_expr(
876        type_info: *mut CDslxTypeInfo,
877        expr: *mut CDslxExpr,
878        error_out: *mut *mut std::os::raw::c_char,
879        result_out: *mut *mut CDslxInterpValue,
880    ) -> bool;
881
882    pub fn xls_dslx_type_get_total_bit_count(
883        type_: *const CDslxType,
884        error_out: *mut *mut std::os::raw::c_char,
885        result_out: *mut i64,
886    ) -> bool;
887
888    pub fn xls_dslx_type_is_signed_bits(
889        type_: *const CDslxType,
890        error_out: *mut *mut std::os::raw::c_char,
891        result_out: *mut bool,
892    ) -> bool;
893
894    pub fn xls_dslx_type_is_bits_like(
895        type_: *const CDslxType,
896        is_signed: *mut *mut CDslxTypeDim,
897        size: *mut *mut CDslxTypeDim,
898    ) -> bool;
899
900    pub fn xls_dslx_type_is_enum(type_: *const CDslxType) -> bool;
901    pub fn xls_dslx_type_is_struct(type_: *const CDslxType) -> bool;
902    pub fn xls_dslx_type_is_array(type_: *const CDslxType) -> bool;
903
904    pub fn xls_dslx_type_dim_is_parametric(dim: *const CDslxTypeDim) -> bool;
905    pub fn xls_dslx_type_dim_get_as_bool(
906        dim: *const CDslxTypeDim,
907        error_out: *mut *mut std::os::raw::c_char,
908        result_out: *mut bool,
909    ) -> bool;
910    pub fn xls_dslx_type_dim_get_as_int64(
911        dim: *const CDslxTypeDim,
912        error_out: *mut *mut std::os::raw::c_char,
913        result_out: *mut i64,
914    ) -> bool;
915    pub fn xls_dslx_type_dim_free(dim: *mut CDslxTypeDim);
916
917    pub fn xls_dslx_type_get_enum_def(ty: *const CDslxType) -> *mut CDslxEnumDef;
918
919    pub fn xls_dslx_type_get_struct_def(ty: *const CDslxType) -> *mut CDslxStructDef;
920
921    pub fn xls_dslx_type_array_get_element_type(ty: *const CDslxType) -> *mut CDslxType;
922    pub fn xls_dslx_type_array_get_size(ty: *const CDslxType) -> *mut CDslxTypeDim;
923
924    // -- IR builder APIs
925
926    pub fn xls_package_create(name: *const std::os::raw::c_char) -> *mut CIrPackage;
927    pub fn xls_package_get_bits_type(package: *mut CIrPackage, bit_count: i64) -> *mut CIrType;
928
929    pub fn xls_package_get_tuple_type(
930        package: *mut CIrPackage,
931        members: *mut *mut CIrType,
932        member_count: i64,
933    ) -> *mut CIrType;
934
935    pub fn xls_package_get_array_type(
936        package: *mut CIrPackage,
937        element_type: *mut CIrType,
938        size: i64,
939    ) -> *mut CIrType;
940
941    pub fn xls_package_get_token_type(package: *mut CIrPackage) -> *mut CIrType;
942
943    pub fn xls_function_builder_create(
944        name: *const std::os::raw::c_char,
945        package: *mut CIrPackage,
946        should_verify: bool,
947    ) -> *mut CIrFunctionBuilder;
948    pub fn xls_function_builder_as_builder_base(
949        builder: *mut CIrFunctionBuilder,
950    ) -> *mut CIrBuilderBase;
951    pub fn xls_function_builder_free(builder: *mut CIrFunctionBuilder);
952    pub fn xls_bvalue_free(bvalue: *mut CIrBValue);
953    pub fn xls_function_builder_add_parameter(
954        builder: *mut CIrFunctionBuilder,
955        name: *const std::os::raw::c_char,
956        type_: *mut CIrType,
957    ) -> *mut CIrBValue;
958    pub fn xls_function_builder_build(
959        builder: *mut CIrFunctionBuilder,
960        error_out: *mut *mut std::os::raw::c_char,
961        function_out: *mut *mut CIrFunction,
962    ) -> bool;
963    pub fn xls_function_builder_build_with_return_value(
964        builder: *mut CIrFunctionBuilder,
965        return_value: *mut CIrBValue,
966        error_out: *mut *mut std::os::raw::c_char,
967        function_out: *mut *mut CIrFunction,
968    ) -> bool;
969    pub fn xls_builder_base_add_and(
970        builder: *mut CIrBuilderBase,
971        lhs: *mut CIrBValue,
972        rhs: *mut CIrBValue,
973        name: *const std::os::raw::c_char,
974    ) -> *mut CIrBValue;
975    pub fn xls_builder_base_add_nand(
976        builder: *mut CIrBuilderBase,
977        lhs: *mut CIrBValue,
978        rhs: *mut CIrBValue,
979        name: *const std::os::raw::c_char,
980    ) -> *mut CIrBValue;
981    pub fn xls_builder_base_add_or(
982        builder: *mut CIrBuilderBase,
983        lhs: *mut CIrBValue,
984        rhs: *mut CIrBValue,
985        name: *const std::os::raw::c_char,
986    ) -> *mut CIrBValue;
987    pub fn xls_builder_base_add_xor(
988        builder: *mut CIrBuilderBase,
989        lhs: *mut CIrBValue,
990        rhs: *mut CIrBValue,
991        name: *const std::os::raw::c_char,
992    ) -> *mut CIrBValue;
993    pub fn xls_builder_base_add_not(
994        builder: *mut CIrBuilderBase,
995        value: *mut CIrBValue,
996        name: *const std::os::raw::c_char,
997    ) -> *mut CIrBValue;
998    pub fn xls_builder_base_add_negate(
999        builder: *mut CIrBuilderBase,
1000        value: *mut CIrBValue,
1001        name: *const std::os::raw::c_char,
1002    ) -> *mut CIrBValue;
1003    pub fn xls_builder_base_add_reverse(
1004        builder: *mut CIrBuilderBase,
1005        value: *mut CIrBValue,
1006        name: *const std::os::raw::c_char,
1007    ) -> *mut CIrBValue;
1008    pub fn xls_builder_base_add_or_reduce(
1009        builder: *mut CIrBuilderBase,
1010        value: *mut CIrBValue,
1011        name: *const std::os::raw::c_char,
1012    ) -> *mut CIrBValue;
1013    pub fn xls_builder_base_add_and_reduce(
1014        builder: *mut CIrBuilderBase,
1015        value: *mut CIrBValue,
1016        name: *const std::os::raw::c_char,
1017    ) -> *mut CIrBValue;
1018    pub fn xls_builder_base_add_xor_reduce(
1019        builder: *mut CIrBuilderBase,
1020        value: *mut CIrBValue,
1021        name: *const std::os::raw::c_char,
1022    ) -> *mut CIrBValue;
1023    pub fn xls_builder_base_add_literal(
1024        builder: *mut CIrBuilderBase,
1025        value: *mut CIrValue,
1026        name: *const std::os::raw::c_char,
1027    ) -> *mut CIrBValue;
1028    pub fn xls_builder_base_add_tuple(
1029        builder: *mut CIrBuilderBase,
1030        operands: *mut *mut CIrBValue,
1031        operand_count: i64,
1032        name: *const std::os::raw::c_char,
1033    ) -> *mut CIrBValue;
1034    pub fn xls_builder_base_add_tuple_index(
1035        builder: *mut CIrBuilderBase,
1036        tuple: *mut CIrBValue,
1037        index: i64,
1038        name: *const std::os::raw::c_char,
1039    ) -> *mut CIrBValue;
1040    pub fn xls_builder_base_add_array(
1041        builder: *mut CIrBuilderBase,
1042        element_type: *mut CIrType,
1043        elements: *const *mut CIrBValue,
1044        element_count: i64,
1045        name: *const std::os::raw::c_char,
1046    ) -> *mut CIrBValue;
1047    pub fn xls_builder_base_add_array_index(
1048        builder: *mut CIrBuilderBase,
1049        array: *mut CIrBValue,
1050        indices: *const *mut CIrBValue,
1051        index_count: i64,
1052        assumed_in_bounds: bool,
1053        name: *const std::os::raw::c_char,
1054    ) -> *mut CIrBValue;
1055    pub fn xls_builder_base_add_dynamic_bit_slice(
1056        builder: *mut CIrBuilderBase,
1057        value: *mut CIrBValue,
1058        start: *mut CIrBValue,
1059        width: i64,
1060        name: *const std::os::raw::c_char,
1061    ) -> *mut CIrBValue;
1062    pub fn xls_builder_base_add_bit_slice(
1063        builder: *mut CIrBuilderBase,
1064        value: *mut CIrBValue,
1065        start: i64,
1066        width: i64,
1067        name: *const std::os::raw::c_char,
1068    ) -> *mut CIrBValue;
1069    pub fn xls_builder_base_add_bit_slice_update(
1070        builder: *mut CIrBuilderBase,
1071        value: *mut CIrBValue,
1072        start: *mut CIrBValue,
1073        update: *mut CIrBValue,
1074        name: *const std::os::raw::c_char,
1075    ) -> *mut CIrBValue;
1076    pub fn xls_builder_base_add_concat(
1077        builder: *mut CIrBuilderBase,
1078        values: *const *mut CIrBValue,
1079        value_count: i64,
1080        name: *const std::os::raw::c_char,
1081    ) -> *mut CIrBValue;
1082    pub fn xls_builder_base_add_add(
1083        builder: *mut CIrBuilderBase,
1084        lhs: *mut CIrBValue,
1085        rhs: *mut CIrBValue,
1086        name: *const std::os::raw::c_char,
1087    ) -> *mut CIrBValue;
1088    pub fn xls_builder_base_add_sub(
1089        builder: *mut CIrBuilderBase,
1090        lhs: *mut CIrBValue,
1091        rhs: *mut CIrBValue,
1092        name: *const std::os::raw::c_char,
1093    ) -> *mut CIrBValue;
1094    pub fn xls_builder_base_add_umul(
1095        builder: *mut CIrBuilderBase,
1096        lhs: *mut CIrBValue,
1097        rhs: *mut CIrBValue,
1098        name: *const std::os::raw::c_char,
1099    ) -> *mut CIrBValue;
1100    pub fn xls_builder_base_add_smul(
1101        builder: *mut CIrBuilderBase,
1102        lhs: *mut CIrBValue,
1103        rhs: *mut CIrBValue,
1104        name: *const std::os::raw::c_char,
1105    ) -> *mut CIrBValue;
1106    pub fn xls_builder_base_add_eq(
1107        builder: *mut CIrBuilderBase,
1108        lhs: *mut CIrBValue,
1109        rhs: *mut CIrBValue,
1110        name: *const std::os::raw::c_char,
1111    ) -> *mut CIrBValue;
1112    pub fn xls_builder_base_add_ne(
1113        builder: *mut CIrBuilderBase,
1114        lhs: *mut CIrBValue,
1115        rhs: *mut CIrBValue,
1116        name: *const std::os::raw::c_char,
1117    ) -> *mut CIrBValue;
1118
1119    // -- comparisons
1120    pub fn xls_builder_base_add_ule(
1121        builder: *mut CIrBuilderBase,
1122        lhs: *mut CIrBValue,
1123        rhs: *mut CIrBValue,
1124        name: *const std::os::raw::c_char,
1125    ) -> *mut CIrBValue;
1126    pub fn xls_builder_base_add_ult(
1127        builder: *mut CIrBuilderBase,
1128        lhs: *mut CIrBValue,
1129        rhs: *mut CIrBValue,
1130        name: *const std::os::raw::c_char,
1131    ) -> *mut CIrBValue;
1132    pub fn xls_builder_base_add_uge(
1133        builder: *mut CIrBuilderBase,
1134        lhs: *mut CIrBValue,
1135        rhs: *mut CIrBValue,
1136        name: *const std::os::raw::c_char,
1137    ) -> *mut CIrBValue;
1138    pub fn xls_builder_base_add_ugt(
1139        builder: *mut CIrBuilderBase,
1140        lhs: *mut CIrBValue,
1141        rhs: *mut CIrBValue,
1142        name: *const std::os::raw::c_char,
1143    ) -> *mut CIrBValue;
1144    pub fn xls_builder_base_add_sle(
1145        builder: *mut CIrBuilderBase,
1146        lhs: *mut CIrBValue,
1147        rhs: *mut CIrBValue,
1148        name: *const std::os::raw::c_char,
1149    ) -> *mut CIrBValue;
1150    pub fn xls_builder_base_add_slt(
1151        builder: *mut CIrBuilderBase,
1152        lhs: *mut CIrBValue,
1153        rhs: *mut CIrBValue,
1154        name: *const std::os::raw::c_char,
1155    ) -> *mut CIrBValue;
1156    pub fn xls_builder_base_add_sgt(
1157        builder: *mut CIrBuilderBase,
1158        lhs: *mut CIrBValue,
1159        rhs: *mut CIrBValue,
1160        name: *const std::os::raw::c_char,
1161    ) -> *mut CIrBValue;
1162    pub fn xls_builder_base_add_sge(
1163        builder: *mut CIrBuilderBase,
1164        lhs: *mut CIrBValue,
1165        rhs: *mut CIrBValue,
1166        name: *const std::os::raw::c_char,
1167    ) -> *mut CIrBValue;
1168
1169    pub fn xls_builder_base_add_shra(
1170        builder: *mut CIrBuilderBase,
1171        a: *mut CIrBValue,
1172        b: *mut CIrBValue,
1173        name: *const std::os::raw::c_char,
1174    ) -> *mut CIrBValue;
1175    pub fn xls_builder_base_add_shrl(
1176        builder: *mut CIrBuilderBase,
1177        a: *mut CIrBValue,
1178        b: *mut CIrBValue,
1179        name: *const std::os::raw::c_char,
1180    ) -> *mut CIrBValue;
1181    pub fn xls_builder_base_add_shll(
1182        builder: *mut CIrBuilderBase,
1183        a: *mut CIrBValue,
1184        b: *mut CIrBValue,
1185        name: *const std::os::raw::c_char,
1186    ) -> *mut CIrBValue;
1187    pub fn xls_builder_base_add_nor(
1188        builder: *mut CIrBuilderBase,
1189        a: *mut CIrBValue,
1190        b: *mut CIrBValue,
1191        name: *const std::os::raw::c_char,
1192    ) -> *mut CIrBValue;
1193    pub fn xls_builder_base_add_clz(
1194        builder: *mut CIrBuilderBase,
1195        a: *mut CIrBValue,
1196        name: *const std::os::raw::c_char,
1197    ) -> *mut CIrBValue;
1198    pub fn xls_builder_base_add_ctz(
1199        builder: *mut CIrBuilderBase,
1200        a: *mut CIrBValue,
1201        name: *const std::os::raw::c_char,
1202    ) -> *mut CIrBValue;
1203    pub fn xls_builder_base_add_encode(
1204        builder: *mut CIrBuilderBase,
1205        a: *mut CIrBValue,
1206        name: *const std::os::raw::c_char,
1207    ) -> *mut CIrBValue;
1208
1209    pub fn xls_builder_base_add_decode(
1210        builder: *mut CIrBuilderBase,
1211        a: *mut CIrBValue,
1212        width: *mut i64,
1213        name: *const std::os::raw::c_char,
1214    ) -> *mut CIrBValue;
1215    pub fn xls_builder_base_add_select(
1216        builder: *mut CIrBuilderBase,
1217        selector: *mut CIrBValue,
1218        cases: *const *mut CIrBValue,
1219        case_count: i64,
1220        default_value: *mut CIrBValue,
1221        name: *const std::os::raw::c_char,
1222    ) -> *mut CIrBValue;
1223    pub fn xls_builder_base_add_array_concat(
1224        builder: *mut CIrBuilderBase,
1225        arrays: *const *mut CIrBValue,
1226        array_count: i64,
1227        name: *const std::os::raw::c_char,
1228    ) -> *mut CIrBValue;
1229    pub fn xls_builder_base_add_array_slice(
1230        builder: *mut CIrBuilderBase,
1231        array: *mut CIrBValue,
1232        start: *mut CIrBValue,
1233        width: i64,
1234        name: *const std::os::raw::c_char,
1235    ) -> *mut CIrBValue;
1236    pub fn xls_builder_base_add_array_update(
1237        builder: *mut CIrBuilderBase,
1238        array: *mut CIrBValue,
1239        update_value: *mut CIrBValue,
1240        indices: *const *mut CIrBValue,
1241        index_count: i64,
1242        assumed_in_bounds: bool,
1243        name: *const std::os::raw::c_char,
1244    ) -> *mut CIrBValue;
1245    pub fn xls_builder_base_add_identity(
1246        builder: *mut CIrBuilderBase,
1247        value: *mut CIrBValue,
1248        name: *const std::os::raw::c_char,
1249    ) -> *mut CIrBValue;
1250
1251    pub fn xls_builder_base_add_sign_extend(
1252        builder: *mut CIrBuilderBase,
1253        value: *mut CIrBValue,
1254        new_bit_count: i64,
1255        name: *const std::os::raw::c_char,
1256    ) -> *mut CIrBValue;
1257    pub fn xls_builder_base_add_zero_extend(
1258        builder: *mut CIrBuilderBase,
1259        value: *mut CIrBValue,
1260        new_bit_count: i64,
1261        name: *const std::os::raw::c_char,
1262    ) -> *mut CIrBValue;
1263
1264    pub fn xls_builder_base_add_one_hot(
1265        builder: *mut CIrBuilderBase,
1266        input: *mut CIrBValue,
1267        lsb_is_priority: bool,
1268        name: *const std::os::raw::c_char,
1269    ) -> *mut CIrBValue;
1270
1271    pub fn xls_builder_base_add_one_hot_select(
1272        builder: *mut CIrBuilderBase,
1273        selector: *mut CIrBValue,
1274        cases: *const *mut CIrBValue,
1275        case_count: i64,
1276        name: *const std::os::raw::c_char,
1277    ) -> *mut CIrBValue;
1278
1279    pub fn xls_builder_base_add_priority_select(
1280        builder: *mut CIrBuilderBase,
1281        selector: *mut CIrBValue,
1282        cases: *const *mut CIrBValue,
1283        case_count: i64,
1284        default_value: *mut CIrBValue,
1285        name: *const std::os::raw::c_char,
1286    ) -> *mut CIrBValue;
1287
1288    pub fn xls_builder_base_get_last_value(
1289        builder: *mut CIrBuilderBase,
1290        error_out: *mut *mut std::os::raw::c_char,
1291        value_out: *mut *mut CIrBValue,
1292    ) -> bool;
1293
1294    pub fn xls_builder_base_get_type(
1295        builder: *mut CIrBuilderBase,
1296        value: *mut CIrBValue,
1297    ) -> *mut CIrType;
1298}
1299
1300pub const DSLX_STDLIB_PATH: &str = env!("DSLX_STDLIB_PATH");
1301pub const XLS_DSO_PATH: &str = env!("XLS_DSO_PATH");