Skip to content

Commit

Permalink
docs(yellowpaper): instruction set updates and fixes (#3515)
Browse files Browse the repository at this point in the history
[See deployment preview
here](https://aztec-packages.vercel.app/docs/public-vm/InstructionSet#isa-section-add)

- Added instructions to emit noteshashes, nullifiers and l2tol1 messages
- Removed instruction (for now) to get l1tol2 messages
- added grandfather root instruction
- did some instruction reordering
- `indirect` is a flag like any other and is present for all
instructions with offset operands
  • Loading branch information
dbanks12 committed Dec 1, 2023
1 parent ba3803e commit bfb61dd
Show file tree
Hide file tree
Showing 61 changed files with 525 additions and 275 deletions.
455 changes: 288 additions & 167 deletions yellow-paper/docs/public-vm/gen/_InstructionSet.mdx

Large diffs are not rendered by default.

Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/ADD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/ADDRESS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/AND.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/BLOCKNUMBER.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/BLOCKSROOT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/CALL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/CALLDEPTH.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/CALLER.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/CAST.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/CHAINID.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/CMOV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/COINBASE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/DIV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/EQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/FEEPERL1GAS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/FEEPERL2GAS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/GLOBALSHASH.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/JUMP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/JUMPI.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/L1GAS.png
Diff not rendered.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/L2GAS.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/LT.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/LTE.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/MOV.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/MSGSROOT.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/NOT.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/NOTESROOT.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/OR.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/ORIGIN.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/PORTAL.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/REFUNDEE.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/RETURN.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/REVERT.png
Diff not rendered.
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/SET.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/SHL.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/SHR.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/SLOAD.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/SSTORE.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/STATICCALL.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/SUB.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/TIMESTAMP.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/ULOG.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/VERSION.png
Binary file modified yellow-paper/docs/public-vm/gen/images/bit-formats/XOR.png
319 changes: 221 additions & 98 deletions yellow-paper/src/preprocess/InstructionSet/InstructionSet.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function toOpcode(index) {

function htmlInstructionSetTable() {
let table = "## Instructions Table\n";
table += "\nClick on an instruction name to jump to its section.\n";
table += "\n<table>\n";
let header = "<th>Opcode</th>";
for (let t = 0; t < TOPICS_IN_TABLE.length; t++) {
Expand Down
24 changes: 15 additions & 9 deletions yellow-paper/src/preprocess/InstructionSet/InstructionSize.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const FIELD_SIZES = { // in bits
"Opcode": 8,
"Indirect": 8,
};
const OPCODE_SIZE = 8;
const FLAG_SIZE = 8;

const DEFAULT_OPERAND_SIZE = 24; // for direct/indirect memory offsets

Expand Down Expand Up @@ -33,7 +31,7 @@ function toOpcode(index) {
* 1 byte for dest-type
*/
function instructionSize(instr) {
let size = FIELD_SIZES['Opcode'] + FIELD_SIZES['Indirect'];
let size = OPCODE_SIZE;
let numUntypedImmediates = 0;
for (let arg of instr['Args']) {
const aSize = argSize(arg);
Expand All @@ -44,8 +42,8 @@ function instructionSize(instr) {
}
}
if (instr['Flags']) {
// assigns each flag a byte (op-type, dest-type)
size += instr['Flags'].length * 8;
// assigns each flag a byte (indirect, op-type, dest-type)
size += instr['Flags'].length * FLAG_SIZE;
}
let sizeStr = size.toString();
if (numUntypedImmediates > 0) {
Expand All @@ -55,7 +53,15 @@ function instructionSize(instr) {
}

function instructionBitFormat(instr, index) {
let bitFormat = { 'Name': instr['Name'], 'Opcode': {'code': toOpcode(index), 'size': 8}, 'Indirect': 8, 'Args': [], 'Flags': [] };
let bitFormat = {
'Name': instr['Name'],
'Opcode': {
'code': toOpcode(index),
'size': OPCODE_SIZE,
},
'Args': [],
'Flags': [],
};

//for (let arg of instr['Args']) {
for (let a = 0; a < instr['Args'].length; a++) {
Expand All @@ -69,7 +75,7 @@ function instructionBitFormat(instr, index) {
}
for (let f = 0; f < instr['Flags'].length; f++) {
const flag = instr['Flags'][f];
bitFormat['Flags'][f] = {"name": flag['name'], "size": 8};
bitFormat['Flags'][f] = {"name": flag['name'], "size": FLAG_SIZE};
}
return bitFormat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function run() {
for (let i = 0; i < INSTRUCTION_SET.length; i++) {
const instr = INSTRUCTION_SET[i];
const bitFormat = instructionBitFormat(instr, i);
console.log(JSON.stringify(bitFormat));
formats.push(bitFormat);
}
fs.writeFileSync('./InstructionBitFormats.json', JSON.stringify(formats));
Expand Down

0 comments on commit bfb61dd

Please sign in to comment.