Skip to content

Commit

Permalink
Documentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed Dec 18, 2024
1 parent 50590fc commit 839e9a8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
6 changes: 3 additions & 3 deletions docs/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Suppose we have the following layout, which is an input layout for a method call

```python
layout = [("foo", 1), ("bar", 32)]
method = Method(input_layout=layout)
method = Method(i=layout)
```

The method can be called in multiple ways.
Expand Down Expand Up @@ -170,7 +170,7 @@ Take the following definitions:

```python
layout2 = [("foobar", layout), ("baz", 42)]
method2 = Method(input_layout=layout2)
method2 = Method(i=layout2)
```

One can then pass the arguments using `dict`s in following ways:
Expand Down Expand Up @@ -208,7 +208,7 @@ The `dict` syntax can be used for returning values from methods.
Take the following method declaration:

```python
method3 = Method(input_layout=layout, output_layout=layout2)
method3 = Method(i=layout, o=layout2)
```

One can then define this method as follows:
Expand Down
30 changes: 15 additions & 15 deletions transactron/core/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,6 @@ def __init__(
The format of `data_in`.
o: method layout
The format of `data_out`.
nonexclusive: bool
If true, the method is non-exclusive: it can be called by multiple
transactions in the same clock cycle. If such a situation happens,
the method still is executed only once, and each of the callers
receive its output. Nonexclusive methods cannot have inputs.
combiner: (Module, Sequence[MethodStruct], Value) -> AssignArg
If `nonexclusive` is true, the combiner function combines the
arguments from multiple calls to this method into a single
argument, which is passed to the method body. The third argument
is a bit vector, whose n-th bit is 1 if the n-th call is active
in a given cycle.
single_caller: bool
If true, this method is intended to be called from a single
transaction. An error will be thrown if called from multiple
transactions.
src_loc: int | SrcLoc
How many stack frames deep the source location is taken from.
Alternatively, the source location to use instead of the default.
Expand Down Expand Up @@ -207,6 +192,21 @@ def body(
It instantiates a combinational circuit for each
method caller. By default, there is no function, so all arguments
are accepted.
combiner: (Module, Sequence[MethodStruct], Value) -> AssignArg
If `nonexclusive` is true, the combiner function combines the
arguments from multiple calls to this method into a single
argument, which is passed to the method body. The third argument
is a bit vector, whose n-th bit is 1 if the n-th call is active
in a given cycle.
nonexclusive: bool
If true, the method is non-exclusive: it can be called by multiple
transactions in the same clock cycle. If such a situation happens,
the method still is executed only once, and each of the callers
receive its output. Nonexclusive methods cannot have inputs.
single_caller: bool
If true, this method is intended to be called from a single
transaction. An error will be thrown if called from multiple
transactions.
Returns
-------
Expand Down
14 changes: 9 additions & 5 deletions transactron/core/sugar.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ def def_method(
default it is `Const(1)`, so the method is always ready.
Assigned combinationally to the `ready` attribute.
validate_arguments: Optional[Callable[..., ValueLike]]
Function that takes input arguments used to call the method
and checks whether the method can be called with those arguments.
It instantiates a combinational circuit for each
method caller. By default, there is no function, so all arguments
are accepted.
For details, see `Method.body`.
validate_arguments: Optional[Callable[..., ValueLike]]
For details, see `Method.body`.
combiner: (Module, Sequence[MethodStruct], Value) -> AssignArg
For details, see `Method.body`.
nonexclusive: bool
For details, see `Method.body`.
single_caller: bool
For details, see `Method.body`.
Examples
--------
Expand Down

0 comments on commit 839e9a8

Please sign in to comment.