• Ben Marshall's avatar
    scalar-crypto: Initial spike support for v0.8.1 (#635) · d6238d99
    Ben Marshall authored
    Brief:
    
    - This commit adds spike support for the scalar cryptography extension.
      See the riscv-crypto repository (https://github.com/riscv/riscv-crypto)
      for more information on this extension.
    
    - It is based on the experimental patch which has so far been kept in the
      riscv-crypto repository. Now that scalar crypto is nearly at the "freeze"
      stage and entering opcode consistency review, it makes sense to start
      upstreaming our experimental version.
    
    - In terms of compiler support - we are using an experimental patch in
      the riscv-crypto repository at the moment, others are working on an
      upstream appropriate version.
    
    Details:
    
    - Add support for dedicated scalar crypto instructions.
    
    - Add very basic support for the entropy source (entropy_source.h).
      Much of the behaviour of this is implementation specific. This model
      aims to provide the bare minimum of functionality which can be used to
      quickly develop software. It uses /dev/urandom as its entropy source for
      now.
    
    - Scalar crypto is unique in that it _borrows_ instructions from the
      Bitmanipulation extension. This is currently _not_ encoded in the patch,
      as I didn't want to damage anything in Bitmanip which is currently under
      review. However, I've added a macro in riscv/decode.h called
      "require_either_extension(A,B)", which allows instructions to be valid
      opcodes iff they are in one or both extensions.
    
     On branch scalar-crypto
     Changes to be committed:
    	modified:   README.md
    	modified:   riscv/decode.h
    	modified:   riscv/encoding.h
    	new file:   riscv/entropy_source.h
    	new file:   riscv/insns/aes64im.h
    	new file:   riscv/insns/aes64ks1i.h
    	new file:   riscv/insns/aes64ks2.h
    	new file:   riscv/insns/aes_common.h
    	new file:   riscv/insns/aesds.h
    	new file:   riscv/insns/aesdsm.h
    	new file:   riscv/insns/aeses.h
    	new file:   riscv/insns/aesesm.h
    	new file:   riscv/insns/sha256sig0.h
    	new file:   riscv/insns/sha256sig1.h
    	new file:   riscv/insns/sha256sum0.h
    	new file:   riscv/insns/sha256sum1.h
    	new file:   riscv/insns/sha512sig0.h
    	new file:   riscv/insns/sha512sig0h.h
    	new file:   riscv/insns/sha512sig0l.h
    	new file:   riscv/insns/sha512sig1.h
    	new file:   riscv/insns/sha512sig1h.h
    	new file:   riscv/insns/sha512sig1l.h
    	new file:   riscv/insns/sha512sum0.h
    	new file:   riscv/insns/sha512sum0r.h
    	new file:   riscv/insns/sha512sum1.h
    	new file:   riscv/insns/sha512sum1r.h
    	new file:   riscv/insns/sm3p0.h
    	new file:   riscv/insns/sm3p1.h
    	new file:   riscv/insns/sm4_common.h
    	new file:   riscv/insns/sm4ed.h
    	new file:   riscv/insns/sm4ks.h
    	modified:   riscv/processor.cc
    	modified:   riscv/processor.h
    	modified:   riscv/riscv.mk.in
    d6238d99