Ethereum in silicon

CfBCfB Member Posts: 29
I looked at the instruction set published there - Is it the final version? If the answer is positive, could anyone answer the following questions, plz:

1. Operation 0x09 (NEG):
What will be the result of NEG(all_bits_are_set_to_1)? Is NEG(NEG(X)) always equal to X?

2. Operation 0x20 (SHA3):
Is it Keccak-f[1600] with 24 rounds?

3. Operation 0x6C (PUSH13):
Why does one need to push such weird number of bytes? How r they going to be popped?

4. I didn't find bit-shifting operations. Am I supposed to use MUL/DIV or NOT/AND combo?

5. What width of address bus is supposed to be used in a processor that implements Ethereum instruction set in silicon? Not 256 "wires" for sure, even 64 would be an overkill. If it's a stack-based machine then one stack is not enough for comfortable programming without dancing salsa with SWAP and DUP all the time.


  • JasperJasper Eindhoven, the NetherlandsMember Posts: 514 ✭✭✭
    @CfB i dont expect that paper is the final word entirely, for instance ALARM is a thing under consideration, and the mining algo not set in stone. Kudos for reading it :)

    1. Looking into cpp-ethereum/libethereum/VM.h, there it is. m_stack.back() = ~(m_stack.back() - 1); Not 100% what it is intended to do.

    Note that negative numbers dont exist in ethereum.

    2. SHA3.. thought those names indicated specific algorithms. (perhaps one for each number of bits)

    3. PUSH exists at any number of bytes upto 16. Dont know for what reason. If you look at the implementation, it does make it easy. (though 2^n would be just as easy.)

    4. AND, OR and XOR look bitwise.. But indeed no shifting, or bitwise not.

    5. Use MLOAD i guess? Dont think this thing is designed for there to be special hardware for contract execution. Everyone being able to run a full node is one of the goals.
  • CfBCfB Member Posts: 29
    Thank you. Completely overlooked that I could find answers in the source code. I hope the instruction set will be changed coz right now it makes it harder to design a specialized processor. I would spend some money for review by an expert from Intel/AMD.
  • CfBCfB Member Posts: 29
    I found an answer on the 5th question. Ethereum works with 3 types of memory (stack, memory, storage) so no memory addressing nor stack salsa is necessary.
  • JasperJasper Eindhoven, the NetherlandsMember Posts: 514 ✭✭✭
    edited May 2014
    @CfB I wouldnt disuade anyone from reading the code, but wouldnt call it necessary.. You can ask questions without doing it. :) It is well written, and review is important for trustlessness when it goes live, though.

    The EVM does have DUP, SWAP and stuff, suppose it is for efficiency. Also there are languages, Serpent and LLL that compile to it, so you dont have to deal with it directly. Infact there isnt any assembler for raw stuff right now?
  • CfBCfB Member Posts: 29
    I'm thinking about processing Ethereum assembly by an ASIC.
  • JasperJasper Eindhoven, the NetherlandsMember Posts: 514 ✭✭✭
    As i said, the mining is specifically designed to ward ASICs off. Modified contract execution is infact being considered to be part of that. However, cant rule it out, but dont really expect the interpreter design choices to be affected by it.

    Your ASIC is sort-of a CPU :), i mean the ethereum assembly is general. I kindah wonder if it is infact difficult to catch up to CPUs interpreting both in speed and energy efficiency.. I dont know how that goes, i mean i expect CPUs to essentially use the newest processes that scale up cheaply, and have a lot of effort in designing them.

    Also note that the interpreter isnt set in stone yet. I dont know what your motivation is, of course.
  • CfBCfB Member Posts: 29
    I meant an ASIC for instruction processing, not for mining.
  • CfBCfB Member Posts: 29
    Why does one need to use POP (operation 0x50)? It just throws away a result of execution of some other operation. If the result is not needed then why execute the operation at all...
  • JasperJasper Eindhoven, the NetherlandsMember Posts: 514 ✭✭✭
    I dont see a particular case, but it is a stack machine. Some function in it may output more values than you want and then you want to get rid of some of the values.

    If you look in, there is a list of functions; funtable; and how to turn them into the stack language. It does use the POP operation.
  • CfBCfB Member Posts: 29
    edited May 2014
    U seem to be right. I guess it's for a situation when one computed a value but conditional branching made this value unnecessary. Thank u for the hint.
Sign In or Register to comment.