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