question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AES custom instruction

See original GitHub issue

I’m currently working on adding a custom instruction to acceleration AES in the SMP branch.

SoC configuration :
./make.py --board=arty_a7 --cpu-count=2 --dcache-width=64 --icache-width=64 --dcache-size=8192 --dcache-ways=2 --icache-size=8192 --icache-ways=2 --aes-instruction=True --local-ip=192.168.0.159 --remote-ip=192.168.0.24 --build --load

Test :
openssl speed -elapsed -evp aes-128-cbc aes-256-cbc

SW :
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
aes-256-cbc        466.55k      683.84k      787.37k      829.75k      838.31k      838.25k
aes-128-cbc        532.21k      798.63k      945.24k     1002.84k     1001.55k     1003.66k

HW AES custom instruction :
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
aes-256 cbc       1781.52k     2834.07k     3323.07k     3486.72k     3465.22k     3440.10k
aes-128-cbc       1408.26k     2907.39k     3990.78k     4392.96k     4398.10k     4390.91k

So a good 4x gain 😃

Nothing is pushed yet excepter the Aes CPU Plugin : https://github.com/SpinalHDL/VexRiscv/blob/dev/src/main/scala/vexriscv/plugin/AesPlugin.scala

The foot print is light : Per CPU : 2KB ROM + 90 LUT + 75 FF

Question now is how do we want to integrate it into buildroot. Basicaly, it require a patch for libopenssl and dropbear. Question is : Is there a way (already used) to make the buildroot build depend on the SoC configuration ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Dolu1990commented, Aug 23, 2022

What are the necessary changes to be made on the buildroot side

None, i mean, in general, if i do a custom instruction, the way i use it in software is by forcing its opcode in the binary. I do not rely on GCC being able to support it.

Here is an example : https://github.com/SpinalHDL/SaxonSoc/blob/dev-0.3/software/standalone/driver/aes_custom.h#L58 defined : https://github.com/SpinalHDL/SaxonSoc/blob/dev-0.3/software/standalone/driver/aes_custom.h#L5 defined : https://github.com/SpinalHDL/SaxonSoc/blob/dev-0.3/software/standalone/driver/riscv.h#L205

Then, if you want to add support into the toolchaine in a “clean” way, i realy have no idea ^^

0reactions
Dolu1990commented, Aug 23, 2022

@amr-25 Hoo i realy have no idea / opinon about this, i probably copy paster stuff found on the web ^^ Else, it is possible that at a given moment, that package was broken for RISC-V 32 bits, and didn’t compiled. A few years ago, things where much less “stable” than now ^^

Read more comments on GitHub >

github_iconTop Results From Across the Web

Instructions for Customs and Border Protection ...
Instructions for Customs and Border Protection Interconnection Security Agreement · Filing through the Census Internet application AESDirect
Read more >
AESDirect User Guide | Census Bureau
The AES is the primary instrument used for collecting export trade data, ... instructions, searching existing data sources, gathering and maintaining the ...
Read more >
A Lightweight AES Coprocessor Based on RISC-V ... - Hindawi
To this end, we propose an extended instruction scheme for the advanced encryption standard (AES) based on RISC-V custom instructions and ...
Read more >
The design of scalar AES Instruction Set Extensions for RISC-V
NI ) [Gue09, DGvK19] ISE supports AES: it significantly improves latency and throughput ... for their custom CRISP (“RISC like”) architecture.
Read more >
Use of the AES instruction set
Use of the AES instruction set - 18 October 2 12. 1 AES-NI a. Overview b. Chronology ... Bernstein and Shwabe: 1 c/B...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found