Skip to content

Commit 4b17076

Browse files
authored
Merge pull request #380 from pllab/aes_example_update
Update AES example
2 parents 2e9fc04 + cd96c20 commit 4b17076

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

pyrtl/rtllib/aes.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,30 @@
44
55
Example::
66
7+
import pyrtl
8+
from pyrtl.rtllib.aes import AES
9+
710
aes = AES()
811
plaintext = pyrtl.Input(bitwidth=128, name='aes_plaintext')
912
key = pyrtl.Input(bitwidth=128, name='aes_key')
1013
aes_ciphertext = pyrtl.Output(bitwidth=128, name='aes_ciphertext')
11-
reset = pyrtl.Input(1)
14+
reset = pyrtl.Input(1, name='reset')
1215
ready = pyrtl.Output(1, name='ready')
13-
ready_out, aes_cipher = aes.encryption_statem(plaintext, key, reset)
16+
ready_out, aes_cipher = aes.encrypt_state_m(plaintext, key, reset)
1417
ready <<= ready_out
1518
aes_ciphertext <<= aes_cipher
1619
sim_trace = pyrtl.SimulationTrace()
1720
sim = pyrtl.Simulation(tracer=sim_trace)
1821
sim.step ({
19-
aes_plaintext: 0x00112233445566778899aabbccddeeff,
20-
aes_key: 0x000102030405060708090a0b0c0d0e0f,
21-
reset: 1
22+
'aes_plaintext': 0x00112233445566778899aabbccddeeff,
23+
'aes_key': 0x000102030405060708090a0b0c0d0e0f,
24+
'reset': 1
2225
})
2326
for cycle in range(1,10):
2427
sim.step ({
25-
aes_plaintext: 0x00112233445566778899aabbccddeeff,
26-
aes_key: 0x000102030405060708090a0b0c0d0e0f,
27-
reset: 0
28+
'aes_plaintext': 0x00112233445566778899aabbccddeeff,
29+
'aes_key': 0x000102030405060708090a0b0c0d0e0f,
30+
'reset': 0
2831
})
2932
sim_trace.render_trace(symbol_len=40, segment_size=1)
3033

0 commit comments

Comments
 (0)