Skip to main content

xlsynth_sys/
lib.rs

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