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
460unsafe extern "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_udiv(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
638    pub fn xls_bits_sdiv(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
639    pub fn xls_bits_umod(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
640    pub fn xls_bits_smod(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
641    pub fn xls_bits_negate(bits: *const CIrBits) -> *mut CIrBits;
642    pub fn xls_bits_abs(bits: *const CIrBits) -> *mut CIrBits;
643    pub fn xls_bits_not(bits: *const CIrBits) -> *mut CIrBits;
644    pub fn xls_bits_and(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
645    pub fn xls_bits_or(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
646    pub fn xls_bits_xor(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
647
648    pub fn xls_bits_shift_left_logical(bits: *const CIrBits, shift_amount: i64) -> *mut CIrBits;
649    pub fn xls_bits_shift_right_logical(bits: *const CIrBits, shift_amount: i64) -> *mut CIrBits;
650    pub fn xls_bits_shift_right_arithmetic(bits: *const CIrBits, shift_amount: i64)
651        -> *mut CIrBits;
652
653    // struct xls_bits* xls_bits_width_slice(const struct xls_bits* bits, int64_t
654    // start, int64_t width);
655
656    pub fn xls_bits_width_slice(bits: *const CIrBits, start: i64, width: i64) -> *mut CIrBits;
657
658    pub fn xls_bits_to_bytes(
659        bits: *const CIrBits,
660        error_out: *mut *mut std::os::raw::c_char,
661        bytes_out: *mut *mut u8,
662        byte_count_out: *mut libc::size_t,
663    ) -> bool;
664    pub fn xls_bytes_free(bytes: *mut u8);
665    pub fn xls_bits_to_uint64(
666        bits: *const CIrBits,
667        error_out: *mut *mut std::os::raw::c_char,
668        value_out: *mut u64,
669    ) -> bool;
670    pub fn xls_bits_to_int64(
671        bits: *const CIrBits,
672        error_out: *mut *mut std::os::raw::c_char,
673        value_out: *mut i64,
674    ) -> bool;
675
676    pub fn xls_create_bits_rope(bit_count: i64) -> *mut CBitsRope;
677    pub fn xls_bits_rope_append_bits(bits_rope: *mut CBitsRope, bits: *const CIrBits);
678    pub fn xls_bits_rope_get_bits(bits_rope: *mut CBitsRope) -> *mut CIrBits;
679    pub fn xls_bits_rope_free(bits_rope: *mut CBitsRope);
680
681    pub fn xls_package_free(package: *mut CIrPackage);
682    pub fn xls_c_str_free(c_str: *mut std::os::raw::c_char);
683    pub fn xls_c_strs_free(c_strs: *mut *mut std::os::raw::c_char, count: libc::size_t);
684    pub fn xls_value_to_string(
685        value: *const CIrValue,
686        str_out: *mut *mut std::os::raw::c_char,
687    ) -> bool;
688    pub fn xls_format_preference_from_string(
689        s: *const std::os::raw::c_char,
690        error_out: *mut *mut std::os::raw::c_char,
691        result_out: *mut XlsFormatPreference,
692    ) -> bool;
693
694    pub fn xls_value_to_string_format_preference(
695        value: *const CIrValue,
696        fmt: XlsFormatPreference,
697        error_out: *mut *mut std::os::raw::c_char,
698        str_out: *mut *mut std::os::raw::c_char,
699    ) -> bool;
700    pub fn xls_bits_to_string(
701        bits: *const CIrBits,
702        fmt: XlsFormatPreference,
703        include_bit_count: bool,
704        error_out: *mut *mut std::os::raw::c_char,
705        str_out: *mut *mut std::os::raw::c_char,
706    ) -> bool;
707
708    pub fn xls_value_get_kind(
709        value: *const CIrValue,
710        error_out: *mut *mut std::os::raw::c_char,
711        kind_out: *mut XlsValueKind,
712    ) -> bool;
713    pub fn xls_value_make_true() -> *mut CIrValue;
714    pub fn xls_value_make_false() -> *mut CIrValue;
715    pub fn xls_value_from_bits_owned(bits: *mut CIrBits) -> *mut CIrValue;
716    pub fn xls_value_flatten_to_bits(value: *const CIrValue) -> *mut CIrBits;
717
718    pub fn xls_value_eq(value: *const CIrValue, value: *const CIrValue) -> bool;
719    pub fn xls_parse_ir_package(
720        ir: *const std::os::raw::c_char,
721        filename: *const std::os::raw::c_char,
722        error_out: *mut *mut std::os::raw::c_char,
723        xls_package_out: *mut *mut CIrPackage,
724    ) -> bool;
725
726    // -- IR analysis APIs
727
728    pub fn xls_ir_analysis_create_from_package(
729        p: *mut CIrPackage,
730        error_out: *mut *mut std::os::raw::c_char,
731        out: *mut *mut CIrAnalysis,
732    ) -> bool;
733
734    pub fn xls_ir_analysis_create_from_package_with_options(
735        p: *mut CIrPackage,
736        options: *const XlsIrAnalysisOptions,
737        error_out: *mut *mut std::os::raw::c_char,
738        out: *mut *mut CIrAnalysis,
739    ) -> bool;
740
741    pub fn xls_ir_analysis_free(a: *mut CIrAnalysis);
742
743    pub fn xls_ir_analysis_get_known_bits_for_node_id(
744        a: *const CIrAnalysis,
745        node_id: i64,
746        error_out: *mut *mut std::os::raw::c_char,
747        known_mask_out: *mut *mut CIrBits,
748        known_value_out: *mut *mut CIrBits,
749    ) -> bool;
750
751    pub fn xls_ir_analysis_get_intervals_for_node_id(
752        a: *const CIrAnalysis,
753        node_id: i64,
754        error_out: *mut *mut std::os::raw::c_char,
755        intervals_out: *mut *mut CIrIntervalSet,
756    ) -> bool;
757
758    pub fn xls_interval_set_get_interval_count(s: *const CIrIntervalSet) -> i64;
759
760    pub fn xls_interval_set_get_interval_bounds(
761        s: *const CIrIntervalSet,
762        i: i64,
763        error_out: *mut *mut std::os::raw::c_char,
764        lo_out: *mut *mut CIrBits,
765        hi_out: *mut *mut CIrBits,
766    ) -> bool;
767
768    pub fn xls_interval_set_free(s: *mut CIrIntervalSet);
769
770    pub fn xls_type_to_string(
771        t: *const CIrType,
772        error_out: *mut *mut std::os::raw::c_char,
773        result_out: *mut *mut std::os::raw::c_char,
774    ) -> bool;
775    pub fn xls_type_get_kind(
776        t: *mut CIrType,
777        error_out: *mut *mut std::os::raw::c_char,
778        kind_out: *mut XlsValueKind,
779    ) -> bool;
780    pub fn xls_type_get_flat_bit_count(t: *const CIrType) -> i64;
781    pub fn xls_type_get_leaf_count(t: *mut CIrType) -> i64;
782    pub fn xls_package_get_type_for_value(
783        package: *const CIrPackage,
784        value: *const CIrValue,
785        error_out: *mut *mut std::os::raw::c_char,
786        result_out: *mut *mut CIrType,
787    ) -> bool;
788    pub fn xls_package_get_function(
789        package: *const CIrPackage,
790        function_name: *const std::os::raw::c_char,
791        error_out: *mut *mut std::os::raw::c_char,
792        result_out: *mut *mut CIrFunction,
793    ) -> bool;
794    pub fn xls_package_get_functions(
795        package: *mut CIrPackage,
796        error_out: *mut *mut std::os::raw::c_char,
797        result_out: *mut *mut *mut CIrFunction,
798        count_out: *mut libc::size_t,
799    ) -> bool;
800    pub fn xls_function_ptr_array_free(function_pointer_array: *mut *mut CIrFunction);
801    pub fn xls_function_get_type(
802        function: *const CIrFunction,
803        error_out: *mut *mut std::os::raw::c_char,
804        xls_fn_type_out: *mut *mut CIrFunctionType,
805    ) -> bool;
806    pub fn xls_function_type_to_string(
807        t: *const CIrFunctionType,
808        error_out: *mut *mut std::os::raw::c_char,
809        string_out: *mut *mut std::os::raw::c_char,
810    ) -> bool;
811    pub fn xls_function_get_name(
812        function: *const CIrFunction,
813        error_out: *mut *mut std::os::raw::c_char,
814        name_out: *mut *mut std::os::raw::c_char,
815    ) -> bool;
816    pub fn xls_function_to_z3_smtlib(
817        function: *mut CIrFunction,
818        error_out: *mut *mut std::os::raw::c_char,
819        string_out: *mut *mut std::os::raw::c_char,
820    ) -> bool;
821    pub fn xls_interpret_function(
822        function: *const CIrFunction,
823        argc: libc::size_t,
824        args: *const *const CIrValue,
825        error_out: *mut *mut std::os::raw::c_char,
826        result_out: *mut *mut CIrValue,
827    ) -> bool;
828    pub fn xls_optimize_ir(
829        ir: *const std::os::raw::c_char,
830        top: *const std::os::raw::c_char,
831        error_out: *mut *mut std::os::raw::c_char,
832        ir_out: *mut *mut std::os::raw::c_char,
833    ) -> bool;
834    pub fn xls_mangle_dslx_name(
835        module_name: *const std::os::raw::c_char,
836        function_name: *const std::os::raw::c_char,
837        error_out: *mut *mut std::os::raw::c_char,
838        mangled_out: *mut *mut std::os::raw::c_char,
839    ) -> bool;
840    pub fn xls_init_xls(
841        usage: *const std::os::raw::c_char,
842        argc: libc::c_int,
843        argv: *mut *mut std::os::raw::c_char,
844    );
845    pub fn xls_package_to_string(
846        p: *const CIrPackage,
847        string_out: *mut *mut std::os::raw::c_char,
848    ) -> bool;
849    pub fn xls_function_to_string(
850        f: *const CIrFunction,
851        string_out: *mut *mut std::os::raw::c_char,
852    ) -> bool;
853    pub fn xls_package_get_top(p: *mut CIrPackage) -> *mut CIrFunctionBase;
854    pub fn xls_package_set_top_by_name(
855        p: *mut CIrPackage,
856        name: *const std::os::raw::c_char,
857        error_out: *mut *mut std::os::raw::c_char,
858    ) -> bool;
859
860    pub fn xls_verify_package(
861        p: *mut CIrPackage,
862        error_out: *mut *mut std::os::raw::c_char,
863    ) -> bool;
864
865    pub fn xls_make_function_jit(
866        function: *const CIrFunction,
867        error_out: *mut *mut std::os::raw::c_char,
868        result_out: *mut *mut CIrFunctionJit,
869    ) -> bool;
870    pub fn xls_aot_compile_function(
871        function: *mut CIrFunction,
872        error_out: *mut *mut std::os::raw::c_char,
873        object_code_out: *mut *mut u8,
874        object_code_count_out: *mut libc::size_t,
875        entrypoints_proto_out: *mut *mut u8,
876        entrypoints_proto_count_out: *mut libc::size_t,
877    ) -> bool;
878    pub fn xls_aot_object_code_free(object_code: *mut u8);
879    pub fn xls_aot_entrypoints_proto_free(entrypoints_proto: *mut u8);
880    pub fn xls_aot_exec_context_create(
881        entrypoints_proto: *const u8,
882        entrypoints_proto_count: libc::size_t,
883        error_out: *mut *mut std::os::raw::c_char,
884        out: *mut *mut CXlsAotExecContext,
885    ) -> bool;
886    pub fn xls_aot_exec_context_clear_events(context: *mut CXlsAotExecContext);
887    pub fn xls_aot_exec_context_free(context: *mut CXlsAotExecContext);
888    pub fn xls_aot_entrypoint_trampoline(
889        function_ptr: usize,
890        inputs: *const *const u8,
891        outputs: *const *mut u8,
892        temp_buffer: *mut libc::c_void,
893        context: *mut CXlsAotExecContext,
894        continuation_point: i64,
895        trace_messages_count_out: *mut libc::size_t,
896        assert_messages_count_out: *mut libc::size_t,
897    ) -> i64;
898    pub fn xls_aot_exec_context_get_trace_message(
899        context: *const CXlsAotExecContext,
900        index: libc::size_t,
901        error_out: *mut *mut std::os::raw::c_char,
902        trace_message_out: *mut CTraceMessage,
903    ) -> bool;
904    pub fn xls_aot_exec_context_get_assert_message(
905        context: *const CXlsAotExecContext,
906        index: libc::size_t,
907        error_out: *mut *mut std::os::raw::c_char,
908        assert_message_out: *mut *mut std::os::raw::c_char,
909    ) -> bool;
910    pub fn xls_function_jit_free(jit: *mut CIrFunctionJit);
911    pub fn xls_function_jit_run(
912        jit: *const CIrFunctionJit,
913        argc: libc::size_t,
914        args: *const *const CIrValue,
915        error_out: *mut *mut std::os::raw::c_char,
916        trace_messages_out: *mut *mut CTraceMessage,
917        trace_messages_count_out: *mut libc::size_t,
918        assert_messages_out: *mut *mut *mut std::os::raw::c_char,
919        assert_messages_count_out: *mut libc::size_t,
920        result_out: *mut *mut CIrValue,
921    ) -> bool;
922    pub fn xls_trace_messages_free(trace_messages: *mut CTraceMessage, count: libc::size_t);
923
924    // -- VAST APIs
925
926    pub fn xls_vast_make_verilog_file(file_type: CVastFileType) -> *mut CVastFile;
927    pub fn xls_vast_verilog_file_free(f: *mut CVastFile);
928    pub fn xls_vast_verilog_file_add_module(
929        f: *mut CVastFile,
930        name: *const std::os::raw::c_char,
931    ) -> *mut CVastModule;
932
933    // - Node creation
934    pub fn xls_vast_verilog_file_make_scalar_type(f: *mut CVastFile) -> *mut CVastDataType;
935    pub fn xls_vast_verilog_file_make_bit_vector_type(
936        f: *mut CVastFile,
937        bit_count: i64,
938        is_signed: bool,
939    ) -> *mut CVastDataType;
940    pub fn xls_vast_verilog_file_make_bit_vector_type_with_expression(
941        f: *mut CVastFile,
942        width_expr: *mut CVastExpression,
943        is_signed: bool,
944    ) -> *mut CVastDataType;
945    pub fn xls_vast_verilog_file_make_integer_type(
946        f: *mut CVastFile,
947        is_signed: bool,
948    ) -> *mut CVastDataType;
949    pub fn xls_vast_verilog_file_make_int_type(
950        f: *mut CVastFile,
951        is_signed: bool,
952    ) -> *mut CVastDataType;
953    pub fn xls_vast_verilog_file_make_integer_def(
954        f: *mut CVastFile,
955        name: *const std::os::raw::c_char,
956        is_signed: bool,
957    ) -> *mut CVastDef;
958    pub fn xls_vast_verilog_file_make_int_def(
959        f: *mut CVastFile,
960        name: *const std::os::raw::c_char,
961        is_signed: bool,
962    ) -> *mut CVastDef;
963    pub fn xls_vast_verilog_file_make_extern_package_type(
964        f: *mut CVastFile,
965        package_name: *const std::os::raw::c_char,
966        type_name: *const std::os::raw::c_char,
967    ) -> *mut CVastDataType;
968    pub fn xls_vast_verilog_file_make_extern_type(
969        f: *mut CVastFile,
970        entity_name: *const std::os::raw::c_char,
971    ) -> *mut CVastDataType;
972    pub fn xls_vast_verilog_file_make_packed_array_type(
973        f: *mut CVastFile,
974        element_type: *mut CVastDataType,
975        dims: *const i64,
976        dim_count: libc::size_t,
977    ) -> *mut CVastDataType;
978    pub fn xls_vast_verilog_file_make_unpacked_array_type(
979        f: *mut CVastFile,
980        element_type: *mut CVastDataType,
981        dims: *const i64,
982        dim_count: libc::size_t,
983    ) -> *mut CVastDataType;
984
985    // -- Data type introspection
986    pub fn xls_vast_data_type_width_as_int64(
987        type_: *mut CVastDataType,
988        out_width: *mut i64,
989        error_out: *mut *mut std::os::raw::c_char,
990    ) -> bool;
991
992    pub fn xls_vast_data_type_flat_bit_count_as_int64(
993        type_: *mut CVastDataType,
994        out_flat_bit_count: *mut i64,
995        error_out: *mut *mut std::os::raw::c_char,
996    ) -> bool;
997
998    // Returns width expression; may return nullptr if none.
999    pub fn xls_vast_data_type_width(type_: *mut CVastDataType) -> *mut CVastExpression;
1000
1001    pub fn xls_vast_data_type_is_signed(type_: *mut CVastDataType) -> bool;
1002
1003    pub fn xls_vast_verilog_file_make_continuous_assignment(
1004        f: *mut CVastFile,
1005        lhs: *mut CVastExpression,
1006        rhs: *mut CVastExpression,
1007    ) -> *mut CVastContinuousAssignment;
1008
1009    pub fn xls_vast_verilog_file_make_concat(
1010        f: *mut CVastFile,
1011        expressions: *mut *mut CVastExpression,
1012        expression_count: libc::size_t,
1013    ) -> *mut CVastExpression;
1014
1015    pub fn xls_vast_verilog_file_make_replicated_concat(
1016        f: *mut CVastFile,
1017        replication: *mut CVastExpression,
1018        elements: *mut *mut CVastExpression,
1019        element_count: libc::size_t,
1020    ) -> *mut CVastConcat;
1021
1022    pub fn xls_vast_verilog_file_make_replicated_concat_i64(
1023        f: *mut CVastFile,
1024        replication_count: i64,
1025        elements: *mut *mut CVastExpression,
1026        element_count: libc::size_t,
1027    ) -> *mut CVastConcat;
1028    pub fn xls_vast_verilog_file_make_array_assignment_pattern(
1029        f: *mut CVastFile,
1030        elements: *mut *mut CVastExpression,
1031        element_count: libc::size_t,
1032    ) -> *mut CVastExpression;
1033
1034    pub fn xls_vast_verilog_file_make_slice_i64(
1035        f: *mut CVastFile,
1036        subject: *mut CVastIndexableExpression,
1037        hi: i64,
1038        lo: i64,
1039    ) -> *mut CVastSlice;
1040    pub fn xls_vast_verilog_file_make_slice(
1041        f: *mut CVastFile,
1042        subject: *mut CVastIndexableExpression,
1043        hi: *mut CVastExpression,
1044        lo: *mut CVastExpression,
1045    ) -> *mut CVastSlice;
1046
1047    pub fn xls_vast_verilog_file_make_index(
1048        f: *mut CVastFile,
1049        subject: *mut CVastIndexableExpression,
1050        index: *mut CVastExpression,
1051    ) -> *mut CVastIndex;
1052    pub fn xls_vast_verilog_file_make_index_i64(
1053        f: *mut CVastFile,
1054        subject: *mut CVastIndexableExpression,
1055        index: i64,
1056    ) -> *mut CVastIndex;
1057
1058    pub fn xls_vast_verilog_file_make_unary(
1059        f: *mut CVastFile,
1060        arg: *mut CVastExpression,
1061        op: VastOperatorKind,
1062    ) -> *mut CVastExpression;
1063
1064    pub fn xls_vast_verilog_file_make_binary(
1065        f: *mut CVastFile,
1066        lhs: *mut CVastExpression,
1067        rhs: *mut CVastExpression,
1068        op: VastOperatorKind,
1069    ) -> *mut CVastExpression;
1070
1071    pub fn xls_vast_verilog_file_make_ternary(
1072        f: *mut CVastFile,
1073        cond: *mut CVastExpression,
1074        then_expr: *mut CVastExpression,
1075        else_expr: *mut CVastExpression,
1076    ) -> *mut CVastExpression;
1077
1078    pub fn xls_vast_verilog_file_make_width_cast(
1079        f: *mut CVastFile,
1080        width: *mut CVastExpression,
1081        value: *mut CVastExpression,
1082    ) -> *mut CVastExpression;
1083
1084    // Cast a value to a specific type.
1085    pub fn xls_vast_verilog_file_make_type_cast(
1086        f: *mut CVastFile,
1087        type_: *mut CVastDataType,
1088        value: *mut CVastExpression,
1089    ) -> *mut CVastExpression;
1090
1091    pub fn xls_vast_verilog_file_make_instantiation(
1092        f: *mut CVastFile,
1093        module_name: *const std::os::raw::c_char,
1094        instance_name: *const std::os::raw::c_char,
1095        parameter_port_names: *const *const std::os::raw::c_char,
1096        parameter_expressions: *const *const CVastExpression,
1097        parameter_count: libc::size_t,
1098        connection_port_names: *const *const std::os::raw::c_char,
1099        connection_expressions: *const *const CVastExpression,
1100        connection_count: libc::size_t,
1101    ) -> *mut CVastInstantiation;
1102    pub fn xls_vast_verilog_file_make_comment(
1103        f: *mut CVastFile,
1104        text: *const std::os::raw::c_char,
1105    ) -> *mut CVastComment;
1106    pub fn xls_vast_verilog_file_make_blank_line(f: *mut CVastFile) -> *mut CVastBlankLine;
1107    pub fn xls_vast_verilog_file_make_inline_verilog_statement(
1108        f: *mut CVastFile,
1109        text: *const std::os::raw::c_char,
1110    ) -> *mut CVastInlineVerilogStatement;
1111    pub fn xls_vast_verilog_file_make_literal(
1112        f: *mut CVastFile,
1113        bits: *const CIrBits,
1114        format_preference: XlsFormatPreference,
1115        emit_bit_count: bool,
1116        error_out: *mut *mut std::os::raw::c_char,
1117        literal_out: *mut *mut CVastLiteral,
1118    ) -> bool;
1119    pub fn xls_vast_verilog_file_make_plain_literal(
1120        f: *mut CVastFile,
1121        value: i32,
1122    ) -> *mut CVastLiteral;
1123
1124    // - Module additions
1125    pub fn xls_vast_verilog_module_add_parameter_port(
1126        m: *mut CVastModule,
1127        name: *const std::os::raw::c_char,
1128        rhs: *mut CVastExpression,
1129    ) -> *mut CVastLogicRef;
1130    pub fn xls_vast_verilog_module_add_typed_parameter_port(
1131        m: *mut CVastModule,
1132        name: *const std::os::raw::c_char,
1133        type_: *mut CVastDataType,
1134        rhs: *mut CVastExpression,
1135    ) -> *mut CVastLogicRef;
1136    pub fn xls_vast_verilog_module_add_input(
1137        m: *mut CVastModule,
1138        name: *const std::os::raw::c_char,
1139        type_: *mut CVastDataType,
1140    ) -> *mut CVastLogicRef;
1141    pub fn xls_vast_verilog_module_add_output(
1142        m: *mut CVastModule,
1143        name: *const std::os::raw::c_char,
1144        type_: *mut CVastDataType,
1145    ) -> *mut CVastLogicRef;
1146    pub fn xls_vast_verilog_module_add_inout(
1147        m: *mut CVastModule,
1148        name: *const std::os::raw::c_char,
1149        type_: *mut CVastDataType,
1150    ) -> *mut CVastLogicRef;
1151    pub fn xls_vast_verilog_module_add_logic_input(
1152        m: *mut CVastModule,
1153        name: *const std::os::raw::c_char,
1154        type_: *mut CVastDataType,
1155    ) -> *mut CVastLogicRef;
1156    pub fn xls_vast_verilog_module_add_logic_output(
1157        m: *mut CVastModule,
1158        name: *const std::os::raw::c_char,
1159        type_: *mut CVastDataType,
1160    ) -> *mut CVastLogicRef;
1161    pub fn xls_vast_verilog_module_add_wire(
1162        m: *mut CVastModule,
1163        name: *const std::os::raw::c_char,
1164        type_: *mut CVastDataType,
1165    ) -> *mut CVastLogicRef;
1166    pub fn xls_vast_verilog_module_add_generate_loop(
1167        m: *mut CVastModule,
1168        genvar_name: *const std::os::raw::c_char,
1169        init: *mut CVastExpression,
1170        limit: *mut CVastExpression,
1171        label: *const std::os::raw::c_char,
1172    ) -> *mut CVastGenerateLoop;
1173    pub fn xls_vast_verilog_module_add_member_instantiation(
1174        m: *mut CVastModule,
1175        inst: *mut CVastInstantiation,
1176    );
1177    pub fn xls_vast_verilog_module_add_member_continuous_assignment(
1178        m: *mut CVastModule,
1179        ca: *mut CVastContinuousAssignment,
1180    );
1181    pub fn xls_vast_verilog_module_add_member_comment(
1182        m: *mut CVastModule,
1183        comment: *mut CVastComment,
1184    );
1185    pub fn xls_vast_verilog_module_add_member_blank_line(
1186        m: *mut CVastModule,
1187        blank: *mut CVastBlankLine,
1188    );
1189    pub fn xls_vast_verilog_module_add_member_inline_statement(
1190        m: *mut CVastModule,
1191        stmt: *mut CVastInlineVerilogStatement,
1192    );
1193    pub fn xls_vast_verilog_module_add_member_macro_statement(
1194        m: *mut CVastModule,
1195        statement: *mut CVastMacroStatement,
1196    );
1197    pub fn xls_vast_verilog_module_add_conditional(
1198        m: *mut CVastModule,
1199        cond: *mut CVastExpression,
1200    ) -> *mut CVastConditional;
1201
1202    pub fn xls_vast_verilog_module_add_parameter(
1203        m: *mut CVastModule,
1204        name: *const std::os::raw::c_char,
1205        rhs: *mut CVastExpression,
1206    ) -> *mut CVastParameterRef;
1207
1208    pub fn xls_vast_verilog_module_add_localparam(
1209        m: *mut CVastModule,
1210        name: *const std::os::raw::c_char,
1211        rhs: *mut CVastExpression,
1212    ) -> *mut CVastLocalparamRef;
1213
1214    pub fn xls_vast_verilog_file_make_def(
1215        f: *mut CVastFile,
1216        name: *const std::os::raw::c_char,
1217        kind: VastDataKind,
1218        type_: *mut CVastDataType,
1219    ) -> *mut CVastDef;
1220
1221    pub fn xls_vast_verilog_module_add_parameter_with_def(
1222        m: *mut CVastModule,
1223        def: *mut CVastDef,
1224        rhs: *mut CVastExpression,
1225    ) -> *mut CVastParameterRef;
1226
1227    pub fn xls_vast_verilog_module_add_localparam_with_def(
1228        m: *mut CVastModule,
1229        def: *mut CVastDef,
1230        rhs: *mut CVastExpression,
1231    ) -> *mut CVastLocalparamRef;
1232
1233    pub fn xls_vast_verilog_module_get_name(m: *mut CVastModule) -> *mut std::os::raw::c_char;
1234
1235    // - Expression conversions
1236    pub fn xls_vast_logic_ref_as_indexable_expression(
1237        v: *mut CVastLogicRef,
1238    ) -> *mut CVastIndexableExpression;
1239    pub fn xls_vast_index_as_indexable_expression(
1240        v: *mut CVastIndex,
1241    ) -> *mut CVastIndexableExpression;
1242    pub fn xls_vast_parameter_ref_as_indexable_expression(
1243        v: *mut CVastParameterRef,
1244    ) -> *mut CVastIndexableExpression;
1245
1246    pub fn xls_vast_literal_as_expression(v: *mut CVastLiteral) -> *mut CVastExpression;
1247    pub fn xls_vast_concat_as_expression(v: *mut CVastConcat) -> *mut CVastExpression;
1248    pub fn xls_vast_logic_ref_as_expression(v: *mut CVastLogicRef) -> *mut CVastExpression;
1249    pub fn xls_vast_slice_as_expression(v: *mut CVastSlice) -> *mut CVastExpression;
1250    pub fn xls_vast_index_as_expression(v: *mut CVastIndex) -> *mut CVastExpression;
1251    pub fn xls_vast_parameter_ref_as_expression(v: *mut CVastParameterRef) -> *mut CVastExpression;
1252    pub fn xls_vast_localparam_ref_as_expression(
1253        v: *mut CVastLocalparamRef,
1254    ) -> *mut CVastExpression;
1255    pub fn xls_vast_indexable_expression_as_expression(
1256        v: *mut CVastIndexableExpression,
1257    ) -> *mut CVastExpression;
1258    pub fn xls_vast_macro_ref_as_expression(v: *mut CVastMacroRef) -> *mut CVastExpression;
1259    pub fn xls_vast_verilog_file_make_unsized_one_literal(
1260        f: *mut CVastFile,
1261    ) -> *mut CVastExpression;
1262    pub fn xls_vast_verilog_file_make_unsized_zero_literal(
1263        f: *mut CVastFile,
1264    ) -> *mut CVastExpression;
1265    pub fn xls_vast_verilog_file_make_unsized_x_literal(f: *mut CVastFile) -> *mut CVastExpression;
1266    pub fn xls_vast_verilog_file_make_macro_ref(
1267        f: *mut CVastFile,
1268        name: *const std::os::raw::c_char,
1269    ) -> *mut CVastMacroRef;
1270    pub fn xls_vast_verilog_file_make_macro_ref_with_args(
1271        f: *mut CVastFile,
1272        name: *const std::os::raw::c_char,
1273        args: *mut *mut CVastExpression,
1274        arg_count: libc::size_t,
1275    ) -> *mut CVastMacroRef;
1276    pub fn xls_vast_verilog_file_make_macro_statement(
1277        f: *mut CVastFile,
1278        r#ref: *mut CVastMacroRef,
1279        emit_semicolon: bool,
1280    ) -> *mut CVastMacroStatement;
1281
1282    pub fn xls_vast_logic_ref_get_name(v: *mut CVastLogicRef) -> *mut std::os::raw::c_char;
1283
1284    pub fn xls_vast_verilog_file_add_include(f: *mut CVastFile, path: *const std::os::raw::c_char);
1285    pub fn xls_vast_verilog_file_add_blank_line(f: *mut CVastFile, blank_line: *mut CVastBlankLine);
1286    pub fn xls_vast_verilog_file_add_comment(
1287        f: *mut CVastFile,
1288        comment: *const std::os::raw::c_char,
1289    );
1290    pub fn xls_vast_verilog_file_emit(f: *const CVastFile) -> *mut std::os::raw::c_char;
1291    pub fn xls_vast_expression_emit(expr: *mut CVastExpression) -> *mut std::os::raw::c_char;
1292
1293    // -- DSLX
1294
1295    pub fn xls_dslx_import_data_create(
1296        dslx_stdlib_path: *const std::os::raw::c_char,
1297        additional_search_paths: *const *const std::os::raw::c_char,
1298        additional_search_paths_count: libc::size_t,
1299    ) -> *mut CDslxImportData;
1300    pub fn xls_dslx_import_data_free(data: *mut CDslxImportData);
1301
1302    pub fn xls_dslx_parse_and_typecheck(
1303        text: *const std::os::raw::c_char,
1304        path: *const std::os::raw::c_char,
1305        module_name: *const std::os::raw::c_char,
1306        import_data: *const CDslxImportData,
1307        error_out: *mut *mut std::os::raw::c_char,
1308        typechecked_module_out: *mut *mut CDslxTypecheckedModule,
1309    ) -> bool;
1310
1311    pub fn xls_dslx_typechecked_module_clone_removing_functions(
1312        tm: *mut CDslxTypecheckedModule,
1313        functions: *mut *mut CDslxFunction,
1314        function_count: libc::size_t,
1315        install_subject: *const std::os::raw::c_char,
1316        import_data: *mut CDslxImportData,
1317        error_out: *mut *mut std::os::raw::c_char,
1318        result_out: *mut *mut CDslxTypecheckedModule,
1319    ) -> bool;
1320
1321    pub fn xls_dslx_typechecked_module_clone_removing_members(
1322        tm: *mut CDslxTypecheckedModule,
1323        members: *mut *mut CDslxModuleMember,
1324        member_count: libc::size_t,
1325        install_subject: *const std::os::raw::c_char,
1326        import_data: *mut CDslxImportData,
1327        error_out: *mut *mut std::os::raw::c_char,
1328        result_out: *mut *mut CDslxTypecheckedModule,
1329    ) -> bool;
1330
1331    pub fn xls_dslx_replace_invocations_in_module(
1332        tm: *mut CDslxTypecheckedModule,
1333        callers: *const *mut CDslxFunction,
1334        callers_count: libc::size_t,
1335        rules: *const CDslxInvocationRewriteRule,
1336        rules_count: libc::size_t,
1337        import_data: *mut CDslxImportData,
1338        install_subject: *const std::os::raw::c_char,
1339        error_out: *mut *mut std::os::raw::c_char,
1340        result_out: *mut *mut CDslxTypecheckedModule,
1341    ) -> bool;
1342
1343    pub fn xls_dslx_typechecked_module_insert_function_specializations(
1344        typechecked_module: *mut CDslxTypecheckedModule,
1345        requests: *const XlsDslxFunctionSpecializationRequest,
1346        request_count: libc::size_t,
1347        import_data: *mut CDslxImportData,
1348        install_subject: *const std::os::raw::c_char,
1349        error_out: *mut *mut std::os::raw::c_char,
1350        result_out: *mut *mut CDslxTypecheckedModule,
1351    ) -> bool;
1352
1353    // bool xls_schedule_and_codegen_package(
1354    // struct xls_package* p, const char* scheduling_options_flags_proto,
1355    // const char* codegen_flags_proto, bool with_delay_model, char** error_out,
1356    // struct xls_schedule_and_codegen_result** result_out);
1357    pub fn xls_schedule_and_codegen_package(
1358        p: *mut CIrPackage,
1359        scheduling_options_flags_proto: *const std::os::raw::c_char,
1360        codegen_flags_proto: *const std::os::raw::c_char,
1361        with_delay_model: bool,
1362        error_out: *mut *mut std::os::raw::c_char,
1363        result_out: *mut *mut CScheduleAndCodegenResult,
1364    ) -> bool;
1365
1366    pub fn xls_schedule_and_codegen_result_get_verilog_text(
1367        result: *mut CScheduleAndCodegenResult,
1368    ) -> *mut std::os::raw::c_char;
1369
1370    pub fn xls_schedule_and_codegen_result_free(result: *mut CScheduleAndCodegenResult);
1371
1372    pub fn xls_dslx_typechecked_module_free(module: *mut CDslxTypecheckedModule);
1373
1374    pub fn xls_dslx_typechecked_module_get_module(
1375        module: *mut CDslxTypecheckedModule,
1376    ) -> *mut CDslxModule;
1377
1378    pub fn xls_dslx_typechecked_module_get_type_info(
1379        module: *mut CDslxTypecheckedModule,
1380    ) -> *mut CDslxTypeInfo;
1381
1382    pub fn xls_dslx_module_to_string(module: *mut CDslxModule) -> *mut std::os::raw::c_char;
1383
1384    pub fn xls_dslx_module_get_name(module: *const CDslxModule) -> *mut std::os::raw::c_char;
1385
1386    pub fn xls_dslx_module_get_type_definition_count(module: *const CDslxModule) -> i64;
1387
1388    pub fn xls_dslx_module_get_member_count(module: *const CDslxModule) -> i64;
1389
1390    pub fn xls_dslx_module_get_member(module: *const CDslxModule, i: i64)
1391        -> *mut CDslxModuleMember;
1392
1393    pub fn xls_dslx_module_get_type_definition_kind(
1394        module: *const CDslxModule,
1395        i: i64,
1396    ) -> DslxTypeDefinitionKind;
1397
1398    pub fn xls_dslx_module_get_type_definition_as_struct_def(
1399        module: *const CDslxModule,
1400        i: i64,
1401    ) -> *mut CDslxStructDef;
1402    pub fn xls_dslx_module_get_type_definition_as_enum_def(
1403        module: *const CDslxModule,
1404        i: i64,
1405    ) -> *mut CDslxEnumDef;
1406    pub fn xls_dslx_module_get_type_definition_as_type_alias(
1407        module: *const CDslxModule,
1408        i: i64,
1409    ) -> *mut CDslxTypeAlias;
1410
1411    // -- xls_dslx_module_member
1412    pub fn xls_dslx_module_member_get_kind(
1413        member: *const CDslxModuleMember,
1414    ) -> DslxModuleMemberKind;
1415    pub fn xls_dslx_module_member_get_constant_def(
1416        member: *const CDslxModuleMember,
1417    ) -> *mut CDslxConstantDef;
1418    pub fn xls_dslx_module_member_get_type_alias(
1419        member: *const CDslxModuleMember,
1420    ) -> *mut CDslxTypeAlias;
1421    pub fn xls_dslx_module_member_get_struct_def(
1422        member: *const CDslxModuleMember,
1423    ) -> *mut CDslxStructDef;
1424    pub fn xls_dslx_module_member_get_enum_def(
1425        member: *const CDslxModuleMember,
1426    ) -> *mut CDslxEnumDef;
1427    pub fn xls_dslx_module_member_get_function(
1428        member: *const CDslxModuleMember,
1429    ) -> *mut CDslxFunction;
1430    pub fn xls_dslx_module_member_get_quickcheck(
1431        member: *const CDslxModuleMember,
1432    ) -> *mut CDslxQuickcheck;
1433    pub fn xls_dslx_module_member_from_constant_def(
1434        constant_def: *mut CDslxConstantDef,
1435    ) -> *mut CDslxModuleMember;
1436    pub fn xls_dslx_module_member_from_struct_def(
1437        struct_def: *mut CDslxStructDef,
1438    ) -> *mut CDslxModuleMember;
1439    pub fn xls_dslx_module_member_from_enum_def(
1440        enum_def: *mut CDslxEnumDef,
1441    ) -> *mut CDslxModuleMember;
1442    pub fn xls_dslx_module_member_from_type_alias(
1443        type_alias: *mut CDslxTypeAlias,
1444    ) -> *mut CDslxModuleMember;
1445    pub fn xls_dslx_module_member_from_function(
1446        function: *mut CDslxFunction,
1447    ) -> *mut CDslxModuleMember;
1448    pub fn xls_dslx_module_member_from_quickcheck(
1449        quickcheck: *mut CDslxQuickcheck,
1450    ) -> *mut CDslxModuleMember;
1451
1452    pub fn xls_dslx_colon_ref_get_attr(
1453        colon_ref: *const CDslxColonRef,
1454    ) -> *mut std::os::raw::c_char;
1455
1456    pub fn xls_dslx_type_info_get_type_struct_def(
1457        type_info: *mut CDslxTypeInfo,
1458        node: *mut CDslxStructDef,
1459    ) -> *mut CDslxType;
1460    pub fn xls_dslx_type_info_get_type_enum_def(
1461        type_info: *mut CDslxTypeInfo,
1462        node: *mut CDslxEnumDef,
1463    ) -> *mut CDslxType;
1464    pub fn xls_dslx_type_info_get_type_struct_member(
1465        type_info: *mut CDslxTypeInfo,
1466        member: *mut CDslxStructMember,
1467    ) -> *mut CDslxType;
1468    pub fn xls_dslx_type_info_get_type_constant_def(
1469        type_info: *mut CDslxTypeInfo,
1470        node: *mut CDslxConstantDef,
1471    ) -> *mut CDslxType;
1472
1473    /// Gets the concrete type for a TypeAnnotation AST node.
1474    pub fn xls_dslx_type_info_get_type_type_annotation(
1475        type_info: *mut CDslxTypeInfo,
1476        type_annotation: *mut CDslxTypeAnnotation,
1477    ) -> *mut CDslxType;
1478
1479    pub fn xls_dslx_type_info_get_imported_type_info(
1480        type_info: *mut CDslxTypeInfo,
1481        module: *mut CDslxModule,
1482    ) -> *mut CDslxTypeInfo;
1483
1484    pub fn xls_dslx_type_info_get_unique_invocation_callee_data(
1485        type_info: *mut CDslxTypeInfo,
1486        function: *mut CDslxFunction,
1487    ) -> *mut CDslxInvocationCalleeDataArray;
1488    pub fn xls_dslx_type_info_get_all_invocation_callee_data(
1489        type_info: *mut CDslxTypeInfo,
1490        function: *mut CDslxFunction,
1491    ) -> *mut CDslxInvocationCalleeDataArray;
1492    pub fn xls_dslx_type_info_get_root_invocation_data(
1493        type_info: *mut CDslxTypeInfo,
1494        invocation: *mut CDslxInvocation,
1495    ) -> *mut CDslxInvocationData;
1496
1497    // -- call_graph
1498    pub fn xls_dslx_type_info_build_function_call_graph(
1499        type_info: *mut CDslxTypeInfo,
1500        error_out: *mut *mut std::os::raw::c_char,
1501        result_out: *mut *mut CDslxCallGraph,
1502    ) -> bool;
1503
1504    pub fn xls_dslx_call_graph_free(call_graph: *mut CDslxCallGraph);
1505
1506    pub fn xls_dslx_call_graph_get_function_count(call_graph: *mut CDslxCallGraph) -> i64;
1507
1508    pub fn xls_dslx_call_graph_get_function(
1509        call_graph: *mut CDslxCallGraph,
1510        index: i64,
1511    ) -> *mut CDslxFunction;
1512
1513    pub fn xls_dslx_call_graph_get_callee_count(
1514        call_graph: *mut CDslxCallGraph,
1515        caller: *mut CDslxFunction,
1516    ) -> i64;
1517
1518    pub fn xls_dslx_call_graph_get_callee_function(
1519        call_graph: *mut CDslxCallGraph,
1520        caller: *mut CDslxFunction,
1521        callee_index: i64,
1522    ) -> *mut CDslxFunction;
1523
1524    pub fn xls_dslx_invocation_callee_data_array_free(array: *mut CDslxInvocationCalleeDataArray);
1525    pub fn xls_dslx_invocation_callee_data_array_get_count(
1526        array: *mut CDslxInvocationCalleeDataArray,
1527    ) -> i64;
1528    pub fn xls_dslx_invocation_callee_data_array_get(
1529        array: *mut CDslxInvocationCalleeDataArray,
1530        index: i64,
1531    ) -> *mut CDslxInvocationCalleeData;
1532
1533    pub fn xls_dslx_invocation_callee_data_clone(
1534        data: *mut CDslxInvocationCalleeData,
1535    ) -> *mut CDslxInvocationCalleeData;
1536    pub fn xls_dslx_invocation_callee_data_free(data: *mut CDslxInvocationCalleeData);
1537    pub fn xls_dslx_invocation_callee_data_get_callee_bindings(
1538        data: *mut CDslxInvocationCalleeData,
1539    ) -> *const CDslxParametricEnv;
1540    pub fn xls_dslx_invocation_callee_data_get_caller_bindings(
1541        data: *mut CDslxInvocationCalleeData,
1542    ) -> *const CDslxParametricEnv;
1543    pub fn xls_dslx_invocation_callee_data_get_derived_type_info(
1544        data: *mut CDslxInvocationCalleeData,
1545    ) -> *mut CDslxTypeInfo;
1546    pub fn xls_dslx_invocation_callee_data_get_invocation(
1547        data: *mut CDslxInvocationCalleeData,
1548    ) -> *mut CDslxInvocation;
1549
1550    pub fn xls_dslx_invocation_data_get_invocation(
1551        data: *mut CDslxInvocationData,
1552    ) -> *mut CDslxInvocation;
1553    pub fn xls_dslx_invocation_data_get_callee(
1554        data: *mut CDslxInvocationData,
1555    ) -> *mut CDslxFunction;
1556    pub fn xls_dslx_invocation_data_get_caller(
1557        data: *mut CDslxInvocationData,
1558    ) -> *mut CDslxFunction;
1559
1560    // -- ConstantDef
1561
1562    pub fn xls_dslx_constant_def_get_name(
1563        constant_def: *const CDslxConstantDef,
1564    ) -> *mut std::os::raw::c_char;
1565
1566    pub fn xls_dslx_constant_def_get_value(constant_def: *const CDslxConstantDef)
1567        -> *mut CDslxExpr;
1568
1569    // -- TypeAlias
1570
1571    pub fn xls_dslx_type_alias_get_identifier(
1572        type_alias: *const CDslxTypeAlias,
1573    ) -> *mut std::os::raw::c_char;
1574
1575    pub fn xls_dslx_type_alias_get_type_annotation(
1576        type_alias: *const CDslxTypeAlias,
1577    ) -> *mut CDslxTypeAnnotation;
1578
1579    // -- TypeAnnotation
1580
1581    pub fn xls_dslx_type_annotation_get_type_ref_type_annotation(
1582        type_annotation: *const CDslxTypeAnnotation,
1583    ) -> *mut CDslxTypeRefTypeAnnotation;
1584
1585    // -- TypeRef
1586
1587    pub fn xls_dslx_type_ref_get_type_definition(
1588        type_ref: *const CDslxTypeRef,
1589    ) -> *mut CDslxTypeDefinition;
1590
1591    // -- Import
1592
1593    pub fn xls_dslx_import_get_subject_count(import: *const CDslxImport) -> i64;
1594    pub fn xls_dslx_import_get_subject(
1595        import: *const CDslxImport,
1596        i: i64,
1597    ) -> *mut std::os::raw::c_char;
1598
1599    // -- ColonRef
1600
1601    pub fn xls_dslx_colon_ref_resolve_import_subject(
1602        colon_ref: *const CDslxColonRef,
1603    ) -> *mut CDslxImport;
1604
1605    // -- TypeDefinition
1606
1607    pub fn xls_dslx_type_definition_get_colon_ref(
1608        type_definition: *const CDslxTypeDefinition,
1609    ) -> *mut CDslxColonRef;
1610    pub fn xls_dslx_type_definition_get_type_alias(
1611        type_definition: *const CDslxTypeDefinition,
1612    ) -> *mut CDslxTypeAlias;
1613
1614    // -- TypeRefTypeAnnotation
1615
1616    pub fn xls_dslx_type_ref_type_annotation_get_type_ref(
1617        type_ref_type_annotation: *const CDslxTypeRefTypeAnnotation,
1618    ) -> *mut CDslxTypeRef;
1619
1620    // -- StructDef
1621
1622    pub fn xls_dslx_struct_def_get_identifier(
1623        struct_def: *const CDslxStructDef,
1624    ) -> *mut std::os::raw::c_char;
1625
1626    pub fn xls_dslx_struct_def_is_parametric(struct_def: *const CDslxStructDef) -> bool;
1627
1628    pub fn xls_dslx_struct_def_get_member_count(struct_def: *const CDslxStructDef) -> i64;
1629
1630    pub fn xls_dslx_struct_def_get_member(
1631        struct_def: *const CDslxStructDef,
1632        i: i64,
1633    ) -> *mut CDslxStructMember;
1634
1635    pub fn xls_dslx_struct_member_get_name(
1636        member: *const CDslxStructMember,
1637    ) -> *mut std::os::raw::c_char;
1638
1639    pub fn xls_dslx_struct_member_get_type(
1640        member: *const CDslxStructMember,
1641    ) -> *mut CDslxTypeAnnotation;
1642
1643    // -- EnumDef
1644
1645    pub fn xls_dslx_enum_def_get_identifier(
1646        enum_def: *const CDslxEnumDef,
1647    ) -> *mut std::os::raw::c_char;
1648
1649    pub fn xls_dslx_enum_def_get_member_count(enum_def: *const CDslxEnumDef) -> i64;
1650
1651    pub fn xls_dslx_enum_def_get_member(
1652        enum_def: *const CDslxEnumDef,
1653        i: i64,
1654    ) -> *mut CDslxEnumMember;
1655
1656    pub fn xls_dslx_enum_def_get_underlying(
1657        enum_def: *const CDslxEnumDef,
1658    ) -> *mut CDslxTypeAnnotation;
1659
1660    pub fn xls_dslx_enum_member_get_name(
1661        member: *const CDslxEnumMember,
1662    ) -> *mut std::os::raw::c_char;
1663
1664    pub fn xls_dslx_enum_member_get_value(member: *const CDslxEnumMember) -> *mut CDslxExpr;
1665
1666    pub fn xls_dslx_expr_get_owner_module(expr: *mut CDslxExpr) -> *mut CDslxModule;
1667
1668    // --
1669
1670    pub fn xls_dslx_interp_value_free(value: *mut CDslxInterpValue);
1671
1672    pub fn xls_dslx_interp_value_to_string(
1673        value: *mut CDslxInterpValue,
1674    ) -> *mut std::os::raw::c_char;
1675
1676    pub fn xls_dslx_interp_value_clone(value: *const CDslxInterpValue) -> *mut CDslxInterpValue;
1677
1678    // Parametric env construction and InterpValue helpers
1679    pub fn xls_dslx_parametric_env_create(
1680        items: *const XlsDslxParametricEnvItem,
1681        items_count: libc::size_t,
1682        error_out: *mut *mut std::os::raw::c_char,
1683        env_out: *mut *mut CDslxParametricEnv,
1684    ) -> bool;
1685    pub fn xls_dslx_parametric_env_free(env: *mut CDslxParametricEnv);
1686    pub fn xls_dslx_parametric_env_clone(env: *const CDslxParametricEnv)
1687        -> *mut CDslxParametricEnv;
1688    pub fn xls_dslx_parametric_env_equals(
1689        lhs: *const CDslxParametricEnv,
1690        rhs: *const CDslxParametricEnv,
1691    ) -> bool;
1692    pub fn xls_dslx_parametric_env_less_than(
1693        lhs: *const CDslxParametricEnv,
1694        rhs: *const CDslxParametricEnv,
1695    ) -> bool;
1696    pub fn xls_dslx_parametric_env_hash(env: *const CDslxParametricEnv) -> u64;
1697    pub fn xls_dslx_parametric_env_to_string(
1698        env: *const CDslxParametricEnv,
1699    ) -> *mut std::os::raw::c_char;
1700    pub fn xls_dslx_parametric_env_get_binding_count(env: *const CDslxParametricEnv) -> i64;
1701    pub fn xls_dslx_parametric_env_get_binding_identifier(
1702        env: *const CDslxParametricEnv,
1703        index: i64,
1704    ) -> *const std::os::raw::c_char;
1705    pub fn xls_dslx_parametric_env_get_binding_value(
1706        env: *const CDslxParametricEnv,
1707        index: i64,
1708    ) -> *mut CDslxInterpValue;
1709
1710    pub fn xls_dslx_interp_value_make_ubits(bit_count: i64, value: u64) -> *mut CDslxInterpValue;
1711    pub fn xls_dslx_interp_value_make_sbits(bit_count: i64, value: i64) -> *mut CDslxInterpValue;
1712    pub fn xls_dslx_interp_value_make_enum(
1713        def: *mut CDslxEnumDef,
1714        is_signed: bool,
1715        bits: *const CIrBits,
1716        error_out: *mut *mut std::os::raw::c_char,
1717        result_out: *mut *mut CDslxInterpValue,
1718    ) -> bool;
1719    pub fn xls_dslx_interp_value_make_tuple(
1720        element_count: libc::size_t,
1721        elements: *mut *mut CDslxInterpValue,
1722        error_out: *mut *mut std::os::raw::c_char,
1723        result_out: *mut *mut CDslxInterpValue,
1724    ) -> bool;
1725    pub fn xls_dslx_interp_value_make_array(
1726        element_count: libc::size_t,
1727        elements: *mut *mut CDslxInterpValue,
1728        error_out: *mut *mut std::os::raw::c_char,
1729        result_out: *mut *mut CDslxInterpValue,
1730    ) -> bool;
1731
1732    pub fn xls_dslx_interp_value_from_string(
1733        text: *const std::os::raw::c_char,
1734        dslx_stdlib_path: *const std::os::raw::c_char,
1735        error_out: *mut *mut std::os::raw::c_char,
1736        result_out: *mut *mut CDslxInterpValue,
1737    ) -> bool;
1738
1739    pub fn xls_dslx_interp_value_convert_to_ir(
1740        value: *const CDslxInterpValue,
1741        error_out: *mut *mut std::os::raw::c_char,
1742        result_out: *mut *mut CIrValue,
1743    ) -> bool;
1744
1745    pub fn xls_dslx_type_to_string(
1746        type_: *const CDslxType,
1747        error_out: *mut *mut std::os::raw::c_char,
1748        result_out: *mut *mut std::os::raw::c_char,
1749    ) -> bool;
1750
1751    // Stringification for DSLX AST nodes
1752    pub fn xls_dslx_function_to_string(function: *const CDslxFunction)
1753        -> *mut std::os::raw::c_char;
1754    pub fn xls_dslx_struct_def_to_string(
1755        struct_def: *const CDslxStructDef,
1756    ) -> *mut std::os::raw::c_char;
1757    pub fn xls_dslx_enum_def_to_string(enum_def: *const CDslxEnumDef) -> *mut std::os::raw::c_char;
1758    pub fn xls_dslx_type_alias_to_string(
1759        type_alias: *const CDslxTypeAlias,
1760    ) -> *mut std::os::raw::c_char;
1761    pub fn xls_dslx_constant_def_to_string(
1762        constant_def: *const CDslxConstantDef,
1763    ) -> *mut std::os::raw::c_char;
1764    pub fn xls_dslx_quickcheck_to_string(qc: *const CDslxQuickcheck) -> *mut std::os::raw::c_char;
1765    pub fn xls_dslx_expr_to_string(expr: *const CDslxExpr) -> *mut std::os::raw::c_char;
1766
1767    pub fn xls_dslx_type_info_get_const_expr(
1768        type_info: *mut CDslxTypeInfo,
1769        expr: *mut CDslxExpr,
1770        error_out: *mut *mut std::os::raw::c_char,
1771        result_out: *mut *mut CDslxInterpValue,
1772    ) -> bool;
1773
1774    pub fn xls_dslx_type_get_total_bit_count(
1775        type_: *const CDslxType,
1776        error_out: *mut *mut std::os::raw::c_char,
1777        result_out: *mut i64,
1778    ) -> bool;
1779
1780    pub fn xls_dslx_type_is_signed_bits(
1781        type_: *const CDslxType,
1782        error_out: *mut *mut std::os::raw::c_char,
1783        result_out: *mut bool,
1784    ) -> bool;
1785
1786    pub fn xls_dslx_type_is_bits_like(
1787        type_: *const CDslxType,
1788        is_signed: *mut *mut CDslxTypeDim,
1789        size: *mut *mut CDslxTypeDim,
1790    ) -> bool;
1791
1792    pub fn xls_dslx_type_is_enum(type_: *const CDslxType) -> bool;
1793    pub fn xls_dslx_type_is_struct(type_: *const CDslxType) -> bool;
1794    pub fn xls_dslx_type_is_array(type_: *const CDslxType) -> bool;
1795
1796    pub fn xls_dslx_type_dim_is_parametric(dim: *const CDslxTypeDim) -> bool;
1797    pub fn xls_dslx_type_dim_get_as_bool(
1798        dim: *const CDslxTypeDim,
1799        error_out: *mut *mut std::os::raw::c_char,
1800        result_out: *mut bool,
1801    ) -> bool;
1802    pub fn xls_dslx_type_dim_get_as_int64(
1803        dim: *const CDslxTypeDim,
1804        error_out: *mut *mut std::os::raw::c_char,
1805        result_out: *mut i64,
1806    ) -> bool;
1807    pub fn xls_dslx_type_dim_free(dim: *mut CDslxTypeDim);
1808
1809    pub fn xls_dslx_type_get_enum_def(ty: *const CDslxType) -> *mut CDslxEnumDef;
1810
1811    pub fn xls_dslx_type_get_struct_def(ty: *const CDslxType) -> *mut CDslxStructDef;
1812
1813    pub fn xls_dslx_type_array_get_element_type(ty: *const CDslxType) -> *mut CDslxType;
1814    pub fn xls_dslx_type_array_get_size(ty: *const CDslxType) -> *mut CDslxTypeDim;
1815
1816    // -- IR builder APIs
1817
1818    pub fn xls_package_create(name: *const std::os::raw::c_char) -> *mut CIrPackage;
1819    pub fn xls_package_get_bits_type(package: *mut CIrPackage, bit_count: i64) -> *mut CIrType;
1820
1821    pub fn xls_package_get_tuple_type(
1822        package: *mut CIrPackage,
1823        members: *mut *mut CIrType,
1824        member_count: i64,
1825    ) -> *mut CIrType;
1826
1827    pub fn xls_package_get_array_type(
1828        package: *mut CIrPackage,
1829        element_type: *mut CIrType,
1830        size: i64,
1831    ) -> *mut CIrType;
1832
1833    pub fn xls_package_get_token_type(package: *mut CIrPackage) -> *mut CIrType;
1834
1835    pub fn xls_function_builder_create(
1836        name: *const std::os::raw::c_char,
1837        package: *mut CIrPackage,
1838        should_verify: bool,
1839    ) -> *mut CIrFunctionBuilder;
1840    pub fn xls_function_builder_as_builder_base(
1841        builder: *mut CIrFunctionBuilder,
1842    ) -> *mut CIrBuilderBase;
1843    pub fn xls_function_builder_free(builder: *mut CIrFunctionBuilder);
1844    pub fn xls_bvalue_free(bvalue: *mut CIrBValue);
1845    pub fn xls_function_builder_add_parameter(
1846        builder: *mut CIrFunctionBuilder,
1847        name: *const std::os::raw::c_char,
1848        type_: *mut CIrType,
1849    ) -> *mut CIrBValue;
1850    pub fn xls_function_builder_build(
1851        builder: *mut CIrFunctionBuilder,
1852        error_out: *mut *mut std::os::raw::c_char,
1853        function_out: *mut *mut CIrFunction,
1854    ) -> bool;
1855    pub fn xls_function_builder_build_with_return_value(
1856        builder: *mut CIrFunctionBuilder,
1857        return_value: *mut CIrBValue,
1858        error_out: *mut *mut std::os::raw::c_char,
1859        function_out: *mut *mut CIrFunction,
1860    ) -> bool;
1861    pub fn xls_builder_base_add_and(
1862        builder: *mut CIrBuilderBase,
1863        lhs: *mut CIrBValue,
1864        rhs: *mut CIrBValue,
1865        name: *const std::os::raw::c_char,
1866    ) -> *mut CIrBValue;
1867    pub fn xls_builder_base_add_nand(
1868        builder: *mut CIrBuilderBase,
1869        lhs: *mut CIrBValue,
1870        rhs: *mut CIrBValue,
1871        name: *const std::os::raw::c_char,
1872    ) -> *mut CIrBValue;
1873    pub fn xls_builder_base_add_or(
1874        builder: *mut CIrBuilderBase,
1875        lhs: *mut CIrBValue,
1876        rhs: *mut CIrBValue,
1877        name: *const std::os::raw::c_char,
1878    ) -> *mut CIrBValue;
1879    pub fn xls_builder_base_add_xor(
1880        builder: *mut CIrBuilderBase,
1881        lhs: *mut CIrBValue,
1882        rhs: *mut CIrBValue,
1883        name: *const std::os::raw::c_char,
1884    ) -> *mut CIrBValue;
1885    pub fn xls_builder_base_add_not(
1886        builder: *mut CIrBuilderBase,
1887        value: *mut CIrBValue,
1888        name: *const std::os::raw::c_char,
1889    ) -> *mut CIrBValue;
1890    pub fn xls_builder_base_add_negate(
1891        builder: *mut CIrBuilderBase,
1892        value: *mut CIrBValue,
1893        name: *const std::os::raw::c_char,
1894    ) -> *mut CIrBValue;
1895    pub fn xls_builder_base_add_reverse(
1896        builder: *mut CIrBuilderBase,
1897        value: *mut CIrBValue,
1898        name: *const std::os::raw::c_char,
1899    ) -> *mut CIrBValue;
1900    pub fn xls_builder_base_add_or_reduce(
1901        builder: *mut CIrBuilderBase,
1902        value: *mut CIrBValue,
1903        name: *const std::os::raw::c_char,
1904    ) -> *mut CIrBValue;
1905    pub fn xls_builder_base_add_and_reduce(
1906        builder: *mut CIrBuilderBase,
1907        value: *mut CIrBValue,
1908        name: *const std::os::raw::c_char,
1909    ) -> *mut CIrBValue;
1910    pub fn xls_builder_base_add_xor_reduce(
1911        builder: *mut CIrBuilderBase,
1912        value: *mut CIrBValue,
1913        name: *const std::os::raw::c_char,
1914    ) -> *mut CIrBValue;
1915    pub fn xls_builder_base_add_literal(
1916        builder: *mut CIrBuilderBase,
1917        value: *mut CIrValue,
1918        name: *const std::os::raw::c_char,
1919    ) -> *mut CIrBValue;
1920    pub fn xls_builder_base_add_tuple(
1921        builder: *mut CIrBuilderBase,
1922        operands: *mut *mut CIrBValue,
1923        operand_count: i64,
1924        name: *const std::os::raw::c_char,
1925    ) -> *mut CIrBValue;
1926    pub fn xls_builder_base_add_tuple_index(
1927        builder: *mut CIrBuilderBase,
1928        tuple: *mut CIrBValue,
1929        index: i64,
1930        name: *const std::os::raw::c_char,
1931    ) -> *mut CIrBValue;
1932    pub fn xls_builder_base_add_array(
1933        builder: *mut CIrBuilderBase,
1934        element_type: *mut CIrType,
1935        elements: *const *mut CIrBValue,
1936        element_count: i64,
1937        name: *const std::os::raw::c_char,
1938    ) -> *mut CIrBValue;
1939    pub fn xls_builder_base_add_array_index(
1940        builder: *mut CIrBuilderBase,
1941        array: *mut CIrBValue,
1942        indices: *const *mut CIrBValue,
1943        index_count: i64,
1944        assumed_in_bounds: bool,
1945        name: *const std::os::raw::c_char,
1946    ) -> *mut CIrBValue;
1947    pub fn xls_builder_base_add_dynamic_bit_slice(
1948        builder: *mut CIrBuilderBase,
1949        value: *mut CIrBValue,
1950        start: *mut CIrBValue,
1951        width: i64,
1952        name: *const std::os::raw::c_char,
1953    ) -> *mut CIrBValue;
1954    pub fn xls_builder_base_add_bit_slice(
1955        builder: *mut CIrBuilderBase,
1956        value: *mut CIrBValue,
1957        start: i64,
1958        width: i64,
1959        name: *const std::os::raw::c_char,
1960    ) -> *mut CIrBValue;
1961    pub fn xls_builder_base_add_bit_slice_update(
1962        builder: *mut CIrBuilderBase,
1963        value: *mut CIrBValue,
1964        start: *mut CIrBValue,
1965        update: *mut CIrBValue,
1966        name: *const std::os::raw::c_char,
1967    ) -> *mut CIrBValue;
1968    pub fn xls_builder_base_add_concat(
1969        builder: *mut CIrBuilderBase,
1970        values: *const *mut CIrBValue,
1971        value_count: i64,
1972        name: *const std::os::raw::c_char,
1973    ) -> *mut CIrBValue;
1974    pub fn xls_builder_base_add_after_all(
1975        builder: *mut CIrBuilderBase,
1976        dependencies: *mut *mut CIrBValue,
1977        dependency_count: i64,
1978        name: *const std::os::raw::c_char,
1979    ) -> *mut CIrBValue;
1980    pub fn xls_builder_base_add_add(
1981        builder: *mut CIrBuilderBase,
1982        lhs: *mut CIrBValue,
1983        rhs: *mut CIrBValue,
1984        name: *const std::os::raw::c_char,
1985    ) -> *mut CIrBValue;
1986    pub fn xls_builder_base_add_sub(
1987        builder: *mut CIrBuilderBase,
1988        lhs: *mut CIrBValue,
1989        rhs: *mut CIrBValue,
1990        name: *const std::os::raw::c_char,
1991    ) -> *mut CIrBValue;
1992    pub fn xls_builder_base_add_umul(
1993        builder: *mut CIrBuilderBase,
1994        lhs: *mut CIrBValue,
1995        rhs: *mut CIrBValue,
1996        name: *const std::os::raw::c_char,
1997    ) -> *mut CIrBValue;
1998    pub fn xls_builder_base_add_smul(
1999        builder: *mut CIrBuilderBase,
2000        lhs: *mut CIrBValue,
2001        rhs: *mut CIrBValue,
2002        name: *const std::os::raw::c_char,
2003    ) -> *mut CIrBValue;
2004    pub fn xls_builder_base_add_umulp(
2005        builder: *mut CIrBuilderBase,
2006        lhs: *mut CIrBValue,
2007        rhs: *mut CIrBValue,
2008        name: *const std::os::raw::c_char,
2009    ) -> *mut CIrBValue;
2010    pub fn xls_builder_base_add_smulp(
2011        builder: *mut CIrBuilderBase,
2012        lhs: *mut CIrBValue,
2013        rhs: *mut CIrBValue,
2014        name: *const std::os::raw::c_char,
2015    ) -> *mut CIrBValue;
2016    pub fn xls_builder_base_add_udiv(
2017        builder: *mut CIrBuilderBase,
2018        lhs: *mut CIrBValue,
2019        rhs: *mut CIrBValue,
2020        name: *const std::os::raw::c_char,
2021    ) -> *mut CIrBValue;
2022    pub fn xls_builder_base_add_sdiv(
2023        builder: *mut CIrBuilderBase,
2024        lhs: *mut CIrBValue,
2025        rhs: *mut CIrBValue,
2026        name: *const std::os::raw::c_char,
2027    ) -> *mut CIrBValue;
2028    pub fn xls_builder_base_add_umod(
2029        builder: *mut CIrBuilderBase,
2030        lhs: *mut CIrBValue,
2031        rhs: *mut CIrBValue,
2032        name: *const std::os::raw::c_char,
2033    ) -> *mut CIrBValue;
2034    pub fn xls_builder_base_add_smod(
2035        builder: *mut CIrBuilderBase,
2036        lhs: *mut CIrBValue,
2037        rhs: *mut CIrBValue,
2038        name: *const std::os::raw::c_char,
2039    ) -> *mut CIrBValue;
2040    pub fn xls_builder_base_add_eq(
2041        builder: *mut CIrBuilderBase,
2042        lhs: *mut CIrBValue,
2043        rhs: *mut CIrBValue,
2044        name: *const std::os::raw::c_char,
2045    ) -> *mut CIrBValue;
2046    pub fn xls_builder_base_add_ne(
2047        builder: *mut CIrBuilderBase,
2048        lhs: *mut CIrBValue,
2049        rhs: *mut CIrBValue,
2050        name: *const std::os::raw::c_char,
2051    ) -> *mut CIrBValue;
2052
2053    // -- comparisons
2054    pub fn xls_builder_base_add_ule(
2055        builder: *mut CIrBuilderBase,
2056        lhs: *mut CIrBValue,
2057        rhs: *mut CIrBValue,
2058        name: *const std::os::raw::c_char,
2059    ) -> *mut CIrBValue;
2060    pub fn xls_builder_base_add_ult(
2061        builder: *mut CIrBuilderBase,
2062        lhs: *mut CIrBValue,
2063        rhs: *mut CIrBValue,
2064        name: *const std::os::raw::c_char,
2065    ) -> *mut CIrBValue;
2066    pub fn xls_builder_base_add_uge(
2067        builder: *mut CIrBuilderBase,
2068        lhs: *mut CIrBValue,
2069        rhs: *mut CIrBValue,
2070        name: *const std::os::raw::c_char,
2071    ) -> *mut CIrBValue;
2072    pub fn xls_builder_base_add_ugt(
2073        builder: *mut CIrBuilderBase,
2074        lhs: *mut CIrBValue,
2075        rhs: *mut CIrBValue,
2076        name: *const std::os::raw::c_char,
2077    ) -> *mut CIrBValue;
2078    pub fn xls_builder_base_add_sle(
2079        builder: *mut CIrBuilderBase,
2080        lhs: *mut CIrBValue,
2081        rhs: *mut CIrBValue,
2082        name: *const std::os::raw::c_char,
2083    ) -> *mut CIrBValue;
2084    pub fn xls_builder_base_add_slt(
2085        builder: *mut CIrBuilderBase,
2086        lhs: *mut CIrBValue,
2087        rhs: *mut CIrBValue,
2088        name: *const std::os::raw::c_char,
2089    ) -> *mut CIrBValue;
2090    pub fn xls_builder_base_add_sgt(
2091        builder: *mut CIrBuilderBase,
2092        lhs: *mut CIrBValue,
2093        rhs: *mut CIrBValue,
2094        name: *const std::os::raw::c_char,
2095    ) -> *mut CIrBValue;
2096    pub fn xls_builder_base_add_sge(
2097        builder: *mut CIrBuilderBase,
2098        lhs: *mut CIrBValue,
2099        rhs: *mut CIrBValue,
2100        name: *const std::os::raw::c_char,
2101    ) -> *mut CIrBValue;
2102
2103    pub fn xls_builder_base_add_shra(
2104        builder: *mut CIrBuilderBase,
2105        a: *mut CIrBValue,
2106        b: *mut CIrBValue,
2107        name: *const std::os::raw::c_char,
2108    ) -> *mut CIrBValue;
2109    pub fn xls_builder_base_add_shrl(
2110        builder: *mut CIrBuilderBase,
2111        a: *mut CIrBValue,
2112        b: *mut CIrBValue,
2113        name: *const std::os::raw::c_char,
2114    ) -> *mut CIrBValue;
2115    pub fn xls_builder_base_add_shll(
2116        builder: *mut CIrBuilderBase,
2117        a: *mut CIrBValue,
2118        b: *mut CIrBValue,
2119        name: *const std::os::raw::c_char,
2120    ) -> *mut CIrBValue;
2121    pub fn xls_builder_base_add_nor(
2122        builder: *mut CIrBuilderBase,
2123        a: *mut CIrBValue,
2124        b: *mut CIrBValue,
2125        name: *const std::os::raw::c_char,
2126    ) -> *mut CIrBValue;
2127    pub fn xls_builder_base_add_clz(
2128        builder: *mut CIrBuilderBase,
2129        a: *mut CIrBValue,
2130        name: *const std::os::raw::c_char,
2131    ) -> *mut CIrBValue;
2132    pub fn xls_builder_base_add_ctz(
2133        builder: *mut CIrBuilderBase,
2134        a: *mut CIrBValue,
2135        name: *const std::os::raw::c_char,
2136    ) -> *mut CIrBValue;
2137    pub fn xls_builder_base_add_encode(
2138        builder: *mut CIrBuilderBase,
2139        a: *mut CIrBValue,
2140        name: *const std::os::raw::c_char,
2141    ) -> *mut CIrBValue;
2142
2143    pub fn xls_builder_base_add_decode(
2144        builder: *mut CIrBuilderBase,
2145        a: *mut CIrBValue,
2146        width: *mut i64,
2147        name: *const std::os::raw::c_char,
2148    ) -> *mut CIrBValue;
2149    pub fn xls_builder_base_add_select(
2150        builder: *mut CIrBuilderBase,
2151        selector: *mut CIrBValue,
2152        cases: *const *mut CIrBValue,
2153        case_count: i64,
2154        default_value: *mut CIrBValue,
2155        name: *const std::os::raw::c_char,
2156    ) -> *mut CIrBValue;
2157    pub fn xls_builder_base_add_array_concat(
2158        builder: *mut CIrBuilderBase,
2159        arrays: *const *mut CIrBValue,
2160        array_count: i64,
2161        name: *const std::os::raw::c_char,
2162    ) -> *mut CIrBValue;
2163    pub fn xls_builder_base_add_array_slice(
2164        builder: *mut CIrBuilderBase,
2165        array: *mut CIrBValue,
2166        start: *mut CIrBValue,
2167        width: i64,
2168        name: *const std::os::raw::c_char,
2169    ) -> *mut CIrBValue;
2170    pub fn xls_builder_base_add_array_update(
2171        builder: *mut CIrBuilderBase,
2172        array: *mut CIrBValue,
2173        update_value: *mut CIrBValue,
2174        indices: *const *mut CIrBValue,
2175        index_count: i64,
2176        assumed_in_bounds: bool,
2177        name: *const std::os::raw::c_char,
2178    ) -> *mut CIrBValue;
2179    pub fn xls_builder_base_add_identity(
2180        builder: *mut CIrBuilderBase,
2181        value: *mut CIrBValue,
2182        name: *const std::os::raw::c_char,
2183    ) -> *mut CIrBValue;
2184
2185    pub fn xls_builder_base_add_sign_extend(
2186        builder: *mut CIrBuilderBase,
2187        value: *mut CIrBValue,
2188        new_bit_count: i64,
2189        name: *const std::os::raw::c_char,
2190    ) -> *mut CIrBValue;
2191    pub fn xls_builder_base_add_zero_extend(
2192        builder: *mut CIrBuilderBase,
2193        value: *mut CIrBValue,
2194        new_bit_count: i64,
2195        name: *const std::os::raw::c_char,
2196    ) -> *mut CIrBValue;
2197
2198    pub fn xls_builder_base_add_one_hot(
2199        builder: *mut CIrBuilderBase,
2200        input: *mut CIrBValue,
2201        lsb_is_priority: bool,
2202        name: *const std::os::raw::c_char,
2203    ) -> *mut CIrBValue;
2204
2205    pub fn xls_builder_base_add_one_hot_select(
2206        builder: *mut CIrBuilderBase,
2207        selector: *mut CIrBValue,
2208        cases: *const *mut CIrBValue,
2209        case_count: i64,
2210        name: *const std::os::raw::c_char,
2211    ) -> *mut CIrBValue;
2212
2213    pub fn xls_builder_base_add_priority_select(
2214        builder: *mut CIrBuilderBase,
2215        selector: *mut CIrBValue,
2216        cases: *const *mut CIrBValue,
2217        case_count: i64,
2218        default_value: *mut CIrBValue,
2219        name: *const std::os::raw::c_char,
2220    ) -> *mut CIrBValue;
2221
2222    pub fn xls_builder_base_get_last_value(
2223        builder: *mut CIrBuilderBase,
2224        error_out: *mut *mut std::os::raw::c_char,
2225        value_out: *mut *mut CIrBValue,
2226    ) -> bool;
2227
2228    pub fn xls_builder_base_get_type(
2229        builder: *mut CIrBuilderBase,
2230        value: *mut CIrBValue,
2231    ) -> *mut CIrType;
2232
2233    // New functions for sequential logic
2234    pub fn xls_vast_verilog_module_add_always_ff(
2235        m: *mut CVastModule,
2236        sensitivity_list_elements: *mut *mut CVastExpression,
2237        sensitivity_list_count: usize,
2238        out_always_ff: *mut *mut CVastAlwaysBase,
2239        error_out: *mut *mut ::std::os::raw::c_char,
2240    ) -> bool;
2241    pub fn xls_vast_verilog_module_add_always_at(
2242        m: *mut CVastModule,
2243        sensitivity_list_elements: *mut *mut CVastExpression,
2244        sensitivity_list_count: usize,
2245        out_always_at: *mut *mut CVastAlwaysBase,
2246        error_out: *mut *mut ::std::os::raw::c_char,
2247    ) -> bool;
2248    pub fn xls_vast_verilog_module_add_always_comb(
2249        m: *mut CVastModule,
2250        out_always_comb: *mut *mut CVastAlwaysBase,
2251        error_out: *mut *mut ::std::os::raw::c_char,
2252    ) -> bool;
2253    pub fn xls_vast_verilog_module_add_reg(
2254        m: *mut CVastModule,
2255        name: *const ::std::os::raw::c_char,
2256        type_: *mut CVastDataType,
2257        out_reg_ref: *mut *mut CVastLogicRef,
2258        error_out: *mut *mut ::std::os::raw::c_char,
2259    ) -> bool;
2260    pub fn xls_vast_verilog_module_add_logic(
2261        m: *mut CVastModule,
2262        name: *const std::os::raw::c_char,
2263        type_: *mut CVastDataType,
2264        out_logic_ref: *mut *mut CVastLogicRef,
2265        error_out: *mut *mut std::os::raw::c_char,
2266    ) -> bool;
2267    pub fn xls_vast_verilog_file_make_pos_edge(
2268        f: *mut CVastFile,
2269        signal_expr: *mut CVastExpression,
2270    ) -> *mut CVastExpression;
2271    pub fn xls_vast_verilog_file_make_nonblocking_assignment(
2272        f: *mut CVastFile,
2273        lhs: *mut CVastExpression,
2274        rhs: *mut CVastExpression,
2275    ) -> *mut CVastStatement;
2276    pub fn xls_vast_verilog_file_make_blocking_assignment(
2277        f: *mut CVastFile,
2278        lhs: *mut CVastExpression,
2279        rhs: *mut CVastExpression,
2280    ) -> *mut CVastStatement;
2281
2282    pub fn xls_vast_always_base_get_statement_block(
2283        always_base: *mut CVastAlwaysBase,
2284    ) -> *mut CVastStatementBlock;
2285
2286    pub fn xls_vast_statement_block_add_nonblocking_assignment(
2287        block: *mut CVastStatementBlock,
2288        lhs: *mut CVastExpression,
2289        rhs: *mut CVastExpression,
2290    ) -> *mut CVastStatement;
2291    pub fn xls_vast_statement_block_add_blocking_assignment(
2292        block: *mut CVastStatementBlock,
2293        lhs: *mut CVastExpression,
2294        rhs: *mut CVastExpression,
2295    ) -> *mut CVastStatement;
2296    pub fn xls_vast_statement_block_add_continuous_assignment(
2297        block: *mut CVastStatementBlock,
2298        lhs: *mut CVastExpression,
2299        rhs: *mut CVastExpression,
2300    ) -> *mut CVastStatement;
2301
2302    pub fn xls_vast_statement_block_add_comment_text(
2303        block: *mut CVastStatementBlock,
2304        text: *const std::os::raw::c_char,
2305    ) -> *mut CVastStatement;
2306
2307    pub fn xls_vast_statement_block_add_blank_line(
2308        block: *mut CVastStatementBlock,
2309    ) -> *mut CVastStatement;
2310
2311    pub fn xls_vast_statement_block_add_inline_text(
2312        block: *mut CVastStatementBlock,
2313        text: *const std::os::raw::c_char,
2314    ) -> *mut CVastStatement;
2315
2316    // Conditional (if / else-if / else)
2317    pub fn xls_vast_statement_block_add_conditional(
2318        block: *mut CVastStatementBlock,
2319        cond: *mut CVastExpression,
2320    ) -> *mut CVastConditional;
2321    pub fn xls_vast_conditional_get_then_block(
2322        cond: *mut CVastConditional,
2323    ) -> *mut CVastStatementBlock;
2324    pub fn xls_vast_conditional_add_else_if(
2325        cond: *mut CVastConditional,
2326        expr_cond: *mut CVastExpression,
2327    ) -> *mut CVastStatementBlock;
2328    pub fn xls_vast_conditional_add_else(cond: *mut CVastConditional) -> *mut CVastStatementBlock;
2329
2330    // Case statement builders
2331    pub fn xls_vast_statement_block_add_case(
2332        block: *mut CVastStatementBlock,
2333        selector: *mut CVastExpression,
2334    ) -> *mut CVastCaseStatement;
2335    pub fn xls_vast_case_statement_add_item(
2336        case_stmt: *mut CVastCaseStatement,
2337        match_expr: *mut CVastExpression,
2338    ) -> *mut CVastStatementBlock;
2339    pub fn xls_vast_case_statement_add_default(
2340        case_stmt: *mut CVastCaseStatement,
2341    ) -> *mut CVastStatementBlock;
2342
2343    pub fn xls_vast_generate_loop_get_genvar(loop_: *mut CVastGenerateLoop) -> *mut CVastLogicRef;
2344    pub fn xls_vast_generate_loop_add_generate_loop(
2345        loop_: *mut CVastGenerateLoop,
2346        genvar_name: *const std::os::raw::c_char,
2347        init: *mut CVastExpression,
2348        limit: *mut CVastExpression,
2349        label: *const std::os::raw::c_char,
2350    ) -> *mut CVastGenerateLoop;
2351    pub fn xls_vast_generate_loop_add_always_comb(
2352        loop_: *mut CVastGenerateLoop,
2353        out_always_comb: *mut *mut CVastAlwaysBase,
2354        error_out: *mut *mut std::os::raw::c_char,
2355    ) -> bool;
2356    pub fn xls_vast_generate_loop_add_always_ff(
2357        loop_: *mut CVastGenerateLoop,
2358        sensitivity_list_elements: *mut *mut CVastExpression,
2359        sensitivity_list_count: usize,
2360        out_always_ff: *mut *mut CVastAlwaysBase,
2361        error_out: *mut *mut std::os::raw::c_char,
2362    ) -> bool;
2363    pub fn xls_vast_generate_loop_add_localparam(
2364        loop_: *mut CVastGenerateLoop,
2365        name: *const std::os::raw::c_char,
2366        rhs: *mut CVastExpression,
2367    ) -> *mut CVastLocalparamRef;
2368    pub fn xls_vast_generate_loop_add_localparam_with_def(
2369        loop_: *mut CVastGenerateLoop,
2370        def: *mut CVastDef,
2371        rhs: *mut CVastExpression,
2372    ) -> *mut CVastLocalparamRef;
2373    pub fn xls_vast_generate_loop_add_continuous_assignment(
2374        loop_: *mut CVastGenerateLoop,
2375        lhs: *mut CVastExpression,
2376        rhs: *mut CVastExpression,
2377    ) -> *mut CVastStatement;
2378    pub fn xls_vast_generate_loop_add_conditional(
2379        loop_: *mut CVastGenerateLoop,
2380        cond: *mut CVastExpression,
2381    ) -> *mut CVastConditional;
2382    pub fn xls_vast_generate_loop_add_blank_line(loop_: *mut CVastGenerateLoop);
2383    pub fn xls_vast_generate_loop_add_comment(
2384        loop_: *mut CVastGenerateLoop,
2385        comment: *mut CVastComment,
2386    );
2387    pub fn xls_vast_generate_loop_add_instantiation(
2388        loop_: *mut CVastGenerateLoop,
2389        instantiation: *mut CVastInstantiation,
2390    );
2391    pub fn xls_vast_generate_loop_add_inline_verilog_statement(
2392        loop_: *mut CVastGenerateLoop,
2393        stmt: *mut CVastInlineVerilogStatement,
2394    );
2395    pub fn xls_vast_generate_loop_add_macro_statement(
2396        loop_: *mut CVastGenerateLoop,
2397        macro_statement: *mut CVastMacroStatement,
2398    );
2399
2400    pub fn xls_function_type_get_param_count(fty: *mut CIrFunctionType) -> i64;
2401
2402    pub fn xls_function_type_get_param_type(
2403        fty: *mut CIrFunctionType,
2404        index: libc::size_t,
2405        error_out: *mut *mut std::os::raw::c_char,
2406        param_type_out: *mut *mut CIrType,
2407    ) -> bool;
2408
2409    pub fn xls_function_type_get_return_type(fty: *mut CIrFunctionType) -> *mut CIrType;
2410
2411    pub fn xls_function_get_param_name(
2412        function: *mut CIrFunction,
2413        index: libc::size_t,
2414        error_out: *mut *mut std::os::raw::c_char,
2415        name_out: *mut *mut std::os::raw::c_char,
2416    ) -> bool;
2417
2418    pub fn xls_dslx_function_is_parametric(function: *const CDslxFunction) -> bool;
2419    pub fn xls_dslx_function_is_public(function: *const CDslxFunction) -> bool;
2420    pub fn xls_dslx_function_get_identifier(
2421        function: *const CDslxFunction,
2422    ) -> *mut std::os::raw::c_char;
2423
2424    pub fn xls_dslx_function_get_param_count(function: *const CDslxFunction) -> i64;
2425    pub fn xls_dslx_function_get_parametric_binding_count(function: *const CDslxFunction) -> i64;
2426    pub fn xls_dslx_function_get_param(
2427        function: *const CDslxFunction,
2428        index: i64,
2429    ) -> *mut CDslxParam;
2430    pub fn xls_dslx_function_get_parametric_binding(
2431        function: *const CDslxFunction,
2432        index: i64,
2433    ) -> *mut CDslxParametricBinding;
2434    pub fn xls_dslx_function_get_body(function: *const CDslxFunction) -> *mut CDslxExpr;
2435    // Returns the declared return type annotation node.
2436    // May return nullptr when the function omits an explicit return
2437    // annotation and relies on inferred return type.
2438    pub fn xls_dslx_function_get_return_type(
2439        function: *const CDslxFunction,
2440    ) -> *mut CDslxTypeAnnotation;
2441    pub fn xls_dslx_function_get_attribute_count(function: *const CDslxFunction) -> i64;
2442    pub fn xls_dslx_function_get_attribute(
2443        function: *const CDslxFunction,
2444        index: i64,
2445    ) -> *mut CDslxAttribute;
2446    pub fn xls_dslx_param_get_name(param: *const CDslxParam) -> *mut std::os::raw::c_char;
2447    pub fn xls_dslx_param_get_type_annotation(param: *const CDslxParam)
2448        -> *mut CDslxTypeAnnotation;
2449    pub fn xls_dslx_attribute_get_kind(attribute: *const CDslxAttribute) -> DslxAttributeKind;
2450    pub fn xls_dslx_attribute_get_argument_count(attribute: *const CDslxAttribute) -> i64;
2451    pub fn xls_dslx_attribute_get_argument_kind(
2452        attribute: *const CDslxAttribute,
2453        index: i64,
2454    ) -> DslxAttributeArgumentKind;
2455    pub fn xls_dslx_attribute_get_string_argument(
2456        attribute: *const CDslxAttribute,
2457        index: i64,
2458    ) -> *mut std::os::raw::c_char;
2459    pub fn xls_dslx_attribute_get_string_literal_argument(
2460        attribute: *const CDslxAttribute,
2461        index: i64,
2462    ) -> *mut std::os::raw::c_char;
2463    pub fn xls_dslx_attribute_get_key_value_argument_key(
2464        attribute: *const CDslxAttribute,
2465        index: i64,
2466    ) -> *mut std::os::raw::c_char;
2467    pub fn xls_dslx_attribute_get_key_value_string_argument_value(
2468        attribute: *const CDslxAttribute,
2469        index: i64,
2470    ) -> *mut std::os::raw::c_char;
2471    pub fn xls_dslx_attribute_get_key_value_int_argument_value(
2472        attribute: *const CDslxAttribute,
2473        index: i64,
2474    ) -> i64;
2475    pub fn xls_dslx_attribute_to_string(
2476        attribute: *const CDslxAttribute,
2477    ) -> *mut std::os::raw::c_char;
2478    pub fn xls_dslx_parametric_binding_get_identifier(
2479        binding: *const CDslxParametricBinding,
2480    ) -> *mut std::os::raw::c_char;
2481    pub fn xls_dslx_parametric_binding_get_type_annotation(
2482        binding: *const CDslxParametricBinding,
2483    ) -> *mut CDslxTypeAnnotation;
2484    pub fn xls_dslx_parametric_binding_get_expr(
2485        binding: *const CDslxParametricBinding,
2486    ) -> *mut CDslxExpr;
2487
2488    // -- "requires implicit token?" determination for a DSLX function
2489    pub fn xls_dslx_type_info_get_requires_implicit_token(
2490        type_info: *mut CDslxTypeInfo,
2491        function: *mut CDslxFunction,
2492        error_out: *mut *mut std::os::raw::c_char,
2493        result_out: *mut bool,
2494    ) -> bool;
2495
2496    // -- Quickcheck APIs
2497    pub fn xls_dslx_quickcheck_get_function(qc: *const CDslxQuickcheck) -> *mut CDslxFunction;
2498
2499    /// Returns true iff the Quickcheck has the `exhaustive` test-cases
2500    /// specifier.
2501    pub fn xls_dslx_quickcheck_is_exhaustive(qc: *const CDslxQuickcheck) -> bool;
2502
2503    /// Retrieves the test-case count for the Quickcheck. Returns true and sets
2504    /// `*result_out` when the Quickcheck has a counted test-case specifier;
2505    /// returns false when the Quickcheck is marked exhaustive (in which case
2506    /// `*result_out` is not modified).
2507    pub fn xls_dslx_quickcheck_get_count(qc: *const CDslxQuickcheck, result_out: *mut i64) -> bool;
2508}
2509
2510pub const DSLX_STDLIB_PATH: &str = env!("DSLX_STDLIB_PATH");
2511
2512/// Directory containing the libxls DSO.
2513///
2514/// *** DO NOT USE THIS VARIABLE FROM WITHIN YOUR build.rs ***
2515///
2516/// You might be tempted to write the following in your build.rs:
2517///
2518/// ```ignore
2519/// // DO NOT DO THIS IN YOUR build.rs!!
2520/// let dylib_dirpath = xlsynth_sys::XLS_DSO_PATH;
2521/// // set rpath to dylib_dirpath or something.
2522/// ```
2523///
2524/// The problem is that build.rs is compiled for host, whereas if you're setting
2525/// an rpath (or something similar) you want to get the path from compiling
2526/// xlsynth_sys for *target*.  In other words, the above will break
2527/// cross-compilation.
2528///
2529/// Instead, your build.rs should get the path from an envvar which:
2530///
2531/// ```ignore
2532/// // Do this from your build.rs instead.
2533/// let dylib_path = std::env::var("DEP_XLSYNTH_DSO_PATH").unwrap();
2534/// ```
2535///
2536/// More details are available at
2537/// <https://doc.rust-lang.org/cargo/reference/build-script-examples.html#using-another-sys-crate>.
2538///
2539/// (If you use this envvar from your crate proper -- i.e. not from build.rs --
2540/// then it's perfectly fine.)
2541pub const XLS_DSO_PATH: &str = env!("XLS_DSO_PATH");
2542
2543// Add opaque types for module port and def.
2544#[repr(C)]
2545pub struct CVastModulePort {
2546    _private: [u8; 0], // Ensures the struct cannot be instantiated
2547}
2548
2549#[repr(C)]
2550pub struct CVastDef {
2551    _private: [u8; 0], // Ensures the struct cannot be instantiated
2552}
2553
2554// Direction enum for module ports.
2555pub type VastModulePortDirection = i32;
2556
2557// Constants that match the C enum definitions.
2558pub const XLS_VAST_MODULE_PORT_DIRECTION_INPUT: VastModulePortDirection = 0;
2559pub const XLS_VAST_MODULE_PORT_DIRECTION_OUTPUT: VastModulePortDirection = 1;
2560
2561unsafe extern "C" {
2562    // -- Module port inspection APIs
2563    pub fn xls_vast_verilog_module_get_ports(
2564        m: *mut CVastModule,
2565        out_count: *mut libc::size_t,
2566    ) -> *mut *mut CVastModulePort;
2567
2568    pub fn xls_vast_verilog_module_free_ports(
2569        ports: *mut *mut CVastModulePort,
2570        count: libc::size_t,
2571    );
2572
2573    pub fn xls_vast_verilog_module_port_get_direction(
2574        port: *mut CVastModulePort,
2575    ) -> VastModulePortDirection;
2576
2577    pub fn xls_vast_verilog_module_port_get_def(port: *mut CVastModulePort) -> *mut CVastDef;
2578
2579    pub fn xls_vast_def_get_name(def: *mut CVastDef) -> *mut std::os::raw::c_char;
2580
2581    pub fn xls_vast_def_get_data_type(def: *mut CVastDef) -> *mut CVastDataType;
2582}