commit e0c0e2ee14f519ad33429533f87519753f07051a
parent 022e4427cfc5edde499c782ba716f8cf95b63f91
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 18 Sep 2017 13:07:27 -0300
comments (documentation about instruction formats)
Diffstat:
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/lopcodes.h b/lopcodes.h
@@ -1,5 +1,5 @@
/*
-** $Id: lopcodes.h,v 1.157 2017/09/13 19:50:08 roberto Exp roberto $
+** $Id: lopcodes.h,v 1.158 2017/09/15 14:19:06 roberto Exp roberto $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -11,21 +11,20 @@
/*===========================================================================
- We assume that instructions are unsigned numbers.
+ We assume that instructions are unsigned 32-bit integers.
All instructions have an opcode in the first 6 bits.
- Instructions can have the following fields:
- 'A' : 8 bits
- 'B' : 9 bits
- 'C' : 9 bits
- 'Ax' : 26 bits ('A', 'B', and 'C' together)
- 'Bx' : 18 bits ('B' and 'C' together)
- 'sBx' : signed Bx
-
- A signed argument is represented in excess K; that is, the number
- value is the unsigned value minus K. K is exactly the maximum value
- for that argument (so that -max is represented by 0, and +max is
- represented by 2*max), which is half the maximum for the corresponding
- unsigned argument.
+ Instructions can have the following formats:
+
+ 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
+ 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+iABC | C(9) | | B(9) | | A(8) | | Op(6) |
+iABx | Bx(18) | | A(8) | | Op(6) |
+iAsBx | sBx (signed)(18) | | A(8) | | Op(6) |
+iAx | Ax(26) | | Op(6) |
+
+ A signed argument is represented in excess K: the represented value is
+ the written unsigned value minus K, where K is half the maximum for the
+ corresponding unsigned argument.
===========================================================================*/