lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2015-01-04 0:10 GMT+02:00 Dibyendu Majumdar <mobile@majumdar.org.uk>:
> On 3 January 2015 at 05:33, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> The 9th bit in B and C is used to distinguish between constants and registers,
>> so your machine will on all instructions that use RK() be able to access only
>> half of your registers. That's all of the arithmetic instructions and
>> quite a few
>
> I see.
>
>> more. So you might as well reduce SIZE_A to 7 and accept that you have
>> a 7-bit machine with a 9-bit opcode space rather than an 8-bit machine with
>> a 6-bit opcode space.
>>
>
> I don't follow above - are you suggesting?
>
> #define SIZE_C          8
> #define SIZE_B          9
> #define SIZE_A          7
> #define SIZE_OP       8
>
> This would still allow only 8 bits for C. Unless you are suggesting:
>
> #define SIZE_C          9
> #define SIZE_B          9
> #define SIZE_A          7
> #define SIZE_OP       7

What I mean is this: with the current design, A always addresses
a register whereas B and C may address either a register or a
constant. One bit is needed to specify which. Therefore, B and
C must be one bit longer than A. At preset we have 8,9,9 leaving
6 bits for the opcode. What I say is that if you want more bits
for the opcode the next possibility is 7,8,8 leving 9 bits.

If you need more opcodes, I would go for one extra instruction
that exploits EXTRA_ARG to give the extra functionality.