Skip to content

Commit 2d9e97c

Browse files
committed
Add a little extra core.sus documentation
1 parent 8cfd6eb commit 2d9e97c

2 files changed

Lines changed: 27 additions & 18 deletions

File tree

std/core.sus

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
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.
13

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`
67
__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.
813
__builtin__ struct int #(int FROM, int TO) {}
914

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]`
1118
__builtin__ struct float {}
1219

1320
/// 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]`
1423
__builtin__ struct double {}
1524

1625
/// Gen-only type for strings. Only used to pass strings to Verilog submodules - like data files for ROMs.

test.sus_errors.txt

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)