Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,30 @@ Shapes built on the command line work the same way:
arc run --cell 'via_array(crect(x0=0., y0=0., w=90., h=40.), 10., 20.)'
```

Top-level declarations may appear in any order: a cell, function, struct, or
enum can be used above the line that declares it. Cells may also instantiate
themselves or one another, which is how a recursive layout is written. The
recursion has to end on a parameter, since the compiler stops at a fixed
nesting depth:

```rust
cell tree(n: Int) {
let leaf = rect("met1", x0=0., y0=0., w=100., h=100.);
if n > 0 {
let child = inst(tree(n - 1));
eq(child.leaf.x0, leaf.x1 + 50.);
eq(child.y, 0.);
} else {
};
}
```

Cell types are nominal: two cells with the same fields are different types,
and a function that accepts either takes `Any`. The type of an instance field
is worked out when it is first read, so the one thing that cannot be resolved
is a field whose type depends on itself through the fields of other cells,
which is reported as an error at the read that closes the cycle.

GDS imports are zero-argument cells. A module-qualified entry such as
`"macros::sram"` can be referenced as `lib::macros::sram()` or imported with
`use lib::macros::sram;`. Paths in the manifest are relative to `Argon.toml`,
Expand Down
17 changes: 8 additions & 9 deletions bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,14 @@ parameter; "peak" is peak heap allocated during compilation.
the top-level README now bites only for genuinely dense coupled blocks, not
for the common sparse-but-coupled case.

- **Hierarchy depth scales linearly.** A cell's static type (`CellTy`) records
the structural type of every field, including instantiated sub-cells. That
type is now **shared** (`Arc`-interned via `CellFnTy::cell`) instead of being
copied into each reference, so the type representation is a DAG rather than a
tree: whether a cell references its child **once** (`let i = inst(child());`)
or **twice** (the `let c = child(); let i = inst(c);` idiom from the tutorial),
`h{k}` holds shared pointers to the single type of `h{k-1}`, and both variants
cost the same — linear in depth (≈160 MiB / 0.15 s at depth 2048, the two
series within ~2% of each other). Before this fix the type was deep-copied per
- **Hierarchy depth scales linearly.** A cell's static type (`CellTy`) is
nominal: it names the declaring cell and carries no field types, so a
reference to a cell costs the same however deep the hierarchy below it is,
and whether a cell references its child **once** (`let i = inst(child());`)
or **twice** (the `let c = child(); let i = inst(c);` idiom from the
tutorial) — linear in depth (≈160 MiB / 0.15 s at depth 2048, the two series
within ~2% of each other). The type used to record the structural type of
every field, including instantiated sub-cells, and was deep-copied per
reference, so the single-ref chain was quadratic (`~depth^1.4`) and the
double-ref chain **doubled with every level** (`×1.9` measured), exhausting
memory beyond ~depth 20 (depth 18 alone took ~3.6 GiB / 11.5 s). The remaining
Expand Down
Loading
Loading