|
| 1 | +// core.sus - Every type and module that the compiler needs to handle in a builtin way. |
| 2 | +// It's maybe a bit hacky, but so that we can use them as builtin IDs, get_builtin_type!("int"), get_builtin_module!("CrossDomain"), and get_builtin_const!("true") refer to values in this file. |
1 | 3 |
|
2 | | -// For now these builtin declarations must be in this order, because they're constants in the code. |
3 | | -// We'll get a better system for this at some point |
4 | | - |
5 | | -/// The decider of truth and falsity |
| 4 | +/// Boolean values. Can take on `true` or `false`. |
| 5 | +/// |
| 6 | +/// Synthesizes to `logic`. Takes on the values `1'b1` for `true`, and `1'b0` for `false` |
6 | 7 | __builtin__ struct bool {} |
7 | | -// An integer of variable size. |
| 8 | +/// Integers are bounded. From an inclusive `FROM` value, to an exclusive `TO` value. For more information, see [Bounded Integers](https://sus-lang.org/docs/docs/integers.html) |
| 9 | +/// |
| 10 | +/// Synthesizes to `logic[sizeof#(T: type int#(FROM, TO)) - 1:0]`. Encoded as unsigned 2s complement for `FROM >= 0`, and as signed 2s complement for `FROM < 0`. |
| 11 | +/// |
| 12 | +/// Generative integers are unbounded of arbitrary size. |
8 | 13 | __builtin__ struct int #(int FROM, int TO) {} |
9 | 14 |
|
10 | | -/// Single precision IEEE 32-bit float. Operators are provided by external libraries, but it's defined here for convenience. |
| 15 | +/// Single precision IEEE 32-bit float. Operators are provided by external libraries, but it's defined here for convenience. |
| 16 | +/// |
| 17 | +/// Synthesizes to `logic[31:0]` |
11 | 18 | __builtin__ struct float {} |
12 | 19 |
|
13 | 20 | /// Single precision IEEE 64-bit double-precision float. Operators are provided by external libraries, but it's defined here for convenience. |
| 21 | +/// |
| 22 | +/// Synthesizes to `logic[63:0]` |
14 | 23 | __builtin__ struct double {} |
15 | 24 |
|
16 | 25 | /// Gen-only type for strings. Only used to pass strings to Verilog submodules - like data files for ROMs. |
|
0 commit comments