-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EOR3, part of Crypto four registers. (#17)
### Description: Add EOR3 instruction which is part of the Cryptographic four-register group of DPSFP https://developer.arm.com/documentation/ddi0602/2023-12/SIMD-FP-Instructions/EOR3--Three-way-Exclusive-OR-?lang=en Also place the shabang line at the top of the shell script `platform_check.sh`. Otherwise, aarch64 is not detected. ### Testing: `make all` including conformance testing. ### License: By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
- Loading branch information
Showing
8 changed files
with
92 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/- | ||
Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Author(s): Shilpi Goel, Nevine Ebeid | ||
-/ | ||
-- EOR3 | ||
|
||
import Arm.Decode | ||
import Arm.Memory | ||
import Arm.Insts.Common | ||
import Arm.BitVec | ||
|
||
---------------------------------------------------------------------- | ||
|
||
namespace DPSFP | ||
|
||
open Std.BitVec | ||
|
||
def exec_crypto_four_reg (inst : Crypto_four_reg_cls) (s : ArmState) : ArmState := | ||
-- This function assumes IsFeatureImplemented(FEAT_SHA3) is true | ||
-- and that AArch64.CheckFPAdvSIMDEnabled() returns successfully | ||
if inst.Op0 != 0b00#2 then | ||
write_err (StateError.Illegal s!"Illegal {inst} encountered!") s | ||
else | ||
let datasize := 128 | ||
let opdm := read_sfp datasize inst.Rm s | ||
let opdn := read_sfp datasize inst.Rn s | ||
let opda := read_sfp datasize inst.Ra s | ||
let result := opdm ^^^ opdn ^^^ opda | ||
let s := write_sfp datasize inst.Rd result s | ||
let s := write_pc ((read_pc s) + 4#64) s | ||
s | ||
|
||
---------------------------------------------------------------------- | ||
|
||
def Crypto_four_reg_cls.eor3.rand : IO (Option (BitVec 32)) := do | ||
let feat_check ← | ||
IO.Process.output | ||
{ cmd := "Arm/Insts/Cosim/platform_check.sh", | ||
args := #["-f", "sha3"] } | ||
if feat_check.exitCode == 0 then | ||
let (inst : Crypto_four_reg_cls) := | ||
{ Op0 := ← pure 0b00#2, | ||
Rm := ← BitVec.rand 5, | ||
Rn := ← BitVec.rand 5, | ||
Ra := ← BitVec.rand 5, | ||
Rd := ← BitVec.rand 5 } | ||
pure (some inst.toBitVec32) | ||
else | ||
pure none | ||
|
||
/-- Generate random instructions of Crypto_four_reg_cls class. -/ | ||
def Crypto_four_reg_cls.rand : List (IO (Option (BitVec 32))) := | ||
[Crypto_four_reg_cls.eor3.rand] | ||
|
||
|
||
end DPSFP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters