Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Kernel ROM chiplet

The kernel ROM enables executing predefined kernel procedures. These procedures are always executed in the root context and can only be accessed by a SYSCALL operation. The chiplet tracks and enforces correctness of all kernel procedure calls as well as maintaining a list of all the procedures defined for the kernel, whether they are executed or not. More background about Miden VM execution contexts can be found here.

Kernel ROM trace

The kernel ROM table consists of five columns. The following example table shows the execution trace of the kernel ROM with procedure digests , which were called 1, 2, and 0 times, respectively. Each digest is included once to respond to the initialization request by the public inputs, and then repeated for each call made by the decoder.

1
0
1
0
0
1

The meaning of columns in the above is as follows:

  • Column specifies the start of a block of rows with identical kernel procedure digests.
  • contain the digests of the kernel procedures. The values in these columns can change only when is set to 1 in the next row. Otherwise, the values in the columns remain the same.

Constraints

Note: the following assumes the ACE chiplet is included in the previous slot, whose documentation will be included in a subsequent PR.

The following constraints are required to enforce the correctness of the kernel ROM trace.

Note: Unless otherwise stated, these constraints should also be multiplied by chiplets module's virtual flag which is active in all rows the kernel ROM chiplet.

The column is a selector indicating the start of a new digest included in the kernel ROM chiplet trace. In this row, the chiplet responds to a bus request made by the verifier to ensure consistency with the set of kernel procedure digests given as public inputs.

As is a selector, it must be binary.

The flag must be set to be 1 in the first row of the kernel ROM chiplet. Otherwise, the digest in this row would not be matched with one of the input procedure roots. This constraint is enforced in the last row of the previous trace, using selector columns from the chiplets module. More precisely, we use the virtual flag from the chiplet selectors which is active in all rows of the previous (in this case ACE) chiplet, along with the selector which transitions from 0 to 1 in the last row, allowing us to target the first row of the kernel ROM trace.

Note that this selector need not be multiplied by the kernel ROM chiplet flag s4, since it is only active when the previous chiplet is active._

The contiguity of the digests in a block is ensured by enforcing equality between digests across two consecutive rows, whenever the next row is not the start of a new block. That is, when , it must hold that . We disable this constraint in the last row of the kernel ROM chiplet trace by using the kernel ROM chiplet selector , since the latter transitions from 0 to 1 when the next chiplet starts.

Note: we could technically remove the selector since and correspond to the same column. We include it here for completeness though.

Chiplets bus constraints

The kernel ROM chiplet must ensure that all kernel procedure digests requested by the decoder correspond to one of the digests provided by the verifier through public inputs. This is achieved by making use of the chiplet bus , responding to requests made by the decoder and by the verifier through public inputs.

In the first row of each new block of hashes in the kernel ROM chiplet trace (i.e., when ), the chiplet responds to a message requested by the verifier. Since these initialization messages must match, the set of digests across all blocks must be equal to the set of procedure digests provided by the verifier (though not necessarily in the same order).

Whenever a digest is requested by the decoder during program block hashing of the SYSCALL operation, a new row is added to the trace after the first row which is used to respond to one of the initialization requests made by the verifier using public inputs. The chiplet responds to the request with a message .

In other words, the selector indicates whether the chiplet should respond to the decoder or the verifier initialization requests. If a digest is requested times by the decoder, the same digest appears in a single block of length .

The variables and representing the bus messages contain reduced bus messages containing a kernel procedure digest. Denoting the random values received from the verifier as , etc., this can be defined as

Here, and are the unique operation labels for the kernel ROM bus message.

Each row of the kernel ROM chiplet trace responds to either a procedure digest initialization or decoder call request. Since the column defines which type of response is sent to the bus, it is used to combine both requests into a single constraint given by

The above simplifies to

  • : , when responding to a request.
  • : , when responding to a request.

The kernel procedure digests initialization requests are implemented by imposing a boundary constraint in the first row of the column. This is described in the chiplets bus constraints.

By using the bus to initialize the kernel ROM procedure digest in this way, the verifier only learns which procedures can be invoked but doesn't learn how often they were called, if at all.

The full set of constraints applied to the are described as part of the chiplets bus constraints.